ATLAS Offline Software
BFieldCache.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
17 #ifndef BFIELDCACHE_H
18 #define BFIELDCACHE_H
19 
20 #include "CxxUtils/restrict.h"
21 #include "CxxUtils/vec.h"
23 
25 {
26 public:
27  // default constructor sets unphysical boundaries, so that inside() will fail
28  BFieldCache() = default;
29  // make this cache invalid, so that inside() will fail
30  void invalidate();
31 
32  // set the z, r, phi range that defines the bin
33  void setRange(double zmin,
34  double zmax,
35  double rmin,
36  double rmax,
37  double phimin,
38  double phimax);
39 
40  // set the 3x8 field array.
41  void setField(const CxxUtils::vec<double, 8>& field1,
42  const CxxUtils::vec<double, 8>& field2,
43  const CxxUtils::vec<double, 8>& field3);
44 
45  // set the multiplicative factor for the field vectors
46  void setBscale(double bscale);
47  float bscale() const;
48 
49  // test if (z, r, phi) is inside this bin
50  bool inside(double z, double r, double phi) const;
51  // interpolate the field and return B[3].
52  // also compute field derivatives if deriv[9] is given.
53  void getB(const double* ATH_RESTRICT xyz,
54  double r,
55  double phi,
56  double* ATH_RESTRICT B,
57  double* ATH_RESTRICT deriv = nullptr) const;
58 
59 private:
60  // bin range in z
61  double m_zmin = 0.0;
62  double m_zmax = 0.0;
63  // bin range in r
64  double m_rmin = 0.0;
65  double m_rmax = 0.0;
66  // bin range in phi
67  double m_phimin = 0.0;
68  double m_phimax = -1.0;
69  // 1/(bin size) in z, r, phi
70  double m_invz;
71  double m_invr;
72  double m_invphi;
73  double m_scale; // unit of m_field in kT
74  alignas(16) double m_field[3][8]; // (Bz,Br,Bphi) at 8 corners of the bin
75 };
76 
78 #endif
beamspotman.r
def r
Definition: beamspotman.py:676
BFieldCache::m_phimin
double m_phimin
Definition: BFieldCache.h:67
BFieldCache::m_invphi
double m_invphi
Definition: BFieldCache.h:72
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
PixelAthClusterMonAlgCfg.zmin
zmin
Definition: PixelAthClusterMonAlgCfg.py:169
xyz
#define xyz
BFieldCache::getB
void getB(const double *ATH_RESTRICT xyz, double r, double phi, double *ATH_RESTRICT B, double *ATH_RESTRICT deriv=nullptr) const
Definition: BFieldCache.cxx:99
BFieldCache::setField
void setField(const CxxUtils::vec< double, 8 > &field1, const CxxUtils::vec< double, 8 > &field2, const CxxUtils::vec< double, 8 > &field3)
BFieldCache::m_invr
double m_invr
Definition: BFieldCache.h:71
BFieldCache::setRange
void setRange(double zmin, double zmax, double rmin, double rmax, double phimin, double phimax)
BFieldCache::BFieldCache
BFieldCache()=default
BFieldCache::m_scale
double m_scale
Definition: BFieldCache.h:73
ATH_RESTRICT
#define ATH_RESTRICT
Definition: restrict.h:31
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
BFieldCache::m_zmin
double m_zmin
Definition: BFieldCache.h:61
z
#define z
BFieldCache::m_rmax
double m_rmax
Definition: BFieldCache.h:65
BFieldCache::m_rmin
double m_rmin
Definition: BFieldCache.h:64
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:169
BFieldCache::invalidate
void invalidate()
BFieldCache::setBscale
void setBscale(double bscale)
BFieldCache
BFieldCache.h.
Definition: BFieldCache.h:25
BFieldVector.h
restrict.h
Macro wrapping the nonstandard restrict keyword.
BFieldCache.icc
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
BFieldCache::m_invz
double m_invz
Definition: BFieldCache.h:70
BFieldCache::inside
bool inside(double z, double r, double phi) const
vec.h
Vectorization helpers.
BFieldCache::m_zmax
double m_zmax
Definition: BFieldCache.h:62
BFieldCache::bscale
float bscale() const
BFieldCache::m_phimax
double m_phimax
Definition: BFieldCache.h:68
BFieldCache::m_field
double m_field[3][8]
Definition: BFieldCache.h:74