ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrackParticleBase Class Reference

#include <TrackParticleBase.h>

Inheritance diagram for Trk::TrackParticleBase:
Collaboration diagram for Trk::TrackParticleBase:

Public Member Functions

 TrackParticleBase ()
 Constructor 0 standard constructor which sets everything to 0, needed for persistency.
 TrackParticleBase (const Track *trk, const TrackParticleOrigin vertexType, const VxCandidate *vxCandidate, const TrackSummary *trkSummary, std::vector< const TrackParameters * > &parameters, const TrackParameters *definingParameter, const FitQuality *fitQuality)
 Main constructor.
 TrackParticleBase (const ElementLink< TrackCollection > &trackLink, const Trk::TrackParticleOrigin trkPrtOrigin, const ElementLink< VxContainer > &vxCandidate, std::unique_ptr< Trk::TrackSummary > trkSummary, std::vector< const Trk::TrackParameters * > &&parameters, std::unique_ptr< Trk::FitQuality > fitQuality, const TrackInfo &info)
 TrackParticleBase (const TrackParticleBase &)
 Copy constructor.
TrackParticleBaseoperator= (const TrackParticleBase &)
 Assignement operator.
TrackParticleBaseoperator= (TrackParticleBase &&) noexcept
virtual ~TrackParticleBase ()
 Destructor.
double charge () const
 Return charge of the particle.
const TrackoriginalTrack () const
 Return pointer to associated track.
const VxCandidatereconstructedVertex () const
 Get a pointer to the primary vertex.
const ElementLink< VxContainer > & reconstructedVertexLink () const
TrackParticleOrigin particleOriginType () const
 Get the particle origin type.
const TrackParametersdefiningParameters () const
 Returns the 'defining' parameter of this TrackParticle.
const std::vector< const TrackParameters * > & trackParameters () const
 Returns the track parameters.
const ElementLink< TrackCollection > * trackElementLink () const
 Return the ElementLink to the Track.
const TrackSummarytrackSummary () const
 accessor function for TrackSummary.
const FitQualityfitQuality () const
 accessor function for FitQuality.
const Perigeeperigee () const
 Attempts to cast the definingParameters() to Perigee.
void setStorableObject (const TrackCollection *trackColl)
void setStorableObject (const VxContainer *vxColl)
void setTrackLink (const TrackCollection *cont, const Track *track)
virtual MsgStream & dump (MsgStream &out) const
 Dump methods to be used by the overloaded stream operator (inheritance!)
virtual std::ostream & dump (std::ostream &out) const
const TrackInfoinfo () const
 returns the info of the track.

Protected Attributes

ElementLink< TrackCollectionm_originalTrack
 ElementLink to the Track used to create this TrackParticleBase object Before writing to disk, should be made valid using setStorableObject(const VxContainer* vxColl).
TrackParticleOrigin m_trackParticleOrigin
 specifies the origin type of the particle (prim.vertex, ...)
ElementLink< VxContainerm_elVxCandidate
 ElementLink to a VxCandidate.
std::vector< const TrackParameters * > m_trackParameters
 DataVector of TrackParameters stored inside this TrackParticle.
const TrackSummarym_trackSummary
 the summary of this TrackParticle.
const FitQualitym_fitQuality
 the fit quality of this TrackParticle.
TrackInfo m_trackInfo
 This is a class which stores the identity of where the track
was created, fitted, which properties the reconstruction had.

Friends

class ::TrackParticleBaseCnv_p1

Detailed Description

Definition at line 40 of file TrackParticleBase.h.

Constructor & Destructor Documentation

◆ TrackParticleBase() [1/4]

Trk::TrackParticleBase::TrackParticleBase ( )

Constructor 0 standard constructor which sets everything to 0, needed for persistency.

Definition at line 19 of file TrackParticleBase.cxx.

19 :
24 m_trackSummary(nullptr),
25 m_fitQuality(nullptr),
27 {
28 #ifdef DEBUG_CTOR_DTOR
29 std::cout<<"TrackParticleBase blank ctr :"<<this<<std::endl;
30 #endif
31 }
const TrackSummary * m_trackSummary
the summary of this TrackParticle.
const FitQuality * m_fitQuality
the fit quality of this TrackParticle.
ElementLink< TrackCollection > m_originalTrack
ElementLink to the Track used to create this TrackParticleBase object Before writing to disk,...
TrackInfo m_trackInfo
This is a class which stores the identity of where the track was created, fitted,...
TrackParticleOrigin m_trackParticleOrigin
specifies the origin type of the particle (prim.vertex, ...)
std::vector< const TrackParameters * > m_trackParameters
DataVector of TrackParameters stored inside this TrackParticle.
ElementLink< VxContainer > m_elVxCandidate
ElementLink to a VxCandidate.
@ NoVtx
Dummy vertex, TrackParticle was not used in vertex fit.
Definition VertexType.h:26

◆ TrackParticleBase() [2/4]

Trk::TrackParticleBase::TrackParticleBase ( const Track * trk,
const TrackParticleOrigin vertexType,
const VxCandidate * vxCandidate,
const TrackSummary * trkSummary,
std::vector< const TrackParameters * > & parameters,
const TrackParameters * definingParameter,
const FitQuality * fitQuality )

Main constructor.

Merged old Constructors 0.5a, 2a and 1a from old (pre 13) TrackParticle constructors & added new info.

I have tried to merge the various TrackParticle constructors (though perhaps we should split this into one which takes RecVertex and one which takes VxCandidate, since they seem to be exclusive)

Parameters
trkTrack used to create this object. Since an ElementLink is used to store the object, setStorableObject(const TrackCollection* trackColl) must be called to set persistency.
vertexTypeSee TrackParticleOrigin for definitions, but should be set to NoVtx if no VxCandidate pointer is passed.
vxCandidatePointer to the VxCandidate used to create this TrackParticleBase.
trkSummarySummary object of this TrackParticleBase (should be created with TrackSummaryTool). Will be owned by this TrackParticleBase.
parametersstd::vector of TrackParameters which describe this TrackParticleBase. Ownership of these TrackParameters objects passes to TrackParticleBase (so if you copied them from a Track, make sure you didn't just copy the pointers but actually created new objects, for example, by using clone() )
definingParameterThe parameter which defines the charge of this TrackParticleBase and which in derived classes (such as Rec::TrackParticle), could be used to define e.g. the 4-momentum. This will be appended to the vector of parameters passed before, so please make sure that it is NOT already contained in that!
fitQualityFitQuality which describes this TrackParticleBase. Will be owned by this TrackParticleBase.
Warning
You MUST pass in a valid 'definingParameter' and this 'definingParameter' must NOT be part of the std::vector<const TrackParameters*> passed.

Definition at line 34 of file TrackParticleBase.cxx.

41 :
43 m_trackParticleOrigin( trkPrtOrigin ),
45 m_trackParameters( parameters ),
46 m_trackSummary( trkSummary ),
48 {
49 #ifdef DEBUG_CTOR_DTOR
50 std::cout<<"TrackParticleBase ctr :"<<this<<std::endl;
51 #endif
52
53 // if no vxCandidate set, then trkPrtOrigin should be NoVtx
54 assert ((vxCandidate!=nullptr)||(trkPrtOrigin==NoVtx));
55
56 // Defining parameter is always last.
57 m_trackParameters.push_back(definingParameter);
58
59 // establish element links
60 if (trk!=nullptr)
61 {
62 m_originalTrack.setElement(trk);
63 m_trackInfo = trk->info();
64 }
65 if (vxCandidate!=nullptr) { m_elVxCandidate.setElement(vxCandidate);
66}
67 }
const FitQuality * fitQuality() const
accessor function for FitQuality.

◆ TrackParticleBase() [3/4]

Trk::TrackParticleBase::TrackParticleBase ( const ElementLink< TrackCollection > & trackLink,
const Trk::TrackParticleOrigin trkPrtOrigin,
const ElementLink< VxContainer > & vxCandidate,
std::unique_ptr< Trk::TrackSummary > trkSummary,
std::vector< const Trk::TrackParameters * > && parameters,
std::unique_ptr< Trk::FitQuality > fitQuality,
const TrackInfo & info )

Definition at line 69 of file TrackParticleBase.cxx.

76 :
77 m_originalTrack(trackLink),
78 m_trackParticleOrigin( trkPrtOrigin ),
79 m_elVxCandidate(vxCandidate),
80 m_trackParameters( std::move(parameters) ),
81 m_trackSummary( trkSummary.release() ),
82 m_fitQuality(fitQuality.release()),
84 {
85 // if no vxCandidate set, then trkPrtOrigin should be NoVtx
86 assert (!vxCandidate.isDefault() || trkPrtOrigin==NoVtx);
87 }
const TrackInfo & info() const
returns the info of the track.

◆ TrackParticleBase() [4/4]

Trk::TrackParticleBase::TrackParticleBase ( const TrackParticleBase & rhs)

Copy constructor.

Copy Constructor.

Definition at line 92 of file TrackParticleBase.cxx.

93 :
94 m_originalTrack(rhs.m_originalTrack),
95 m_trackParticleOrigin(rhs.m_trackParticleOrigin),
96 m_elVxCandidate(rhs.m_elVxCandidate),
98 m_trackSummary( (rhs.m_trackSummary) ? new TrackSummary(*(rhs.m_trackSummary)) : nullptr ),
99 m_fitQuality( (rhs.m_fitQuality) ? new FitQuality(*(rhs.m_fitQuality)) : nullptr ),
100 m_trackInfo(rhs.m_trackInfo)
101 {
102
103 #ifdef DEBUG_CTOR_DTOR
104 std::cout<<"TrackParticleBase copy ctr :"<<this<<std::endl;
105 #endif
106
107 std::vector<const TrackParameters*>::const_iterator it = rhs.m_trackParameters.begin();
108 std::vector<const TrackParameters*>::const_iterator itEnd = rhs.m_trackParameters.end();
109 for (; it!=itEnd; ++it) { m_trackParameters.push_back( (*it)->clone() );
110}
111 }

◆ ~TrackParticleBase()

Trk::TrackParticleBase::~TrackParticleBase ( )
virtual

Destructor.

Definition at line 176 of file TrackParticleBase.cxx.

176 {
177 #ifdef DEBUG_CTOR_DTOR
178 std::cout<<"TrackParticleBase dtor :"<<this<<std::endl;
179 #endif
180 std::vector<const TrackParameters*>::const_iterator it = m_trackParameters.begin();
181 std::vector<const TrackParameters*>::const_iterator itEnd = m_trackParameters.end();
182 for (; it!=itEnd; ++it) { delete (*it);
183}
184 if (m_trackSummary!=nullptr) { delete m_trackSummary;
185}
186 if (m_fitQuality !=nullptr) { delete m_fitQuality;
187}
188 }

Member Function Documentation

◆ charge()

double Trk::TrackParticleBase::charge ( void ) const
inline

Return charge of the particle.

Returns
The charge of the particle is calculated via the TrackParameters::charge() method. It is calculated via the sign of the track parameters \( \frac{q_0}{p} \).

Definition at line 200 of file TrackParticleBase.h.

201 {
202 return definingParameters().charge();
203 }
double charge() const
Returns the charge.
const TrackParameters & definingParameters() const
Returns the 'defining' parameter of this TrackParticle.

◆ definingParameters()

const TrackParameters & Trk::TrackParticleBase::definingParameters ( ) const
inline

Returns the 'defining' parameter of this TrackParticle.

Returns
The parameters (from the vector returned by trackParameters() ) which define the charge(), and (in the inherited Rec::TrackParticle, the 4 momentum)

Definition at line 239 of file TrackParticleBase.h.

239 {
240 return *( m_trackParameters.back() );
241 }

◆ dump() [1/2]

MsgStream & Trk::TrackParticleBase::dump ( MsgStream & out) const
virtual

Dump methods to be used by the overloaded stream operator (inheritance!)

Reimplemented in Rec::TrackParticle.

Definition at line 190 of file TrackParticleBase.cxx.

191 {
192 // DO NOT specificy an output level like MSG::VERBOSE (should be done by the caller)
193 sl << "Printing TrackParticle. OriginType: " << this->particleOriginType() << endmsg;
194 if (this->trackElementLink()->isValid())
195 {
196 sl << "The ElementLink<TrackCollection> is valid." << endmsg;
197 } else
198 {
199 sl << "The ElementLink<TrackCollection> is NOT valid." << endmsg;
200 }
201 if ( this->fitQuality() !=nullptr ) { sl << * ( this->fitQuality() ) <<endmsg;
202}
203 if ( this->trackSummary() !=nullptr ) { sl << * ( this->trackSummary() ) <<endmsg;
204}
205 // vertex EL should alwasy be there as it is in ESD and AOD
206 if ( this->reconstructedVertex() !=nullptr ) { sl << ( this->reconstructedVertex()->recVertex() ) <<endmsg;
207}
208 const std::vector<const TrackParameters*> trackParameters = this->trackParameters();
209 sl << "TrackParticle has " << trackParameters.size() << " track parameters. Printing them:" << endmsg;
210 for (const auto *trackParameter : trackParameters)
211 {
212 sl << (*trackParameter) << endmsg;
213 }
214 sl<<"TrackInfo inherited from original Track comes below:"<<endmsg;
215 sl<<m_trackInfo.dumpInfo();
216 return sl;
217 }
#define endmsg
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
const ElementLink< TrackCollection > * trackElementLink() const
Return the ElementLink to the Track.
const TrackSummary * trackSummary() const
accessor function for TrackSummary.
const std::vector< const TrackParameters * > & trackParameters() const
Returns the track parameters.
const VxCandidate * reconstructedVertex() const
Get a pointer to the primary vertex.
TrackParticleOrigin particleOriginType() const
Get the particle origin type.
const Trk::RecVertex & recVertex(void) const
Returns a reference to reconstructed vertex.

◆ dump() [2/2]

std::ostream & Trk::TrackParticleBase::dump ( std::ostream & out) const
virtual

Reimplemented in Rec::TrackParticle.

Definition at line 219 of file TrackParticleBase.cxx.

220 {
221 sl << "Printing TrackParticle. OriginType: " << this->particleOriginType() << std::endl;
222 if (this->trackElementLink()->isValid())
223 {
224 sl << "The ElementLink<TrackCollection> is valid." << std::endl;
225 } else
226 {
227 sl << "The ElementLink<TrackCollection> is NOT valid." << std::endl;
228 }
229 if ( this->fitQuality() !=nullptr ) { sl << * ( this->fitQuality() ) <<std::endl;
230}
231 if ( this->trackSummary() !=nullptr ) { sl << * ( this->trackSummary() ) <<std::endl;
232}
233 // vertex EL should alwasy be there as it is in ESD and AOD
234 if ( this->reconstructedVertex() !=nullptr ) { sl << ( this->reconstructedVertex()->recVertex() ) <<std::endl;
235}
236 const std::vector<const TrackParameters*> trackParameters = this->trackParameters();
237 sl << "TrackParticle has " << trackParameters.size() << " track parameters. Printing them:" << std::endl;
238 for (const auto *trackParameter : trackParameters)
239 {
240 sl << (*trackParameter) << std::endl;
241 }
242 sl<<"TrackInfo inherited from original Track comes below:"<<std::endl;
243 sl<<m_trackInfo.dumpInfo();
244 return sl;
245 }

◆ fitQuality()

const FitQuality * Trk::TrackParticleBase::fitQuality ( ) const
inline

accessor function for FitQuality.

Returns
The pointer to the FitQuality for this class. Can be 0 if object was created with no FitQuality.
Todo
Is this correct? Is it valid to have a TPB with no FQ?

Definition at line 259 of file TrackParticleBase.h.

259 {
260 return m_fitQuality;
261 }

◆ info()

const TrackInfo & Trk::TrackParticleBase::info ( ) const
inline

returns the info of the track.

Definition at line 276 of file TrackParticleBase.h.

277 {
278 return m_trackInfo;
279 }

◆ operator=() [1/2]

TrackParticleBase & Trk::TrackParticleBase::operator= ( const TrackParticleBase & rhs)

Assignement operator.

Assignment operator.

Definition at line 116 of file TrackParticleBase.cxx.

117 {
118 if (this!=&rhs)
119 {
120 // only delete objects where these two pointers point to
121 // the other pointers point to objects in storegate
122 if (m_trackSummary!=nullptr) { delete m_trackSummary; m_trackSummary = nullptr; }
123 if (m_fitQuality !=nullptr) { delete m_fitQuality ; m_fitQuality = nullptr; }
124 std::vector<const TrackParameters*>::const_iterator it = m_trackParameters.begin();
125 std::vector<const TrackParameters*>::const_iterator itEnd = m_trackParameters.end();
126 for (; it!=itEnd; ++it) { delete (*it);
127 }
128
129 m_originalTrack = rhs.m_originalTrack;
130 m_trackParticleOrigin = rhs.m_trackParticleOrigin;
131 m_elVxCandidate = rhs.m_elVxCandidate;
132
133 //the following are owned, and so must be copied.
134 m_trackSummary = (rhs.m_trackSummary) ? new TrackSummary(*(rhs.m_trackSummary)) : nullptr;
135 m_fitQuality = (rhs.m_fitQuality) ? new FitQuality(*(rhs.m_fitQuality)) : nullptr;
136 m_trackInfo = rhs.m_trackInfo;
137
138 it = rhs.m_trackParameters.begin();
139 itEnd = rhs.m_trackParameters.end();
140 for (; it!=itEnd; ++it) { m_trackParameters.push_back( (*it)->clone() );
141 }
142 }
143 return *this;
144 }

◆ operator=() [2/2]

TrackParticleBase & Trk::TrackParticleBase::operator= ( TrackParticleBase && rhs)
noexcept

Definition at line 147 of file TrackParticleBase.cxx.

148 {
149 if (this != &rhs) {
150 delete m_trackSummary;
151 m_trackSummary = rhs.m_trackSummary;
152 rhs.m_trackSummary = nullptr;
153
154 delete m_fitQuality;
155 m_fitQuality = rhs.m_fitQuality;
156 rhs.m_fitQuality = nullptr;
157
158 for (const TrackParameters* p : m_trackParameters) {
159 delete p;
160 }
161
162 m_trackParameters = std::move(rhs.m_trackParameters);
163
164 m_originalTrack = rhs.m_originalTrack;
165 m_trackParticleOrigin = rhs.m_trackParticleOrigin;
166 m_elVxCandidate = rhs.m_elVxCandidate;
167
168 m_trackInfo = rhs.m_trackInfo;
169 }
170 return *this;
171 }
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ originalTrack()

const Track * Trk::TrackParticleBase::originalTrack ( ) const
inline

Return pointer to associated track.

Returns
a pointer to the Track with which the particle was created. Right now it is also possible to create a particle without a track (or possibly the Track is not accessible). In that case the method returns 0.

Definition at line 205 of file TrackParticleBase.h.

206 {
207 if (m_originalTrack.isValid()){
208 return *m_originalTrack;
209 }
210 return nullptr;
211
212 }

◆ particleOriginType()

TrackParticleOrigin Trk::TrackParticleBase::particleOriginType ( ) const
inline

Get the particle origin type.

Returns
A TrackParticleOrigin enum (see TrkEventPrimitives/VertexType.h for definitions)

Definition at line 235 of file TrackParticleBase.h.

235 {
237 }

◆ perigee()

const Perigee * Trk::TrackParticleBase::perigee ( ) const
inline

Attempts to cast the definingParameters() to Perigee.

The result is not cached, so there will be a (small) time penalty each time you call this.

Returns
Perigee* if the cast was successful, zero if not

Definition at line 263 of file TrackParticleBase.h.

264 {
265 return dynamic_cast<const Perigee*>( &(definingParameters()) );
266 }
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee

◆ reconstructedVertex()

const VxCandidate * Trk::TrackParticleBase::reconstructedVertex ( ) const
inline

Get a pointer to the primary vertex.

Returns
Returns a pointer to the primary vertex.

Definition at line 215 of file TrackParticleBase.h.

216 {
217 if (m_elVxCandidate.isValid()) {
218 return *m_elVxCandidate;
219 }
220
221 return nullptr;
222
223 }

◆ reconstructedVertexLink()

const ElementLink< VxContainer > & Trk::TrackParticleBase::reconstructedVertexLink ( ) const
inline

Definition at line 225 of file TrackParticleBase.h.

226 {
227 return m_elVxCandidate;
228 }

◆ setStorableObject() [1/2]

void Trk::TrackParticleBase::setStorableObject ( const TrackCollection * trackColl)
inline

Definition at line 251 of file TrackParticleBase.h.

251 {
252 m_originalTrack.setStorableObject(*trackColl);
253 }

◆ setStorableObject() [2/2]

void Trk::TrackParticleBase::setStorableObject ( const VxContainer * vxColl)
inline

Definition at line 255 of file TrackParticleBase.h.

255 {
256 m_elVxCandidate.setStorableObject(*vxColl);
257 }

◆ setTrackLink()

void Trk::TrackParticleBase::setTrackLink ( const TrackCollection * cont,
const Track * track )
inline

Definition at line 269 of file TrackParticleBase.h.

270 {
271 if ( m_originalTrack.isValid() ) { m_originalTrack.reset();
272}
273 m_originalTrack.toContainedElement( *cont, track);
274 }

◆ trackElementLink()

const ElementLink< TrackCollection > * Trk::TrackParticleBase::trackElementLink ( ) const
inline

Return the ElementLink to the Track.

Returns
ElementLink<TrackCollection>

This is necessary to force backnavigation from AOD to ESD

Definition at line 230 of file TrackParticleBase.h.

231 {
232 return &m_originalTrack;
233 }

◆ trackParameters()

const std::vector< const TrackParameters * > & Trk::TrackParticleBase::trackParameters ( ) const
inline

Returns the track parameters.

Returns
The TrackParameters of the TrackParticleBase, expressed at various points through out the detector.

"Various" may seem vague, but it is up to the clients of this class to decide what is needed (Perigee, MuonSpectrometer entrance etc). However, the size of this vector must be at least 1, since ALL TrackParticleBases are required to have ONE defining parameter

Definition at line 243 of file TrackParticleBase.h.

243 {
244 return m_trackParameters;
245 }

◆ trackSummary()

const TrackSummary * Trk::TrackParticleBase::trackSummary ( ) const
inline

accessor function for TrackSummary.

Returns
A pointer to the TrackSummary owned by this object (could be 0)

Definition at line 247 of file TrackParticleBase.h.

247 {
248 return m_trackSummary;
249 }

◆ ::TrackParticleBaseCnv_p1

friend class ::TrackParticleBaseCnv_p1
friend

Definition at line 160 of file TrackParticleBase.h.

Member Data Documentation

◆ m_elVxCandidate

ElementLink< VxContainer > Trk::TrackParticleBase::m_elVxCandidate
protected

ElementLink to a VxCandidate.

Before writing to disk, should be made valid using setStorableObject(const VxContainer* vxColl)

Definition at line 170 of file TrackParticleBase.h.

◆ m_fitQuality

const FitQuality* Trk::TrackParticleBase::m_fitQuality
protected

the fit quality of this TrackParticle.

Owned by this object.

Definition at line 179 of file TrackParticleBase.h.

◆ m_originalTrack

ElementLink< TrackCollection > Trk::TrackParticleBase::m_originalTrack
protected

ElementLink to the Track used to create this TrackParticleBase object Before writing to disk, should be made valid using setStorableObject(const VxContainer* vxColl).

Definition at line 164 of file TrackParticleBase.h.

◆ m_trackInfo

TrackInfo Trk::TrackParticleBase::m_trackInfo
protected

This is a class which stores the identity of where the track
was created, fitted, which properties the reconstruction had.

Definition at line 186 of file TrackParticleBase.h.

◆ m_trackParameters

std::vector<const TrackParameters*> Trk::TrackParticleBase::m_trackParameters
protected

DataVector of TrackParameters stored inside this TrackParticle.

(This TrackParticleBase owns all the TrackParameters, and will delete them in the destructor)

Definition at line 173 of file TrackParticleBase.h.

◆ m_trackParticleOrigin

TrackParticleOrigin Trk::TrackParticleBase::m_trackParticleOrigin
protected

specifies the origin type of the particle (prim.vertex, ...)

Definition at line 167 of file TrackParticleBase.h.

◆ m_trackSummary

const TrackSummary* Trk::TrackParticleBase::m_trackSummary
protected

the summary of this TrackParticle.

Owned by this object.

Definition at line 176 of file TrackParticleBase.h.


The documentation for this class was generated from the following files: