Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:53

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0013 #include "Acts/Utilities/Any.hpp"
0014 #include "Acts/Utilities/Result.hpp"
0015 
0016 namespace Acts {
0017 
0018 /// @defgroup MagneticField Magnetic field
0019 
0020 /// Base class for all magnetic field providers
0021 class MagneticFieldProvider {
0022  public:
0023   /// Opaque cache type that can store arbitrary implementation specific cache
0024   /// data. Examples are an interpolation cell, or an experiment specific
0025   /// conditions data handle.
0026   using Cache = Acts::AnyBase<sizeof(char) * 512>;
0027 
0028   /// Make an opaque cache for the magnetic field. Instructs the specific
0029   /// implementation to generate a @c Cache instance for magnetic field lookup.
0030   ///
0031   /// @param mctx The magnetic field context to generate cache for
0032   /// @return Cache The opaque cache object
0033   virtual Cache makeCache(const MagneticFieldContext& mctx) const = 0;
0034 
0035   /// Retrieve magnetic field value at a given location. Requires a cache object
0036   /// created through makeCache().
0037   ///
0038   /// @param [in] position global 3D position for the lookup
0039   /// @param [in,out] cache Field provider specific cache object
0040   ///
0041   /// @return magnetic field vector at given position
0042   virtual Result<Vector3> getField(const Vector3& position,
0043                                    Cache& cache) const = 0;
0044 
0045   virtual ~MagneticFieldProvider() = default;
0046 };
0047 
0048 }  // namespace Acts