ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MagneticField
MagFieldElements
MagFieldElements
AtlasFieldMap.icc
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
namespace MagField {
6
inline const BFieldZone*
7
MagField::AtlasFieldMap::findBFieldZone(double z, double r, double phi) const
8
{
9
10
// make sure it's inside the largest zone
11
// NB: the sign of the logic is chosen in order to return 0 on NaN inputs
12
if (z >= m_zmin && z <= m_zmax && r <= m_rmax) {
13
// find the edges of the zone
14
// z
15
int iz = int(m_invq[0] * (z - m_zmin)); // index to LUT
16
iz = m_edgeLUT[0][iz]; // tentative index from LUT
17
if (z > m_edge[0][iz + 1]) {
18
iz++;
19
}
20
// r
21
int ir = int(m_invq[1] * r); // index to LUT - note minimum r is always 0
22
ir = m_edgeLUT[1][ir]; // tentative index from LUT
23
if (r > m_edge[1][ir + 1]) {
24
ir++;
25
}
26
// phi
27
int iphi =
28
int(m_invq[2] * (phi + M_PI)); // index to LUT - minimum phi is -pi
29
iphi = m_edgeLUT[2][iphi]; // tentative index from LUT
30
if (phi > m_edge[2][iphi + 1]) {
31
iphi++;
32
}
33
// use LUT to get the zone
34
return m_zoneLUT[(iz * m_nr + ir) * m_nphi + iphi];
35
}
36
return nullptr;
37
}
38
39
// fast 2d map (made of one zone)
40
inline const BFieldMeshZR*
41
AtlasFieldMap::getBFieldMesh() const
42
{
43
return m_meshZR;
44
}
45
46
}
47
Generated on
for ATLAS Offline Software by
1.17.0