Belle II Software  release-08-01-10
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/trackFindingCDC/geometry/Vector3D.h>
11 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
12 #include <tracking/trackFindingCDC/numerics/LookupTable.h>
13 
14 #include <memory>
15 #include <cmath>
16 
17 namespace Belle2 {
22  namespace TrackFindingCDC {
23 
28 
29  public:
31  virtual ~FlightTimeEstimator() = default;
32 
34  virtual double
35  getFlightTime2D(const Vector2D& /*pos2D*/, double /*alpha*/, double /*beta */ = 1) const
36  {
37  return 0;
38  }
39 
40  public:
42  static const FlightTimeEstimator&
43  instance(std::unique_ptr<FlightTimeEstimator> replacement = nullptr);
44  };
45 
48 
49  public:
52 
54  double getFlightTime2D(const Vector2D& pos2D, double alpha, double beta = 1) const override
55  {
56  double absAlpha = std::fabs(alpha);
57  double directDist2D = pos2D.cylindricalR();
58  return directDist2D * m_firstPeriodAlphaFlightTimeFactor(absAlpha) / beta;
59  }
60 
61  private:
64  };
65 
68 
69  public:
71  explicit CosmicRayFlightTimeEstimator(Vector3D triggerPoint = Vector3D(0, 0, 0));
72 
74  double getFlightTime2D(const Vector2D& pos2D, double alpha, double beta = 1) const override
75  {
76  Vector2D relPos2D = pos2D - m_triggerPoint.xy();
77  double deltaAlpha = pos2D.angleWith(relPos2D);
78  alpha += deltaAlpha;
79  double absAlpha = std::fabs(alpha);
80  double directDist2D = relPos2D.cylindricalR();
81  return directDist2D * m_halfPeriodAlphaFlightTimeFactor(absAlpha) / beta;
82  }
83 
84  private:
87 
90  };
91 
92  }
94 }
Concrete estimator for the regular beam event setup.
LookupTable< float > m_firstPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
double getFlightTime2D(const Vector2D &pos2D, double alpha, double beta=1) const override
Flight time estimator for regular beam events.
BeamEventFlightTimeEstimator()
Constructor also setting up the flight time lookup table.
Concrete estimator for the cosmic ray setup - estimates negative times on incoming arm.
LookupTable< float > m_halfPeriodAlphaFlightTimeFactor
Lookup table for the sinc function.
CosmicRayFlightTimeEstimator(Vector3D triggerPoint=Vector3D(0, 0, 0))
Constructor also setting up the flight time lookup table.
double getFlightTime2D(const Vector2D &pos2D, double alpha, double beta=1) const override
Flight time estimator for cosmic ray events.
Vector3D 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 Vector2D &, double, double=1) const
Default estimator for the flight time.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
double cylindricalR() const
Gives the cylindrical radius of the vector. Same as norm()
Definition: Vector2D.h:569
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:209
A three dimensional vector.
Definition: Vector3D.h:33
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:508
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:34
Abstract base class for different kinds of events.