Belle II Software development
RecoTrack Class Reference

This is the Reconstruction Event-Data Model Track. More...

#include <RecoTrack.h>

Inheritance diagram for RecoTrack:
RelationsInterface< BASE >

Public Types

enum  MatchingStatus {
  c_undefined ,
  c_matched ,
  c_matchedWrongCharge ,
  c_clone ,
  c_cloneWrongCharge ,
  c_background ,
  c_ghost
}
 Enum for the matching status of this reco track (set by the matching modules in the tracking package). More...
 

Public Member Functions

 RecoTrack ()
 Empty constructor for ROOT. Do not use!
 
 RecoTrack (const ROOT::Math::XYZVector &seedPosition, const ROOT::Math::XYZVector &seedMomentum, const short int seedCharge, const std::string &storeArrayNameOfPXDHits="", const std::string &storeArrayNameOfSVDHits="", const std::string &storeArrayNameOfCDCHits="", const std::string &storeArrayNameOfBKLMHits="", const std::string &storeArrayNameOfEKLMHits="", const std::string &storeArrayNameOfRecoHitInformation="")
 Construct a RecoTrack with the given seed helix parameters and the given names for the hits.
 
 RecoTrack (const RecoTrack &)=delete
 Delete the copy construtr.
 
RecoTrackoperator= (RecoTrack const &)=delete
 Delete the copy construtr.
 
genfit::TrackCand createGenfitTrackCand () const
 Create a genfit::TrackCand out of this reco track and copy all information to the track candidate.
 
RecoTrackcopyToStoreArrayUsing (StoreArray< RecoTrack > &storeArray, const ROOT::Math::XYZVector &position, const ROOT::Math::XYZVector &momentum, short charge, const TMatrixDSym &covariance, double timeSeed) const
 Append a new RecoTrack to the given store array and copy its general properties, but not the hits themself.
 
RecoTrackcopyToStoreArrayUsingSeeds (StoreArray< RecoTrack > &storeArray) const
 Append a new RecoTrack to the given store array and copy its general properties, but not the hits themself.
 
RecoTrackcopyToStoreArray (StoreArray< RecoTrack > &storeArray) const
 Append a new RecoTrack to the given store array and copy its general properties, but not the hits themself.
 
size_t addHitsFromRecoTrack (const RecoTrack *recoTrack, unsigned int sortingParameterOffset=0, bool reversed=false, std::optional< double > optionalMinimalWeight=std::nullopt)
 Add all hits from another RecoTrack to this RecoTrack.
 
bool addCDCHit (const UsedCDCHit *cdcHit, const unsigned int sortingParameter, RightLeftInformation rightLeftInformation=RightLeftInformation::c_undefinedRightLeftInformation, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
 Adds a cdc hit with the given information to the reco track.
 
bool addPXDHit (const UsedPXDHit *pxdHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
 Adds a pxd hit with the given information to the reco track.
 
bool addSVDHit (const UsedSVDHit *svdHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
 Adds a svd hit with the given information to the reco track.
 
bool addBKLMHit (const UsedBKLMHit *bklmHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
 Adds a bklm hit with the given information to the reco track.
 
bool addEKLMHit (const UsedEKLMHit *eklmHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
 Adds an eklm hit with the given information to the reco track.
 
template<class HitType >
RecoHitInformationgetRecoHitInformation (HitType *hit) const
 Return the reco hit information for a generic hit from the storeArray.
 
template<class HitType >
TrackingDetector getTrackingDetector (const HitType *hit) const
 Return the tracking detector of a given hit (every type) or throws an exception of the hit is not related to the track.
 
template<class HitType >
RightLeftInformation getRightLeftInformation (const HitType *hit) const
 Return the right left information of a given hit (every type) or throws an exception of the hit is not related to the track.
 
template<class HitType >
OriginTrackFinder getFoundByTrackFinder (const HitType *hit) const
 Return the found by track finder flag for the given hit (every type) or throws an exception of the hit is not related to the track.
 
template<class HitType >
unsigned int getSortingParameter (const HitType *hit) const
 Return the sorting parameter for a given hit (every type) or throws an exception of the hit is not related to the track.
 
template<class HitType >
void setRightLeftInformation (const HitType *hit, RightLeftInformation rightLeftInformation)
 Set the right left information or throws an exception of the hit is not related to the track. Will set the dirty flag!
 
template<class HitType >
void setFoundByTrackFinder (const HitType *hit, OriginTrackFinder originTrackFinder)
 Set the found by track finder flag or throws an exception of the hit is not related to the track.
 
template<class HitType >
void setSortingParameter (const HitType *hit, unsigned int sortingParameter)
 Set the sorting parameter or throws an exception of the hit is not related to the track. Will set the dirty flag!
 
const genfit::TrackPoint * getCreatedTrackPoint (const RecoHitInformation *recoHitInformation) const
 Get a pointer to the TrackPoint that was created from this hit.
 
bool hasPXDHits () const
 Returns true if the track has pxd hits.
 
bool hasSVDHits () const
 Returns true if the track has svd hits.
 
bool hasCDCHits () const
 Returns true if the track has cdc hits.
 
bool hasBKLMHits () const
 Returns true if the track has bklm hits.
 
bool hasEKLMHits () const
 Returns true if the track has eklm hits.
 
template<class HitType >
bool hasHit (const HitType *hit) const
 Returns true if the given hit is in the track.
 
unsigned int getNumberOfPXDHits () const
 Return the number of pxd hits.
 
unsigned int getNumberOfSVDHits () const
 Return the number of svd hits.
 
unsigned int getNumberOfCDCHits () const
 Return the number of cdc hits.
 
unsigned int getNumberOfBKLMHits () const
 Return the number of bklm hits.
 
unsigned int getNumberOfEKLMHits () const
 Return the number of eklm hits.
 
unsigned int getNumberOfTotalHits () const
 Return the number of cdc + svd + pxd + bklm + eklm hits.
 
unsigned int getNumberOfTrackingHits () const
 Return the number of cdc + svd + pxd hits.
 
std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList () const
 Return an unsorted list of pxd hits.
 
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList () const
 Return an unsorted list of svd hits.
 
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList () const
 Return an unsorted list of cdc hits.
 
std::vector< Belle2::RecoTrack::UsedBKLMHit * > getBKLMHitList () const
 Return an unsorted list of bklm hits.
 
std::vector< Belle2::RecoTrack::UsedEKLMHit * > getEKLMHitList () const
 Return an unsorted list of eklm hits.
 
std::vector< Belle2::RecoTrack::UsedPXDHit * > getSortedPXDHitList () const
 Return a sorted list of pxd hits. Sorted by the sortingParameter.
 
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSortedSVDHitList () const
 Return a sorted list of svd hits. Sorted by the sortingParameter.
 
std::vector< Belle2::RecoTrack::UsedCDCHit * > getSortedCDCHitList () const
 Return a sorted list of cdc hits. Sorted by the sortingParameter.
 
std::vector< Belle2::RecoTrack::UsedBKLMHit * > getSortedBKLMHitList () const
 Return a sorted list of bklm hits. Sorted by the sortingParameter.
 
std::vector< Belle2::RecoTrack::UsedEKLMHit * > getSortedEKLMHitList () const
 Return a sorted list of eklm hits. Sorted by the sortingParameter.
 
ROOT::Math::XYZVector getPositionSeed () const
 Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
 
ROOT::Math::XYZVector getMomentumSeed () const
 Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
 
const TVectorD & getStateSeed () const
 Return the state seed in the form posX, posY, posZ, momX, momY, momZ. ATTENTION: This is not the fitted state.
 
const genfit::Track & getGenfitTrack () const
 Returns genfit track.
 
short int getChargeSeed () const
 Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
 
double getTimeSeed () const
 Return the time seed stored in the reco track. ATTENTION: This is not the fitted time.
 
float getOutgoingArmTime ()
 Return the track time of the outgoing arm.
 
float getOutgoingArmTimeError ()
 Return the error of the track time of the outgoing arm.
 
float getIngoingArmTime ()
 Return the track time of the ingoing arm.
 
float getIngoingArmTimeError ()
 Return the error of the track time of the ingoing arm.
 
float getInOutArmTimeDifference ()
 Return the difference between the track times of the ingoing and outgoing arms.
 
float getInOutArmTimeDifferenceError ()
 Return the error of the difference between the track times of the ingoing and outgoing arms.
 
bool hasIngoingArmTime ()
 Check if the ingoing arm time is set.
 
bool hasOutgoingArmTime ()
 Check if the outgoing arm time is set.
 
int getNSVDHitsOfOutgoingArm ()
 Return the number of clusters used to estimate the outgoing arm time.
 
int getNSVDHitsOfIngoingArm ()
 Return the number of clusters used to estimate the ingoing arm time.
 
void flipTrackDirectionAndCharge (const genfit::AbsTrackRep *representation=nullptr)
 Flip the direction of the RecoTrack by inverting the momentum vector and the charge.
 
std::tuple< ROOT::Math::XYZVector, ROOT::Math::XYZVector, short > extractTrackState () const
 Return the position, the momentum and the charge of the first measured state on plane or - if unfitted - the seeds.
 
void setPositionAndMomentum (const ROOT::Math::XYZVector &positionSeed, const ROOT::Math::XYZVector &momentumSeed)
 Set the position and momentum seed of the reco track. ATTENTION: This is not the fitted position or momentum.
 
void setChargeSeed (const short int chargeSeed)
 Set the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
 
void setTimeSeed (const double timeSeed)
 Set the time seed. ATTENTION: This is not the fitted time.
 
const TMatrixDSym & getSeedCovariance () const
 Return the covariance matrix of the seed. ATTENTION: This is not the fitted covariance.
 
void setSeedCovariance (const TMatrixDSym &seedCovariance)
 Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
 
bool wasFitSuccessful (const genfit::AbsTrackRep *representation=nullptr) const
 Returns true if the last fit with the given representation was successful.
 
const genfit::FitStatus * getTrackFitStatus (const genfit::AbsTrackRep *representation=nullptr) const
 Return the track fit status for the given representation or for the cardinal one. You are not allowed to modify or delete it!
 
bool hasTrackFitStatus (const genfit::AbsTrackRep *representation=nullptr) const
 Check, if there is a fit status for the given representation or for the cardinal one.
 
genfit::AbsTrackRep * getCardinalRepresentation () const
 Get a pointer to the cardinal track representation. You are not allowed to modify or delete it!
 
const std::vector< genfit::AbsTrackRep * > & getRepresentations () const
 Return a list of track representations. You are not allowed to modify or delete them!
 
genfit::AbsTrackRep * getTrackRepresentationForPDG (int pdgCode) const
 Return an already created track representation of the given reco track for the PDG.
 
std::vector< RecoHitInformation * > getRecoHitInformations (bool getSorted=false) const
 Return a list of all RecoHitInformations associated with the RecoTrack.
 
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromFirstHit (const genfit::AbsTrackRep *representation=nullptr) const
 Return genfit's MeasuredStateOnPlane for the first hit in a fit useful for extrapolation of measurements to other locations Const version.
 
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromLastHit (const genfit::AbsTrackRep *representation=nullptr) const
 Return genfit's MeasuredStateOnPlane for the last hit in a fit useful for extrapolation of measurements to other locations Const version.
 
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromRecoHit (const RecoHitInformation *recoHitInfo, const genfit::AbsTrackRep *representation=nullptr) const
 Return genfit's MeasuredStateOnPlane on plane for associated with one RecoHitInformation.
 
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneClosestTo (const ROOT::Math::XYZVector &closestPoint, const genfit::AbsTrackRep *representation=nullptr)
 Return genfit's MasuredStateOnPlane, that is closest to the given point useful for extrapolation of measurements other locations.
 
void prune ()
 Prune the genfit track, e.g.
 
void estimateArmTime ()
 This function calculates the track time of the ingoing and outgoing arms and their difference.
 
bool isOutgoingArm (RecoHitInformation::RecoHitDetector pre=RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector, RecoHitInformation::RecoHitDetector post=RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector)
 This function returns true if the arm direction is Outgoing and false if the arm direction is Ingoing.
 
const std::vector< genfit::TrackPoint * > & getHitPointsWithMeasurement () const
 Return a list of measurements and track points, which can be used e.g. to extrapolate. You are not allowed to modify or delete them!
 
bool getDirtyFlag () const
 This returns true, if a hit was added after the last fit and measurement creation and a refit should be done.
 
void setDirtyFlag (const bool &dirtyFlag=true)
 Set to true, if you want to rebuild the measurements and do the fit independent on changes of the hit content.
 
const std::string & getStoreArrayNameOfPXDHits () const
 Name of the store array of the pxd hits.
 
const std::string & getStoreArrayNameOfSVDHits () const
 Name of the store array of the svd hits.
 
const std::string & getStoreArrayNameOfCDCHits () const
 Name of the store array of the cdc hits.
 
const std::string & getStoreArrayNameOfBKLMHits () const
 Name of the store array of the bklm hits.
 
const std::string & getStoreArrayNameOfEKLMHits () const
 Name of the store array of the eklm hits.
 
const std::string & getStoreArrayNameOfRecoHitInformation () const
 Name of the store array of the reco hit information.
 
void revertRecoHitInformationSorting ()
 Revert the sorting order of the RecoHitInformation.
 
template<class HitType >
void mapOnHits (const std::string &storeArrayNameOfHits, std::function< void(RecoHitInformation &, HitType *)> const &mapFunction, std::function< bool(const RecoHitInformation &, const HitType *)> const &pickFunction)
 Call a function on all hits of the given type in the store array, that are related to this track.
 
template<class HitType >
void mapOnHits (const std::string &storeArrayNameOfHits, std::function< void(const RecoHitInformation &, const HitType *)> const &mapFunction, std::function< bool(const RecoHitInformation &, const HitType *)> const &pickFunction) const
 Call a function on all hits of the given type in the store array, that are related to this track.
 
template<class HitType >
void mapOnHits (const std::string &storeArrayNameOfHits, std::function< void(RecoHitInformation &, HitType *)> const &mapFunction)
 Call a function on all hits of the given type in the store array, that are related to this track.
 
template<class HitType >
void mapOnHits (const std::string &storeArrayNameOfHits, std::function< void(const RecoHitInformation &, const HitType *)> const &mapFunction) const
 Call a function on all hits of the given type in the store array, that are related to this track.
 
MatchingStatus getMatchingStatus () const
 Return the matching status set by the TrackMatcher module.
 
void setMatchingStatus (MatchingStatus matchingStatus)
 Set the matching status (used by the TrackMatcher module)
 
float getQualityIndicator () const
 Get the quality index attached to this RecoTrack given by one of the reconstruction algorithms. 0 means likely fake.
 
void setQualityIndicator (const float qualityIndicator)
 Set the quality index attached to this RecoTrack. 0 means likely fake.
 
float getFlipQualityIndicator () const
 Get the 1st flipping quality attached to this RecoTrack as a reference for flipping.
 
void setFlipQualityIndicator (const float qualityIndicator)
 Set the 1st flipping quality attached to this RecoTrack.
 
float get2ndFlipQualityIndicator () const
 Get the 2nd flipping quality attached to this RecoTrack as a reference for flipping.
 
void set2ndFlipQualityIndicator (const float qualityIndicator)
 Set the 2nd flipping quality attached to this RecoTrack.
 
void deleteFittedInformation ()
 Delete all fitted information for all representations.
 
void deleteFittedInformationForRepresentation (const genfit::AbsTrackRep *rep)
 Delete all fitted information for the given representations.
 
std::string getInfoHTML () const override
 Get useful information on EventDisplay.
 
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.
 

Static Public Member Functions

static void registerRequiredRelations (StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
 Convenience method which registers all relations required to fully use a RecoTrack.
 
static RecoTrackcreateFromTrackCand (const genfit::TrackCand &trackCand, const std::string &storeArrayNameOfRecoTracks="", const std::string &storeArrayNameOfPXDHits="", const std::string &storeArrayNameOfSVDHits="", const std::string &storeArrayNameOfCDCHits="", const std::string &storeArrayNameOfBKLMHits="", const std::string &storeArrayNameOfEKLMHits="", const std::string &storeArrayNameOfRecoHitInformation="", const bool recreateSortingParameters=false)
 Create a reco track from a genfit::TrackCand and save it to the given store array.
 

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 Types

typedef RecoHitInformation::RightLeftInformation RightLeftInformation
 Copy the definitions from the RecoHitInformation to this class.
 
typedef RecoHitInformation::RecoHitDetector TrackingDetector
 Copy the definitions from the RecoHitInformation to this class.
 
typedef RecoHitInformation::OriginTrackFinder OriginTrackFinder
 Copy the definitions from the RecoHitInformation to this class.
 
typedef RecoHitInformation::UsedCDCHit UsedCDCHit
 Copy the definitions from the RecoHitInformation to this class.
 
typedef RecoHitInformation::UsedSVDHit UsedSVDHit
 Copy the definitions from the RecoHitInformation to this class.
 
typedef RecoHitInformation::UsedPXDHit UsedPXDHit
 Copy the definitions from the RecoHitInformation to this class.
 
typedef RecoHitInformation::UsedBKLMHit UsedBKLMHit
 Copy the definitions from the RecoHitInformation to this class.
 
typedef RecoHitInformation::UsedEKLMHit UsedEKLMHit
 Copy the definitions from the RecoHitInformation to this class.
 

Private Member Functions

template<class HitType , class ... Args>
bool addHit (const HitType *hit, Args &&... params)
 Add a generic hit with the given parameters for the reco hit information.
 
template<class HitType >
void addHitWithHitInformation (const HitType *hit, RecoHitInformation *recoHitInformation)
 Add the needed relations for adding a generic hit with the given hit information and reset track time information.
 
template<class HitType >
RecoHitInformationgetRecoHitInformationSafely (HitType *hit) const
 Returns the reco hit information for a given hit or throws an exception if the hit is not related to the track.
 
template<class HitType >
unsigned int getNumberOfHitsOfGivenType (const std::string &storeArrayNameOfHits) const
 Get the number of hits for the given hit type in the store array that are related to this track.
 
template<class HitType >
std::vector< HitType * > getSortedHitList (const std::string &storeArrayNameOfHits) const
 Return a sorted list of hits of the given type in the store array that are related to this track.
 
template<class HitType >
std::vector< HitType * > getHitList (const std::string &storeArrayNameOfHits) const
 Return an unsorted list of hits of the given type in the store array that are related to this track.
 
void swapArmTimes ()
 Swap arm times, booleans and nSVDHits.
 
void checkDirtyFlag () const
 Helper: Check the dirty flag and produce a warning, whenever a fit result is accessed.
 
 ClassDefOverride (RecoTrack, 14)
 Making this class a ROOT class.
 
 ClassDef (RelationsInterface, 0)
 defines interface for accessing relations of objects in StoreArray.
 

Private Attributes

genfit::Track m_genfitTrack
 Internal storage for the genfit track.
 
short int m_charge = 1
 Storage for the charge. All other helix parameters are saved in the genfit::Track.
 
std::string m_storeArrayNameOfPXDHits = ""
 Store array name of added PXD hits.
 
std::string m_storeArrayNameOfSVDHits = ""
 Store array name of added SVD hits.
 
std::string m_storeArrayNameOfCDCHits = ""
 Store array name of added CDC hits.
 
std::string m_storeArrayNameOfBKLMHits = ""
 Store array name of added BKLM hits.
 
std::string m_storeArrayNameOfEKLMHits = ""
 Store array name of added EKLM hits.
 
std::string m_storeArrayNameOfRecoHitInformation = ""
 Store array of added RecoHitInformation.
 
bool m_dirtyFlag = true
 Bool is hits were added to track after fitting and the measurements should be recalculated.
 
MatchingStatus m_matchingStatus = MatchingStatus::c_undefined
 Flag used in the MCRecoTracksMatcherModule.
 
float m_qualityIndicator = NAN
 Quality index for classification of fake vs. MC-matched Tracks.
 
float m_flipqualityIndicator = NAN
 Quality index for flipping.
 
float m_2ndFlipqualityIndicator = NAN
 Quality index for flipping.
 
float m_outgoingArmTime = NAN
 Track time of the outgoing arm.
 
float m_outgoingArmTimeError = NAN
 Error of the track time of the outgoing arm.
 
float m_ingoingArmTime = NAN
 Track time of the ingoing arm.
 
float m_ingoingArmTimeError = NAN
 Error of the track time of the ingoing arm.
 
bool m_isArmTimeComputed = false
 true if the arms times are already computed, false otherwise
 
bool m_hasIngoingArmTime = false
 Internal storage of the final ingoing arm time is set.
 
bool m_hasOutgoingArmTime = false
 Internal storage of the final outgoing arm time is set.
 
int m_nSVDHitsOfOutgoingArm = 0
 Number of SVD clusters of the outgoing arm.
 
int m_nSVDHitsOfIngoingArm = 0
 Number of SVD clusters of the ingoing arm.
 
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 RecoTrackGenfitAccess
 The RecoTrackGenfitAccess need to access the genfit track (which is intended)!
 

Detailed Description

This is the Reconstruction Event-Data Model Track.

This class collects hits, saves the track parameters and can be used with a TrackFitter to perform fits to the hits. It can be created from a genfit::TrackCand and converted to a genfit::Track, but it is better to use this class directly in the modules, because it offers a more datastore-suited interface.

The RecoTrack itself does only store a genfit::Track internally. All hit content is stored as a relation to the hits. For each of these relations to a detector hit, there is also a relation to a RecoHitInformation, to store additional information. However, the user does not need to access these relation by himself, but can use the accessor functions of the RecoTrack.

Typically, a RecoTrack object is created with a position and momentum seed and a charge.

RecoTrack recoTrack(position, momentum, charge, ...)

Then, hits are added

recoTrack.addCDCHit(cdcHit, rlInformation, ...) ....

After that, the hits can either be accessed:

recoTrack.getCDCHitList(); recoTrack.getRightLeftInformation(cdcHit);

or the track can be fitted:

TrackFitter fitter; fitter.fit(recoTrack);

See also the TrackFitter class for possibilities to fit. After the track is fitted properly, the hit points with measurements can be used to extrapolate the track

recoTrack.getHitPointsWithMeasurement();

See the recoTrack.cc test for an overview on the hit information accessor methods.

Definition at line 79 of file RecoTrack.h.

Member Typedef Documentation

◆ OriginTrackFinder

Copy the definitions from the RecoHitInformation to this class.

Definition at line 89 of file RecoTrack.h.

◆ RightLeftInformation

Copy the definitions from the RecoHitInformation to this class.

Definition at line 85 of file RecoTrack.h.

◆ TrackingDetector

Copy the definitions from the RecoHitInformation to this class.

Definition at line 87 of file RecoTrack.h.

◆ UsedBKLMHit

Copy the definitions from the RecoHitInformation to this class.

Definition at line 97 of file RecoTrack.h.

◆ UsedCDCHit

Copy the definitions from the RecoHitInformation to this class.

Definition at line 91 of file RecoTrack.h.

◆ UsedEKLMHit

Copy the definitions from the RecoHitInformation to this class.

Definition at line 99 of file RecoTrack.h.

◆ UsedPXDHit

Copy the definitions from the RecoHitInformation to this class.

Definition at line 95 of file RecoTrack.h.

◆ UsedSVDHit

Copy the definitions from the RecoHitInformation to this class.

Definition at line 93 of file RecoTrack.h.

Member Enumeration Documentation

◆ MatchingStatus

Enum for the matching status of this reco track (set by the matching modules in the tracking package).

Definition at line 105 of file RecoTrack.h.

105 {
106 c_undefined, //until the matcher module sets it
107 c_matched, // hit pattern and charge are both correct
108 c_matchedWrongCharge, // hit pattern is correct, but the charge is wrong
109 c_clone, //a clone with the correct charge
110 c_cloneWrongCharge, //a clone with the wrong charge
111 c_background,
112 c_ghost
113 };

Constructor & Destructor Documentation

◆ RecoTrack() [1/2]

RecoTrack ( )
inline

Empty constructor for ROOT. Do not use!

Definition at line 140 of file RecoTrack.h.

140{ }

◆ RecoTrack() [2/2]

RecoTrack ( const ROOT::Math::XYZVector &  seedPosition,
const ROOT::Math::XYZVector &  seedMomentum,
const short int  seedCharge,
const std::string &  storeArrayNameOfPXDHits = "",
const std::string &  storeArrayNameOfSVDHits = "",
const std::string &  storeArrayNameOfCDCHits = "",
const std::string &  storeArrayNameOfBKLMHits = "",
const std::string &  storeArrayNameOfEKLMHits = "",
const std::string &  storeArrayNameOfRecoHitInformation = "" 
)

Construct a RecoTrack with the given seed helix parameters and the given names for the hits.

If you do not provide information for the hit store array names, the standard parameters are used.

Parameters
seedPositionA position on the helix of the track seed. Only the perigee of the helix will be saved.
seedMomentumThe seed momentum of the helix on the given position.
seedChargeThe seed charge of the helix
storeArrayNameOfPXDHitsThe name of the store array where the related PXD hits are stored.
storeArrayNameOfSVDHitsThe name of the store array where the related SVD hits are stored.
storeArrayNameOfCDCHitsThe name of the store array where the related CDC hits are stored.
storeArrayNameOfBKLMHitsThe name of the store array where the related BKLM hits are stored.
storeArrayNameOfEKLMHitsThe name of the store array where the related EKLM hits are stored.
storeArrayNameOfRecoHitInformationThe name of the store array where the related hit information are stored.

Definition at line 25 of file RecoTrack.cc.

32 :
33 m_charge(seedCharge),
34 m_storeArrayNameOfPXDHits(storeArrayNameOfPXDHits),
35 m_storeArrayNameOfSVDHits(storeArrayNameOfSVDHits),
36 m_storeArrayNameOfCDCHits(storeArrayNameOfCDCHits),
37 m_storeArrayNameOfBKLMHits(storeArrayNameOfBKLMHits),
38 m_storeArrayNameOfEKLMHits(storeArrayNameOfEKLMHits),
39 m_storeArrayNameOfRecoHitInformation(storeArrayNameOfRecoHitInformation)
40{
41 m_genfitTrack.setStateSeed(XYZToTVector(seedPosition), XYZToTVector(seedMomentum));
42 // TODO Set the covariance seed (that should be done by the tracking package)
43 TMatrixDSym covSeed(6);
44 covSeed(0, 0) = 1e-3;
45 covSeed(1, 1) = 1e-3;
46 covSeed(2, 2) = 4e-3;
47 covSeed(3, 3) = 0.01e-3;
48 covSeed(4, 4) = 0.01e-3;
49 covSeed(5, 5) = 0.04e-3;
50 m_genfitTrack.setCovSeed(covSeed);
51}
std::string m_storeArrayNameOfCDCHits
Store array name of added CDC hits.
Definition: RecoTrack.h:905
std::string m_storeArrayNameOfBKLMHits
Store array name of added BKLM hits.
Definition: RecoTrack.h:907
short int m_charge
Storage for the charge. All other helix parameters are saved in the genfit::Track.
Definition: RecoTrack.h:899
std::string m_storeArrayNameOfSVDHits
Store array name of added SVD hits.
Definition: RecoTrack.h:903
genfit::Track m_genfitTrack
Internal storage for the genfit track.
Definition: RecoTrack.h:897
std::string m_storeArrayNameOfEKLMHits
Store array name of added EKLM hits.
Definition: RecoTrack.h:909
std::string m_storeArrayNameOfPXDHits
Store array name of added PXD hits.
Definition: RecoTrack.h:901
std::string m_storeArrayNameOfRecoHitInformation
Store array of added RecoHitInformation.
Definition: RecoTrack.h:911
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
Definition: VectorUtil.h:24

Member Function Documentation

◆ addBKLMHit()

bool addBKLMHit ( const UsedBKLMHit bklmHit,
const unsigned int  sortingParameter,
OriginTrackFinder  foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder 
)
inline

Adds a bklm hit with the given information to the reco track.

You only have to provide the hit and the sorting parameter, all other parameters have default value.

Parameters
bklmHitThe pointer to a stored BKLMHit in the store array you provided earlier, which you want to add.
sortingParameterThe index of the hit. It starts with 0 with the first hit.
foundByTrackFinderWhich track finder has found the hit?
Returns
True if the hit was not already added to the track.

Definition at line 286 of file RecoTrack.h.

288 {
289 return addHit(bklmHit, foundByTrackFinder, sortingParameter);
290 }
bool addHit(const HitType *hit, Args &&... params)
Add a generic hit with the given parameters for the reco hit information.
Definition: RecoTrack.h:949

◆ addCDCHit()

bool addCDCHit ( const UsedCDCHit cdcHit,
const unsigned int  sortingParameter,
RightLeftInformation  rightLeftInformation = RightLeftInformation::c_undefinedRightLeftInformation,
OriginTrackFinder  foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder 
)
inline

Adds a cdc hit with the given information to the reco track.

You only have to provide the hit and the sorting parameter, all other parameters have default value.

Parameters
cdcHitThe pointer to a stored CDCHit in the store array you provided earlier, which you want to add.
sortingParameterThe index of the hit. It starts with 0 with the first hit.
rightLeftInformationThe right left information (if you know it).
foundByTrackFinderWhich track finder has found the hit?
Returns
True if the hit was not already added to the track.

Definition at line 243 of file RecoTrack.h.

246 {
247 return addHit(cdcHit, rightLeftInformation, foundByTrackFinder, sortingParameter);
248 }

◆ addEKLMHit()

bool addEKLMHit ( const UsedEKLMHit eklmHit,
const unsigned int  sortingParameter,
OriginTrackFinder  foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder 
)
inline

Adds an eklm hit with the given information to the reco track.

You only have to provide the hit and the sorting parameter, all other parameters have default value.

Parameters
eklmHitThe pointer to a stored BKLMHit in the store array you provided earlier, which you want to add.
sortingParameterThe index of the hit. It starts with 0 with the first hit.
foundByTrackFinderWhich track finder has found the hit?
Returns
True if the hit was not already added to the track.

Definition at line 300 of file RecoTrack.h.

302 {
303 return addHit(eklmHit, foundByTrackFinder, sortingParameter);
304 }

◆ addHit()

bool addHit ( const HitType *  hit,
Args &&...  params 
)
inlineprivate

Add a generic hit with the given parameters for the reco hit information.

Parameters
hita generic hit.
paramsfor the constructor of the reco hit information.
Returns
true if the hit was new.

Definition at line 949 of file RecoTrack.h.

950 {
951 if (hasHit(hit)) {
952 return false;
953 }
954
955 StoreArray<RecoHitInformation> recoHitInformations(m_storeArrayNameOfRecoHitInformation);
956 RecoHitInformation* newRecoHitInformation = recoHitInformations.appendNew(hit, params...);
957
958 addHitWithHitInformation(hit, newRecoHitInformation);
959
960 return true;
961 }
bool hasHit(const HitType *hit) const
Returns true if the given hit is in the track.
Definition: RecoTrack.h:411
void addHitWithHitInformation(const HitType *hit, RecoHitInformation *recoHitInformation)
Add the needed relations for adding a generic hit with the given hit information and reset track time...
Definition: RecoTrack.h:969

◆ addHitsFromRecoTrack()

size_t addHitsFromRecoTrack ( const RecoTrack recoTrack,
unsigned int  sortingParameterOffset = 0,
bool  reversed = false,
std::optional< double >  optionalMinimalWeight = std::nullopt 
)

Add all hits from another RecoTrack to this RecoTrack.

Parameters
recoTrack: Pointer to the RecoTrack where the hits are copied from
sortingParameterOffset: This number will be added to the sortingParameter of all hits copied from recoTrack. Set this to (largest sorting parameter) + 1 in order to add hits at the end of this reco track.
reversed: add the hits in a reversed order - each sorting parameter is set to maximal sorting parameter - sorting parameter + offset
optionalMinimalWeight: if set, do only copy hits with a weight above this (if fitted already with the DAF).
Returns
The number of hits copied.

Definition at line 240 of file RecoTrack.cc.

242{
243 size_t hitsCopied = 0;
244
245 unsigned int maximalSortingParameter = 0;
246
247 if (reversed) {
248 const auto& recoHitInformations = recoTrack->getRecoHitInformations();
249 const auto sortBySP = [](const RecoHitInformation * lhs, const RecoHitInformation * rhs) {
250 return lhs->getSortingParameter() < rhs->getSortingParameter();
251 };
252 const auto& maximalElement = std::max_element(recoHitInformations.begin(), recoHitInformations.end(), sortBySP);
253 if (maximalElement != recoHitInformations.end()) {
254 maximalSortingParameter = (*maximalElement)->getSortingParameter();
255 }
256 }
257
258 // Helper function to add the sorting parameter offset (or reverse the sign of the sorting parameter)
259 const auto calculateSortingParameter = [maximalSortingParameter, sortingParameterOffset](unsigned int sortingParameters) {
260 if (maximalSortingParameter > 0) {
261 return maximalSortingParameter - sortingParameters + sortingParameterOffset;
262 }
263 return sortingParameters + sortingParameterOffset;
264 };
265
266 const auto testHitWeight = [recoTrack, optionalMinimalWeight](const RecoHitInformation * recoHitInformation) {
267 if (not optionalMinimalWeight) {
268 return true;
269 }
270 double minimalWeight = *optionalMinimalWeight;
271 const genfit::TrackPoint* trackPoint = recoTrack->getCreatedTrackPoint(recoHitInformation);
272 if (trackPoint) {
273 genfit::KalmanFitterInfo* kalmanFitterInfo = trackPoint->getKalmanFitterInfo();
274 if (not kalmanFitterInfo) {
275 return false;
276 }
277 const std::vector<double>& weights = kalmanFitterInfo->getWeights();
278 const auto checkWeight = [minimalWeight](const double weight) {
279 return weight >= minimalWeight;
280 };
281 return std::any_of(weights.begin(), weights.end(), checkWeight);
282 }
283 return true;
284 };
285
286 for (auto* pxdHit : recoTrack->getPXDHitList()) {
287 auto recoHitInfo = recoTrack->getRecoHitInformation(pxdHit);
288 assert(recoHitInfo);
289 if (testHitWeight(recoHitInfo)) {
290 hitsCopied += addPXDHit(pxdHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
291 recoHitInfo->getFoundByTrackFinder());
292 }
293 }
294
295 for (auto* svdHit : recoTrack->getSVDHitList()) {
296 auto recoHitInfo = recoTrack->getRecoHitInformation(svdHit);
297 assert(recoHitInfo);
298 if (testHitWeight(recoHitInfo)) {
299 hitsCopied += addSVDHit(svdHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
300 recoHitInfo->getFoundByTrackFinder());
301 }
302 }
303
304 for (auto* cdcHit : recoTrack->getCDCHitList()) {
305 auto recoHitInfo = recoTrack->getRecoHitInformation(cdcHit);
306 assert(recoHitInfo);
307 if (testHitWeight(recoHitInfo)) {
308 hitsCopied += addCDCHit(cdcHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
309 recoHitInfo->getRightLeftInformation(),
310 recoHitInfo->getFoundByTrackFinder());
311 }
312 }
313
314 for (auto* bklmHit : recoTrack->getBKLMHitList()) {
315 auto recoHitInfo = recoTrack->getRecoHitInformation(bklmHit);
316 assert(recoHitInfo);
317 if (testHitWeight(recoHitInfo)) {
318 hitsCopied += addBKLMHit(bklmHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
319 recoHitInfo->getFoundByTrackFinder());
320 }
321 }
322
323 for (auto* eklmHit : recoTrack->getEKLMHitList()) {
324 auto recoHitInfo = recoTrack->getRecoHitInformation(eklmHit);
325 assert(recoHitInfo);
326 if (testHitWeight(recoHitInfo)) {
327 hitsCopied += addEKLMHit(eklmHit, calculateSortingParameter(recoHitInfo->getSortingParameter()),
328 recoHitInfo->getFoundByTrackFinder());
329 }
330 }
331
332 return hitsCopied;
333}
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
unsigned int getSortingParameter() const
Get the sorting parameter.
bool addBKLMHit(const UsedBKLMHit *bklmHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a bklm hit with the given information to the reco track.
Definition: RecoTrack.h:286
bool addCDCHit(const UsedCDCHit *cdcHit, const unsigned int sortingParameter, RightLeftInformation rightLeftInformation=RightLeftInformation::c_undefinedRightLeftInformation, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a cdc hit with the given information to the reco track.
Definition: RecoTrack.h:243
std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList() const
Return an unsorted list of pxd hits.
Definition: RecoTrack.h:449
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList() const
Return an unsorted list of svd hits.
Definition: RecoTrack.h:452
bool addEKLMHit(const UsedEKLMHit *eklmHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds an eklm hit with the given information to the reco track.
Definition: RecoTrack.h:300
bool addPXDHit(const UsedPXDHit *pxdHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a pxd hit with the given information to the reco track.
Definition: RecoTrack.h:258
std::vector< Belle2::RecoTrack::UsedBKLMHit * > getBKLMHitList() const
Return an unsorted list of bklm hits.
Definition: RecoTrack.h:458
std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList() const
Return an unsorted list of cdc hits.
Definition: RecoTrack.h:455
std::vector< Belle2::RecoTrack::UsedEKLMHit * > getEKLMHitList() const
Return an unsorted list of eklm hits.
Definition: RecoTrack.h:461
RecoHitInformation * getRecoHitInformation(HitType *hit) const
Return the reco hit information for a generic hit from the storeArray.
Definition: RecoTrack.h:312
const genfit::TrackPoint * getCreatedTrackPoint(const RecoHitInformation *recoHitInformation) const
Get a pointer to the TrackPoint that was created from this hit.
Definition: RecoTrack.cc:230
std::vector< RecoHitInformation * > getRecoHitInformations(bool getSorted=false) const
Return a list of all RecoHitInformations associated with the RecoTrack.
Definition: RecoTrack.cc:557
bool addSVDHit(const UsedSVDHit *svdHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a svd hit with the given information to the reco track.
Definition: RecoTrack.h:272

◆ addHitWithHitInformation()

void addHitWithHitInformation ( const HitType *  hit,
RecoHitInformation recoHitInformation 
)
inlineprivate

Add the needed relations for adding a generic hit with the given hit information and reset track time information.

Parameters
hitThe hit to add
recoHitInformationThe reco hit information of the hit.

Definition at line 969 of file RecoTrack.h.

970 {
971 hit->addRelationTo(this);
972 addRelationTo(recoHitInformation);
973
974 m_isArmTimeComputed = false;
975 m_hasIngoingArmTime = false;
976 m_hasOutgoingArmTime = false;
977 m_outgoingArmTime = NAN;
978 m_ingoingArmTime = NAN;
981
982 setDirtyFlag();
983 }
float m_ingoingArmTimeError
Error of the track time of the ingoing arm.
Definition: RecoTrack.h:930
bool m_hasIngoingArmTime
Internal storage of the final ingoing arm time is set.
Definition: RecoTrack.h:934
bool m_hasOutgoingArmTime
Internal storage of the final outgoing arm time is set.
Definition: RecoTrack.h:936
float m_outgoingArmTime
Track time of the outgoing arm.
Definition: RecoTrack.h:924
void setDirtyFlag(const bool &dirtyFlag=true)
Set to true, if you want to rebuild the measurements and do the fit independent on changes of the hit...
Definition: RecoTrack.h:722
bool m_isArmTimeComputed
true if the arms times are already computed, false otherwise
Definition: RecoTrack.h:932
float m_ingoingArmTime
Track time of the ingoing arm.
Definition: RecoTrack.h:928
float m_outgoingArmTimeError
Error of the track time of the outgoing arm.
Definition: RecoTrack.h:926
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).

◆ addPXDHit()

bool addPXDHit ( const UsedPXDHit pxdHit,
const unsigned int  sortingParameter,
OriginTrackFinder  foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder 
)
inline

Adds a pxd hit with the given information to the reco track.

You only have to provide the hit and the sorting parameter, all other parameters have default value.

Parameters
pxdHitThe pointer to a stored PXDHit/Cluster in the store array you provided earlier, which you want to add.
sortingParameterThe index of the hit. It starts with 0 with the first hit.
foundByTrackFinderWhich track finder has found the hit?
Returns
True if the hit was not already added to the track.

Definition at line 258 of file RecoTrack.h.

260 {
261 return addHit(pxdHit, foundByTrackFinder, sortingParameter);
262 }

◆ 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 }

◆ addSVDHit()

bool addSVDHit ( const UsedSVDHit svdHit,
const unsigned int  sortingParameter,
OriginTrackFinder  foundByTrackFinder = OriginTrackFinder::c_undefinedTrackFinder 
)
inline

Adds a svd hit with the given information to the reco track.

You only have to provide the hit and the sorting parameter, all other parameters have default value.

Parameters
svdHitThe pointer to a stored SVDHit in the store array you provided earlier, which you want to add.
sortingParameterThe index of the hit. It starts with 0 with the first hit.
foundByTrackFinderWhich track finder has found the hit?
Returns
True if the hit was not already added to the track.

Definition at line 272 of file RecoTrack.h.

274 {
275 return addHit(svdHit, foundByTrackFinder, sortingParameter);
276 }

◆ checkDirtyFlag()

void checkDirtyFlag ( ) const
inlineprivate

Helper: Check the dirty flag and produce a warning, whenever a fit result is accessed.

Definition at line 1066 of file RecoTrack.h.

1067 {
1068 if (m_dirtyFlag) {
1069 B2DEBUG(100, "Dirty flag is set. The result may not be in sync with the latest changes. Refit the track to be sure.");
1070 }
1071 }
bool m_dirtyFlag
Bool is hits were added to track after fitting and the measurements should be recalculated.
Definition: RecoTrack.h:914

◆ 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 }

◆ copyToStoreArray()

RecoTrack * copyToStoreArray ( StoreArray< RecoTrack > &  storeArray) const

Append a new RecoTrack to the given store array and copy its general properties, but not the hits themself.

The position, momentum and charge are set to the seed values of this reco track, if it was not fitted or to the values at the first hit.

Definition at line 529 of file RecoTrack.cc.

530{
531 if (wasFitSuccessful()) {
532 const auto& mSoP = getMeasuredStateOnPlaneFromFirstHit();
533 return copyToStoreArrayUsing(storeArray,
534 ROOT::Math::XYZVector(mSoP.getPos()),
535 ROOT::Math::XYZVector(mSoP.getMom()),
536 static_cast<short>(mSoP.getCharge()),
537 mSoP.get6DCov(), mSoP.getTime());
538 } else {
539 return copyToStoreArrayUsingSeeds(storeArray);
540 }
541}
bool wasFitSuccessful(const genfit::AbsTrackRep *representation=nullptr) const
Returns true if the last fit with the given representation was successful.
Definition: RecoTrack.cc:336
RecoTrack * copyToStoreArrayUsingSeeds(StoreArray< RecoTrack > &storeArray) const
Append a new RecoTrack to the given store array and copy its general properties, but not the hits the...
Definition: RecoTrack.cc:524
RecoTrack * copyToStoreArrayUsing(StoreArray< RecoTrack > &storeArray, const ROOT::Math::XYZVector &position, const ROOT::Math::XYZVector &momentum, short charge, const TMatrixDSym &covariance, double timeSeed) const
Append a new RecoTrack to the given store array and copy its general properties, but not the hits the...
Definition: RecoTrack.cc:510
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromFirstHit(const genfit::AbsTrackRep *representation=nullptr) const
Return genfit's MeasuredStateOnPlane for the first hit in a fit useful for extrapolation of measureme...
Definition: RecoTrack.cc:605

◆ copyToStoreArrayUsing()

RecoTrack * copyToStoreArrayUsing ( StoreArray< RecoTrack > &  storeArray,
const ROOT::Math::XYZVector &  position,
const ROOT::Math::XYZVector &  momentum,
short  charge,
const TMatrixDSym &  covariance,
double  timeSeed 
) const

Append a new RecoTrack to the given store array and copy its general properties, but not the hits themself.

The position, momentum, charge etc. are set to the given parameters.

Definition at line 510 of file RecoTrack.cc.

513{
514 RecoTrack* newRecoTrack = storeArray.appendNew(position, momentum, charge,
517
518 newRecoTrack->setTimeSeed(timeSeed);
519 newRecoTrack->setSeedCovariance(covariance);
520
521 return newRecoTrack;
522}
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
const std::string & getStoreArrayNameOfEKLMHits() const
Name of the store array of the eklm hits.
Definition: RecoTrack.h:744
const std::string & getStoreArrayNameOfSVDHits() const
Name of the store array of the svd hits.
Definition: RecoTrack.h:735
const std::string & getStoreArrayNameOfPXDHits() const
Name of the store array of the pxd hits.
Definition: RecoTrack.h:732
const std::string & getStoreArrayNameOfBKLMHits() const
Name of the store array of the bklm hits.
Definition: RecoTrack.h:741
void setTimeSeed(const double timeSeed)
Set the time seed. ATTENTION: This is not the fitted time.
Definition: RecoTrack.h:604
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Definition: RecoTrack.h:614
const std::string & getStoreArrayNameOfRecoHitInformation() const
Name of the store array of the reco hit information.
Definition: RecoTrack.h:747
const std::string & getStoreArrayNameOfCDCHits() const
Name of the store array of the cdc hits.
Definition: RecoTrack.h:738
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246

◆ copyToStoreArrayUsingSeeds()

RecoTrack * copyToStoreArrayUsingSeeds ( StoreArray< RecoTrack > &  storeArray) const

Append a new RecoTrack to the given store array and copy its general properties, but not the hits themself.

The position, momentum and charge are set to the seed values of this reco track.

Definition at line 524 of file RecoTrack.cc.

525{
527}
const TMatrixDSym & getSeedCovariance() const
Return the covariance matrix of the seed. ATTENTION: This is not the fitted covariance.
Definition: RecoTrack.h:611
ROOT::Math::XYZVector getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
Definition: RecoTrack.h:480
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition: RecoTrack.h:508
ROOT::Math::XYZVector getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
Definition: RecoTrack.h:487
double getTimeSeed() const
Return the time seed stored in the reco track. ATTENTION: This is not the fitted time.
Definition: RecoTrack.h:511

◆ createFromTrackCand()

RecoTrack * createFromTrackCand ( const genfit::TrackCand &  trackCand,
const std::string &  storeArrayNameOfRecoTracks = "",
const std::string &  storeArrayNameOfPXDHits = "",
const std::string &  storeArrayNameOfSVDHits = "",
const std::string &  storeArrayNameOfCDCHits = "",
const std::string &  storeArrayNameOfBKLMHits = "",
const std::string &  storeArrayNameOfEKLMHits = "",
const std::string &  storeArrayNameOfRecoHitInformation = "",
const bool  recreateSortingParameters = false 
)
static

Create a reco track from a genfit::TrackCand and save it to the given store array.

Parameters
trackCandThe genfit::TrackCand from which to create the new object.
storeArrayNameOfRecoTracksThe store array where the new object should be saved.
storeArrayNameOfPXDHitsThe name of the store array where the related PXD hits are stored.
storeArrayNameOfSVDHitsThe name of the store array where the related SVD hits are stored.
storeArrayNameOfCDCHitsThe name of the store array where the related CDC hits are stored.
storeArrayNameOfBKLMHitsThe name of the store array where the related BKLM hits are stored.
storeArrayNameOfEKLMHitsThe name of the store array where the related EKLM hits are stored.
storeArrayNameOfRecoHitInformationThe name of the store array where the related hit information are stored.
recreateSortingParametersThe VXDTF does not set the sorting parameters correctly (they are all 0). This flag can be used to recover the parameters.
Returns
The newly created reco track.

Definition at line 97 of file RecoTrack.cc.

107{
108
109 StoreArray<RecoTrack> recoTracks(storeArrayNameOfRecoTracks);
110 StoreArray<RecoHitInformation> recoHitInformations(storeArrayNameOfRecoHitInformation);
111 StoreArray<UsedPXDHit> pxdHits(storeArrayNameOfPXDHits);
112 StoreArray<UsedSVDHit> svdHits(storeArrayNameOfSVDHits);
113 StoreArray<UsedCDCHit> cdcHits(storeArrayNameOfCDCHits);
114 StoreArray<UsedBKLMHit> bklmHits(storeArrayNameOfBKLMHits);
115 StoreArray<UsedEKLMHit> eklmHits(storeArrayNameOfEKLMHits);
116
117 // Set the tracking parameters
118 const ROOT::Math::XYZVector& position = ROOT::Math::XYZVector(trackCand.getPosSeed());
119 const ROOT::Math::XYZVector& momentum = ROOT::Math::XYZVector(trackCand.getMomSeed());
120 const short int charge = trackCand.getChargeSeed();
121 const double time = trackCand.getTimeSeed();
122
123 RecoTrack* newRecoTrack = recoTracks.appendNew(position, momentum, charge,
124 pxdHits.getName(), svdHits.getName(), cdcHits.getName(),
125 bklmHits.getName(), eklmHits.getName(),
126 recoHitInformations.getName());
127 newRecoTrack->setTimeSeed(time);
128
129 // TODO Set the covariance seed (that should be done by the tracking package)
130 TMatrixDSym covSeed(6);
131 covSeed(0, 0) = 1e-3;
132 covSeed(1, 1) = 1e-3;
133 covSeed(2, 2) = 4e-3;
134 covSeed(3, 3) = 0.01e-3;
135 covSeed(4, 4) = 0.01e-3;
136 covSeed(5, 5) = 0.04e-3;
137 newRecoTrack->m_genfitTrack.setCovSeed(covSeed);
138
139 for (unsigned int hitIndex = 0; hitIndex < trackCand.getNHits(); hitIndex++) {
140 genfit::TrackCandHit* trackCandHit = trackCand.getHit(hitIndex);
141 const int detID = trackCandHit->getDetId();
142 const int hitID = trackCandHit->getHitId();
143 const unsigned int sortingParameter = recreateSortingParameters ? hitIndex : static_cast<unsigned int>
144 (trackCandHit->getSortingParameter());
145 if (detID == Const::CDC) {
146 UsedCDCHit* cdcHit = cdcHits[hitID];
147 // Special case for CDC hits, we add a right-left information
148 const genfit::WireTrackCandHit* wireHit = dynamic_cast<const genfit::WireTrackCandHit*>(trackCandHit);
149 if (not wireHit) {
150 B2FATAL("CDC hit is not a wire hit. The RecoTrack can not handle such a case.");
151 }
152 if (wireHit->getLeftRightResolution() > 0) {
153 newRecoTrack->addCDCHit(cdcHit, sortingParameter, RecoHitInformation::RightLeftInformation::c_right);
154 } else if (wireHit->getLeftRightResolution() < 0) {
155 newRecoTrack->addCDCHit(cdcHit, sortingParameter, RecoHitInformation::RightLeftInformation::c_left);
156 } else {
157 newRecoTrack->addCDCHit(cdcHit, sortingParameter, RecoHitInformation::RightLeftInformation::c_undefinedRightLeftInformation);
158 }
159
160 } else if (detID == Const::SVD) {
161 UsedSVDHit* svdHit = svdHits[hitID];
162 newRecoTrack->addSVDHit(svdHit, sortingParameter);
163 } else if (detID == Const::PXD) {
164 UsedPXDHit* pxdHit = pxdHits[hitID];
165 newRecoTrack->addPXDHit(pxdHit, sortingParameter);
166 } else if (detID == Const::BKLM) {
167 UsedBKLMHit* bklmHit = bklmHits[hitID];
168 newRecoTrack->addBKLMHit(bklmHit, sortingParameter);
169 } else if (detID == Const::EKLM) {
170 UsedEKLMHit* eklmHit = eklmHits[hitID];
171 newRecoTrack->addEKLMHit(eklmHit, sortingParameter);
172 }
173 }
174
175 return newRecoTrack;
176}
RecoHitInformation::UsedCDCHit UsedCDCHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:91
RecoHitInformation::UsedEKLMHit UsedEKLMHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:99
RecoHitInformation::UsedBKLMHit UsedBKLMHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:97
RecoHitInformation::UsedSVDHit UsedSVDHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:93
RecoHitInformation::UsedPXDHit UsedPXDHit
Copy the definitions from the RecoHitInformation to this class.
Definition: RecoTrack.h:95
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ createGenfitTrackCand()

genfit::TrackCand createGenfitTrackCand ( ) const

Create a genfit::TrackCand out of this reco track and copy all information to the track candidate.

Definition at line 178 of file RecoTrack.cc.

179{
180 genfit::TrackCand createdTrackCand;
181
182 // Set the trajectory parameters
183 createdTrackCand.setPosMomSeed(XYZToTVector(getPositionSeed()), XYZToTVector(getMomentumSeed()), getChargeSeed());
184 createdTrackCand.setCovSeed(getSeedCovariance());
185 createdTrackCand.setTimeSeed(getTimeSeed());
186
187 // Add the hits
188 mapOnHits<UsedPXDHit>(m_storeArrayNameOfPXDHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
189 const UsedPXDHit * const hit) {
190 createdTrackCand.addHit(Const::PXD, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
191 });
192 mapOnHits<UsedSVDHit>(m_storeArrayNameOfSVDHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
193 const UsedSVDHit * const hit) {
194 createdTrackCand.addHit(Const::SVD, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
195 });
196 mapOnHits<UsedCDCHit>(m_storeArrayNameOfCDCHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
197 const UsedCDCHit * const hit) {
198 if (hitInformation.getRightLeftInformation() == RecoHitInformation::c_left) {
199 createdTrackCand.addHit(new genfit::WireTrackCandHit(Const::CDC, hit->getArrayIndex(), -1,
200 hitInformation.getSortingParameter(), -1));
201 } else if (hitInformation.getRightLeftInformation() == RecoHitInformation::c_right) {
202 createdTrackCand.addHit(new genfit::WireTrackCandHit(Const::CDC, hit->getArrayIndex(), -1,
203 hitInformation.getSortingParameter(), 1));
204 } else {
205 createdTrackCand.addHit(new genfit::WireTrackCandHit(Const::CDC, hit->getArrayIndex(), -1,
206 hitInformation.getSortingParameter(), 0));
207 }
208 });
209 mapOnHits<UsedBKLMHit>(m_storeArrayNameOfBKLMHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
210 const UsedBKLMHit * const hit) {
211 createdTrackCand.addHit(Const::BKLM, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
212 });
213 mapOnHits<UsedEKLMHit>(m_storeArrayNameOfEKLMHits, [&createdTrackCand](const RecoHitInformation & hitInformation,
214 const UsedEKLMHit * const hit) {
215 createdTrackCand.addHit(Const::EKLM, hit->getArrayIndex(), -1, hitInformation.getSortingParameter());
216 });
217
218 createdTrackCand.sortHits();
219
220 // Set the MC Particle
221 const MCParticle* relatedMCParticle = getRelatedTo<MCParticle>();
222 if (relatedMCParticle) {
223 createdTrackCand.setMcTrackId(relatedMCParticle->getArrayIndex());
224 }
225
226 // Add the hits
227 return createdTrackCand;
228}
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
Definition: MCParticle.h:244
RightLeftInformation getRightLeftInformation() const
Get the right-left-information.

◆ deleteFittedInformation()

void deleteFittedInformation ( )

Delete all fitted information for all representations.

This function is needed, when you want to start the fitting "from scratch". After this function, a fit will recreate all measurements and fitted information. Please be aware that any pointers will be invalid after that!

Definition at line 462 of file RecoTrack.cc.

463{
464 // Delete all fitted information for all representations
465 for (const genfit::AbsTrackRep* rep : getRepresentations()) {
467 }
468}
const std::vector< genfit::AbsTrackRep * > & getRepresentations() const
Return a list of track representations. You are not allowed to modify or delete them!
Definition: RecoTrack.h:638
void deleteFittedInformationForRepresentation(const genfit::AbsTrackRep *rep)
Delete all fitted information for the given representations.
Definition: RecoTrack.cc:470

◆ deleteFittedInformationForRepresentation()

void deleteFittedInformationForRepresentation ( const genfit::AbsTrackRep *  rep)

Delete all fitted information for the given representations.

This function is needed, when you want to start the fitting "from scratch". After this function, a fit will recreate all measurements and fitted information. Please be aware that any pointers will be invalid after that!

Definition at line 470 of file RecoTrack.cc.

471{
472 m_genfitTrack.deleteFittedState(rep);
473}

◆ estimateArmTime()

void estimateArmTime ( )

This function calculates the track time of the ingoing and outgoing arms and their difference.

If they do not exists they are set to NAN by default

Definition at line 633 of file RecoTrack.cc.

634{
635 m_isArmTimeComputed = true;
636 const std::vector<RecoHitInformation*>& recoHits = getRecoHitInformations(true);
637 bool svdDone = false;
638 int nSVDHits = 0;
639 static RecoHitInformation::RecoHitDetector und = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector;
640 RecoHitInformation::RecoHitDetector SVD = RecoHitInformation::RecoHitDetector::c_SVD;
643 float clusterTimeSum = 0;
644 float clusterTimeSigma2Sum = 0;
645 bool trackArmTimeDone = false;
646
647 // loop over the recoHits of the RecoTrack
648 for (const auto& recoHit : recoHits) {
649 RecoHitInformation::RecoHitDetector foundin = recoHit->getTrackingDetector();
650 if (!svdDone && foundin != SVD) {
651 detIDpre = foundin;
652 trackArmTimeDone = false;
653 }
654 if (foundin == SVD) {
655 RelationVector<SVDCluster> svdClusters = recoHit->getRelationsTo<SVDCluster>(m_storeArrayNameOfSVDHits);
656 clusterTimeSum += svdClusters[0]->getClsTime();
657 clusterTimeSigma2Sum += svdClusters[0]->getClsTimeSigma() * svdClusters[0]->getClsTimeSigma();
658 nSVDHits += 1;
659 svdDone = true;
660 } else {
661 // Compute the track arm times using SVD cluster times
662 if (svdDone && nSVDHits > 1) {
663 detIDpost = foundin;
664 if (!isOutgoingArm(detIDpre, detIDpost)) {
665 m_ingoingArmTime = clusterTimeSum / nSVDHits;
666 m_ingoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
667 m_hasIngoingArmTime = true;
668 m_nSVDHitsOfIngoingArm = nSVDHits;
669 } else {
670 m_outgoingArmTime = clusterTimeSum / nSVDHits;
671 m_outgoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
673 m_nSVDHitsOfOutgoingArm = nSVDHits;
674 }
675 svdDone = false;
676 detIDpre = detIDpost;
677 detIDpost = und;
678 clusterTimeSum = 0;
679 nSVDHits = 0;
680 trackArmTimeDone = true;
681 }
682 }
683
684 // When the last recoHit is SVD, it does not enter in the else{} of if (detID == SVD) {...} else {...}
685 // where the track arm times are calculated, so they are calculated here.
686 // It will not reset all variables because it is run only at the last recoHit
687 if (!trackArmTimeDone && (recoHit == recoHits.back()) && nSVDHits > 1) {
688 if (!isOutgoingArm(detIDpre, detIDpost)) {
689 m_ingoingArmTime = clusterTimeSum / nSVDHits;
690 m_ingoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
691 m_hasIngoingArmTime = true;
692 m_nSVDHitsOfIngoingArm = nSVDHits;
693 } else {
694 m_outgoingArmTime = clusterTimeSum / nSVDHits;
695 m_outgoingArmTimeError = std::sqrt(clusterTimeSigma2Sum / (nSVDHits * (nSVDHits - 1)));
697 m_nSVDHitsOfOutgoingArm = nSVDHits;
698 }
699 }
700 }
701}
RecoHitDetector
The detector this hit comes from (which is of course also visible in the hit type)
int m_nSVDHitsOfOutgoingArm
Number of SVD clusters of the outgoing arm.
Definition: RecoTrack.h:938
int m_nSVDHitsOfIngoingArm
Number of SVD clusters of the ingoing arm.
Definition: RecoTrack.h:940
bool isOutgoingArm(RecoHitInformation::RecoHitDetector pre=RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector, RecoHitInformation::RecoHitDetector post=RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector)
This function returns true if the arm direction is Outgoing and false if the arm direction is Ingoing...
Definition: RecoTrack.cc:703
Class for type safe access to objects that are referred to in relations.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29

◆ extractTrackState()

std::tuple< ROOT::Math::XYZVector, ROOT::Math::XYZVector, short > extractTrackState ( ) const

Return the position, the momentum and the charge of the first measured state on plane or - if unfitted - the seeds.

Helper function to get the seed or the measured state on plane from a track.

Definition at line 499 of file RecoTrack.cc.

500{
501 if (not wasFitSuccessful()) {
502 return std::make_tuple(getPositionSeed(), getMomentumSeed(), getChargeSeed());
503 } else {
504 const auto& measuredStateOnPlane = getMeasuredStateOnPlaneFromFirstHit();
505 return std::make_tuple(ROOT::Math::XYZVector(measuredStateOnPlane.getPos()), ROOT::Math::XYZVector(measuredStateOnPlane.getMom()),
506 measuredStateOnPlane.getCharge());
507 }
508}

◆ flipTrackDirectionAndCharge()

void flipTrackDirectionAndCharge ( const genfit::AbsTrackRep *  representation = nullptr)

Flip the direction of the RecoTrack by inverting the momentum vector and the charge.

In addition, also the ingoing and outgoing arms and arm times are swapped.

Parameters
representationTrack representation to be used to get the MeasuredStateOnPlane at the last hit

Definition at line 724 of file RecoTrack.cc.

725{
726 const genfit::MeasuredStateOnPlane& measuredStateOnPlane = getMeasuredStateOnPlaneFromLastHit(representation);
727 const ROOT::Math::XYZVector& fittedPosition = ROOT::Math::XYZVector(measuredStateOnPlane.getPos());
728 const ROOT::Math::XYZVector& fittedMomentum = ROOT::Math::XYZVector(measuredStateOnPlane.getMom());
729 const double& fittedCharge = measuredStateOnPlane.getCharge();
730
731 // revert the charge and momentum
732 setChargeSeed(-fittedCharge);
733 setPositionAndMomentum(fittedPosition, -fittedMomentum);
735 swapArmTimes();
736 setDirtyFlag();
737}
void setChargeSeed(const short int chargeSeed)
Set the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition: RecoTrack.h:597
void setPositionAndMomentum(const ROOT::Math::XYZVector &positionSeed, const ROOT::Math::XYZVector &momentumSeed)
Set the position and momentum seed of the reco track. ATTENTION: This is not the fitted position or m...
Definition: RecoTrack.h:590
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromLastHit(const genfit::AbsTrackRep *representation=nullptr) const
Return genfit's MeasuredStateOnPlane for the last hit in a fit useful for extrapolation of measuremen...
Definition: RecoTrack.cc:619
void revertRecoHitInformationSorting()
Revert the sorting order of the RecoHitInformation.
Definition: RecoTrack.h:750
void swapArmTimes()
Swap arm times, booleans and nSVDHits.
Definition: RecoTrack.h:1058

◆ get2ndFlipQualityIndicator()

float get2ndFlipQualityIndicator ( ) const
inline

Get the 2nd flipping quality attached to this RecoTrack as a reference for flipping.

Definition at line 864 of file RecoTrack.h.

865 {
867 }
float m_2ndFlipqualityIndicator
Quality index for flipping.
Definition: RecoTrack.h:922

◆ 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

◆ getBKLMHitList()

std::vector< Belle2::RecoTrack::UsedBKLMHit * > getBKLMHitList ( ) const
inline

Return an unsorted list of bklm hits.

Definition at line 458 of file RecoTrack.h.

458{ return getHitList<UsedBKLMHit>(m_storeArrayNameOfBKLMHits); }

◆ getCardinalRepresentation()

genfit::AbsTrackRep * getCardinalRepresentation ( ) const
inline

Get a pointer to the cardinal track representation. You are not allowed to modify or delete it!

Definition at line 631 of file RecoTrack.h.

632 {
634 return m_genfitTrack.getCardinalRep();
635 }
void checkDirtyFlag() const
Helper: Check the dirty flag and produce a warning, whenever a fit result is accessed.
Definition: RecoTrack.h:1066

◆ getCDCHitList()

std::vector< Belle2::RecoTrack::UsedCDCHit * > getCDCHitList ( ) const
inline

Return an unsorted list of cdc hits.

Definition at line 455 of file RecoTrack.h.

455{ return getHitList<UsedCDCHit>(m_storeArrayNameOfCDCHits); }

◆ getChargeSeed()

short int getChargeSeed ( ) const
inline

Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.

Definition at line 508 of file RecoTrack.h.

508{ return m_charge; }

◆ getCreatedTrackPoint()

const genfit::TrackPoint * getCreatedTrackPoint ( const RecoHitInformation recoHitInformation) const

Get a pointer to the TrackPoint that was created from this hit.

Can be a nullptr if no measurement was already created. Please be aware that refitting may or may not recreate the track points and older pointers can be invalidated. Also, pruning a RecoTrack will also delete most of the TrackPoints.

Definition at line 230 of file RecoTrack.cc.

231{
232 int createdTrackPointID = recoHitInformation->getCreatedTrackPointID();
233 if (createdTrackPointID == -1) {
234 return nullptr;
235 }
236
237 return m_genfitTrack.getPoint(createdTrackPointID);
238}
int getCreatedTrackPointID() const
Get the id of the TrackPoint related to this reco hit information in the genfit::Track.

◆ getDirtyFlag()

bool getDirtyFlag ( ) const
inline

This returns true, if a hit was added after the last fit and measurement creation and a refit should be done.

Definition at line 715 of file RecoTrack.h.

715{ return m_dirtyFlag; }

◆ getEKLMHitList()

std::vector< Belle2::RecoTrack::UsedEKLMHit * > getEKLMHitList ( ) const
inline

Return an unsorted list of eklm hits.

Definition at line 461 of file RecoTrack.h.

461{ return getHitList<UsedEKLMHit>(m_storeArrayNameOfEKLMHits); }

◆ getFlipQualityIndicator()

float getFlipQualityIndicator ( ) const
inline

Get the 1st flipping quality attached to this RecoTrack as a reference for flipping.

Definition at line 853 of file RecoTrack.h.

854 {
856 }
float m_flipqualityIndicator
Quality index for flipping.
Definition: RecoTrack.h:920

◆ getFoundByTrackFinder()

OriginTrackFinder getFoundByTrackFinder ( const HitType *  hit) const
inline

Return the found by track finder flag for the given hit (every type) or throws an exception of the hit is not related to the track.

Definition at line 347 of file RecoTrack.h.

348 {
349 RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
350 return recoHitInformation->getFoundByTrackFinder();
351 }
RecoHitInformation * getRecoHitInformationSafely(HitType *hit) const
Returns the reco hit information for a given hit or throws an exception if the hit is not related to ...
Definition: RecoTrack.h:987

◆ getGenfitTrack()

const genfit::Track & getGenfitTrack ( ) const
inline

Returns genfit track.

const casting of the return reference is forbidden! If you need to modify genfit track, please use RecoTrackGenfitAccess::getGenfitTrack(RecoTrack& recoTrack).

Returns
const reference to genfit track

Definition at line 505 of file RecoTrack.h.

505{return m_genfitTrack;}

◆ getHitList()

std::vector< HitType * > getHitList ( const std::string &  storeArrayNameOfHits) const
inlineprivate

Return an unsorted list of hits of the given type in the store array that are related to this track.

Parameters
storeArrayNameOfHitsThe StoreArray to look for.

Definition at line 1044 of file RecoTrack.h.

1045 {
1046 RelationVector<HitType> relatedHits = getRelationsFrom<HitType>(storeArrayNameOfHits);
1047 std::vector<HitType*> hitList;
1048 hitList.reserve(relatedHits.size());
1049 for (HitType& hit : relatedHits) {
1050 // cppcheck-suppress useStlAlgorithm
1051 hitList.push_back(&hit);
1052 }
1053 // cppcheck-suppress returnDanglingLifetime
1054 return hitList;
1055 }

◆ getHitPointsWithMeasurement()

const std::vector< genfit::TrackPoint * > & getHitPointsWithMeasurement ( ) const
inline

Return a list of measurements and track points, which can be used e.g. to extrapolate. You are not allowed to modify or delete them!

Definition at line 708 of file RecoTrack.h.

709 {
711 return m_genfitTrack.getPointsWithMeasurement();
712 }

◆ 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

Get useful information on EventDisplay.

Reimplemented from RelationsInterface< BASE >.

Definition at line 739 of file RecoTrack.cc.

740{
741 std::stringstream out;
742
743 out << "<b>Charge seed</b>=" << getChargeSeed();
744
745 out << "<b>pT seed</b>=" << getMomentumSeed().Rho();
746 out << ", <b>pZ seed</b>=" << getMomentumSeed().Z();
747 out << "<br>";
748 out << "<b>position seed</b>=" << getMomentumSeed().X() << ", " << getMomentumSeed().Y() << ", " << getMomentumSeed().Z();
749 out << "<br>";
750
751 for (const genfit::AbsTrackRep* rep : getRepresentations()) {
752 out << "<b>was fitted with " << rep->getPDG() << "</b>=" << wasFitSuccessful() << ", ";
753 }
754 out << "<br>";
755
756 return out.str();
757}

◆ getIngoingArmTime()

float getIngoingArmTime ( )
inline

Return the track time of the ingoing arm.

Definition at line 528 of file RecoTrack.h.

529 {
531 return m_ingoingArmTime;
532 }
void estimateArmTime()
This function calculates the track time of the ingoing and outgoing arms and their difference.
Definition: RecoTrack.cc:633

◆ getIngoingArmTimeError()

float getIngoingArmTimeError ( )
inline

Return the error of the track time of the ingoing arm.

Definition at line 535 of file RecoTrack.h.

536 {
539 }

◆ getInOutArmTimeDifference()

float getInOutArmTimeDifference ( )
inline

Return the difference between the track times of the ingoing and outgoing arms.

Definition at line 542 of file RecoTrack.h.

◆ getInOutArmTimeDifferenceError()

float getInOutArmTimeDifferenceError ( )
inline

Return the error of the difference between the track times of the ingoing and outgoing arms.

Definition at line 549 of file RecoTrack.h.

◆ getMatchingStatus()

MatchingStatus getMatchingStatus ( ) const
inline

Return the matching status set by the TrackMatcher module.

Definition at line 829 of file RecoTrack.h.

830 {
831 return m_matchingStatus;
832 }
MatchingStatus m_matchingStatus
Flag used in the MCRecoTracksMatcherModule.
Definition: RecoTrack.h:916

◆ getMeasuredStateOnPlaneClosestTo()

const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneClosestTo ( const ROOT::Math::XYZVector &  closestPoint,
const genfit::AbsTrackRep *  representation = nullptr 
)

Return genfit's MasuredStateOnPlane, that is closest to the given point useful for extrapolation of measurements other locations.

Definition at line 426 of file RecoTrack.cc.

428{
430 const unsigned int numberOfPoints = m_genfitTrack.getNumPointsWithMeasurement();
431
432 assert(numberOfPoints > 0);
433
434 const genfit::MeasuredStateOnPlane* nearestStateOnPlane = nullptr;
435 double minimalDistance2 = 0;
436 for (unsigned int hitIndex = 0; hitIndex < numberOfPoints; hitIndex++) {
437 try {
438 const genfit::MeasuredStateOnPlane& measuredStateOnPlane = m_genfitTrack.getFittedState(hitIndex, representation);
439
440 const double currentDistance2 = (ROOT::Math::XYZVector(measuredStateOnPlane.getPos()) - closestPoint).Mag2();
441
442 if (not nearestStateOnPlane or currentDistance2 < minimalDistance2) {
443 nearestStateOnPlane = &measuredStateOnPlane;
444 minimalDistance2 = currentDistance2;
445 }
446 } catch (const genfit::Exception& exception) {
447 B2DEBUG(50, "Can not get mSoP because of: " << exception.what());
448 continue;
449 }
450 }
451
452 // catch case no hit has measured state on plane (not sure how likely that is) which would lead to undefined behavior
453 if (not nearestStateOnPlane) {
454 B2WARNING("Non of the track hits had a MeasuredStateOnPlane! Exception thrown.");
455 throw NoStateOnPlaneFound();
456 }
457
458 return *nearestStateOnPlane;
459}

◆ getMeasuredStateOnPlaneFromFirstHit()

const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromFirstHit ( const genfit::AbsTrackRep *  representation = nullptr) const

Return genfit's MeasuredStateOnPlane for the first hit in a fit useful for extrapolation of measurements to other locations Const version.

Definition at line 605 of file RecoTrack.cc.

606{
607 const unsigned int trackSize = m_genfitTrack.getNumPoints();
608 for (unsigned int i = 0; i < trackSize; i++) {
609 try {
610 return m_genfitTrack.getFittedState(i, representation);
611 } catch (const genfit::Exception& exception) {
612 B2DEBUG(28, "Can not get mSoP because of: " << exception.what());
613 }
614 }
615
616 B2FATAL("There is no single hit with a valid mSoP in this track! Check if the fit failed with wasFitSuccessful before");
617}

◆ getMeasuredStateOnPlaneFromLastHit()

const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromLastHit ( const genfit::AbsTrackRep *  representation = nullptr) const

Return genfit's MeasuredStateOnPlane for the last hit in a fit useful for extrapolation of measurements to other locations Const version.

Definition at line 619 of file RecoTrack.cc.

620{
621 int trackSize = m_genfitTrack.getNumPoints();
622 for (int i = -1; i >= -trackSize; i--) {
623 try {
624 return m_genfitTrack.getFittedState(i, representation);
625 } catch (const genfit::Exception& exception) {
626 B2DEBUG(28, "Can not get mSoP because of: " << exception.what());
627 }
628 }
629
630 B2FATAL("There is no single hit with a valid mSoP in this track!");
631}

◆ getMeasuredStateOnPlaneFromRecoHit()

const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromRecoHit ( const RecoHitInformation recoHitInfo,
const genfit::AbsTrackRep *  representation = nullptr 
) const

Return genfit's MeasuredStateOnPlane on plane for associated with one RecoHitInformation.

The caller needs to ensure that recoHitInfo->useInFit() is true and the a fit has been performed on the track, a.k.a. hasTrackFitStatus() == true

Definition at line 579 of file RecoTrack.cc.

581{
583
584 if (!hasTrackFitStatus(representation)) {
585 B2FATAL("MeasuredStateOnPlane can not be retrieved for RecoTracks where no fit has been attempted.");
586 }
587
588 if (!recoHitInfo->useInFit()) {
589 B2FATAL("MeasuredStateOnPlane cannot be provided for RecoHit which was not used in the fit.");
590 }
591
592 const auto* hitTrackPoint = getCreatedTrackPoint(recoHitInfo);
593 if (not hitTrackPoint) {
594 B2FATAL("TrackPoint was requested which has not been created");
595 }
596
597 const auto* fittedResult = hitTrackPoint->getFitterInfo(representation);
598 if (not fittedResult) {
599 throw NoTrackFitResult();
600 }
601
602 return fittedResult->getFittedState();
603}
bool useInFit() const
Get the flag, whether this his should be used in a fit or not.
bool hasTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Check, if there is a fit status for the given representation or for the cardinal one.
Definition: RecoTrack.cc:543

◆ getMomentumSeed()

ROOT::Math::XYZVector getMomentumSeed ( ) const
inline

Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.

Definition at line 487 of file RecoTrack.h.

488 {
489 const TVectorD& seed = m_genfitTrack.getStateSeed();
490 return ROOT::Math::XYZVector(seed(3), seed(4), seed(5));
491 }

◆ getName()

virtual std::string getName ( ) const
inlinevirtualinherited

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

pi+ for an MCParticle.

Reimplemented in Particle, MCParticle, and SpacePoint.

Definition at line 344 of file RelationsObject.h.

344{ return ""; }

◆ getNSVDHitsOfIngoingArm()

int getNSVDHitsOfIngoingArm ( )
inline

Return the number of clusters used to estimate the ingoing arm time.

Definition at line 575 of file RecoTrack.h.

576 {
578 }

◆ getNSVDHitsOfOutgoingArm()

int getNSVDHitsOfOutgoingArm ( )
inline

Return the number of clusters used to estimate the outgoing arm time.

Definition at line 569 of file RecoTrack.h.

570 {
572 }

◆ getNumberOfBKLMHits()

unsigned int getNumberOfBKLMHits ( ) const
inline

Return the number of bklm hits.

Definition at line 430 of file RecoTrack.h.

430{ return getNumberOfHitsOfGivenType<UsedBKLMHit>(m_storeArrayNameOfBKLMHits); }

◆ getNumberOfCDCHits()

unsigned int getNumberOfCDCHits ( ) const
inline

Return the number of cdc hits.

Definition at line 427 of file RecoTrack.h.

427{ return getNumberOfHitsOfGivenType<UsedCDCHit>(m_storeArrayNameOfCDCHits); }

◆ getNumberOfEKLMHits()

unsigned int getNumberOfEKLMHits ( ) const
inline

Return the number of eklm hits.

Definition at line 433 of file RecoTrack.h.

433{ return getNumberOfHitsOfGivenType<UsedEKLMHit>(m_storeArrayNameOfEKLMHits); }

◆ getNumberOfHitsOfGivenType()

unsigned int getNumberOfHitsOfGivenType ( const std::string &  storeArrayNameOfHits) const
inlineprivate

Get the number of hits for the given hit type in the store array that are related to this track.

Parameters
storeArrayNameOfHitsThe StoreArray to look for.

Definition at line 1002 of file RecoTrack.h.

1003 {
1004 return getRelationsFrom<HitType>(storeArrayNameOfHits).size();
1005 }

◆ getNumberOfPXDHits()

unsigned int getNumberOfPXDHits ( ) const
inline

Return the number of pxd hits.

Definition at line 421 of file RecoTrack.h.

421{ return getNumberOfHitsOfGivenType<UsedPXDHit>(m_storeArrayNameOfPXDHits); }

◆ getNumberOfSVDHits()

unsigned int getNumberOfSVDHits ( ) const
inline

Return the number of svd hits.

Definition at line 424 of file RecoTrack.h.

424{ return getNumberOfHitsOfGivenType<UsedSVDHit>(m_storeArrayNameOfSVDHits); }

◆ getNumberOfTotalHits()

unsigned int getNumberOfTotalHits ( ) const
inline

Return the number of cdc + svd + pxd + bklm + eklm hits.

Definition at line 436 of file RecoTrack.h.

437 {
440 }
unsigned int getNumberOfBKLMHits() const
Return the number of bklm hits.
Definition: RecoTrack.h:430
unsigned int getNumberOfEKLMHits() const
Return the number of eklm hits.
Definition: RecoTrack.h:433
unsigned int getNumberOfSVDHits() const
Return the number of svd hits.
Definition: RecoTrack.h:424
unsigned int getNumberOfCDCHits() const
Return the number of cdc hits.
Definition: RecoTrack.h:427
unsigned int getNumberOfPXDHits() const
Return the number of pxd hits.
Definition: RecoTrack.h:421

◆ getNumberOfTrackingHits()

unsigned int getNumberOfTrackingHits ( ) const
inline

Return the number of cdc + svd + pxd hits.

Definition at line 443 of file RecoTrack.h.

444 {
446 }

◆ getOutgoingArmTime()

float getOutgoingArmTime ( )
inline

Return the track time of the outgoing arm.

Definition at line 514 of file RecoTrack.h.

515 {
517 return m_outgoingArmTime;
518 }

◆ getOutgoingArmTimeError()

float getOutgoingArmTimeError ( )
inline

Return the error of the track time of the outgoing arm.

Definition at line 521 of file RecoTrack.h.

522 {
525 }

◆ getPositionSeed()

ROOT::Math::XYZVector getPositionSeed ( ) const
inline

Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.

Definition at line 480 of file RecoTrack.h.

481 {
482 const TVectorD& seed = m_genfitTrack.getStateSeed();
483 return ROOT::Math::XYZVector(seed(0), seed(1), seed(2));
484 }

◆ getPXDHitList()

std::vector< Belle2::RecoTrack::UsedPXDHit * > getPXDHitList ( ) const
inline

Return an unsorted list of pxd hits.

Definition at line 449 of file RecoTrack.h.

449{ return getHitList<UsedPXDHit>(m_storeArrayNameOfPXDHits); }

◆ getQualityIndicator()

float getQualityIndicator ( ) const
inline

Get the quality index attached to this RecoTrack given by one of the reconstruction algorithms. 0 means likely fake.

Definition at line 841 of file RecoTrack.h.

842 {
843 return m_qualityIndicator;
844 }
float m_qualityIndicator
Quality index for classification of fake vs. MC-matched Tracks.
Definition: RecoTrack.h:918

◆ getRecoHitInformation()

RecoHitInformation * getRecoHitInformation ( HitType *  hit) const
inline

Return the reco hit information for a generic hit from the storeArray.

Parameters
hitthe hit to look for.
Returns
The connected RecoHitInformation or a nullptr when the hit is not connected to the track.

Definition at line 312 of file RecoTrack.h.

313 {
314 RelationVector<RecoHitInformation> relatedHitInformationToHit = hit->template getRelationsFrom<RecoHitInformation>
316
317 for (RecoHitInformation& recoHitInformation : relatedHitInformationToHit) {
318 // cppcheck-suppress useStlAlgorithm
319 if (recoHitInformation.getRelatedFrom<RecoTrack>(this->getArrayName()) == this) {
320 // cppcheck-suppress returnDanglingLifetime
321 return &recoHitInformation;
322 }
323 }
324
325 return nullptr;
326 }
RecoTrack()
Empty constructor for ROOT. Do not use!
Definition: RecoTrack.h:140

◆ getRecoHitInformations()

std::vector< RecoHitInformation * > getRecoHitInformations ( bool  getSorted = false) const

Return a list of all RecoHitInformations associated with the RecoTrack.

This is especially useful when you want to iterate over all (fitted) hits in a track without caring whether its a CDC, VXD etc hit.

Parameters
getSortedif true, the list of RecoHitInformations will be returned sorted by the Sorting parameter in an ascending order. If false, the hits will be returned unsorted.

Definition at line 557 of file RecoTrack.cc.

558{
559 std::vector<RecoHitInformation*> hitList;
560 RelationVector<RecoHitInformation> recoHitInformations = getRelationsTo<RecoHitInformation>
562
563 hitList.reserve(recoHitInformations.size());
564 for (auto& recoHit : recoHitInformations) {
565 hitList.push_back(&recoHit);
566 }
567
568 // sort the returned vector if requested
569 if (getSorted) {
570 std::sort(hitList.begin(), hitList.end(), [](const RecoHitInformation * a,
571 const RecoHitInformation * b) -> bool {
572 return a->getSortingParameter() < b->getSortingParameter();
573 });
574 }
575
576 return hitList;
577}
size_t size() const
Get number of relations.

◆ getRecoHitInformationSafely()

RecoHitInformation * getRecoHitInformationSafely ( HitType *  hit) const
inlineprivate

Returns the reco hit information for a given hit or throws an exception if the hit is not related to the track.

Definition at line 987 of file RecoTrack.h.

988 {
989 RecoHitInformation* recoHitInformation = getRecoHitInformation(hit);
990 if (recoHitInformation == nullptr) {
991 B2FATAL("Queried hit is not in the reco track! Did you prune it?");
992 } else {
993 return recoHitInformation;
994 }
995 }

◆ 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 }

◆ getRepresentations()

const std::vector< genfit::AbsTrackRep * > & getRepresentations ( ) const
inline

Return a list of track representations. You are not allowed to modify or delete them!

Definition at line 638 of file RecoTrack.h.

639 {
641 return m_genfitTrack.getTrackReps();
642 }

◆ getRightLeftInformation()

RightLeftInformation getRightLeftInformation ( const HitType *  hit) const
inline

Return the right left information of a given hit (every type) or throws an exception of the hit is not related to the track.

Definition at line 339 of file RecoTrack.h.

340 {
341 RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
342 return recoHitInformation->getRightLeftInformation();
343 }

◆ getSeedCovariance()

const TMatrixDSym & getSeedCovariance ( ) const
inline

Return the covariance matrix of the seed. ATTENTION: This is not the fitted covariance.

Definition at line 611 of file RecoTrack.h.

611{ return m_genfitTrack.getCovSeed(); }

◆ getSortedBKLMHitList()

std::vector< Belle2::RecoTrack::UsedBKLMHit * > getSortedBKLMHitList ( ) const
inline

Return a sorted list of bklm hits. Sorted by the sortingParameter.

Definition at line 473 of file RecoTrack.h.

473{ return getSortedHitList<UsedBKLMHit>(m_storeArrayNameOfBKLMHits); }

◆ getSortedCDCHitList()

std::vector< Belle2::RecoTrack::UsedCDCHit * > getSortedCDCHitList ( ) const
inline

Return a sorted list of cdc hits. Sorted by the sortingParameter.

Definition at line 470 of file RecoTrack.h.

470{ return getSortedHitList<UsedCDCHit>(m_storeArrayNameOfCDCHits); }

◆ getSortedEKLMHitList()

std::vector< Belle2::RecoTrack::UsedEKLMHit * > getSortedEKLMHitList ( ) const
inline

Return a sorted list of eklm hits. Sorted by the sortingParameter.

Definition at line 476 of file RecoTrack.h.

476{ return getSortedHitList<UsedEKLMHit>(m_storeArrayNameOfEKLMHits); }

◆ getSortedHitList()

std::vector< HitType * > getSortedHitList ( const std::string &  storeArrayNameOfHits) const
inlineprivate

Return a sorted list of hits of the given type in the store array that are related to this track.

Parameters
storeArrayNameOfHitsThe StoreArray to look for.

Definition at line 1012 of file RecoTrack.h.

1013 {
1014 const RelationVector<RecoHitInformation>& relatedHitInformation = getRelationsTo<RecoHitInformation>
1016
1017 std::vector<const RecoHitInformation*> relatedHitInformationAsVector;
1018 relatedHitInformationAsVector.reserve(relatedHitInformation.size());
1019 for (const RecoHitInformation& hitInformation : relatedHitInformation) {
1020 // cppcheck-suppress useStlAlgorithm
1021 relatedHitInformationAsVector.push_back(&hitInformation);
1022 }
1023 std::sort(relatedHitInformationAsVector.begin(), relatedHitInformationAsVector.end(), [](const RecoHitInformation * a,
1024 const RecoHitInformation * b) -> bool {
1025 return a->getSortingParameter() < b->getSortingParameter();
1026 });
1027
1028 std::vector<HitType*> hitList;
1029 hitList.reserve(relatedHitInformationAsVector.size());
1030 for (const RecoHitInformation* hitInformation : relatedHitInformationAsVector) {
1031 HitType* relatedHit = hitInformation->getRelatedTo<HitType>(storeArrayNameOfHits);
1032 if (relatedHit != nullptr) {
1033 hitList.push_back(relatedHit);
1034 }
1035 }
1036 return hitList;
1037 }

◆ getSortedPXDHitList()

std::vector< Belle2::RecoTrack::UsedPXDHit * > getSortedPXDHitList ( ) const
inline

Return a sorted list of pxd hits. Sorted by the sortingParameter.

Definition at line 464 of file RecoTrack.h.

464{ return getSortedHitList<UsedPXDHit>(m_storeArrayNameOfPXDHits); }

◆ getSortedSVDHitList()

std::vector< Belle2::RecoTrack::UsedSVDHit * > getSortedSVDHitList ( ) const
inline

Return a sorted list of svd hits. Sorted by the sortingParameter.

Definition at line 467 of file RecoTrack.h.

467{ return getSortedHitList<UsedSVDHit>(m_storeArrayNameOfSVDHits); }

◆ getSortingParameter()

unsigned int getSortingParameter ( const HitType *  hit) const
inline

Return the sorting parameter for a given hit (every type) or throws an exception of the hit is not related to the track.

Definition at line 355 of file RecoTrack.h.

356 {
357 RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
358 return recoHitInformation->getSortingParameter();
359 }

◆ getStateSeed()

const TVectorD & getStateSeed ( ) const
inline

Return the state seed in the form posX, posY, posZ, momX, momY, momZ. ATTENTION: This is not the fitted state.

Definition at line 494 of file RecoTrack.h.

495 {
496 return m_genfitTrack.getStateSeed();
497 }

◆ getStoreArrayNameOfBKLMHits()

const std::string & getStoreArrayNameOfBKLMHits ( ) const
inline

Name of the store array of the bklm hits.

Definition at line 741 of file RecoTrack.h.

◆ getStoreArrayNameOfCDCHits()

const std::string & getStoreArrayNameOfCDCHits ( ) const
inline

Name of the store array of the cdc hits.

Definition at line 738 of file RecoTrack.h.

◆ getStoreArrayNameOfEKLMHits()

const std::string & getStoreArrayNameOfEKLMHits ( ) const
inline

Name of the store array of the eklm hits.

Definition at line 744 of file RecoTrack.h.

◆ getStoreArrayNameOfPXDHits()

const std::string & getStoreArrayNameOfPXDHits ( ) const
inline

Name of the store array of the pxd hits.

Definition at line 732 of file RecoTrack.h.

◆ getStoreArrayNameOfRecoHitInformation()

const std::string & getStoreArrayNameOfRecoHitInformation ( ) const
inline

Name of the store array of the reco hit information.

Definition at line 747 of file RecoTrack.h.

◆ getStoreArrayNameOfSVDHits()

const std::string & getStoreArrayNameOfSVDHits ( ) const
inline

Name of the store array of the svd hits.

Definition at line 735 of file RecoTrack.h.

◆ getSVDHitList()

std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList ( ) const
inline

Return an unsorted list of svd hits.

Definition at line 452 of file RecoTrack.h.

452{ return getHitList<UsedSVDHit>(m_storeArrayNameOfSVDHits); }

◆ getTimeSeed()

double getTimeSeed ( ) const
inline

Return the time seed stored in the reco track. ATTENTION: This is not the fitted time.

Definition at line 511 of file RecoTrack.h.

511{ return m_genfitTrack.getTimeSeed(); }

◆ getTrackFitStatus()

const genfit::FitStatus * getTrackFitStatus ( const genfit::AbsTrackRep *  representation = nullptr) const
inline

Return the track fit status for the given representation or for the cardinal one. You are not allowed to modify or delete it!

Definition at line 621 of file RecoTrack.h.

622 {
624 return m_genfitTrack.getFitStatus(representation);
625 }

◆ getTrackingDetector()

TrackingDetector getTrackingDetector ( const HitType *  hit) const
inline

Return the tracking detector of a given hit (every type) or throws an exception of the hit is not related to the track.

Definition at line 331 of file RecoTrack.h.

332 {
333 RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
334 return recoHitInformation->getTrackingDetector();
335 }

◆ getTrackRepresentationForPDG()

genfit::AbsTrackRep * getTrackRepresentationForPDG ( int  pdgCode) const

Return an already created track representation of the given reco track for the PDG.

You are not allowed to modify this TrackRep! Will return nulltpr if a trackRep is not available for the given pdgCode.

Parameters
pdgCodePDG code of the track representations, only positive PDG numbers are allowed

Definition at line 475 of file RecoTrack.cc.

476{
477 if (pdgCode < 0) {
478 B2FATAL("Only positive pdgCode is possible when calling getTrackRepresentationForPDG, got " << pdgCode);
479 }
480
481 const std::vector<genfit::AbsTrackRep*>& trackRepresentations = getRepresentations();
482
483 for (genfit::AbsTrackRep* trackRepresentation : trackRepresentations) {
484 // Check if the track representation is a RKTrackRep.
485 const genfit::RKTrackRep* rkTrackRepresenation = dynamic_cast<const genfit::RKTrackRep*>(trackRepresentation);
486 if (rkTrackRepresenation != nullptr) {
487 // take the absolute value of the PDG code as the TrackRep holds the PDG code including the charge (so -13 or 13)
488 if (std::abs(rkTrackRepresenation->getPDG()) == pdgCode) {
489 return trackRepresentation;
490 }
491 }
492 }
493
494 return nullptr;
495}

◆ hasBKLMHits()

bool hasBKLMHits ( ) const
inline

Returns true if the track has bklm hits.

Definition at line 404 of file RecoTrack.h.

404{ return getRelatedFrom<UsedBKLMHit>(m_storeArrayNameOfBKLMHits) != nullptr; }

◆ hasCDCHits()

bool hasCDCHits ( ) const
inline

Returns true if the track has cdc hits.

Definition at line 401 of file RecoTrack.h.

401{ return getRelatedFrom<UsedCDCHit>(m_storeArrayNameOfCDCHits) != nullptr; }

◆ hasEKLMHits()

bool hasEKLMHits ( ) const
inline

Returns true if the track has eklm hits.

Definition at line 407 of file RecoTrack.h.

407{ return getRelatedFrom<UsedEKLMHit>(m_storeArrayNameOfEKLMHits) != nullptr; }

◆ hasHit()

bool hasHit ( const HitType *  hit) const
inline

Returns true if the given hit is in the track.

Definition at line 411 of file RecoTrack.h.

412 {
413 const RelationVector<RecoTrack>& relatedTracksToHit = hit->template getRelationsTo<RecoTrack>(getArrayName());
414 return std::find_if(relatedTracksToHit.begin(), relatedTracksToHit.end(), [this](const RecoTrack & recoTrack) {
415 return &recoTrack == this;
416 }) != relatedTracksToHit.end();
417 }
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.

◆ hasIngoingArmTime()

bool hasIngoingArmTime ( )
inline

Check if the ingoing arm time is set.

Definition at line 557 of file RecoTrack.h.

558 {
559 return m_hasIngoingArmTime;
560 }

◆ hasOutgoingArmTime()

bool hasOutgoingArmTime ( )
inline

Check if the outgoing arm time is set.

Definition at line 563 of file RecoTrack.h.

564 {
566 }

◆ hasPXDHits()

bool hasPXDHits ( ) const
inline

Returns true if the track has pxd hits.

Definition at line 395 of file RecoTrack.h.

395{ return getRelatedFrom<UsedPXDHit>(m_storeArrayNameOfPXDHits) != nullptr; }

◆ hasSVDHits()

bool hasSVDHits ( ) const
inline

Returns true if the track has svd hits.

Definition at line 398 of file RecoTrack.h.

398{ return getRelatedFrom<UsedSVDHit>(m_storeArrayNameOfSVDHits) != nullptr; }

◆ hasTrackFitStatus()

bool hasTrackFitStatus ( const genfit::AbsTrackRep *  representation = nullptr) const

Check, if there is a fit status for the given representation or for the cardinal one.

Definition at line 543 of file RecoTrack.cc.

544{
546
547 // there might be the case, where the genfit track has no trackreps, even not the cardinal
548 // one because no fit attempt was performed. In this case, the "hasFitStatus" call to genfit
549 // will fail with an access violation. To prevent that, check for the number of reps here before
550 // actually calling genfit's hasFitStatus(...)
551 if (m_genfitTrack.getNumReps() == 0)
552 return false;
553
554 return m_genfitTrack.hasFitStatus(representation);
555}

◆ isOutgoingArm()

bool isOutgoingArm ( RecoHitInformation::RecoHitDetector  pre = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector,
RecoHitInformation::RecoHitDetector  post = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector 
)

This function returns true if the arm direction is Outgoing and false if the arm direction is Ingoing.

The detector sequences considered are: outgoing arm: PXD-SVD-CDC, PXD-SVD, SVD-CDC; ingoing arm: CDC-SVD-PXD, CDC-SVD, SVD-PXD; pre and post are defined w.r.t SVD, so they can be PXD, CDC or undefined if one of the two is missing

Definition at line 703 of file RecoTrack.cc.

704{
705 static RecoHitInformation::RecoHitDetector und = RecoHitInformation::RecoHitDetector::c_undefinedTrackingDetector;
706 RecoHitInformation::RecoHitDetector PXD = RecoHitInformation::RecoHitDetector::c_PXD;
707 RecoHitInformation::RecoHitDetector CDC = RecoHitInformation::RecoHitDetector::c_CDC;
708 bool isOutgoing = true;
709 if (pre == PXD && post == CDC) isOutgoing = true;
710 else if (pre == und && post == CDC) isOutgoing = true;
711 else if (pre == PXD && post == und) isOutgoing = true;
712 else if (pre == CDC && post == PXD) isOutgoing = false;
713 else if (pre == und && post == PXD) isOutgoing = false;
714 else if (pre == CDC && post == und) isOutgoing = false;
715 else {
716 //TO DO
717 B2DEBUG(29,
718 "SVD-only? PXD-SVD-PXD??? --- use layer information to determine if the track arm is outgoing or ingoing! Considered --> 'OUT'");
719 isOutgoing = true;
720 }
721 return isOutgoing;
722}

◆ mapOnHits() [1/4]

void mapOnHits ( const std::string &  storeArrayNameOfHits,
std::function< void(const RecoHitInformation &, const HitType *)> const &  mapFunction 
) const
inline

Call a function on all hits of the given type in the store array, that are related to this track.

Const version.

Parameters
storeArrayNameOfHitsThe store array the hits should come from.
mapFunctionCall this function for every hit (with its reco hit information)

Definition at line 821 of file RecoTrack.h.

823 {
824 mapOnHits<HitType>(storeArrayNameOfHits, mapFunction, [](const RecoHitInformation&, const HitType*) -> bool { return true; });
825 }

◆ mapOnHits() [2/4]

void mapOnHits ( const std::string &  storeArrayNameOfHits,
std::function< void(const RecoHitInformation &, const HitType *)> const &  mapFunction,
std::function< bool(const RecoHitInformation &, const HitType *)> const &  pickFunction 
) const
inline

Call a function on all hits of the given type in the store array, that are related to this track.

Const version.

Parameters
storeArrayNameOfHitsThe store array the hits should come from.
mapFunctionCall this function for every hit (with its reco hit information)
pickFunctionUse only those hits where the function returns true.

Definition at line 788 of file RecoTrack.h.

791 {
792 RelationVector<RecoHitInformation> relatedHitInformation = getRelationsTo<RecoHitInformation>
794
795 for (const RecoHitInformation& hitInformation : relatedHitInformation) {
796 const HitType* const hit = hitInformation.getRelatedTo<HitType>(storeArrayNameOfHits);
797 if (hit != nullptr && pickFunction(hitInformation, hit)) {
798 mapFunction(hitInformation, hit);
799 }
800 }
801 }

◆ mapOnHits() [3/4]

void mapOnHits ( const std::string &  storeArrayNameOfHits,
std::function< void(RecoHitInformation &, HitType *)> const &  mapFunction 
)
inline

Call a function on all hits of the given type in the store array, that are related to this track.

Parameters
storeArrayNameOfHitsThe store array the hits should come from.
mapFunctionCall this function for every hit (with its reco hit information)

Definition at line 809 of file RecoTrack.h.

811 {
812 mapOnHits<HitType>(storeArrayNameOfHits, mapFunction, [](const RecoHitInformation&, const HitType*) -> bool { return true; });
813 }

◆ mapOnHits() [4/4]

void mapOnHits ( const std::string &  storeArrayNameOfHits,
std::function< void(RecoHitInformation &, HitType *)> const &  mapFunction,
std::function< bool(const RecoHitInformation &, const HitType *)> const &  pickFunction 
)
inline

Call a function on all hits of the given type in the store array, that are related to this track.

Parameters
storeArrayNameOfHitsThe store array the hits should come from.
mapFunctionCall this function for every hit (with its reco hit information)
pickFunctionUse only those hits where the function returns true.

Definition at line 766 of file RecoTrack.h.

769 {
770 RelationVector<RecoHitInformation> relatedHitInformation = getRelationsTo<RecoHitInformation>
772
773 for (RecoHitInformation& hitInformation : relatedHitInformation) {
774 HitType* const hit = hitInformation.getRelatedTo<HitType>(storeArrayNameOfHits);
775 if (hit != nullptr && pickFunction(hitInformation, hit)) {
776 mapFunction(hitInformation, hit);
777 }
778 }
779 }

◆ prune()

void prune ( )

Prune the genfit track, e.g.

remove all track points with measurements, but the first and the last one. Also, set the flags of the corresponding RecoHitInformation to pruned. Only to be used in the prune module.

Definition at line 375 of file RecoTrack.cc.

376{
377 // "Delete" all RecoHitInfromation but the first and the last.
378 // Copy is intended!
379 std::vector<RelationEntry> relatedRecoHitInformations = getRelationsWith<RecoHitInformation>
381 std::sort(relatedRecoHitInformations.begin(), relatedRecoHitInformations.end(), [](const RelationEntry & lhs,
382 const RelationEntry & rhs) {
383 return dynamic_cast<RecoHitInformation*>(lhs.object)->getSortingParameter() > dynamic_cast<RecoHitInformation*>
384 (rhs.object)->getSortingParameter();
385 });
386
387 // "Prune" all RecoHitInformation but the first and the last.
388 for (unsigned int i = 1; i < relatedRecoHitInformations.size() - 1; ++i) {
389 dynamic_cast<RecoHitInformation*>(relatedRecoHitInformations[i].object)->setFlag(RecoHitInformation::RecoHitFlag::c_pruned);
390 dynamic_cast<RecoHitInformation*>(relatedRecoHitInformations[i].object)->setCreatedTrackPointID(-1);
391 }
392
393 // Genfits prune method fails, if the number of hits is too small.
394 if (getHitPointsWithMeasurement().size() >= 2) {
395 m_genfitTrack.prune("FL");
396 }
397}
const std::vector< genfit::TrackPoint * > & getHitPointsWithMeasurement() const
Return a list of measurements and track points, which can be used e.g. to extrapolate....
Definition: RecoTrack.h:708
Struct for relations.
Definition: RelationEntry.h:24

◆ registerRequiredRelations()

void registerRequiredRelations ( StoreArray< RecoTrack > &  recoTracks,
std::string const &  pxdHitsStoreArrayName = "",
std::string const &  svdHitsStoreArrayName = "",
std::string const &  cdcHitsStoreArrayName = "",
std::string const &  bklmHitsStoreArrayName = "",
std::string const &  eklmHitsStoreArrayName = "",
std::string const &  recoHitInformationStoreArrayName = "" 
)
static

Convenience method which registers all relations required to fully use a RecoTrack.

If you create a new RecoTrack StoreArray, call this method in the initialize() method of your module. Note that the BKLM and EKLM relations may not be registered because the KLM modules are loaded after tracking; in this case, a second call of this method is required after creation of the BKLM and EKLM hits store arrays.

Parameters
recoTracksReference to the store array where the new RecoTrack list is located
pxdHitsStoreArrayNamename of the StoreArray holding the PXDClusters lists
svdHitsStoreArrayNamename of the StoreArray holding the SVDClusters lists
cdcHitsStoreArrayNamename of the StoreArray holding the CDCHits lists
bklmHitsStoreArrayNamename of the StoreArray holding the BKLMHits lists
eklmHitsStoreArrayNamename of the StoreArray holding the EKLMHits lists
recoHitInformationStoreArrayNamename of the StoreArray holding RecoHitInformation lists

Definition at line 53 of file RecoTrack.cc.

61{
62 StoreArray<RecoHitInformation> recoHitInformations(recoHitInformationStoreArrayName);
63 recoHitInformations.registerInDataStore();
64 recoTracks.registerRelationTo(recoHitInformations);
65
66 StoreArray<RecoHitInformation::UsedPXDHit> pxdHits(pxdHitsStoreArrayName);
67 if (pxdHits.isOptional()) {
68 pxdHits.registerRelationTo(recoTracks);
69 recoHitInformations.registerRelationTo(pxdHits);
70 }
71
72 StoreArray<RecoHitInformation::UsedSVDHit> svdHits(svdHitsStoreArrayName);
73 if (svdHits.isOptional()) {
74 svdHits.registerRelationTo(recoTracks);
75 recoHitInformations.registerRelationTo(svdHits);
76 }
77
78 StoreArray<RecoHitInformation::UsedCDCHit> cdcHits(cdcHitsStoreArrayName);
79 if (cdcHits.isOptional()) {
80 cdcHits.registerRelationTo(recoTracks);
81 recoHitInformations.registerRelationTo(cdcHits);
82 }
83
84 StoreArray<RecoHitInformation::UsedBKLMHit> bklmHits(bklmHitsStoreArrayName);
85 if (bklmHits.isOptional()) {
86 bklmHits.registerRelationTo(recoTracks);
87 recoHitInformations.registerRelationTo(bklmHits);
88 }
89
90 StoreArray<RecoHitInformation::UsedEKLMHit> eklmHits(eklmHitsStoreArrayName);
91 if (eklmHits.isOptional()) {
92 eklmHits.registerRelationTo(recoTracks);
93 recoHitInformations.registerRelationTo(eklmHits);
94 }
95}
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition: StoreArray.h:140

◆ revertRecoHitInformationSorting()

void revertRecoHitInformationSorting ( )
inline

Revert the sorting order of the RecoHitInformation.

Definition at line 750 of file RecoTrack.h.

751 {
752 const uint recoHitInformationSize = getRecoHitInformations().size();
753 for (auto RecoHitInfo : getRecoHitInformations()) {
754 // The "-1" ensures that the sorting parameter still is in range 0...size-1 instead of 1...size
755 RecoHitInfo->setSortingParameter(recoHitInformationSize - RecoHitInfo->getSortingParameter() - 1);
756 }
757 }

◆ set2ndFlipQualityIndicator()

void set2ndFlipQualityIndicator ( const float  qualityIndicator)
inline

Set the 2nd flipping quality attached to this RecoTrack.

Definition at line 870 of file RecoTrack.h.

871 {
872 m_2ndFlipqualityIndicator = qualityIndicator;
873 }

◆ setChargeSeed()

void setChargeSeed ( const short int  chargeSeed)
inline

Set the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.

Definition at line 597 of file RecoTrack.h.

598 {
599 m_charge = chargeSeed;
601 }
void deleteFittedInformation()
Delete all fitted information for all representations.
Definition: RecoTrack.cc:462

◆ setDirtyFlag()

void setDirtyFlag ( const bool &  dirtyFlag = true)
inline

Set to true, if you want to rebuild the measurements and do the fit independent on changes of the hit content.

You can use this setting if you want to use other measurement creators than before (probably non-default settings) or different fitting algorithms.

Definition at line 722 of file RecoTrack.h.

723 {
724 m_dirtyFlag = dirtyFlag;
725 if (dirtyFlag) {
727 }
728 }

◆ setFlipQualityIndicator()

void setFlipQualityIndicator ( const float  qualityIndicator)
inline

Set the 1st flipping quality attached to this RecoTrack.

Definition at line 859 of file RecoTrack.h.

860 {
861 m_flipqualityIndicator = qualityIndicator;
862 }

◆ setFoundByTrackFinder()

void setFoundByTrackFinder ( const HitType *  hit,
OriginTrackFinder  originTrackFinder 
)
inline

Set the found by track finder flag or throws an exception of the hit is not related to the track.

Definition at line 372 of file RecoTrack.h.

373 {
374 RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
375 recoHitInformation->setFoundByTrackFinder(originTrackFinder);
376 }

◆ setMatchingStatus()

void setMatchingStatus ( MatchingStatus  matchingStatus)
inline

Set the matching status (used by the TrackMatcher module)

Definition at line 835 of file RecoTrack.h.

836 {
837 m_matchingStatus = matchingStatus;
838 }

◆ setPositionAndMomentum()

void setPositionAndMomentum ( const ROOT::Math::XYZVector &  positionSeed,
const ROOT::Math::XYZVector &  momentumSeed 
)
inline

Set the position and momentum seed of the reco track. ATTENTION: This is not the fitted position or momentum.

Definition at line 590 of file RecoTrack.h.

591 {
592 m_genfitTrack.setStateSeed(XYZToTVector(positionSeed), XYZToTVector(momentumSeed));
594 }

◆ setQualityIndicator()

void setQualityIndicator ( const float  qualityIndicator)
inline

Set the quality index attached to this RecoTrack. 0 means likely fake.

Definition at line 847 of file RecoTrack.h.

848 {
849 m_qualityIndicator = qualityIndicator;
850 }

◆ setRightLeftInformation()

void setRightLeftInformation ( const HitType *  hit,
RightLeftInformation  rightLeftInformation 
)
inline

Set the right left information or throws an exception of the hit is not related to the track. Will set the dirty flag!

Definition at line 363 of file RecoTrack.h.

364 {
365 RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
366 recoHitInformation->setRightLeftInformation(rightLeftInformation);
367 setDirtyFlag();
368 }

◆ setSeedCovariance()

void setSeedCovariance ( const TMatrixDSym &  seedCovariance)
inline

Set the covariance of the seed. ATTENTION: This is not the fitted covariance.

Definition at line 614 of file RecoTrack.h.

614{ m_genfitTrack.setCovSeed(seedCovariance); }

◆ setSortingParameter()

void setSortingParameter ( const HitType *  hit,
unsigned int  sortingParameter 
)
inline

Set the sorting parameter or throws an exception of the hit is not related to the track. Will set the dirty flag!

Definition at line 380 of file RecoTrack.h.

381 {
382 RecoHitInformation* recoHitInformation = getRecoHitInformationSafely(hit);
383 recoHitInformation->setSortingParameter(sortingParameter);
384 setDirtyFlag();
385 }

◆ setTimeSeed()

void setTimeSeed ( const double  timeSeed)
inline

Set the time seed. ATTENTION: This is not the fitted time.

Definition at line 604 of file RecoTrack.h.

605 {
606 m_genfitTrack.setTimeSeed(timeSeed);
608 }

◆ swapArmTimes()

void swapArmTimes ( )
inlineprivate

Swap arm times, booleans and nSVDHits.

Definition at line 1058 of file RecoTrack.h.

◆ wasFitSuccessful()

bool wasFitSuccessful ( const genfit::AbsTrackRep *  representation = nullptr) const

Returns true if the last fit with the given representation was successful.

Definition at line 336 of file RecoTrack.cc.

337{
339
340 if (getRepresentations().empty()) {
341 return false;
342 }
343
344 if (not hasTrackFitStatus(representation)) {
345 return false;
346 }
347
348 const genfit::FitStatus* fs = getTrackFitStatus(representation);
349 if (not fs) {
350 return false;
351 }
352 if (not fs->isFitConverged()) {
353 return false;
354 }
355
356 // make sure we only consider fitted if the Kalman method was used
357 if (not dynamic_cast<const genfit::KalmanFitStatus*>(fs)) {
358 return false;
359 }
360
361 // make sure there is at least one hit with a valid mSoP
362 const unsigned int trackSize = m_genfitTrack.getNumPoints();
363 for (unsigned int i = 0; i < trackSize; i++) {
364 try {
365 m_genfitTrack.getFittedState(i, representation);
366 return true;
367 } catch (const genfit::Exception& exception) {
368 B2DEBUG(29, "Can not get mSoP because of: " << exception.what());
369 }
370 }
371
372 return false;
373}
const genfit::FitStatus * getTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Return the track fit status for the given representation or for the cardinal one. You are not allowed...
Definition: RecoTrack.h:621

Friends And Related Function Documentation

◆ RecoTrackGenfitAccess

friend class RecoTrackGenfitAccess
friend

The RecoTrackGenfitAccess need to access the genfit track (which is intended)!

Definition at line 81 of file RecoTrack.h.

Member Data Documentation

◆ m_2ndFlipqualityIndicator

float m_2ndFlipqualityIndicator = NAN
private

Quality index for flipping.

Definition at line 922 of file RecoTrack.h.

◆ 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_charge

short int m_charge = 1
private

Storage for the charge. All other helix parameters are saved in the genfit::Track.

Definition at line 899 of file RecoTrack.h.

◆ m_dirtyFlag

bool m_dirtyFlag = true
private

Bool is hits were added to track after fitting and the measurements should be recalculated.

will be true after ROOT deserialization, which means the measurements will be recreated

Definition at line 914 of file RecoTrack.h.

◆ m_flipqualityIndicator

float m_flipqualityIndicator = NAN
private

Quality index for flipping.

Definition at line 920 of file RecoTrack.h.

◆ m_genfitTrack

genfit::Track m_genfitTrack
private

Internal storage for the genfit track.

Definition at line 897 of file RecoTrack.h.

◆ m_hasIngoingArmTime

bool m_hasIngoingArmTime = false
private

Internal storage of the final ingoing arm time is set.

Definition at line 934 of file RecoTrack.h.

◆ m_hasOutgoingArmTime

bool m_hasOutgoingArmTime = false
private

Internal storage of the final outgoing arm time is set.

Definition at line 936 of file RecoTrack.h.

◆ m_ingoingArmTime

float m_ingoingArmTime = NAN
private

Track time of the ingoing arm.

Definition at line 928 of file RecoTrack.h.

◆ m_ingoingArmTimeError

float m_ingoingArmTimeError = NAN
private

Error of the track time of the ingoing arm.

Definition at line 930 of file RecoTrack.h.

◆ m_isArmTimeComputed

bool m_isArmTimeComputed = false
private

true if the arms times are already computed, false otherwise

Definition at line 932 of file RecoTrack.h.

◆ m_matchingStatus

MatchingStatus m_matchingStatus = MatchingStatus::c_undefined
private

Flag used in the MCRecoTracksMatcherModule.

Definition at line 916 of file RecoTrack.h.

◆ m_nSVDHitsOfIngoingArm

int m_nSVDHitsOfIngoingArm = 0
private

Number of SVD clusters of the ingoing arm.

Definition at line 940 of file RecoTrack.h.

◆ m_nSVDHitsOfOutgoingArm

int m_nSVDHitsOfOutgoingArm = 0
private

Number of SVD clusters of the outgoing arm.

Definition at line 938 of file RecoTrack.h.

◆ m_outgoingArmTime

float m_outgoingArmTime = NAN
private

Track time of the outgoing arm.

Definition at line 924 of file RecoTrack.h.

◆ m_outgoingArmTimeError

float m_outgoingArmTimeError = NAN
private

Error of the track time of the outgoing arm.

Definition at line 926 of file RecoTrack.h.

◆ m_qualityIndicator

float m_qualityIndicator = NAN
private

Quality index for classification of fake vs. MC-matched Tracks.

Definition at line 918 of file RecoTrack.h.

◆ m_storeArrayNameOfBKLMHits

std::string m_storeArrayNameOfBKLMHits = ""
private

Store array name of added BKLM hits.

Definition at line 907 of file RecoTrack.h.

◆ m_storeArrayNameOfCDCHits

std::string m_storeArrayNameOfCDCHits = ""
private

Store array name of added CDC hits.

Definition at line 905 of file RecoTrack.h.

◆ m_storeArrayNameOfEKLMHits

std::string m_storeArrayNameOfEKLMHits = ""
private

Store array name of added EKLM hits.

Definition at line 909 of file RecoTrack.h.

◆ m_storeArrayNameOfPXDHits

std::string m_storeArrayNameOfPXDHits = ""
private

Store array name of added PXD hits.

Definition at line 901 of file RecoTrack.h.

◆ m_storeArrayNameOfRecoHitInformation

std::string m_storeArrayNameOfRecoHitInformation = ""
private

Store array of added RecoHitInformation.

Definition at line 911 of file RecoTrack.h.

◆ m_storeArrayNameOfSVDHits

std::string m_storeArrayNameOfSVDHits = ""
private

Store array name of added SVD hits.

Definition at line 903 of file RecoTrack.h.


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