ATLAS Offline Software
Loading...
Searching...
No Matches
BFieldCacheZR.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5//
6// BFieldCacheZR.h
7//
8// Cashe of one bin of the magnetic field map.
9// Defined by ranges in z, r, and the (Bz, Br) vectors at the 4 corners of the
10// "bin".
11//
12// Masahiro Morii, Harvard University
13//
14#ifndef BFIELDCACHEZR_H
15#define BFIELDCACHEZR_H
16
18#include "CxxUtils/restrict.h"
19#include <cmath>
20
22{
23public:
24 // invalidate this cache, so that inside() will fail
25 void invalidate();
26 // set the z, r range that defines the bin
27 void setRange(double zmin, double zmax, double rmin, double rmax);
28 // set the field values at each corner (rescale for current scale factor)
29 void setField(int i, const BFieldVectorZR& field, double scaleFactor = 1.0);
30 // set the multiplicative factor for the field vectors
31 // test if (z, r) is inside this bin
32 bool inside(double z, double r) const;
33 // interpolate the field and return B[3].
34 // also compute field derivatives if deriv[9] is given.
35 void getB(const double* ATH_RESTRICT xyz,
36 double r,
37 double* ATH_RESTRICT B,
38 double* ATH_RESTRICT deriv = nullptr) const;
39
40private:
41 // default unphysical boundaries, so that inside() will fail
42 double m_zmin{0}, m_zmax{-1}; // bin range in z
43 double m_rmin{0}, m_rmax{-1}; // bin range in r
44 double m_invz{-1}, m_invr{-1}; // 1/(bin size) in z, r
45 double m_field[2][4]; // (Bz,Br) at 4 corners of the bin
46};
48#endif
#define xyz
#define z
void getB(const double *ATH_RESTRICT xyz, double r, double *ATH_RESTRICT B, double *ATH_RESTRICT deriv=nullptr) const
void setField(int i, const BFieldVectorZR &field, double scaleFactor=1.0)
void invalidate()
bool inside(double z, double r) const
double m_field[2][4]
void setRange(double zmin, double zmax, double rmin, double rmax)
int r
Definition globals.cxx:22
Macro wrapping the nonstandard restrict keyword.
#define ATH_RESTRICT
Definition restrict.h:31