ATLAS Offline Software
BinnedMaterial.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9  const Trk::Material* mat, Trk::BinUtility*& bu,
10  const std::vector<size_t>& index,
11  const std::vector<Trk::IdentifiedMaterial>& detailedMat)
12  : Trk::Material(*mat),
13  m_matVec(detailedMat),
14  m_matBins(std::make_unique<
16  ptrs(), index, bu)) {}
17 
20  const Trk::Material* mat, Trk::BinUtility*& bu,
21  std::vector<Trk::BinUtility*>& bVec,
22  const std::vector<std::vector<size_t> >& index,
23  const std::vector<Trk::IdentifiedMaterial>& detailedMat)
24  : Trk::Material(*mat),
25  m_matVec(detailedMat),
26  m_matBins(std::make_unique<
28  ptrs(), index, bu, bVec)) {}
29 
31  : Material(amc), m_matVec(amc.m_matVec) {
32  if (amc.m_matBins) {
33  if (!m_matVec.empty()) {
34  m_matBins = binsPtr_t(amc.m_matBins->clone(ptrs()));
35  } else {
36  m_matBins = binsPtr_t(amc.m_matBins->clone());
37  }
38  }
39 }
40 
43  if (this != &amc) {
44  X0 = amc.X0;
45  L0 = amc.L0;
46  A = amc.A;
47  Z = amc.Z;
48  rho = amc.rho;
49  dEdX = amc.dEdX;
50  zOaTr = amc.zOaTr;
51  m_matVec = amc.m_matVec;
52  m_matBins.reset();
53  if (amc.m_matBins) {
54  if (!m_matVec.empty()) {
55  m_matBins = binsPtr_t(amc.m_matBins->clone(ptrs()));
56  } else {
57  m_matBins = binsPtr_t(amc.m_matBins->clone());
58  }
59  }
60  }
61  return (*this);
62 }
63 
66  const Amg::Vector3D& position) const {
68  m_matBins ? m_matBins->object(position) : nullptr;
69  return mat;
70 }
71 
74  const Amg::Vector3D& position, const Amg::Vector3D& direction,
75  bool layOnly) const {
77  m_matBins ? m_matBins->nextObject(position, direction, layOnly) : nullptr;
78  return mat;
79 }
80 
81 std::vector<const Trk::IdentifiedMaterial*> Trk::BinnedMaterial::ptrs() const {
82  std::vector<const Trk::IdentifiedMaterial*> p;
83  p.reserve(m_matVec.size());
84  for (const Trk::IdentifiedMaterial& m : m_matVec) {
85  p.push_back(&m);
86  }
87  return p;
88 }
BinnedMaterial.h
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::Material::L0
float L0
Definition: Material.h:120
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
index
Definition: index.py:1
Trk::Material::Z
float Z
Definition: Material.h:122
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
Trk::BinnedMaterial
Definition: BinnedMaterial.h:38
Trk::BinnedMaterial::m_matVec
std::vector< IdentifiedMaterial > m_matVec
Definition: BinnedMaterial.h:83
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Trk::BinnedMaterial::BinnedMaterial
BinnedMaterial()=default
Default Constructor needed for POOL.
Trk::CompactBinnedArray2D
Definition: CompactBinnedArray2D.h:32
pdg_comparison.X0
X0
Definition: pdg_comparison.py:314
Trk::BinnedMaterial::materialNext
const IdentifiedMaterial * materialNext(const Amg::Vector3D &pos, const Amg::Vector3D &dir, bool layOnly) const
access to binned material
Definition: BinnedMaterial.cxx:73
A
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::Material::A
float A
Definition: Material.h:121
Trk::Material::X0
float X0
Definition: Material.h:119
Trk::BinUtility
Definition: BinUtility.h:39
Trk::BinnedMaterial::binsPtr_t
std::unique_ptr< const CompactBinnedArray< const IdentifiedMaterial > > binsPtr_t
Definition: BinnedMaterial.h:85
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::BinnedMaterial::operator=
BinnedMaterial & operator=(const BinnedMaterial &amc)
Assignment operator.
Definition: BinnedMaterial.cxx:42
Trk::Material::rho
float rho
Definition: Material.h:123
Trk::BinnedMaterial::m_matBins
binsPtr_t m_matBins
Definition: BinnedMaterial.h:86
Trk::BinnedMaterial::ptrs
std::vector< const Trk::IdentifiedMaterial * > ptrs() const
Definition: BinnedMaterial.cxx:81
Trk::BinnedMaterial::material
const IdentifiedMaterial * material(const Amg::Vector3D &position) const
access to material/id per bin
Definition: BinnedMaterial.cxx:65
Trk::Material::dEdX
float dEdX
Definition: Material.h:124
Trk::Material::zOaTr
float zOaTr
Definition: Material.h:125
Trk::Material
Definition: Material.h:116
Trk::CompactBinnedArray1D
Definition: CompactBinnedArray1D.h:33
Trk::IdentifiedMaterial
std::pair< const Material *, int > IdentifiedMaterial
Definition: BinnedMaterial.h:28
fitman.rho
rho
Definition: fitman.py:532
Trk::L0
@ L0
Definition: AlignModuleList.h:32