ATLAS Offline Software
AssociatedMaterial.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 // AssociatedMaterial.cxx, (c) ATLAS Detector software
8 
10 
11 #include "TrkGeometry/Layer.h"
13 // Gaudi
14 #include "GaudiKernel/MsgStream.h"
15 // STD
16 #include <iostream>
17 
19  : m_materialPosition(Amg::Vector3D(0., 0., 0.)),
20  m_correctionFactor(0.),
21  m_materialProperties(nullptr),
22  m_materialStep(nullptr),
23  m_trackingVolume(nullptr),
24  m_layer(nullptr),
25  m_cleanup(false) {}
26 
28  float steplength, float X0,
29  float L0, float A, float Z,
30  float rho, float cFactor,
31  const TrackingVolume* tvol,
32  const Layer* lay)
33  : m_materialPosition(hitpos),
34  m_correctionFactor(cFactor),
35  m_materialProperties(nullptr),
36  m_materialStep(new Trk::MaterialStep(hitpos.x(), hitpos.y(), hitpos.z(),
37  steplength, X0, L0, A, Z, rho)),
38  m_trackingVolume(tvol),
39  m_layer(lay),
40  m_cleanup(true) {}
41 
43  const Amg::Vector3D& hitpos, float steplength, const Trk::Material& mat,
44  float cFactor, const TrackingVolume* tvol, const Layer* lay)
45  : m_materialPosition(hitpos),
46  m_correctionFactor(cFactor),
47  m_materialProperties(new Trk::MaterialProperties(mat, steplength)),
48  m_materialStep(nullptr),
49  m_trackingVolume(tvol),
50  m_layer(lay),
51  m_cleanup(true) {}
52 
54  const Amg::Vector3D& hitpos, const Trk::MaterialProperties* mprop,
55  float cFactor, const Trk::TrackingVolume* tvol, const Trk::Layer* lay)
56  : m_materialPosition(hitpos),
57  m_correctionFactor(cFactor),
58  m_materialProperties(mprop),
59  m_materialStep(nullptr),
60  m_trackingVolume(tvol),
61  m_layer(lay),
62  m_cleanup(false)
63 
64 {}
65 
67  float cFactor,
68  const Trk::TrackingVolume* tvol,
69  const Trk::Layer* lay)
70  : m_materialPosition(Amg::Vector3D(ms->hitX(), ms->hitY(), ms->hitZ())),
71  m_correctionFactor(cFactor),
72  m_materialProperties(nullptr),
73  m_materialStep(ms),
74  m_trackingVolume(tvol),
75  m_layer(lay),
76  m_cleanup(false) {}
77 
79  const Trk::TrackingVolume* tvol,
80  const Trk::Layer* lay)
81  : m_materialPosition(hitpos),
82  m_correctionFactor(0.),
83  m_materialProperties(nullptr),
84  m_materialStep(nullptr),
85  m_trackingVolume(tvol),
86  m_layer(lay),
87  m_cleanup(false) {}
88 
90  : m_materialPosition(am.m_materialPosition),
91  m_correctionFactor(am.m_correctionFactor),
92  m_materialProperties(am.m_cleanup && am.m_materialProperties
93  ? am.m_materialProperties->clone()
94  : am.m_materialProperties),
95  m_materialStep((am.m_cleanup && am.m_materialStep)
96  ? new Trk::MaterialStep(*am.m_materialStep)
97  : am.m_materialStep),
98  m_trackingVolume(am.m_trackingVolume),
99  m_layer(am.m_layer),
100  m_cleanup(am.m_cleanup) {}
101 
103  Trk::AssociatedMaterial&& am) noexcept
104  : m_materialPosition(std::move(am.m_materialPosition)),
105  m_correctionFactor(am.m_correctionFactor),
106  m_materialProperties(am.m_materialProperties),
107  m_materialStep(am.m_materialStep),
108  m_trackingVolume(am.m_trackingVolume),
109  m_layer(am.m_layer),
110  m_cleanup(am.m_cleanup) {
111  am.m_materialProperties = nullptr;
112  am.m_materialStep = nullptr;
113  am.m_cleanup = false;
114 }
115 
117  const Trk::AssociatedMaterial& am) {
118  if (&am != this) {
119  if (m_cleanup) {
120  delete m_materialStep;
121  delete m_materialProperties;
122  }
123  m_materialPosition = am.m_materialPosition;
124  m_correctionFactor = am.m_correctionFactor;
125  m_materialProperties = (am.m_cleanup && am.m_materialProperties)
128  m_materialStep = (am.m_cleanup && am.m_materialStep)
130  : am.m_materialStep;
131  m_trackingVolume = am.m_trackingVolume;
132  m_layer = am.m_layer;
133  m_cleanup = am.m_cleanup;
134  }
135  return (*this);
136 }
137 
139  Trk::AssociatedMaterial&& am) noexcept {
140  m_materialPosition = std::move(am.m_materialPosition);
141  m_correctionFactor = am.m_correctionFactor;
142  m_trackingVolume = am.m_trackingVolume;
143  m_layer = am.m_layer;
144  m_cleanup = am.m_cleanup;
145 
146  if (m_materialProperties && m_materialProperties != am.m_materialProperties) {
147  delete m_materialProperties;
148  }
149  m_materialProperties = am.m_materialProperties;
150  am.m_materialProperties = nullptr;
151 
152  if (m_materialStep && m_materialStep != am.m_materialStep) {
153  delete m_materialStep;
154  }
155  m_materialStep = am.m_materialStep;
156  am.m_materialStep = nullptr;
157 
158  am.m_cleanup = false;
159  return *this;
160 }
161 
163  if (m_cleanup) {
164  delete m_materialStep;
165  delete m_materialProperties;
166  }
167 }
168 
169 MsgStream& Trk::AssociatedMaterial::dump(MsgStream& sl) const {
170  sl << "----> AssociatedMaterial - recorded at (x/y/z) | r : ("
171  << m_materialPosition.x() << "/ ";
172  sl << m_materialPosition.y() << "/ ";
173  sl << m_materialPosition.z() << ")" << std::endl;
174  sl << " Material (t/x0/l0/A/Z/rho) : (" << steplength() << "/ ";
175  sl << x0() << "/ ";
176  sl << l0() << "/ ";
177  sl << A() << "/ ";
178  sl << Z() << "/ ";
179  sl << rho() << ")" << std::endl;
180  if (m_trackingVolume)
181  sl << " Associated to TrackingVolume : "
182  << m_trackingVolume->volumeName() << std::endl;
183  if (m_layer)
184  sl << " and Layer with Index : "
185  << m_layer->layerIndex().value() << std::endl;
186  return sl;
187 }
188 
189 std::ostream& Trk::AssociatedMaterial::dump(std::ostream& sl) const {
190  sl << "----> AssociatedMaterial - recorded at (x/y/z) | r : ("
191  << m_materialPosition.x() << "/ ";
192  sl << m_materialPosition.y() << "/ ";
193  sl << m_materialPosition.z() << ")" << std::endl;
194  sl << " Material (t/x0/l0/A/Z/rho) : (" << steplength() << "/ ";
195  sl << x0() << "/ ";
196  sl << l0() << "/ ";
197  sl << A() << "/ ";
198  sl << Z() << "/ ";
199  sl << rho() << ")" << std::endl;
200  if (m_trackingVolume)
201  sl << " Associated to TrackingVolume : "
202  << m_trackingVolume->volumeName() << std::endl;
203  if (m_layer)
204  sl << " and Layer with Index : "
205  << m_layer->layerIndex().value() << std::endl;
206  return sl;
207 }
208 
209 MsgStream& Trk::operator<<(MsgStream& sl,
210  const Trk::AssociatedMaterial& mstep) {
211  return mstep.dump(sl);
212 }
213 
214 std::ostream& Trk::operator<<(std::ostream& sl,
215  const Trk::AssociatedMaterial& mstep) {
216  return mstep.dump(sl);
217 }
218 
Trk::y
@ y
Definition: ParamDefs.h:56
Trk::AssociatedMaterial::m_materialProperties
const Trk::MaterialProperties * m_materialProperties
Definition: AssociatedMaterial.h:120
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
Trk::AssociatedMaterial::m_materialStep
const Trk::MaterialStep * m_materialStep
Definition: AssociatedMaterial.h:121
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
Trk::AssociatedMaterial::AssociatedMaterial
AssociatedMaterial()
Default constructor.
Definition: AssociatedMaterial.cxx:18
Layer.h
Trk::AssociatedMaterial::operator=
AssociatedMaterial & operator=(const AssociatedMaterial &am)
Assignment operator.
Definition: AssociatedMaterial.cxx:116
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Trk::AssociatedMaterial::m_layer
const Trk::Layer * m_layer
Definition: AssociatedMaterial.h:123
python.Utilities.clone
clone
Definition: Utilities.py:134
pdg_comparison.X0
X0
Definition: pdg_comparison.py:314
Trk::MaterialStep
Definition: MaterialStep.h:34
A
Trk::MaterialProperties::clone
MaterialProperties * clone() const
Pseudo-Constructor clone()
Definition: MaterialProperties.cxx:33
Trk::AssociatedMaterial
Definition: AssociatedMaterial.h:33
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Trk::AssociatedMaterial::m_cleanup
bool m_cleanup
Definition: AssociatedMaterial.h:124
Trk::AssociatedMaterial::m_correctionFactor
float m_correctionFactor
Definition: AssociatedMaterial.h:119
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::MaterialProperties
Definition: MaterialProperties.h:40
TrackingVolume.h
Trk::AssociatedMaterial::m_materialPosition
Amg::Vector3D m_materialPosition
Definition: AssociatedMaterial.h:118
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
Trk::AssociatedMaterial::m_trackingVolume
const Trk::TrackingVolume * m_trackingVolume
Definition: AssociatedMaterial.h:122
ReadCellNoiseFromCoolCompare.l0
l0
Definition: ReadCellNoiseFromCoolCompare.py:359
AssociatedMaterial.h
Trk::Material
Definition: Material.h:116
Trk::x
@ x
Definition: ParamDefs.h:55
Trk::TrackingVolume
Definition: TrackingVolume.h:121
fitman.rho
rho
Definition: fitman.py:532
Trk::L0
@ L0
Definition: AlignModuleList.h:32
Trk::AssociatedMaterial::~AssociatedMaterial
~AssociatedMaterial()
Destructor.
Definition: AssociatedMaterial.cxx:162
Trk::AssociatedMaterial::dump
MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
Definition: AssociatedMaterial.cxx:169
Trk::Layer
Definition: Layer.h:73