Belle II Software development
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#include <framework/geometry/B2Vector3.h>
14
15using namespace Belle2;
16
17REG_MODULE(IPTrackTimeEstimator)
18
19double IPTrackTimeEstimatorModule::estimateFlightLengthUsingFittedInformation(genfit::MeasuredStateOnPlane& measuredStateOnPlane)
20const
21{
22 const B2Vector3D 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
34{
35 const ROOT::Math::XYZVector& position = recoTrack.getPositionSeed();
36 const ROOT::Math::XYZVector& momentum = recoTrack.getMomentumSeed();
37 const short int charge = recoTrack.getChargeSeed();
38
39 const double bZ = BFieldManager::getFieldInTesla({0, 0, 0}).Z();
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}
static ROOT::Math::XYZVector getFieldInTesla(const ROOT::Math::XYZVector &pos)
return the magnetic field at a given position in Tesla.
Definition: BFieldManager.h:61
Helix parameter class.
Definition: Helix.h:48
Base Module estimating the track time of RecoTracks - before or after the fit.
double estimateFlightLengthUsingSeedInformation(const RecoTrack &recoTrack) const override
Calculate the flight length from the origin or the perigee to the start position of the track.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
ROOT::Math::XYZVector getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
Definition: RecoTrack.h:480
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition: RecoTrack.h:508
ROOT::Math::XYZVector getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
Definition: RecoTrack.h:487
#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.