ATLAS Offline Software
Loading...
Searching...
No Matches
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/***************************************************************************
6TrackParticle.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
18#include "GaudiKernel/MsgStream.h"
19
20#include <sstream>
21
22
23namespace Rec
24{
25
26 // Constructor 0
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,
42 trkPrtOrigin,
43 vxCandidate,
44 trkSummary,
45 parameters,
46 definingParameter,
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,
66 const Trk::TrackInfo& info,
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)
87 , P4PxPyPzEBase(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
125
130 {
131 delete m_trackSummary;
133 }
134
136 {
137 delete m_fitQuality;
138 m_fitQuality=0;
139 }
140
142 {
143 for (std::vector<const Trk::TrackParameters*>::iterator iter =
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
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
214 m_abc.setAthenaBarCode(id);
215 }
216
217 //Comparing & Versioning Control
219 return m_abc.hasSameAthenaBarCode(bc);
220 }
221
223 return m_abc.hasSameAthenaBarCodeExceptVersion(bc);
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
uint64_t AthenaBarCode_t
barcode for all INav4Mom classes
AthenaBarCode_t AthenaBarCodeVersion_t
MsgStream & operator<<(MsgStream &sl, const Rec::TrackParticle &trackParticle)
Overload of << operator for MsgStream for debug output.
constexpr int pow(int base, int exp) noexcept
I4Momentum is an abstract base class providing 4-momentum behavior.
Definition I4Momentum.h:31
P4PxPyPzEBase is a base class for classes with 4-momentum behavior, for which Px, Py,...
virtual double px() const
get px data member
Definition P4PxPyPzE.h:122
P4PxPyPzE(const double px, const double py, const double pz, const double e)
constructor with all data members
Definition P4PxPyPzE.h:104
virtual double py() const
get py data member
Definition P4PxPyPzE.h:126
virtual double pz() const
get pz data member
Definition P4PxPyPzE.h:129
void setVersion(AthenaBarCodeVersion_t newversion)
AthenaBarCode_t getAthenaBarCode() const
void set4Mom(const I4Momentum *const theI4Mom)
set 4Momentum (will throw exception if cannot be implemented)
virtual ~TrackParticle()
Destructor.
bool hasSameAthenaBarCode(const IAthenaBarCode &) const
virtual MsgStream & dump(MsgStream &out) const
Dump methods to be used by the overloaded stream operator (inheritance!)
void removeFitQuality()
removeFitQuality to delete the fit quality object
void removeErrorMatrix()
removeErrorMatrix to delete the error matrix.
AthenaBarCodeVersion_t getVersion() const
bool hasSameAthenaBarCodeExceptVersion(const IAthenaBarCode &) const
void removeSummary()
Slimming methods used to reduce the TrackParticle content and size that may be called by users when m...
TrackParticle & operator=(const TrackParticle &)
Assignment operator.
void setAthenaBarCode(AthenaBarCode_t)
TrackParticle()
Constructor 0 standard constructor which sets everything to 0, needed for persistency.
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition FitQuality.h:97
virtual ParametersT< DIM, T, S > * clone() const override final
Virtual clone.
Contains information about the 'fitter' of this track.
TrackParticleBase & operator=(const TrackParticleBase &)
Assignement operator.
const TrackSummary * m_trackSummary
the summary of this TrackParticle.
const FitQuality * m_fitQuality
the fit quality of this TrackParticle.
const FitQuality * fitQuality() const
accessor function for FitQuality.
virtual MsgStream & dump(MsgStream &out) const
Dump methods to be used by the overloaded stream operator (inheritance!)
TrackParticleBase()
Constructor 0 standard constructor which sets everything to 0, needed for persistency.
std::vector< const TrackParameters * > m_trackParameters
DataVector of TrackParameters stored inside this TrackParticle.
const TrackInfo & info() const
returns the info of the track.
A summary of the information contained by a track.
Gaudi Tools.
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
VertexType TrackParticleOrigin
ParametersBase< TrackParametersDim, Charged > TrackParameters
STL namespace.
Mass declaration of particles covered in the ParticleHypothesis.