ATLAS Offline Software
Loading...
Searching...
No Matches
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{
25public:
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
57private:
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
#define z
double mesh(size_t i, size_t j) const
void reserve(int nz, int nr)
std::array< std::vector< int >, 2 > m_LUT
std::array< double, 2 > m_max
BFieldMeshZR()=delete
bool inside(double z, double r) const
double zmin() const
double rmin() const
BFieldMeshZR(double zmin, double zmax, double rmin, double rmax)
void getCache(double z, double r, BFieldCacheZR &cache, double scaleFactor=1.0) const
const BFieldVectorZR & field(size_t i) const
double max(size_t i) const
double min(size_t i) const
unsigned nfield() const
unsigned nmesh(size_t i) const
std::array< double, 2 > m_min
double zmax() const
int memSize() const
void appendMesh(int i, double mesh)
std::vector< BFieldVectorZR > m_field
double rmax() const
std::array< double, 2 > m_invUnit
std::array< std::vector< double >, 2 > m_mesh
void appendField(const BFieldVectorZR &field)
int r
Definition globals.cxx:22