ATLAS Offline Software
AtlasFieldCache.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 #ifndef MAGFIELDCONDITIONS_ATLASMTFIELDCACHE_H
13 #define MAGFIELDCONDITIONS_ATLASMTFIELDCACHE_H 1
14 
15 // MagField includes
16 #include "CxxUtils/restrict.h"
17 #include "GaudiKernel/ServiceHandle.h"
18 #include "GaudiKernel/SystemOfUnits.h"
25 
26 #include <memory>
27 namespace MagField {
28 
43 {
44 public:
45  AtlasFieldCache() = default;
49  AtlasFieldCache(double solFieldScale,
50  double torFieldScale,
51  const AtlasFieldMap* fieldMap);
52 
60  ~AtlasFieldCache() = default;
61 
66  void getField(const double* ATH_RESTRICT xyz,
67  double* ATH_RESTRICT bxyz,
68  double* ATH_RESTRICT deriv = nullptr);
69 
77  void getFieldZR(const double* ATH_RESTRICT xyz,
78  double* ATH_RESTRICT bxyz,
79  double* ATH_RESTRICT deriv = nullptr);
80 
82  bool solenoidOn() const;
83  bool toroidOn() const;
84 
85 private:
86 
88  bool fillFieldCache(double z, double r, double phi);
90  bool fillFieldCacheZR(double z, double r);
91 
93  double m_solScale{ 1 };
94  double m_torScale{ 1 };
95  double m_scaleToUse{ 1 };
96 
97  // Solenoid zone ID number - needed to set solScale.
98  // Assumes only one Solenoid zone.
99  int m_solZoneId{ -1 };
100 
102  const AtlasFieldMap* m_fieldMap{ nullptr };
103 
108  const BFieldZone* m_zone3d{ nullptr };
109 
114 
117  const std::vector<BFieldCond>* m_cond{ nullptr };
118 
122  const BFieldMeshZR* m_meshZR{ nullptr };
123 
126 };
127 
128 } // namespace MagField
129 #include "AtlasFieldCache.icc"
130 #endif // MAGFIELDCONDITIONS_ATLASMTFIELDCACHE_H
beamspotman.r
def r
Definition: beamspotman.py:676
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
MagField::AtlasFieldCache::m_solZoneId
int m_solZoneId
Definition: AtlasFieldCache.h:99
MagField::AtlasFieldCache::m_scaleToUse
double m_scaleToUse
Definition: AtlasFieldCache.h:95
BFieldMeshZR
Definition: BFieldMeshZR.h:24
MagField::AtlasFieldCache::m_meshZR
const BFieldMeshZR * m_meshZR
fast 2d map made of one zone assuming phi/roatational symmetry Owned by AtlasFieldMap.
Definition: AtlasFieldCache.h:122
MagField::AtlasFieldCache::getFieldZR
void getFieldZR(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field valaue on the z-r plane at given position works only inside the solenoid.
Definition: AtlasFieldCache.cxx:86
MagField::AtlasFieldCache::m_cond
const std::vector< BFieldCond > * m_cond
Pointer to the conductors in the current field zone (to compute Biot-Savart component) Owned by Atlas...
Definition: AtlasFieldCache.h:117
MagField::AtlasFieldCache::m_cacheZR
BFieldCacheZR m_cacheZR
Fast 2d field cell/cache.
Definition: AtlasFieldCache.h:125
BFieldCache.h
BFieldCond.h
MagField::AtlasFieldCache::fillFieldCacheZR
bool fillFieldCacheZR(double z, double r)
fill Z-R cache for solenoid *‍/
xyz
#define xyz
MagField::AtlasFieldCache::toroidOn
bool toroidOn() const
MagField::AtlasFieldCache::m_torScale
double m_torScale
Definition: AtlasFieldCache.h:94
ATH_RESTRICT
#define ATH_RESTRICT
Definition: restrict.h:31
MagField::AtlasFieldCache::AtlasFieldCache
AtlasFieldCache(AtlasFieldCache &&other)=default
MagField::AtlasFieldCache::AtlasFieldCache
AtlasFieldCache()=default
BFieldCacheZR.h
AtlasFieldCache.icc
z
#define z
MagField::AtlasFieldCache::m_fieldMap
const AtlasFieldMap * m_fieldMap
handle to the magnetic field map - not owned
Definition: AtlasFieldCache.h:102
BFieldZone.h
MagField::AtlasFieldCache::m_cache3d
BFieldCache m_cache3d
Full 3d field cell/cache This will be a cell inside a 3d field zone.
Definition: AtlasFieldCache.h:113
BFieldZone
Definition: BFieldZone.h:29
BFieldCacheZR
Definition: BFieldCacheZR.h:22
MagField::AtlasFieldCache::operator=
AtlasFieldCache & operator=(AtlasFieldCache &&other)=default
Move-able and copy-able.
MagField::AtlasFieldCache::solenoidOn
bool solenoidOn() const
status of the magnets
BFieldCache
BFieldCache.h.
Definition: BFieldCache.h:25
MagField
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: ForwardRegionFieldSvc.h:27
restrict.h
Macro wrapping the nonstandard restrict keyword.
MagField::AtlasFieldCache::AtlasFieldCache
AtlasFieldCache(double solFieldScale, double torFieldScale, const AtlasFieldMap *fieldMap)
constructor to setup with field scale and magnetic field map for first access to field
MagField::AtlasFieldMap
Map for magnetic field.
Definition: AtlasFieldMap.h:39
AtlasFieldMap.h
MagField::AtlasFieldCache::m_solScale
double m_solScale
magnetic field scales from currents
Definition: AtlasFieldCache.h:93
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MagField::AtlasFieldCache::fillFieldCache
bool fillFieldCache(double z, double r, double phi)
fill given magnetic field zone *‍/
MagField::AtlasFieldCache::m_zone3d
const BFieldZone * m_zone3d
A zone of the full 3d field.
Definition: AtlasFieldCache.h:108
MagField::AtlasFieldCache::AtlasFieldCache
AtlasFieldCache(const AtlasFieldCache &other)=default
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
MagField::AtlasFieldCache::operator=
AtlasFieldCache & operator=(const AtlasFieldCache &other)=default
MagField::AtlasFieldCache::getField
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
Definition: AtlasFieldCache.cxx:42
BFieldMeshZR.h
MagField::AtlasFieldCache::~AtlasFieldCache
~AtlasFieldCache()=default