2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
6 // Find and return the cache of the bin containing (z,r)
9 BFieldMeshZR::getCache(double z,
12 double scaleFactor) const
14 // find the mesh, and relative location in the mesh
16 const std::vector<double>& mz(m_mesh[0]);
17 int iz = int((z - zmin()) * m_invUnit[0]); // index to LUT
18 iz = m_LUT[0][iz]; // tentative mesh index from LUT
23 const std::vector<double>& mr(m_mesh[1]);
24 int ir = int((r - rmin()) * m_invUnit[1]); // index to LUT
25 ir = m_LUT[1][ir]; // tentative mesh index from LUT
29 // store the bin edges
30 cache.setRange(mz[iz], mz[iz + 1], mr[ir], mr[ir + 1]);
31 // store the B field at the 8 corners
32 int im0 = iz * m_zoff + ir; // index of the first corner
33 cache.setField(0, m_field[im0], scaleFactor);
34 cache.setField(1, m_field[im0 + 1], scaleFactor);
35 cache.setField(2, m_field[im0 + m_zoff], scaleFactor);
36 cache.setField(3, m_field[im0 + m_zoff + 1], scaleFactor);
39 inline BFieldMeshZR::BFieldMeshZR(double zmin,
43 : m_min { zmin, rmin },
49 BFieldMeshZR::reserve(int nz, int nr)
51 m_mesh[0].reserve(nz);
52 m_mesh[1].reserve(nr);
53 m_field.reserve(nz * nr);
55 // add elements to vectors
57 BFieldMeshZR::appendMesh(int i, double mesh)
59 m_mesh[i].push_back(mesh);
62 BFieldMeshZR::appendField(const BFieldVectorZR& field)
64 m_field.push_back(field);
67 // test if a point is inside this zone
69 BFieldMeshZR::inside(double z, double r) const
71 return (z >= zmin() && z <= zmax() && r >= rmin() && r <= rmax());
75 BFieldMeshZR::min(size_t i) const
80 BFieldMeshZR::max(size_t i) const
85 BFieldMeshZR::zmin() const
90 BFieldMeshZR::zmax() const
95 BFieldMeshZR::rmin() const
100 BFieldMeshZR::rmax() const
105 BFieldMeshZR::nmesh(size_t i) const
107 return m_mesh[i].size();
110 BFieldMeshZR::mesh(size_t i, size_t j) const
115 BFieldMeshZR::nfield() const
117 return m_field.size();
119 inline const BFieldVectorZR&
120 BFieldMeshZR::field(size_t i) const