ATLAS Offline Software
Loading...
Searching...
No Matches
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
16
17#ifndef BFIELDCACHE_H
18#define BFIELDCACHE_H
19
20#include "CxxUtils/restrict.h"
21#include "CxxUtils/vec.h"
23
25{
26public:
27 // default constructor sets unphysical boundaries, so that inside() will fail
28 BFieldCache() = default; // cppcheck-suppress uninitMemberVar; m_field uninit on purpose
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.
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
59private:
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 = 0.0;
71 double m_invr = 0.0;
72 double m_invphi = 0.0;
73 double m_scale = 0.0; // 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
Scalar phi() const
phi method
#define xyz
#define z
void setRange(double zmin, double zmax, double rmin, double rmax, double phimin, double phimax)
void setField(const CxxUtils::vec< double, 8 > &field1, const CxxUtils::vec< double, 8 > &field2, const CxxUtils::vec< double, 8 > &field3)
double m_field[3][8]
Definition BFieldCache.h:74
double m_invphi
Definition BFieldCache.h:72
double m_rmin
Definition BFieldCache.h:64
double m_phimin
Definition BFieldCache.h:67
double m_rmax
Definition BFieldCache.h:65
BFieldCache()=default
void getB(const double *ATH_RESTRICT xyz, double r, double phi, double *ATH_RESTRICT B, double *ATH_RESTRICT deriv=nullptr) const
double m_invr
Definition BFieldCache.h:71
bool inside(double z, double r, double phi) const
void invalidate()
double m_zmax
Definition BFieldCache.h:62
double m_zmin
Definition BFieldCache.h:61
double m_phimax
Definition BFieldCache.h:68
double m_scale
Definition BFieldCache.h:73
float bscale() const
double m_invz
Definition BFieldCache.h:70
void setBscale(double bscale)
int r
Definition globals.cxx:22
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition vec.h:207
Macro wrapping the nonstandard restrict keyword.
#define ATH_RESTRICT
Definition restrict.h:31
Vectorization helpers.