All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
TOFUtils Namespace Reference

Functions

bool sortByRho (EVENT::TrackerHit *a, EVENT::TrackerHit *b)
 Comparator function by radius for tracker hits. More...
 
IMPL::TrackStateImpl getTrackStateAtHit (MarlinTrk::IMarlinTrack *marlinTrk, EVENT::TrackerHit *hit)
 Get track state at tracker hit. More...
 
dd4hep::rec::Vector3D getHelixMomAtTrackState (const EVENT::TrackState &ts, double bField)
 Get track momentum at the track state. More...
 
double getHelixArcLength (const EVENT::TrackState &ts1, const EVENT::TrackState &ts2)
 Get track length. More...
 
double getHelixLengthAlongZ (const EVENT::TrackState &ts1, const EVENT::TrackState &ts2)
 Get track length. More...
 
double getHelixNRevolutions (const EVENT::TrackState &ts1, const EVENT::TrackState &ts2)
 Get number of helix revolutions. More...
 
double getTPCOuterR ()
 Returns TPC outer radius from the DD4hep detector geometry. More...
 
EVENT::TrackerHit * getSETHit (EVENT::Track *track, double tpcOuterR)
 Returns SET hit. More...
 
std::vector
< EVENT::CalorimeterHit * > 
selectFrankEcalHits (EVENT::Cluster *cluster, EVENT::Track *track, int maxEcalLayer, double bField)
 Get a subset of the cluster calorimeter hits. More...
 
std::vector< EVENT::Track * > getSubTracks (EVENT::Track *track)
 Get all subtracks of the Track. More...
 
std::vector< IMPL::TrackStateImpl > getTrackStatesPerHit (std::vector< EVENT::Track * > tracks, MarlinTrk::IMarlinTrkSystem *trkSystem, bool extrapolateToEcal, double bField)
 Get list of track states. More...
 
double getTofClosest (EVENT::Cluster *cluster, EVENT::Track *track, double timeResolution)
 Get the time-of-flight using the closest ECal hit. More...
 
double getTofFrankAvg (std::vector< EVENT::CalorimeterHit * > selectedHits, EVENT::Track *track, double timeResolution)
 Get the time-of-flight using average of the Frank ECal hits. More...
 
double getTofFrankFit (std::vector< EVENT::CalorimeterHit * > selectedHits, EVENT::Track *track, double timeResolution)
 Get the time-of-flight using fit of the Frank ECal hits. More...
 

Function Documentation

double TOFUtils::getHelixArcLength ( const EVENT::TrackState &  ts1,
const EVENT::TrackState &  ts2 
)

Get track length.

Returns the track length between two track states estimated by the helix length formula:

$ \ell = \sqrt{\left( \frac{\varphi_{i+1} - \varphi_{i}}{\Omega}\right)^{2} + \left( z_{i+1} - z_{i} \right)^{2} } $

Note: The formula above works only for the arcs with $ \Delta \varphi < \pi $.

Definition at line 71 of file TOFUtils.cc.

double TOFUtils::getHelixLengthAlongZ ( const EVENT::TrackState &  ts1,
const EVENT::TrackState &  ts2 
)

Get track length.

Returns the track length between two track states estimated by the helix length formula:

$ \ell = \frac{\left |z_{i+1} - z_{i}\right |}{\tan{\lambda}} \sqrt{1 + \tan{\lambda}^{2} } $

Note: The formula above works for any $ \Delta \varphi $.

However it is less precise than getHelixArcLength() due to the less precise $ \tan{\lambda} $. Also helix formula implies constant momentum assumption which may show higher discrepancy for long tracks with low momentum.

Definition at line 82 of file TOFUtils.cc.

dd4hep::rec::Vector3D TOFUtils::getHelixMomAtTrackState ( const EVENT::TrackState &  ts,
double  bField 
)

Get track momentum at the track state.

Returns momentum Vector3D from the given track state.

Definition at line 58 of file TOFUtils.cc.

double TOFUtils::getHelixNRevolutions ( const EVENT::TrackState &  ts1,
const EVENT::TrackState &  ts2 
)

Get number of helix revolutions.

Returns number of helix revolutions between two track states.

The calculation is done with: $ N_{\mathrm{turns}} = \frac{\left |z_{i+1} - z_{i}\right |}{\tan{\lambda}} \bigg / (2 \pi \frac{1}{|\Omega|}) $

Definition at line 90 of file TOFUtils.cc.

EVENT::TrackerHit * TOFUtils::getSETHit ( EVENT::Track *  track,
double  tpcOuterR 
)

Returns SET hit.

Checks the $ \rho = \sqrt{x^{2}+y^{2}} $ of the tracker hit. If $ \rho > R_{\mathrm{TPC, outer}} $ then it is the SET hit.

Definition at line 112 of file TOFUtils.cc.

std::vector< EVENT::Track * > TOFUtils::getSubTracks ( EVENT::Track *  track)

Get all subtracks of the Track.

Returns a vector of the subTracks of the main track that is passed as an argument.

The main purpose of this function is to capture all hits of the track. This requires iteration over the subTracks as the main Track stores hits only of the first half turn due to the our fit procedure.

The first subTrack in the returned vector is always main Track itself, which containes VXD, SIT and TPC tracker hits for the first half turn.

Then additional subTracks are added which contain hits for additional track revolutions if such exist.

If nTPCHits $ \pm 1$ = nHits of SubTrack0 then assume subTrack0 stores TPC hits. This would mean that VXD and SIT subTrack is not stored! So we need skip only first subtrack: initial subTrack0 with TPC hits which we have anyhow added with the main Track Else if nTPCHits $ \pm 1$ = nHits of SubTrack1 assume subTrack1 stores TPC hits This would mean that subTrack0 stores VXD and SIT hits. So we need to skip both subtracks VXD+SIT and 1st TPC half-turn subTracks which we have anyhow added with the main Track

Note: We consider deviations for $\pm 1$ hit may happen because of the SET and only God knows what other reasons...

Note: This function is not guarantied to properly work 100% of times, but I didn't find a better way to collect subTracks.

Definition at line 149 of file TOFUtils.cc.

double TOFUtils::getTofClosest ( EVENT::Cluster *  cluster,
EVENT::Track *  track,
double  timeResolution 
)

Get the time-of-flight using the closest ECal hit.

Returns time measured by the closest ECal hit to the extrapolated track position at the ECal surface.

$ \mathrm{TOF} = t_{\mathrm{closest}} - \frac{\left| \vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{closest}} \right|}{c} $

If no ECal hits are found returns 0.0.

Definition at line 268 of file TOFUtils.cc.

double TOFUtils::getTofFrankAvg ( std::vector< EVENT::CalorimeterHit * >  selectedHits,
EVENT::Track *  track,
double  timeResolution 
)

Get the time-of-flight using average of the Frank ECal hits.

Returns the time-of-flight as an average of the Frank hits time corrected for the distance to the extrapolated track position at the ECal surface assuming speed of flight is the speed of light.

$ \mathrm{TOF} = \frac{1}{\mathrm{MaxEcalLayer}}\sum_{i}^{\mathrm{MaxEcalLayer}} \left( t_{i} - \frac{\left|\vec{r}_{\mathrm{track}} - \vec{r}_{i} \right|}{c} \right) $

If no ECal hits are found within selectedHits, then returns 0.0.

Definition at line 292 of file TOFUtils.cc.

double TOFUtils::getTofFrankFit ( std::vector< EVENT::CalorimeterHit * >  selectedHits,
EVENT::Track *  track,
double  timeResolution 
)

Get the time-of-flight using fit of the Frank ECal hits.

Returns the time-of-flight as an extrapolated time at the extrapolated track position at the ECal surface by using a linear fit of the Frank hits time as a function of the distance to the extrapolated track position at the ECal surface.

$ \mathrm{TOF}=f(|\vec{r}_{\mathrm{track}} - \vec{r}_{\mathrm{hit}} |=0) $

If no ECal hits are found within selectedHits, then returns 0.0. If only one ECal hit is found, which is not enough to perform the linear fit, then returns the same as getTofClosest() and getTofFrankAvg().

Definition at line 309 of file TOFUtils.cc.

double TOFUtils::getTPCOuterR ( )

Returns TPC outer radius from the DD4hep detector geometry.

Definition at line 104 of file TOFUtils.cc.

IMPL::TrackStateImpl TOFUtils::getTrackStateAtHit ( MarlinTrk::IMarlinTrack *  marlinTrk,
EVENT::TrackerHit *  hit 
)

Get track state at tracker hit.

Returns track state at tracker hit from the Kalman Filter fit.

Tracker hit has to be used in the fit by the Kalman Filter.

Definition at line 49 of file TOFUtils.cc.

std::vector< IMPL::TrackStateImpl > TOFUtils::getTrackStatesPerHit ( std::vector< EVENT::Track * >  tracks,
MarlinTrk::IMarlinTrkSystem *  trkSystem,
bool  extrapolateToEcal,
double  bField 
)

Get list of track states.

Returns a vector of track states at the IP, track state for every tracker hit inside all provided subTracks as tracks argument and the track state at the ECal surface if extrapolateToEcal argument is set to true.

Definition at line 175 of file TOFUtils.cc.

std::vector< EVENT::CalorimeterHit * > TOFUtils::selectFrankEcalHits ( EVENT::Cluster *  cluster,
EVENT::Track *  track,
int  maxEcalLayer,
double  bField 
)

Get a subset of the cluster calorimeter hits.

Returns the subset of the cluster calorimeter hits which we call "Frank" by historical reasons as these hits were used to calculate time-of-flight as a default method for the IDR production.

"Frank" hits are the closest ECal hits to the linearly extrapolated track line inside the ECal in each of the first maxEcalLayer ECal layers.

Definition at line 122 of file TOFUtils.cc.

bool TOFUtils::sortByRho ( EVENT::TrackerHit *  a,
EVENT::TrackerHit *  b 
)

Comparator function by radius for tracker hits.

Returns true if $ \rho_{a} < \rho_{b} $. With $ \rho $ being a radius of the tracker hit projected on the $ xy $ plane: $ \rho = \sqrt{x^2 + y^2} $.

Primarily used to sort vector of tracker hits by $ \rho $ for the Kalman Filter fit.

Definition at line 42 of file TOFUtils.cc.