Belle II Software  release-05-02-19
FlightTimeEstimator.h
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 #pragma once
11 
12 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
13 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
14 #include <tracking/trackFindingCDC/numerics/LookupTable.h>
15 
16 #include <memory>
17 #include <cmath>
18 
19 namespace Belle2 {
24  namespace TrackFindingCDC {
25 
29  class FlightTimeEstimator {
30 
31  public:
33  virtual ~FlightTimeEstimator() = default;
34 
36  virtual double
37  getFlightTime2D(const Vector2D& /*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 Vector2D& pos2D, double alpha, double beta = 1) const override
57  {
58  double absAlpha = std::fabs(alpha);
59  double directDist2D = pos2D.cylindricalR();
60  return directDist2D * m_firstPeriodAlphaFlightTimeFactor(absAlpha) / beta;
61  }
62 
63  private:
66  };
67 
69  class CosmicRayFlightTimeEstimator : public FlightTimeEstimator {
70 
71  public:
73  explicit CosmicRayFlightTimeEstimator(Vector3D triggerPoint = Vector3D(0, 0, 0));
74 
76  double getFlightTime2D(const Vector2D& pos2D, double alpha, double beta = 1) const override
77  {
78  Vector2D relPos2D = pos2D - m_triggerPoint.xy();
79  double deltaAlpha = pos2D.angleWith(relPos2D);
80  alpha += deltaAlpha;
81  double absAlpha = std::fabs(alpha);
82  double directDist2D = relPos2D.cylindricalR();
83  return directDist2D * m_halfPeriodAlphaFlightTimeFactor(absAlpha) / beta;
84  }
85 
86  private:
89 
92  };
93 
94  }
96 }
Belle2::TrackFindingCDC::CosmicRayFlightTimeEstimator::getFlightTime2D
double getFlightTime2D(const Vector2D &pos2D, double alpha, double beta=1) const override
Flight time estimator for cosmic ray events.
Definition: FlightTimeEstimator.h:84
Belle2::TrackFindingCDC::CosmicRayFlightTimeEstimator::m_triggerPoint
Vector3D m_triggerPoint
Trigger point of the cosmic ray setup.
Definition: FlightTimeEstimator.h:96
Belle2::Vector3D
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:35
Belle2::TrackFindingCDC::BeamEventFlightTimeEstimator::m_firstPeriodAlphaFlightTimeFactor
LookupTable< float > m_firstPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
Definition: FlightTimeEstimator.h:73
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::FlightTimeEstimator::getFlightTime2D
virtual double getFlightTime2D(const Vector2D &, double, double=1) const
Default estimator for the flight time.
Definition: FlightTimeEstimator.h:45
Belle2::TrackFindingCDC::BeamEventFlightTimeEstimator
Concrete estimator for the regular beam event setup.
Definition: FlightTimeEstimator.h:57
Belle2::TrackFindingCDC::LookupTable< float >
Belle2::TrackFindingCDC::FlightTimeEstimator::~FlightTimeEstimator
virtual ~FlightTimeEstimator()=default
Making the destructor virtual for this interface class.
Belle2::TrackFindingCDC::FlightTimeEstimator
Helper struct to provide consistent flight time estimation throughout the CDC track finding.
Definition: FlightTimeEstimator.h:37
Belle2::TrackFindingCDC::BeamEventFlightTimeEstimator::getFlightTime2D
double getFlightTime2D(const Vector2D &pos2D, double alpha, double beta=1) const override
Flight time estimator for regular beam events.
Definition: FlightTimeEstimator.h:64
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::Vector2D::cylindricalR
double cylindricalR() const
Gives the cylindrical radius of the vector. Same as norm()
Definition: Vector2D.h:571
Belle2::TrackFindingCDC::Vector3D::xy
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:500
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::m_halfPeriodAlphaFlightTimeFactor
LookupTable< float > m_halfPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
Definition: FlightTimeEstimator.h:99
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::Vector2D::angleWith
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:211
Belle2::TrackFindingCDC::BeamEventFlightTimeEstimator::BeamEventFlightTimeEstimator
BeamEventFlightTimeEstimator()
Constructor also setting up the flight time lookup table.
Definition: FlightTimeEstimator.cc:39