ATLAS Offline Software
BFieldMeshZR.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
6 // BFieldMeshZR.cxx
7 //
8 // A 2-dim z-r mesh inside the solenoid field map
9 //
10 // Masahiro Morii, Harvard University
11 //
13 
14 //
15 // Construct the look-up table to accelerate bin-finding.
16 //
17 void
19 {
20  for (int j = 0; j < 2; j++) { // z, r
21  // determine the unit size, q, to be used in the LUTs
22  double width = m_mesh[j].back() - m_mesh[j].front();
23  double q(width);
24  for (unsigned i = 0; i < m_mesh[j].size() - 1; i++) {
25  q = std::min(q, m_mesh[j][i + 1] - m_mesh[j][i]);
26  }
27  // find the number of units in the LUT
28  int n = int(width / q) + 1;
29  q = width / (n + 0.5);
30  m_invUnit[j] = 1.0 / q; // new unit size
31  n++;
32  int m = 0; // mesh number
33  m_LUT[j].reserve(n);
34  for (int i = 0; i < n; i++) { // LUT index
35  if (i * q + m_mesh[j].front() > m_mesh[j][m + 1]) {
36  m++;
37  }
38  m_LUT[j].push_back(m);
39  }
40  }
41  m_zoff = m_mesh[1].size(); // index offset for incrementing z by 1
42 }
43 
44 int
46 {
47  int size = 0;
48  size += sizeof(double) * 6;
49  size += sizeof(int) * 1;
50  for (int i = 0; i < 2; i++) {
51  size += sizeof(double) * m_mesh[i].capacity();
52  size += sizeof(int) * m_LUT[i].capacity();
53  }
54  size += sizeof(BFieldVectorZR) * m_field.capacity();
55  return size;
56 }
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
BFieldMeshZR::buildLUT
void buildLUT()
Definition: BFieldMeshZR.cxx:18
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
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
beamspotman.n
n
Definition: beamspotman.py:731
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
BFieldMeshZR::m_field
std::vector< BFieldVectorZR > m_field
Definition: BFieldMeshZR.h:61
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
BFieldMeshZR::m_invUnit
std::array< double, 2 > m_invUnit
Definition: BFieldMeshZR.h:64
extractSporadic.q
list q
Definition: extractSporadic.py:98
BFieldMeshZR::memSize
int memSize() const
Definition: BFieldMeshZR.cxx:45
BFieldMeshZR.h
BFieldVectorZR
Definition: BFieldVectorZR.h:19