TrackExtenderWithMTD
Abstract
This producer module (EDProducer) adds time and related information to the event, including:
- time of arrival at MTD () with uncertainty;
- time of flight (henceforth TOF) under 3 different mass hypotheses (, , ) with uncertainty;
- length of travelled path from primary vertex to MTD;
- information on track matching to BTL, ETL hits (spatial and time match );
- momentum, and of each track at innermost point.
Class definition
Since TrackExtenderWithMTD class is designed to work with possibly different types of track collections, a template class TrackExtenderwithMTDT is defined as:
Although the collection can be changed, it is now meant to work with reco::TrackCollection:
Code flow
The main entrypoint is the produce() method. Although each called method is described in full detail the Methods section below, an overall summary is here provided. For each track, produce():
- first matches BTL and ETL hits to the track using the
tryBTLLayers(),tryETLLayers()methods. If matched, trajectory and track hit list is updated to also include MTD hits. The association with hits is what determines for the track. It should be noted that, in order for an approximate evaluation of time compatibility between the track and MTD hits, thetrackPathLength()method is first invoked here, although its output is not used at this point for the actual TOF calculation. - By using the
buildTrack()method, the updated track is built, also calculating the path length between vertex and MTD, the associated TOF under different mass hypotheses and kinematic quantities obtained in the calculation. It is at this step that track back-propagation to vertex is performed, evaluating the track momentum at each tracker hit: all this information is contained in aTrackSegmentsobject, built by thetrackPathLength()method. This object is then fed to thecomputeTrackTofPidInfo()method for TOF claculation, which saves all info to aTrackTofPidInfoobject. Each rebuilt track is stored in a track collection that will be saved to the event in the final step. - By using the
buildTrackExtra()method, track extra information, most notably including its hit collection, is populated and associated to the track re-built in the previous step. - The rebuilt tracks, their associated track extras and associated reco hits are saved back into the
Event(respectively asTrackCollection,TrackExtraCollection,TrackingRecHit). All previously evaluted time information is instead stored as aValueMapand saved in the event through thefillValueMap()method.
The overall call flow is hence as follows:
produce()
├── tryBTLLayers()
├── tryETLLayers()
├── trackPathLength()#(1)!
├── buildTrack()
│ ├── trackPathLength()
│ └── computeTrackTofPidInfo()
├── buildTrackExtra()
└── fillValueMap()
- called, but not used for actual TOF evaluation (second call is)
Methods
tryBTLLayers()
tryETLLayers()
buildTrack()
template <class TrackCollection>
reco::Track TrackExtenderWithMTDT<TrackCollection>::buildTrack( //(1)!
const reco::TrackRef& orig,
const Trajectory& traj,
const Trajectory& trajWithMtd,
const reco::BeamSpot& bs,
const MagneticField* field,
const Propagator* thePropagator,
bool hasMTD,
float& pathLengthOut,
float& tmtdOut,
float& sigmatmtdOut,
float& tofpi,
float& tofk,
float& tofp,
float& sigmatofpi,
float& sigmatofk,
float& sigmatofp
) const;
- buildTrack is a template method (to which the
template <class TrackCollection>heading refers to) of a template class (henceTrackExtenderWithMTDT<TrackCollection>) returning areco::Trackvalue
Steps
- Calculate path length by invoking
trackPathLength() - Calculate depending on whether track crossed:
- BLT: since only 1 hit can be recorded, track time is equal to that hit time;
- ELT: since 2 hits must be always recorded, defining the innermost hit as hit #1 and the outermost as hit #2:
- propagate track from hit #2 back to hit #1, evaluating with (i.e. uncertainty is inflated by TOF variation given by extreme mass hypotheses of pion and proton)
- if and are compatible (i.e. they pass a given cut), their weighted average is taken as MTD time. Spatial hit corresponds to hit #1.
- Calculate TOF by invoking
computeTrackTofPidInfo()using theTofCalc::kSegmoption (i.e. taking into account the variation in momentum along propagation).
Output
Returns reco::Track with same trajectory as input one (i.e. including matched MTD hit) with the evaluated time at vertex.
Also saves the following value in the argument references:
- MTD time and relative uncertainty as defined above;
- travelled path length (as per
trackPathLength()); - time of flight under , , mass hypotheses with relative uncertainty (as per
computeTrackTofPidInfo()).
buildTrackExtra()
computeTrackTofPidInfo()
const TrackTofPidInfo computeTrackTofPidInfo(
float magp2,
float length,
TrackSegments trs,
float t_mtd,
float t_mtderr,
float t_vtx,
float t_vtx_err,
bool addPIDError = true,
TofCalc choice = TofCalc::kCost,
SigmaTofCalc sigma_choice = SigmaTofCalc::kCost);
Steps
Supports three TOF calculation strategies:
TofCalc::kConst: assuming constant momentum, evaluated TOF as ;TofCalc::kSegm: takes into account the variation of momentum due to energy loss through propagation. Uses theTrackSegments::computeTof(),TrackSegments::computeSigmaTof()methods;TofCalc::kMixd: calculates . No physical meaning, only defined for convenience of use insidetryBTLLayers(),tryETLLayers().
The calculation is repeated for the pion, kaon and proton mass hypotheses. The associated and is also evaluated.
The time difference with respect to the primary vertex is calculated as corresponding to the time of the particle at the vertex. The associated uncertainty is, crucially, defined as:
where (i.e. difference between TOF in pion and proton hypothesis). This last term is only included if addPIDError = 1.
Why is uncertainty evaluated this way?
By inflating the uncertainty on the time at vertex in this way, we are taking into account the uncertainty on the actual particle ID. This is used in the first iteration of the 4D vertex reconstruction algorithm, where different mass hypotheses cannot be resolved until a first version of vertex candidates is provided.
Lastly, a likelihood for each mass hypothesis is evaluated as:
If any hypothesis performs better in terms of with respect to the pion hypothesis, is overriden by that hypothesis.
Output
Fills a TrackTofPidInfo struct with all the required information (see structure for list of member variables).
trackPathLength()
bool trackPathLength(const Trajectory& traj,
const TrajectoryStateClosestToBeamLine& tscbl,
const Propagator* thePropagator,
float& pathlength,
TrackSegments& trs);
Steps
Note
Since it only calculates propagation lengths, it does not make use of any mass hypothesis. It only needs to know momentum.
Iterating over trajectory measurements (starting from outermost, first in order),
- propagates track state to the surface of the next measurement (i.e. to the previous hit);
- saves the calculated segment using
TrackSegments::addSegment(), saving the propagated , the squared momentum magnitude at the beginning of each trajectory segment and its associated uncertainty, as obtained fromTrajectoryState::curvilinearError()(internally calculated after track fitting through the Kalman filter algorithm);
In the end, the track segment associated to the propagation from the innermost trajectory measurement (i.e. first tracker hit) to the extrapolated beam spot is also computed.
Used Propagator
Uses the PropagatorWithMaterialForMTD propagator, i.e. a PropagatorWithMaterial propagator taking into account material effects, with the following parameters:
Output
Saves sum of partial propagation lengths to input argument pathlength.
Populates output TrackSegments with list of segments, each containing info on partial propagation length , squared momentum magnitude at the beginning of each segment and uncertainty on momentum.
Returns bool validpropagation checking if pathlength > 0 for each single propagated segment. If even a single segment fails, propagation is not considered valid.
fillValueMap()
Classes
TrackSegments
Member variables
uint32_t nSegment_ = 0;
std::vector<float> segmentPathOvc_; // segment lengths
std::vector<float> segmentMom2_; // squared momentum at the start of each segment
std::vector<float> segmentSigmaMom_; // uncertainty on momentum (not squared)
Methods
float computeSigmaTof(float mass_inv2): computes as sum of partial pathlength over each segment , with depending on the mass hypothesismass_inv2;float computeSigmaTof(float mass_inv2) const: computes assuming a complete correlation between all momentum measurements, resulting in the formula
using the as obtained in trackPathLength().
calculation
As , taking into account the pair-wise correlation between segments descending from the momentum measurement correlation: where . We here assume all segments to be fully correlated () (due to the fact the Kalman filter algorithm does not return them; however, we can assume them to be strongly correlated, since the momentum variation through propagation --as well as its associated uncertainty-- is small). Partial derivatives amount to 1.
Since , we have:
hence the formula above.
Notice both methods refer to the kSegm calculation strategy, and are invoked within computeTrackTofPidInfo().
TrackTofPidInfo
Member variables
float tmtd; // time of associated MTD hit
float tmtderror; // uncertainty
float pathlength; // travelled distance between MTD hit and beamline PCA
float betaerror; // difference in beta between pion and proton mass hp
float dt; // time difference between vertex and track beamline PCA
float dterror;
float dtchi2;
float dt_best; // dt under mass hypothesis with smallest dtchi2
float dterror_best;
float dtchi2_best;
float gammasq_pi;
float beta_pi;
float dt_pi;
float sigma_dt_pi;
float gammasq_k;
float beta_k;
float dt_k;
float sigma_dt_k;
float gammasq_p;
float beta_p;
float dt_p;
float sigma_dt_p;
float prob_pi;
float prob_k;
float prob_p;
See computeTrackTofPidInfo for how each variable is computed.
Output
The main output quantities are here summarized again, with pointers to the method which calculates them: