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