 |
Belle II Software
release-05-02-19
|
10 #include <tracking/modules/fitter/timeEstimator/BaseTrackTimeEstimatorModule.h>
12 #include <tracking/trackFitting/fitter/base/TrackFitter.h>
13 #include <tracking/dataobjects/RecoTrack.h>
22 double calculateVelocity(
const TVector3& momentum,
const Const::ChargedStable& particleHypothesis)
25 const double m = particleHypothesis.
getMass();
26 const double p = momentum.Mag();
27 const double E = hypot(m, p);
28 const double beta = p / E;
29 const double v = beta * Const::speedOfLight;
35 BaseTrackTimeEstimatorModule::BaseTrackTimeEstimatorModule() :
38 setDescription(
"Module estimating the track time of RecoTracks - before or after the fit. "
39 "Loops over all RecoTracks and set their time seed correctly. In case of using the fitted information,"
40 "it also sets the track seeds of the position and momentum into the first measurement (where the time seed"
41 "is calculated). It also deletes all fitted information. Do not forget to refit "
42 "the tracks afterwards.");
49 " or the tracking seeds for doing the extrapolation. Of course, the track fit has to be performed to use the fitted information.",
53 "Which PDG code to use for creating the time estimate. How this information is used"
54 "depends on the implementation details of the child modules. Please only use the positive pdg code.",
61 "In cases where the readout of the trigger is not located at the trigger directly and the signal has to"
62 "propagate a non-vanashing distance, you can set the readout position here. Please note that you have to"
63 "enable this feature by using the useReadoutPosition flag. You can control the propagation speed with the"
66 "When this feature is enabled, the length from the incident of the particle in the trigger to the position"
67 "set by the readoutPosition flag is calculated and using the readoutPositionPropagationSpeed, a time is"
68 "calculated which is used in the time estimation as an offset."
71 "Speed of the propagation from the hit on the trigger to the readoutPosition. Only is used when the"
79 recoTracks.isRequired();
82 B2FATAL(
"The combination of using the seed information and the readout position is not implemented in the moment.");
93 for (
auto& recoTrack : recoTracks) {
99 B2WARNING(
"Time extraction from fitted state failed because of " << e.what());
106 if (!(timeSeed > -1000)) {
108 B2WARNING(
"Fixing calculated seed Time " << timeSeed <<
" to zero.");
115 B2DEBUG(100,
"Setting seed to " << timeSeed);
116 recoTrack.setTimeSeed(timeSeed);
126 if (not trackRepresentation or not recoTrack.
wasFitSuccessful(trackRepresentation)) {
127 B2WARNING(
"Could not estimate a correct time, as the last fit failed.");
139 const TVector3& momentum = measuredState.getMom();
140 const double v = calculateVelocity(momentum, particleHypothesis);
142 const double flightTime = flightLength / v;
147 const TVector3& position = measuredState.getPos();
150 const double propagationLength = (position - readoutPositionAsTVector3).Mag();
153 return flightTime - propagationTime;
167 const double v = calculateVelocity(momentum, particleHypothesis);
Exception class for error handling in GENFIT (provides storage for diagnostic information)
unsigned int m_param_pdgCodeToUseForEstimation
Which PDG code to use for creating the time estimate.
bool wasFitSuccessful(const genfit::AbsTrackRep *representation=nullptr) const
Returns true if the last fit with the given representation was successful.
bool m_param_useReadoutPosition
Enable the usage of the readout position.
void setDescription(const std::string &description)
Sets the description of the module.
void event() override
Loop over all RecoTracks and set their time seed correctly.
std::vector< double > m_param_readoutPosition
In cases where the readout of the trigger is not located at the trigger directly and the signal has t...
#StateOnPlane with additional covariance matrix.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
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...
bool m_param_useFittedInformation
Whether to use the information in the measurements (after fit) or the tracking seeds for doing the ex...
genfit::AbsTrackRep * getTrackRepresentationForPDG(int pdgCode)
Return an already created track representation of the given reco track for the PDG.
double estimateTimeSeedUsingSeedInformation(RecoTrack &recoTrack, const Const::ChargedStable &particleHypothesis) const
Private helper function which calls the estimateFlightLengthUsingSeedInformation and computes the fli...
Abstract base class for a track representation.
static int createCorrectPDGCodeForChargedStable(const Const::ChargedStable &particleType, const RecoTrack &recoTrack)
Helper function to multiply the PDG code of a charged stable with the charge of the reco track (if ne...
virtual double estimateFlightLengthUsingSeedInformation(const RecoTrack &recoTrack) const =0
Overload this function to implement a specific extrapolation mechanism for track seeds.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
This is the Reconstruction Event-Data Model Track.
double estimateTimeSeedUsingFittedInformation(RecoTrack &recoTrack, const Const::ChargedStable &particleHypothesis) const
Private helper function which calls the estimateFlightLengthUsingFittedInformation with the correct m...
Abstract base class for different kinds of events.
void initialize() override
Initialize the needed StoreArrays and ensure they are created properly.
std::string m_param_recoTracksStoreArrayName
StoreArray name of the input and output reco tracks.
double m_param_timeOffset
If you want to subtract or add a certain time, you can use this variable.
TVector3 getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Provides a type-safe way to pass members of the chargedStableSet set.
Accessor to arrays stored in the data store.
void setPositionAndMomentum(const TVector3 &positionSeed, const TVector3 &momentumSeed)
Set the position and momentum seed of the reco track. ATTENTION: This is not the fitted position or m...
double m_param_readoutPositionPropagationSpeed
Speed of the propagation from the hit on the trigger to the readoutPosition.
virtual double estimateFlightLengthUsingFittedInformation(genfit::MeasuredStateOnPlane &measuredStateOnPlane) const =0
Overload this function to implement a specific extrapolation mechanism for fitted tracks....
double getMass() const
Particle mass.