ATLAS Offline Software
TrackParticle.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***************************************************************************
6 TrackParticle.cxx - Description
7  -------------------
8  begin : 27-01-2004
9  authors : Andreas Wildauer (CERN PH-ATC), Fredrik Akesson (CERN PH-ATC)
10  email : andreas.wildauer@cern.ch, fredrik.akesson@cern.ch
11  changes :
12 
13 ***************************************************************************/
14 
15 #include "Particle/TrackParticle.h"
18 #include "GaudiKernel/MsgStream.h"
19 
20 #include <sstream>
21 
22 
23 namespace Rec
24 {
25 
26  // Constructor 0
28  : Trk::TrackParticleBase()
29  , P4PxPyPzE()
31  {}
32 
34  const Trk::Track* trk,
35  const Trk::TrackParticleOrigin trkPrtOrigin,
36  const Trk::VxCandidate* vxCandidate,
37  const Trk::TrackSummary* trkSummary,
38  std::vector<const Trk::TrackParameters*>& parameters,
39  const Trk::TrackParameters* definingParameter,
41  : Trk::TrackParticleBase(trk,
42  trkPrtOrigin,
43  vxCandidate,
44  trkSummary,
45  parameters,
46  definingParameter,
47  fitQuality)
48  , P4PxPyPzE(definingParameter->momentum()[Trk::px],
49  definingParameter->momentum()[Trk::py],
50  definingParameter->momentum()[Trk::pz],
51  sqrt(pow(Trk::ParticleMasses::mass[Trk::pion], 2) +
52  pow(definingParameter->momentum()[Trk::px], 2) +
53  pow(definingParameter->momentum()[Trk::py], 2) +
54  pow(definingParameter->momentum()[Trk::pz], 2)))
56  {}
57 
59  const ElementLink<TrackCollection>& trackLink,
60  const Trk::TrackParticleOrigin trkPrtOrigin,
61  const ElementLink<VxContainer>& vxCandidate,
62  std::unique_ptr<Trk::TrackSummary> trkSummary,
63  // passes ownership of elements.
64  std::vector<const Trk::TrackParameters*>&& parameters,
65  std::unique_ptr<Trk::FitQuality> fitQuality,
67  const P4PxPyPzE& mom)
68  : Trk::TrackParticleBase(trackLink,
69  trkPrtOrigin,
70  vxCandidate,
71  std::move(trkSummary),
72  std::move(parameters),
73  std::move(fitQuality),
74  std::move(info))
75  , P4PxPyPzE(mom)
77  {}
78 
83  : IAthenaBarCode(rhs)
84  , INavigable(rhs)
85  , I4Momentum(rhs)
86  , INavigable4Momentum(rhs)
87  , P4PxPyPzEBase(rhs)
88  , Trk::TrackParticleBase(rhs)
89  , P4PxPyPzE(rhs)
91  , m_abc(rhs.m_abc)
92  {}
93 
99  {
100  if (this != &rhs) {
101  P4PxPyPzE::operator=(rhs);
103  m_abc = rhs.m_abc;
104  }
105  return *this;
106  }
107 
109  {
110  if (this!=&rhs)
111  {
112  P4PxPyPzE::operator= (rhs);
113  m_abc = rhs.m_abc;
114  Trk::TrackParticleBase::operator=(std::move(rhs));
115  }
116  return *this;
117  }
118 
123  {
124  }
125 
130  {
131  delete m_trackSummary;
132  m_trackSummary=0;
133  }
134 
136  {
137  delete m_fitQuality;
138  m_fitQuality=0;
139  }
140 
142  {
144  this->m_trackParameters.begin();
145  iter != this->m_trackParameters.end();
146  ++iter) {
147  /* If this is a measured perigee, then we clone it without error matrix
148  and replace the Perigee with its clone */
149  const Trk::Perigee* measPg=dynamic_cast<const Trk::Perigee*>(*iter);
150  if (measPg) {
151  *iter=measPg->clone();
152  delete measPg;
153  }
154  }
155  }
156 
157  MsgStream& Rec::TrackParticle::dump( MsgStream& sl ) const
158  {
160  std::ostringstream os;
161  m_abc.dump(os);
162  sl<<std::endl<<os.str();
163  return sl;
164  }
165 
166  std::ostream& Rec::TrackParticle::dump( std::ostream& sl ) const
167  {
169  sl<<std::endl;
170  m_abc.dump(sl);
171  return sl;
172  }
173 
175  void TrackParticle::set4Mom (const I4Momentum * const )
176  {
177  std::cout << " FATAL ERROR : TrackParticle::set4Mom called. Changing the 4 "
178  "momentum of the TrackParticle is not allowed! Aborting!"
179  << std::endl;
180  std::abort();
181  return;
182  }
183 
185  void TrackParticle::set4Mom (const I4Momentum & )
186  {
187  std::cout << " FATAL ERROR : TrackParticle::set4Mom called. Changing the 4 "
188  "momentum of the TrackParticle is not allowed! Aborting!"
189  << std::endl;
190  std::abort();
191  return;
192  }
193 
195  void TrackParticle::set4Mom (const CLHEP::HepLorentzVector & )
196  {
197  std::cout << " FATAL ERROR : TrackParticle::set4Mom called. Changing the 4 "
198  "momentum of the TrackParticle is not allowed! Aborting!"
199  << std::endl;
200  std::abort();
201  return;
202  }
203 
204 
206 // IAthenaBarCode implementation
208 
210  return m_abc.getAthenaBarCode();
211  }
212 
215  }
216 
217  //Comparing & Versioning Control
219  return m_abc.hasSameAthenaBarCode(bc);
220  }
221 
224  }
225 
227  return m_abc.getVersion();
228  }
229 
231  m_abc.newVersion();
232  }
233 
235  m_abc.setVersion(newversion);
236  }
237 
239 // Finished Passing all interface of IAthenaBarCode
241 
242 
243 
244 
245 }//end of namespace definitions
246 
247 //the sream operatoes are defined in the global namespace
248 //header files. Making the same here.
249 
250  MsgStream& operator << ( MsgStream& sl, const Rec::TrackParticle& trackParticle)
251  {
252  trackParticle.dump(sl);
253  return sl;
254  }
255 
256  std::ostream& operator << ( std::ostream& sl, const Rec::TrackParticle& trackParticle)
257  {
258  trackParticle.dump(sl);
259  return sl;
260  }
261 
grepfile.info
info
Definition: grepfile.py:38
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::TrackParticleBase::operator=
TrackParticleBase & operator=(const TrackParticleBase &)
Assignement operator.
Definition: TrackParticleBase.cxx:116
Trk::TrackInfo
Contains information about the 'fitter' of this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:32
I4Momentum
Definition: I4Momentum.h:31
test_pyathena.px
px
Definition: test_pyathena.py:18
Rec::TrackParticle::TrackParticle
TrackParticle()
Constructor 0 standard constructor which sets everything to 0, needed for persistency.
Definition: TrackParticle.cxx:35
TrackParticle.h
ParticleMasses
Rec::TrackParticle::setAthenaBarCode
void setAthenaBarCode(AthenaBarCode_t)
Definition: TrackParticle.cxx:221
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
operator<<
MsgStream & operator<<(MsgStream &sl, const Rec::TrackParticle &trackParticle)
Overload of << operator for MsgStream for debug output.
Definition: TrackParticle.cxx:250
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Trk::VertexType
VertexType
Definition: VertexType.h:25
Rec::TrackParticle::operator=
TrackParticle & operator=(const TrackParticle &)
Assignment operator.
Definition: TrackParticle.cxx:106
NavigableTerminalNode
Dummy type needed fro specialized implementation.
Definition: NavigableTerminalNode.h:19
xAOD::pion
@ pion
Definition: TrackingPrimitives.h:196
Rec::TrackParticle::getAthenaBarCode
AthenaBarCode_t getAthenaBarCode() const
Definition: TrackParticle.cxx:217
Trk::TrackParticleBase::dump
virtual MsgStream & dump(MsgStream &out) const
Dump methods to be used by the overloaded stream operator (inheritance!)
Definition: TrackParticleBase.cxx:190
AthenaBarCodeImpl::setAthenaBarCode
void setAthenaBarCode(AthenaBarCode_t id)
Definition: AthenaBarCodeImpl.cxx:211
ParamDefs.h
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
Rec::TrackParticle::hasSameAthenaBarCodeExceptVersion
bool hasSameAthenaBarCodeExceptVersion(const IAthenaBarCode &) const
Definition: TrackParticle.cxx:230
Rec::TrackParticle::removeFitQuality
void removeFitQuality()
removeFitQuality to delete the fit quality object
Definition: TrackParticle.cxx:143
AthenaBarCode_t
uint64_t AthenaBarCode_t
barcode for all INav4Mom classes
Definition: AthenaKernel/AthenaKernel/IAthenaBarCode.h:44
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Rec::TrackParticle::hasSameAthenaBarCode
bool hasSameAthenaBarCode(const IAthenaBarCode &) const
Definition: TrackParticle.cxx:226
AthenaBarCodeImpl::newVersion
void newVersion()
Definition: AthenaBarCodeImpl.cxx:138
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
Rec
Name: MuonSpContainer.h Package : offline/Reconstruction/MuonIdentification/muonEvent.
Definition: FakeTrackBuilder.h:10
Rec::TrackParticle::dump
virtual MsgStream & dump(MsgStream &out) const
Dump methods to be used by the overloaded stream operator (inheritance!)
Definition: TrackParticle.cxx:165
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
AthenaBarCodeImpl::hasSameAthenaBarCodeExceptVersion
bool hasSameAthenaBarCodeExceptVersion(const IAthenaBarCode &obj) const
Definition: AthenaBarCodeImpl.cxx:120
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
Trk::ParametersBase
Definition: ParametersBase.h:55
INavigable
Definition: INavigable.h:18
Rec::TrackParticle::removeErrorMatrix
void removeErrorMatrix()
removeErrorMatrix to delete the error matrix.
Definition: TrackParticle.cxx:149
Rec::TrackParticle::getVersion
AthenaBarCodeVersion_t getVersion() const
Definition: TrackParticle.cxx:234
ParticleHypothesis.h
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
IAthenaBarCode
Definition: AthenaKernel/AthenaKernel/IAthenaBarCode.h:48
P4PxPyPzEBase
Definition: P4PxPyPzEBase.h:26
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg::py
@ py
Definition: GeoPrimitives.h:39
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
Rec::TrackParticle::~TrackParticle
virtual ~TrackParticle()
Destructor.
Definition: TrackParticle.cxx:130
AthenaBarCodeImpl::getAthenaBarCode
AthenaBarCode_t getAthenaBarCode() const
Definition: AthenaBarCodeImpl.cxx:203
Rec::TrackParticle::setVersion
void setVersion(AthenaBarCodeVersion_t newversion)
Definition: TrackParticle.cxx:242
Trk::TrackParticleBase::m_fitQuality
const FitQuality * m_fitQuality
the fit quality of this TrackParticle.
Definition: TrackParticleBase.h:179
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
Trk::GsfMeasurementUpdator::fitQuality
FitQualityOnSurface fitQuality(const MultiComponentState &, const MeasurementBase &)
Method for determining the chi2 of the multi-component state and the number of degrees of freedom.
Definition: GsfMeasurementUpdator.cxx:845
Rec::TrackParticle::m_abc
AthenaBarCodeImpl m_abc
Definition: Reconstruction/Particle/Particle/TrackParticle.h:171
P4PxPyPzE
Definition: P4PxPyPzE.h:29
Trk::TrackParticleBase::m_trackParameters
std::vector< const TrackParameters * > m_trackParameters
DataVector of TrackParameters stored inside this TrackParticle.
Definition: TrackParticleBase.h:173
AthenaBarCodeImpl::hasSameAthenaBarCode
bool hasSameAthenaBarCode(const IAthenaBarCode &obj) const
Definition: AthenaBarCodeImpl.cxx:110
Trk::TrackParticleBase::m_trackSummary
const TrackSummary * m_trackSummary
the summary of this TrackParticle.
Definition: TrackParticleBase.h:176
Trk::VxCandidate
Definition: VxCandidate.h:27
INavigable4Momentum
Definition: INavigable4Momentum.h:21
Rec::TrackParticle::set4Mom
void set4Mom(const I4Momentum *const theI4Mom)
set 4Momentum (will throw exception if cannot be implemented)
Definition: TrackParticle.cxx:183
Rec::TrackParticle::removeSummary
void removeSummary()
Slimming methods used to reduce the TrackParticle content and size that may be called by users when m...
Definition: TrackParticle.cxx:137
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
AthenaBarCodeVersion_t
AthenaBarCode_t AthenaBarCodeVersion_t
Definition: AthenaKernel/AthenaKernel/IAthenaBarCode.h:46
Trk::ParametersT::clone
virtual ParametersT< DIM, T, S > * clone() const override final
Virtual clone.
Rec::TrackParticle::newVersion
void newVersion()
Definition: TrackParticle.cxx:238
AthenaBarCodeImpl::setVersion
void setVersion(AthenaBarCodeVersion_t newversion)
Definition: AthenaBarCodeImpl.cxx:157
AthenaBarCodeImpl::getVersion
AthenaBarCodeVersion_t getVersion() const
Definition: AthenaBarCodeImpl.cxx:131