ATLAS Offline Software
Loading...
Searching...
No Matches
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//
17void
19{
20 for (int j = 0; j < 2; j++) { // z, r
21 // determine the unit size, q, to be used in the LUTs
22 const 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
44int
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}
const double width
std::array< std::vector< int >, 2 > m_LUT
int memSize() const
std::vector< BFieldVectorZR > m_field
std::array< double, 2 > m_invUnit
std::array< std::vector< double >, 2 > m_mesh