Belle II Software  release-05-01-25
FlightTimeEstimator.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/eventdata/utils/FlightTimeEstimator.h>
11 
12 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
13 
14 #include <tracking/trackFindingCDC/numerics/SpecialFunctions.h>
15 #include <tracking/trackFindingCDC/numerics/Angle.h>
16 
17 #include <framework/gearbox/Const.h>
18 
19 using namespace Belle2;
20 using namespace TrackFindingCDC;
21 
22 const FlightTimeEstimator&
23 FlightTimeEstimator::instance(std::unique_ptr<FlightTimeEstimator> replacement)
24 {
25  static std::unique_ptr<FlightTimeEstimator> s_instance(new FlightTimeEstimator);
26  if (replacement) {
27  s_instance = std::move(replacement);
28  }
29  return *s_instance;
30 }
31 
32 namespace {
33  double getFirstPeriodAlphaFlightTime(double absAlpha)
34  {
35  return 1.0 / (sinc(absAlpha) * Const::speedOfLight);
36  }
37 }
38 
40  : m_firstPeriodAlphaFlightTimeFactor(getFirstPeriodAlphaFlightTime,
41  512,
42  0,
43  std::nextafter(M_PI, INFINITY))
44 {
45 }
46 
47 namespace {
48  double getHalfPeriodAlphaFlightTime(double absAlpha)
49  {
50  if (absAlpha > M_PI / 2.0) {
51  double reverseAlpha = AngleUtil::reversed(absAlpha);
52  return -1.0 / (sinc(reverseAlpha) * Const::speedOfLight);
53  } else {
54  return 1.0 / (sinc(absAlpha) * Const::speedOfLight);
55  }
56  }
57 }
58 
60  : m_triggerPoint(triggerPoint)
61  , m_halfPeriodAlphaFlightTimeFactor(getHalfPeriodAlphaFlightTime,
62  512,
63  0,
64  std::nextafter(M_PI, INFINITY))
65 {
66 }
Belle2::TrackFindingCDC::FlightTimeEstimator
Helper struct to provide consistent flight time estimation throughout the CDC track finding.
Definition: FlightTimeEstimator.h:37
Belle2::Const::speedOfLight
static const double speedOfLight
[cm/ns]
Definition: Const.h:568
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::AngleUtil::reversed
static double reversed(const double angle)
Get the angle that point in the opposite direction.
Definition: Angle.h:64
Belle2::TrackFindingCDC::FlightTimeEstimator::instance
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
Definition: FlightTimeEstimator.cc:23
Belle2::TrackFindingCDC::CosmicRayFlightTimeEstimator::CosmicRayFlightTimeEstimator
CosmicRayFlightTimeEstimator(Vector3D triggerPoint=Vector3D(0, 0, 0))
Constructor also setting up the flight time lookup table.
Definition: FlightTimeEstimator.cc:59
Belle2::TrackFindingCDC::BeamEventFlightTimeEstimator::BeamEventFlightTimeEstimator
BeamEventFlightTimeEstimator()
Constructor also setting up the flight time lookup table.
Definition: FlightTimeEstimator.cc:39