Belle II Software development
FlightTimeEstimator.h
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#pragma once
9
10#include <tracking/trackingUtilities/numerics/LookupTable.h>
11#include <tracking/trackingUtilities/geometry/VectorUtil.h>
12
13#include <Math/Vector2D.h>
14#include <Math/VectorUtil.h>
15
16#include <memory>
17#include <cmath>
18
19namespace Belle2 {
24 namespace TrackFindingCDC {
25
30
31 public:
33 virtual ~FlightTimeEstimator() = default;
34
36 virtual double
37 getFlightTime2D(const ROOT::Math::XYVector& /*pos2D*/, double /*alpha*/, double /*beta */ = 1) const
38 {
39 return 0;
40 }
41
42 public:
44 static const FlightTimeEstimator&
45 instance(std::unique_ptr<FlightTimeEstimator> replacement = nullptr);
46 };
47
50
51 public:
54
56 double getFlightTime2D(const ROOT::Math::XYVector& pos2D, double alpha, double beta = 1) const override
57 {
58 double absAlpha = std::fabs(alpha);
59 double directDist2D = pos2D.R();
60 return directDist2D * m_firstPeriodAlphaFlightTimeFactor(absAlpha) / beta;
61 }
62
63 private:
66 };
67
70
71 public:
73 explicit CosmicRayFlightTimeEstimator(ROOT::Math::XYZVector triggerPoint = ROOT::Math::XYZVector(0, 0, 0));
74
76 double getFlightTime2D(const ROOT::Math::XYVector& pos2D, double alpha, double beta = 1) const override
77 {
78 ROOT::Math::XYVector relPos2D = pos2D - VectorUtil::getXYVector(m_triggerPoint);
79 double deltaAlpha = ROOT::Math::VectorUtil::DeltaPhi(pos2D, relPos2D);
80 alpha += deltaAlpha;
81 double absAlpha = std::fabs(alpha);
82 double directDist2D = relPos2D.R();
83 return directDist2D * m_halfPeriodAlphaFlightTimeFactor(absAlpha) / beta;
84 }
85
86 private:
89
91 ROOT::Math::XYZVector m_triggerPoint;
92 };
93
94 }
96}
double getFlightTime2D(const ROOT::Math::XYVector &pos2D, double alpha, double beta=1) const override
Flight time estimator for regular beam events.
TrackingUtilities::LookupTable< float > m_firstPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
BeamEventFlightTimeEstimator()
Constructor also setting up the flight time lookup table.
double getFlightTime2D(const ROOT::Math::XYVector &pos2D, double alpha, double beta=1) const override
Flight time estimator for cosmic ray events.
CosmicRayFlightTimeEstimator(ROOT::Math::XYZVector triggerPoint=ROOT::Math::XYZVector(0, 0, 0))
Constructor also setting up the flight time lookup table.
TrackingUtilities::LookupTable< float > m_halfPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
ROOT::Math::XYZVector m_triggerPoint
Trigger point of the cosmic ray setup.
Helper struct to provide consistent flight time estimation throughout the CDC track finding.
virtual ~FlightTimeEstimator()=default
Making the destructor virtual for this interface class.
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
virtual double getFlightTime2D(const ROOT::Math::XYVector &, double, double=1) const
Default estimator for the flight time.
Class which holds precomputed values of a function.
Definition LookupTable.h:50
Abstract base class for different kinds of events.