Belle II Software light-2406-ragdoll
Track Class Reference

Class that bundles various TrackFitResults. More...

#include <Track.h>

Inheritance diagram for Track:
Collaboration diagram for Track:

Public Types

enum  StatusBit { c_isFlippedAndRefitted = 1 << 0 }
 status enumerator More...
 
typedef std::pair< Const::ChargedStable, TrackFitResult * > ChargedStableTrackFitResultPair
 Pair to hold the particle hypothesis used for the fit as first entry and the result of the track fit as second.
 

Public Member Functions

 Track (float qualityIndicator=0.)
 Constructor of Track without any attached TrackFitResults.
 
const TrackFitResultgetTrackFitResultByName (const Const::ChargedStable &chargedStable, const std::string trackFitResultsName) const
 Access to TrackFitResults with a specified Name.
 
const TrackFitResultgetTrackFitResult (const Const::ChargedStable &chargedStable) const
 Default Access to TrackFitResults.
 
const TrackFitResultgetTrackFitResultWithClosestMassByName (const Const::ChargedStable &requestedType, const std::string trackFitResultsName) const
 Return the track fit (from TrackFitResult with specified name) for a fit hypothesis with the closest mass.
 
const TrackFitResultgetTrackFitResultWithClosestMass (const Const::ChargedStable &requestedType) const
 Return the track fit for a fit hypothesis with the closest mass.
 
std::vector< ChargedStableTrackFitResultPairgetTrackFitResultsByName (const std::string trackFitResultsName) const
 Access to all track fit results at the same time (from TrackFitResult with specified name)
 
std::vector< ChargedStableTrackFitResultPairgetTrackFitResults () const
 Deafult Access to all track fit results at the same time.
 
void addStatusBits (unsigned short int bitmask)
 Add Track Refining Status Bit.
 
void setFlippedAndRefitted ()
 Set the Track status bit when the track has been flipped and refitted in the refining step.
 
bool getStatusBit (unsigned short int bitmask) const
 Get Track Status after Refining.
 
bool isFlippedAndRefitted () const
 Check the Track status after the Refining step.
 
bool wasRefined ()
 Check whether Track was modified in the Refining step.
 
void setTrackFitResultIndex (const Const::ChargedStable &chargedStable, short index)
 Set an index (for positive values) or unavailability-code (index = -1) for a specific mass hypothesis.
 
unsigned int getNumberOfFittedHypotheses () const
 Returns the number of fitted hypothesis which are stored in this track.
 
float getQualityIndicator () const
 Getter for quality indicator for classification of fake vs.
 
void setTrackTime (float track_time)
 Set track time computed as the difference between the outgoing/ingoing arm time (computed with SVD hits) and the SVD EventT0.
 
float getTrackTime () const
 Returns track time computed as the difference between the average of SVD clusters time and the SVD EventT0.
 
virtual std::string getInfoHTML () const override
 Return a short summary of this object's contents in HTML format.
 
void addRelationTo (const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
 Add a relation from this object to another object (with caching).
 
void addRelationTo (const TObject *object, float weight=1.0, const std::string &namedRelation="") const
 Add a relation from this object to another object (no caching, can be quite slow).
 
void copyRelations (const RelationsInterface< BASE > *sourceObj)
 Copies all relations of sourceObj (pointing from or to sourceObj) to this object (including weights).
 
template<class TO >
RelationVector< TO > getRelationsTo (const std::string &name="", const std::string &namedRelation="") const
 Get the relations that point from this object to another store array.
 
template<class FROM >
RelationVector< FROM > getRelationsFrom (const std::string &name="", const std::string &namedRelation="") const
 Get the relations that point from another store array to this object.
 
template<class T >
RelationVector< T > getRelationsWith (const std::string &name="", const std::string &namedRelation="") const
 Get the relations between this object and another store array.
 
template<class TO >
TO * getRelatedTo (const std::string &name="", const std::string &namedRelation="") const
 Get the object to which this object has a relation.
 
template<class FROM >
FROM * getRelatedFrom (const std::string &name="", const std::string &namedRelation="") const
 Get the object from which this object has a relation.
 
template<class T >
T * getRelated (const std::string &name="", const std::string &namedRelation="") const
 Get the object to or from which this object has a relation.
 
template<class TO >
std::pair< TO *, float > getRelatedToWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing to an array.
 
template<class FROM >
std::pair< FROM *, float > getRelatedFromWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing from an array.
 
template<class T >
std::pair< T *, float > getRelatedWithWeight (const std::string &name="", const std::string &namedRelation="") const
 Get first related object & weight of relation pointing from/to an array.
 
virtual std::string getName () const
 Return a short name that describes this object, e.g.
 
std::string getInfo () const
 Return a short summary of this object's contents in raw text format.
 
std::string getArrayName () const
 Get name of array this object is stored in, or "" if not found.
 
int getArrayIndex () const
 Returns this object's array index (in StoreArray), or -1 if not found.
 

Protected Member Functions

TClonesArray * getArrayPointer () const
 Returns the pointer to the raw DataStore array holding this object (protected since these arrays are easy to misuse).
 

Private Member Functions

std::vector< short int > getValidIndices () const
 Returns a vector of all fit hypothesis indices in m_trackFitIndices which have been set (meaning are not -1)
 
 ClassDefOverride (Track, 6)
 Class that bundles various TrackFitResults.
 
 ClassDef (RelationsInterface, 0)
 defines interface for accessing relations of objects in StoreArray.
 

Private Attributes

unsigned short int m_statusBitmap = 0
 Bitmap of the track status, contains informations on the refining stage.
 
short int m_trackFitIndices [Const::ChargedStable::c_SetSize]
 Index list of the TrackFitResults associated with this Track.
 
float const m_qualityIndicator
 Quality indicator for classification of fake vs.
 
float m_trackTime = std::numeric_limits<float>::quiet_NaN()
 Track time, computed as the difference between outgoing/ingoing arm time and the SVDEvent T0.
 
DataStore::StoreEntrym_cacheDataStoreEntry
 Cache of the data store entry to which this object belongs.
 
int m_cacheArrayIndex
 Cache of the index in the TClonesArray to which this object belongs.
 

Friends

class FixMergedObjectsModule
 
class PostMergeUpdaterModule
 

Detailed Description

Class that bundles various TrackFitResults.

As the RecoTrack has a lot of information that is only necessary during the fit, this is a much stripped down version containing only indices of TrackFitResults (which is what remains of the various TrackReps, that Genfit might use during the fit).

Definition at line 25 of file Track.h.

Member Typedef Documentation

◆ ChargedStableTrackFitResultPair

Pair to hold the particle hypothesis used for the fit as first entry and the result of the track fit as second.

Definition at line 39 of file Track.h.

Member Enumeration Documentation

◆ StatusBit

enum StatusBit

status enumerator

Definition at line 29 of file Track.h.

29 {
30
31 c_isFlippedAndRefitted = 1 << 0
32
33 };

Constructor & Destructor Documentation

◆ Track()

Track ( float  qualityIndicator = 0.)
inlineexplicit

Constructor of Track without any attached TrackFitResults.

Corresponding TrackFitResults should be added using the corresponding setter function. The array with the indices for the TrackFitResults is initialized with -1, which is an invalid index.

Parameters
qualityIndicatorInitialises m_qualityIndicator with 0, a value associated typically with fake tracks.

Definition at line 48 of file Track.h.

48 : m_qualityIndicator(qualityIndicator)
49 {
51 }
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:618
short int m_trackFitIndices[Const::ChargedStable::c_SetSize]
Index list of the TrackFitResults associated with this Track.
Definition: Track.h:230
float const m_qualityIndicator
Quality indicator for classification of fake vs.
Definition: Track.h:243

Member Function Documentation

◆ addRelationTo() [1/2]

void addRelationTo ( const RelationsInterface< BASE > *  object,
float  weight = 1.0,
const std::string &  namedRelation = "" 
) const
inlineinherited

Add a relation from this object to another object (with caching).

Parameters
objectThe object to which the relation should point.
weightThe weight of the relation.
namedRelationAdditional name for the relation, or "" for the default naming

Definition at line 142 of file RelationsObject.h.

143 {
144 if (object)
146 object, object->m_cacheDataStoreEntry, object->m_cacheArrayIndex, weight, namedRelation);
147 }
void addRelation(const TObject *fromObject, StoreEntry *&fromEntry, int &fromIndex, const TObject *toObject, StoreEntry *&toEntry, int &toIndex, float weight, const std::string &namedRelation)
Add a relation from an object in a store array to another object in a store array.
Definition: DataStore.cc:492
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
DataStore::StoreEntry * m_cacheDataStoreEntry
Cache of the data store entry to which this object belongs.
int m_cacheArrayIndex
Cache of the index in the TClonesArray to which this object belongs.

◆ addRelationTo() [2/2]

void addRelationTo ( const TObject *  object,
float  weight = 1.0,
const std::string &  namedRelation = "" 
) const
inlineinherited

Add a relation from this object to another object (no caching, can be quite slow).

Parameters
objectThe object to which the relation should point.
weightThe weight of the relation.
namedRelationAdditional name for the relation, or "" for the default naming

Definition at line 155 of file RelationsObject.h.

156 {
157 StoreEntry* toEntry = nullptr;
158 int toIndex = -1;
159 DataStore::Instance().addRelation(this, m_cacheDataStoreEntry, m_cacheArrayIndex, object, toEntry, toIndex, weight, namedRelation);
160 }

◆ addStatusBits()

void addStatusBits ( unsigned short int  bitmask)
inline

Add Track Refining Status Bit.

Parameters
bitmaskto be added to the m_statusBitmap

Definition at line 144 of file Track.h.

144{ m_statusBitmap |= bitmask; }
unsigned short int m_statusBitmap
Bitmap of the track status, contains informations on the refining stage.
Definition: Track.h:227

◆ copyRelations()

void copyRelations ( const RelationsInterface< BASE > *  sourceObj)
inlineinherited

Copies all relations of sourceObj (pointing from or to sourceObj) to this object (including weights).

Useful if you want to make a complete copy of a StoreArray object to make modifications to it, but retain all information on linked objects.

Note: this only works if sourceObj inherits from the same base (e.g. RelationsObject), and only for related objects that also inherit from the same base.

Definition at line 170 of file RelationsObject.h.

171 {
172 if (!sourceObj)
173 return;
174 auto fromRels = sourceObj->getRelationsFrom<RelationsInterface<BASE>>("ALL");
175 for (unsigned int iRel = 0; iRel < fromRels.size(); iRel++) {
176 fromRels.object(iRel)->addRelationTo(this, fromRels.weight(iRel));
177 }
178
179 auto toRels = sourceObj->getRelationsTo<RelationsInterface<BASE>>("ALL");
180 for (unsigned int iRel = 0; iRel < toRels.size(); iRel++) {
181 this->addRelationTo(toRels.object(iRel), toRels.weight(iRel));
182 }
183 }
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).

◆ getArrayIndex()

int getArrayIndex ( ) const
inlineinherited

Returns this object's array index (in StoreArray), or -1 if not found.

Definition at line 385 of file RelationsObject.h.

386 {
388 return m_cacheArrayIndex;
389 }
bool findStoreEntry(const TObject *object, StoreEntry *&entry, int &index)
Find an object in an array in the data store.
Definition: DataStore.cc:398

◆ getArrayName()

std::string getArrayName ( ) const
inlineinherited

Get name of array this object is stored in, or "" if not found.

Definition at line 377 of file RelationsObject.h.

◆ getArrayPointer()

TClonesArray * getArrayPointer ( ) const
inlineprotectedinherited

Returns the pointer to the raw DataStore array holding this object (protected since these arrays are easy to misuse).

Definition at line 418 of file RelationsObject.h.

419 {
422 return nullptr;
424 }
TClonesArray * getPtrAsArray() const
Return ptr cast to TClonesArray.
Definition: StoreEntry.cc:83

◆ getInfo()

std::string getInfo ( ) const
inlineinherited

Return a short summary of this object's contents in raw text format.

Returns the contents of getInfoHTML() while translating line-breaks etc.

Note
: You don't need to implement this function (it's not virtual), getInfoHTML() is enough.

Definition at line 370 of file RelationsObject.h.

371 {
373 }
virtual std::string getInfoHTML() const
Return a short summary of this object's contents in HTML format.
std::string htmlToPlainText(const std::string &html)
See RelationsObject::getInfo()

◆ getInfoHTML()

std::string getInfoHTML ( ) const
overridevirtual

Return a short summary of this object's contents in HTML format.

Reimplemented from RelationsInterface< BASE >.

Definition at line 109 of file Track.cc.

110{
111 std::stringstream out;
112 out << "<b>Number of Fitted Hypothesis</b>: " << getNumberOfFittedHypotheses() << "<br>";
113
114 // just output all the TrackFitResult infos.
115 size_t count = 1;
116 for (auto fitResults : getTrackFitResults()) {
117 out << "<p>";
118 out << "<br><b>-- Hypothesis " << count << " --</b><br>";
119 out << fitResults.second->getInfoHTML();
120 out << "</p>";
121 count++;
122 }
123 return out.str();
124}
std::vector< ChargedStableTrackFitResultPair > getTrackFitResults() const
Deafult Access to all track fit results at the same time.
Definition: Track.cc:60
unsigned int getNumberOfFittedHypotheses() const
Returns the number of fitted hypothesis which are stored in this track.
Definition: Track.cc:36

◆ getName()

virtual std::string getName ( ) const
inlinevirtualinherited

Return a short name that describes this object, e.g.

pi+ for an MCParticle.

Reimplemented in Particle, and MCParticle.

Definition at line 344 of file RelationsObject.h.

344{ return ""; }

◆ getNumberOfFittedHypotheses()

unsigned int getNumberOfFittedHypotheses ( ) const

Returns the number of fitted hypothesis which are stored in this track.

Definition at line 36 of file Track.cc.

37{
38 return getValidIndices().size();
39}
std::vector< short int > getValidIndices() const
Returns a vector of all fit hypothesis indices in m_trackFitIndices which have been set (meaning are ...
Definition: Track.cc:65

◆ getQualityIndicator()

float getQualityIndicator ( ) const
inline

Getter for quality indicator for classification of fake vs.

MC-matched Tracks.

During reconstruction, the probability (given a certain sample composition) of a track to originate from a charged particle rather than e.g. a random combination of hits from different charged particles and background contributions is estimated. This estimate includes information, that isn't used for the calculation of the p-value of the fit, e.g. energy-deposition, timing, and cluster-shape information. We consider it unlikely, that we will make such an estimate for each hypothesis. Therfore, the Track rather than the TrackFitResult is the place to store this information. We don't want to provide a default cut, because charged-particle-vetos and recombination of different kind of resonances potentially can profit from different working points on the efficiency-purity curve, and we expect some MC-data discrepancy due to imperfect calibration of the local reconstruction inputs. The meaning of the value may strongly depend on the presence of VXD or CDC measurements, but this information is available at mdst level as well.

Definition at line 198 of file Track.h.

199 {
200 return m_qualityIndicator;
201 }

◆ getRelated()

T * getRelated ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object to or from which this object has a relation.

Template Parameters
TThe class of objects to or from which the relation points.
Parameters
nameThe name of the store array to or from which the relation points. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 278 of file RelationsObject.h.

279 {
281 T::Class(), name, namedRelation).object);
282 }
@ c_BothSides
Combination of c_FromSide and c_ToSide.
Definition: DataStore.h:79
Belle2::RelationEntry getRelationWith(ESearchSide searchSide, const TObject *object, StoreEntry *&entry, int &index, const TClass *withClass, const std::string &withName, const std::string &namedRelation)
Get the first relation between an object and another object in a store array.
Definition: DataStore.cc:597
TObject * object
Pointer to the object.
Definition: RelationEntry.h:32

◆ getRelatedFrom()

FROM * getRelatedFrom ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object from which this object has a relation.

Template Parameters
FROMThe class of objects from which the relation points.
Parameters
nameThe name of the store array from which the relation points. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 263 of file RelationsObject.h.

264 {
266 m_cacheArrayIndex, FROM::Class(), name, namedRelation).object);
267 }
@ c_FromSide
Return relations/objects pointed from (to a given object).
Definition: DataStore.h:77

◆ getRelatedFromWithWeight()

std::pair< FROM *, float > getRelatedFromWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing from an array.

Template Parameters
FROMThe class of objects from which the relation points.
Parameters
nameThe name of the store array from which the relation points. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 314 of file RelationsObject.h.

316 {
318 FROM::Class(), name, namedRelation);
319 return std::make_pair(static_cast<FROM*>(entry.object), entry.weight);
320 }

◆ getRelatedTo()

TO * getRelatedTo ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the object to which this object has a relation.

Template Parameters
TOThe class of objects to which the relation points.
Parameters
nameThe name of the store array to which the relation points. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
The first related object or a null pointer.

Definition at line 248 of file RelationsObject.h.

249 {
251 TO::Class(), name, namedRelation).object);
252 }
@ c_ToSide
Return relations/objects pointed to (from a given object).
Definition: DataStore.h:78

◆ getRelatedToWithWeight()

std::pair< TO *, float > getRelatedToWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing to an array.

Template Parameters
TOThe class of objects to which the relation points.
Parameters
nameThe name of the store array to which the relation points. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 297 of file RelationsObject.h.

299 {
301 TO::Class(), name, namedRelation);
302 return std::make_pair(static_cast<TO*>(entry.object), entry.weight);
303 }

◆ getRelatedWithWeight()

std::pair< T *, float > getRelatedWithWeight ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get first related object & weight of relation pointing from/to an array.

Template Parameters
TThe class of objects to or from which the relation points.
Parameters
nameThe name of the store array to or from which the relation points. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
Pair of first related object and the relation weight, or (NULL, 1.0) if none found.

Definition at line 331 of file RelationsObject.h.

333 {
335 T::Class(), name, namedRelation);
336 return std::make_pair(static_cast<T*>(entry.object), entry.weight);
337 }

◆ getRelationsFrom()

RelationVector< FROM > getRelationsFrom ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations that point from another store array to this object.

Template Parameters
FROMThe class of objects from which the relations point.
Parameters
nameThe name of the store array from which the relations point. If empty the default store array name for class FROM will be used. If the special name "ALL" is given all store arrays containing objects of type FROM are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 212 of file RelationsObject.h.

214 {
216 m_cacheArrayIndex, FROM::Class(), name, namedRelation));
217 }
RelationVector< T > getRelationsWith(const std::string &name="", const std::string &namedRelation="") const
Get the relations between this object and another store array.

◆ getRelationsTo()

RelationVector< TO > getRelationsTo ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations that point from this object to another store array.

Template Parameters
TOThe class of objects to which the relations point.
Parameters
nameThe name of the store array to which the relations point. If empty the default store array name for class TO will be used. If the special name "ALL" is given all store arrays containing objects of type TO are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 197 of file RelationsObject.h.

198 {
200 m_cacheArrayIndex, TO::Class(), name, namedRelation));
201 }

◆ getRelationsWith()

RelationVector< T > getRelationsWith ( const std::string &  name = "",
const std::string &  namedRelation = "" 
) const
inlineinherited

Get the relations between this object and another store array.

Relations in both directions are returned.

Template Parameters
TThe class of objects to or from which the relations point.
Parameters
nameThe name of the store array to or from which the relations point. If empty the default store array name for class T will be used. If the special name "ALL" is given all store arrays containing objects of type T are considered.
namedRelationAdditional name for the relation, or "" for the default naming
Returns
A vector of relations.

Definition at line 230 of file RelationsObject.h.

231 {
233 m_cacheArrayIndex, T::Class(), name, namedRelation));
234 }

◆ getStatusBit()

bool getStatusBit ( unsigned short int  bitmask) const
inline

Get Track Status after Refining.

Parameters
bitmask
Returns
status (1 or 0) corresponding to the bitmask

Definition at line 155 of file Track.h.

155{ return (m_statusBitmap & bitmask) == bitmask; }

◆ getTrackFitResult()

const TrackFitResult * getTrackFitResult ( const Const::ChargedStable chargedStable) const

Default Access to TrackFitResults.

This tries to return the TrackFitResult for the requested track hypothesis. If the requested track hypothesis is not available, we return a nullptr.

TODO: Do something special if we did not even try to fit!

Parameters
chargedStableDetermines the particle for which you want to get the best available fit hypothesis.
Returns
TrackFitResult for fit with particle hypothesis given by ParticleCode or a nullptr, if no result is available.
See also
TrackFitResult

Definition at line 30 of file Track.cc.

31{
32 return getTrackFitResultByName(chargedStable, "");
33}
const TrackFitResult * getTrackFitResultByName(const Const::ChargedStable &chargedStable, const std::string trackFitResultsName) const
Access to TrackFitResults with a specified Name.
Definition: Track.cc:17

◆ getTrackFitResultByName()

const TrackFitResult * getTrackFitResultByName ( const Const::ChargedStable chargedStable,
const std::string  trackFitResultsName 
) const

Access to TrackFitResults with a specified Name.

This tries to return the TrackFitResult for the requested track hypothesis. If the requested track hypothesis is not available, we return a nullptr.

TODO: Do something special if we did not even try to fit!

Parameters
chargedStableDetermines the particle for which you want to get the best available fit hypothesis.
trackFitResultsNameThe name of the storeArray to get the TrackFitResults from
Returns
TrackFitResult for fit with particle hypothesis given by ParticleCode or a nullptr, if no result is available.
See also
TrackFitResult

Definition at line 17 of file Track.cc.

19{
20 const auto trackFitResultArrayIndex = m_trackFitIndices[chargedStable.getIndex()];
21 if (trackFitResultArrayIndex < 0) {
22 B2DEBUG(20, "TrackFitResult for the requested hypothesis is not set. Returning a nullptr instead.");
23 return nullptr;
24 }
25
26 StoreArray<TrackFitResult> trackFitResults(trackFitResultsName);
27 return trackFitResults[trackFitResultArrayIndex];
28}
int getIndex() const
This particle's index in the associated set.
Definition: Const.h:461
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113

◆ getTrackFitResults()

std::vector< Track::ChargedStableTrackFitResultPair > getTrackFitResults ( ) const

Deafult Access to all track fit results at the same time.

Returns a vector of pair of all track fit results which have been set and the respective particle hypothesis they have been fitted with.

Definition at line 60 of file Track.cc.

61{
62 return getTrackFitResultsByName("");
63}
std::vector< ChargedStableTrackFitResultPair > getTrackFitResultsByName(const std::string trackFitResultsName) const
Access to all track fit results at the same time (from TrackFitResult with specified name)
Definition: Track.cc:42

◆ getTrackFitResultsByName()

std::vector< Track::ChargedStableTrackFitResultPair > getTrackFitResultsByName ( const std::string  trackFitResultsName) const

Access to all track fit results at the same time (from TrackFitResult with specified name)

Parameters
trackFitResultsNameThe name of the storeArray to get the TrackFitResults from Returns a vector of pair of all track fit results which have been set and the respective particle hypothesis they have been fitted with.

Definition at line 42 of file Track.cc.

43{
44 StoreArray<TrackFitResult> trackFitResults(trackFitResultsName);
45 std::vector<Track::ChargedStableTrackFitResultPair> result;
46
47 const auto validParticleIndices = getValidIndices();
48
49 // extract the particle class and trackfitresult pointer for each
50 // stored hypothesis
51 for (auto particleIndex : validParticleIndices) {
52 const auto indexInStoreArray = m_trackFitIndices[particleIndex];
53 result.emplace_back(std::make_pair(Const::ChargedStable(Const::chargedStableSet.at(particleIndex)),
54 trackFitResults[indexInStoreArray]));
55 }
56
57 return result;
58}
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:589

◆ getTrackFitResultWithClosestMass()

const TrackFitResult * getTrackFitResultWithClosestMass ( const Const::ChargedStable requestedType) const

Return the track fit for a fit hypothesis with the closest mass.

Multiple particle hypothesis are used for fitting during the reconstruction and stored with this Track class. Not all hypothesis are available for all tracks because either a specific hypothesis was not fitted or because the fit failed. This method returns the track fit result of a successful fit with the hypothesis of a mass closest to the requested particle type. If the requested type's hypothesis is available it will be returned otherwise the next closest hypothesis in terms of the absolute mass difference will be returned.

For example, if a pion is requested (mass 140 MeV) and only a muon fit (mass 106 MeV) and an electron fit (mass 511 kEV) is available, the muon fit result will be returned. So this method is guaranteed to always return a TrackFitResult (opposite to getTrackFitResult() which can return nullptr if the requested Particle type was not fitted).

Parameters
requestedTypeThe particle type for which the fit result should be returned.
Returns
a pointer to the TrackFitResult object. Use TrackFitResult::getParticleType() to check which fitting hypothesis was actually used for this result.

Definition at line 104 of file Track.cc.

105{
106 return getTrackFitResultWithClosestMassByName(requestedType, "");
107}
const TrackFitResult * getTrackFitResultWithClosestMassByName(const Const::ChargedStable &requestedType, const std::string trackFitResultsName) const
Return the track fit (from TrackFitResult with specified name) for a fit hypothesis with the closest ...
Definition: Track.cc:80

◆ getTrackFitResultWithClosestMassByName()

const TrackFitResult * getTrackFitResultWithClosestMassByName ( const Const::ChargedStable requestedType,
const std::string  trackFitResultsName 
) const

Return the track fit (from TrackFitResult with specified name) for a fit hypothesis with the closest mass.

Multiple particle hypothesis are used for fitting during the reconstruction and stored with this Track class. Not all hypothesis are available for all tracks because either a specific hypothesis was not fitted or because the fit failed. This method returns the track fit result of a successful fit with the hypothesis of a mass closest to the requested particle type. If the requested type's hypothesis is available it will be returned otherwise the next closest hypothesis in terms of the absolute mass difference will be returned.

For example, if a pion is requested (mass 140 MeV) and only a muon fit (mass 106 MeV) and an electron fit (mass 511 kEV) is available, the muon fit result will be returned. So this method is guaranteed to always return a TrackFitResult (opposite to getTrackFitResult() which can return nullptr if the requested Particle type was not fitted).

Parameters
requestedTypeThe particle type for which the fit result should be returned.
trackFitResultsNameThe name of the storeArray to get the TrackFitResults from
Returns
a pointer to the TrackFitResult object. Use TrackFitResult::getParticleType() to check which fitting hypothesis was actually used for this result.

Definition at line 80 of file Track.cc.

82{
83 // make sure at least one hypothesis exist. No B2 Track should exist which does not have at least
84 // one hypothesis
85 B2ASSERT("Belle2::Track must always have at least one successfully fitted hypothesis.", getNumberOfFittedHypotheses() > 0);
86
87 // find fitted hypothesis which is closest to the mass of our requested particle type
88 auto allFitRes = getTrackFitResultsByName(trackFitResultsName);
89
90 // sort so the closest mass hypothesis fit in the first entry of the vector
91 auto bestMassFit = std::min_element(allFitRes.begin(), allFitRes.end(), [requestedType](auto & a, auto & b) {
92 const auto massDiffA = std::abs(a.first.getMass() - requestedType.getMass());
93 const auto massDiffB = std::abs(b.first.getMass() - requestedType.getMass());
94
95 return massDiffA < massDiffB;
96 });
97
98 if (std::isnan(bestMassFit->second->getPValue())) {
99 return nullptr;
100 }
101 return bestMassFit->second;
102}

◆ getTrackTime()

float getTrackTime ( ) const
inline

Returns track time computed as the difference between the average of SVD clusters time and the SVD EventT0.

Definition at line 215 of file Track.h.

216 {
217 return m_trackTime;
218 }
float m_trackTime
Track time, computed as the difference between outgoing/ingoing arm time and the SVDEvent T0.
Definition: Track.h:246

◆ getValidIndices()

std::vector< short int > getValidIndices ( ) const
private

Returns a vector of all fit hypothesis indices in m_trackFitIndices which have been set (meaning are not -1)

Definition at line 65 of file Track.cc.

66{
67 std::vector <short int> resultParticleIndex;
68
69 short int i = 0;
70 for (const auto& hyp : m_trackFitIndices) {
71 if (hyp != -1) {
72 resultParticleIndex.push_back(i);
73 }
74 i++;
75 }
76
77 return resultParticleIndex;
78}

◆ isFlippedAndRefitted()

bool isFlippedAndRefitted ( ) const
inline

Check the Track status after the Refining step.

Returns
true if the track was flipped and refitted in the refining step

Definition at line 160 of file Track.h.

160{ return getStatusBit(c_isFlippedAndRefitted); }
bool getStatusBit(unsigned short int bitmask) const
Get Track Status after Refining.
Definition: Track.h:155

◆ setFlippedAndRefitted()

void setFlippedAndRefitted ( )
inline

Set the Track status bit when the track has been flipped and refitted in the refining step.

Definition at line 149 of file Track.h.

149{ addStatusBits(c_isFlippedAndRefitted); }
void addStatusBits(unsigned short int bitmask)
Add Track Refining Status Bit.
Definition: Track.h:144

◆ setTrackFitResultIndex()

void setTrackFitResultIndex ( const Const::ChargedStable chargedStable,
short  index 
)
inline

Set an index (for positive values) or unavailability-code (index = -1) for a specific mass hypothesis.

The TrackFitResult itself should be saved separately in the DataStore.

Parameters
chargedStableDetermines the hypothesis for which you want to store the index or unavailability-code.
indexindex of track fit result (for positive values) or unavailability-code (index = -1)

Definition at line 174 of file Track.h.

175 {
176 m_trackFitIndices[chargedStable.getIndex()] = index;
177 }

◆ setTrackTime()

void setTrackTime ( float  track_time)
inline

Set track time computed as the difference between the outgoing/ingoing arm time (computed with SVD hits) and the SVD EventT0.

If both outgoing and ingoing arms exist: 1) if the outgoing arm time is smaller than the ingoing arm time, the track time is computed as the difference of the outgoing arm time and the SVD EventT0; 2) otherwise the track time is computed as the difference of the ingoing arm time and the SVD EventT0. If only the outgoing arm exists, the track time is computed as the difference of the outgoing arm time and the SVD EventT0. If only the ingoing arm exists, the track time is computed as the difference of the ingoing arm time and the SVD EventT0.

Definition at line 209 of file Track.h.

210 {
211 m_trackTime = track_time;
212 }

◆ wasRefined()

bool wasRefined ( )
inline

Check whether Track was modified in the Refining step.

Returns
true if the track was modified in the refining step

Definition at line 165 of file Track.h.

165{ return m_statusBitmap > 0; }

Friends And Related Function Documentation

◆ FixMergedObjectsModule

friend class FixMergedObjectsModule
friend

Definition at line 250 of file Track.h.

◆ PostMergeUpdaterModule

friend class PostMergeUpdaterModule
friend

Definition at line 251 of file Track.h.

Member Data Documentation

◆ m_cacheArrayIndex

int m_cacheArrayIndex
mutableprivateinherited

Cache of the index in the TClonesArray to which this object belongs.

Definition at line 432 of file RelationsObject.h.

◆ m_cacheDataStoreEntry

DataStore::StoreEntry* m_cacheDataStoreEntry
mutableprivateinherited

Cache of the data store entry to which this object belongs.

Definition at line 429 of file RelationsObject.h.

◆ m_qualityIndicator

float const m_qualityIndicator
private

Quality indicator for classification of fake vs.

MC-matched Tracks.

Given likely data-MC discrepancies etc orders of magnitude larger than float precision, single precision is enough.

Definition at line 243 of file Track.h.

◆ m_statusBitmap

unsigned short int m_statusBitmap = 0
private

Bitmap of the track status, contains informations on the refining stage.

Definition at line 227 of file Track.h.

◆ m_trackFitIndices

short int m_trackFitIndices[Const::ChargedStable::c_SetSize]
private

Index list of the TrackFitResults associated with this Track.

Definition at line 230 of file Track.h.

◆ m_trackTime

float m_trackTime = std::numeric_limits<float>::quiet_NaN()
private

Track time, computed as the difference between outgoing/ingoing arm time and the SVDEvent T0.

Definition at line 246 of file Track.h.


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