Belle II Software  release-06-02-00
IPTrackTimeEstimatorModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <tracking/modules/fitter/timeEstimator/IPTrackTimeEstimatorModule.h>
9 
10 #include <tracking/dataobjects/RecoTrack.h>
11 #include <framework/dataobjects/Helix.h>
12 #include <framework/geometry/BFieldManager.h>
13 
14 using namespace std;
15 using namespace Belle2;
16 
17 REG_MODULE(IPTrackTimeEstimator)
18 
19 double IPTrackTimeEstimatorModule::estimateFlightLengthUsingFittedInformation(genfit::MeasuredStateOnPlane& measuredStateOnPlane)
20 const
21 {
22  const TVector3 ipPosition;
23  try {
24  const double s = measuredStateOnPlane.extrapolateToPoint(ipPosition);
25  // Negative, because we extrapolated in the wrong direction
26  return -s;
27  } catch (const genfit::Exception& e) {
28  B2WARNING("Extrapolation failed: " << e.what());
29  return 0;
30  }
31 }
32 
33 double IPTrackTimeEstimatorModule::estimateFlightLengthUsingSeedInformation(const RecoTrack& recoTrack) const
34 {
35  const TVector3& position = recoTrack.getPositionSeed();
36  const TVector3& momentum = recoTrack.getMomentumSeed();
37  const short int charge = recoTrack.getChargeSeed();
38 
39  const double bZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
40  const Helix h(position, momentum, charge, bZ);
41  const double s2D = h.getArcLength2DAtXY(position.X(), position.Y());
42  const double s = s2D * hypot(1, h.getTanLambda());
43 
44  return s;
45 }
Helix parameter class.
Definition: Helix.h:48
Base Module estimating the track time of RecoTracks - before or after the fit.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:76
TVector3 getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
Definition: RecoTrack.h:483
TVector3 getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
Definition: RecoTrack.h:476
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition: RecoTrack.h:496
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Definition: Exception.h:48
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.
Defines for I/O streams used for error and debug printing.