ATLAS Offline Software
BFieldMeshZR.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * BFieldMeshZR.h
7  *
8  * A 2-dim z-r mesh inside the solenoid field map
9  *
10  * Masahiro Morii, Harvard University
11  *
12  * AthenaMT : RD Schaffer , Christos Anastopoulos
13  */
14 #ifndef BFIELDMESHZR_H
15 #define BFIELDMESHZR_H
16 
19 #include <array>
20 #include <cmath>
21 #include <vector>
22 
24 {
25 public:
26  // no default constructor
27  BFieldMeshZR() = delete;
28  // constructor
29  BFieldMeshZR(double zmin, double zmax, double rmin, double rmax);
30  // allocate space to vectors
31  void reserve(int nz, int nr);
32  // add elements to vectors
33  void appendMesh(int i, double mesh);
35  // build LUT
36  void buildLUT();
37  // test if a point is inside this zone
38  bool inside(double z, double r) const;
39  // find the bin
40  inline void getCache(double z,
41  double r,
42  BFieldCacheZR& cache,
43  double scaleFactor = 1.0) const;
44  // accessors
45  double min(size_t i) const;
46  double max(size_t i) const;
47  double zmin() const;
48  double zmax() const;
49  double rmin() const;
50  double rmax() const;
51  unsigned nmesh(size_t i) const;
52  double mesh(size_t i, size_t j) const;
53  unsigned nfield() const;
54  const BFieldVectorZR& field(size_t i) const;
55  int memSize() const;
56 
57 private:
58  std::array<double, 2> m_min;
59  std::array<double, 2> m_max;
60  std::array<std::vector<double>, 2> m_mesh;
61  std::vector<BFieldVectorZR> m_field;
62  // look-up table and related variables
63  std::array<std::vector<int>, 2> m_LUT;
64  std::array<double, 2> m_invUnit = {1}; // inverse unit size in the LUT
65  int m_zoff{0};
66 };
67 
69 #endif
beamspotman.r
def r
Definition: beamspotman.py:676
BFieldMeshZR::m_max
std::array< double, 2 > m_max
Definition: BFieldMeshZR.h:59
BFieldMeshZR::rmin
double rmin() const
BFieldMeshZR
Definition: BFieldMeshZR.h:24
BFieldMeshZR.icc
BFieldMeshZR::nmesh
unsigned nmesh(size_t i) const
BFieldMeshZR::BFieldMeshZR
BFieldMeshZR()=delete
BFieldMeshZR::zmin
double zmin() const
BFieldMeshZR::m_min
std::array< double, 2 > m_min
Definition: BFieldMeshZR.h:58
BFieldMeshZR::buildLUT
void buildLUT()
Definition: BFieldMeshZR.cxx:18
BFieldCacheZR.h
BFieldMeshZR::m_zoff
int m_zoff
Definition: BFieldMeshZR.h:65
BFieldMeshZR::m_LUT
std::array< std::vector< int >, 2 > m_LUT
Definition: BFieldMeshZR.h:63
BFieldMeshZR::m_mesh
std::array< std::vector< double >, 2 > m_mesh
Definition: BFieldMeshZR.h:60
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
BFieldMeshZR::nfield
unsigned nfield() const
BFieldMeshZR::appendField
void appendField(const BFieldVectorZR &field)
BFieldMeshZR::zmax
double zmax() const
BFieldCacheZR
Definition: BFieldCacheZR.h:22
BFieldVectorZR.h
BFieldMeshZR::m_field
std::vector< BFieldVectorZR > m_field
Definition: BFieldMeshZR.h:61
BFieldMeshZR::min
double min(size_t i) const
BFieldMeshZR::mesh
double mesh(size_t i, size_t j) const
BFieldMeshZR::BFieldMeshZR
BFieldMeshZR(double zmin, double zmax, double rmin, double rmax)
BFieldMeshZR::appendMesh
void appendMesh(int i, double mesh)
BFieldMeshZR::inside
bool inside(double z, double r) const
BFieldMeshZR::reserve
void reserve(int nz, int nr)
BFieldMeshZR::m_invUnit
std::array< double, 2 > m_invUnit
Definition: BFieldMeshZR.h:64
BFieldMeshZR::getCache
void getCache(double z, double r, BFieldCacheZR &cache, double scaleFactor=1.0) const
BFieldMeshZR::max
double max(size_t i) const
BFieldMeshZR::memSize
int memSize() const
Definition: BFieldMeshZR.cxx:45
BFieldMeshZR::rmax
double rmax() const
BFieldVectorZR
Definition: BFieldVectorZR.h:19
BFieldMeshZR::field
const BFieldVectorZR & field(size_t i) const