Belle II Software development
FlightTimeEstimator.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/trackFindingCDC/eventdata/utils/FlightTimeEstimator.h>
9
10#include <tracking/trackingUtilities/geometry/Vector3D.h>
11
12#include <tracking/trackingUtilities/numerics/SpecialFunctions.h>
13#include <tracking/trackingUtilities/numerics/Angle.h>
14
15#include <framework/gearbox/Const.h>
16
17using namespace Belle2;
18using namespace TrackFindingCDC;
19using namespace TrackingUtilities;
20
22FlightTimeEstimator::instance(std::unique_ptr<FlightTimeEstimator> replacement)
23{
24 static std::unique_ptr<FlightTimeEstimator> s_instance(new FlightTimeEstimator);
25 if (replacement) {
26 s_instance = std::move(replacement);
27 }
28 return *s_instance;
29}
30
31namespace {
32 double getFirstPeriodAlphaFlightTime(double absAlpha)
33 {
34 return 1.0 / (sinc(absAlpha) * Const::speedOfLight);
35 }
36}
37
39 : m_firstPeriodAlphaFlightTimeFactor(getFirstPeriodAlphaFlightTime,
40 512,
41 0,
42 std::nextafter(M_PI, INFINITY))
43{
44}
45
46namespace {
47 double getHalfPeriodAlphaFlightTime(double absAlpha)
48 {
49 if (absAlpha > M_PI / 2.0) {
50 double reverseAlpha = AngleUtil::reversed(absAlpha);
51 return -1.0 / (sinc(reverseAlpha) * Const::speedOfLight);
52 } else {
53 return 1.0 / (sinc(absAlpha) * Const::speedOfLight);
54 }
55 }
56}
57
59 : m_halfPeriodAlphaFlightTimeFactor(getHalfPeriodAlphaFlightTime,
60 512,
61 0,
62 std::nextafter(M_PI, INFINITY))
63 , m_triggerPoint(triggerPoint)
64{
65}
static const double speedOfLight
[cm/ns]
Definition Const.h:695
TrackingUtilities::LookupTable< float > m_firstPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
BeamEventFlightTimeEstimator()
Constructor also setting up the flight time lookup table.
CosmicRayFlightTimeEstimator(TrackingUtilities::Vector3D triggerPoint=TrackingUtilities::Vector3D(0, 0, 0))
Constructor also setting up the flight time lookup table.
TrackingUtilities::Vector3D m_triggerPoint
Trigger point of the cosmic ray setup.
TrackingUtilities::LookupTable< float > m_halfPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
Helper struct to provide consistent flight time estimation throughout the CDC track finding.
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition Cell.h:34
Abstract base class for different kinds of events.
STL namespace.
static double reversed(const double angle)
Get the angle that point in the opposite direction.
Definition Angle.h:54