Belle II Software  release-08-01-10
Phi0Sweeped.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/hough/perigee/Phi0Rep.h>
11 #include <tracking/trackFindingCDC/hough/perigee/CurvRep.h>
12 #include <tracking/trackFindingCDC/hough/boxes/SweepBox.h>
13 #include <tracking/trackFindingCDC/hough/baseelements/SameSignChecker.h>
14 #include <tracking/trackFindingCDC/topology/ILayer.h>
15 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22 
23 
25  template<class T, class APhi0 = DiscretePhi0>
26  class APhi0Sweeped : public T {
27 
28  public:
30  using T::T;
31 
32  public:
34  using HoughBox = SweepBox<APhi0, typename T::HoughBox>;
35 
37  using SubordinaryHoughBox = typename T::HoughBox;
38 
40  APhi0Sweeped(float curlCurv) : m_curlCurv(curlCurv) {}
41 
42  public:
45  ESign getDistanceSign(const HoughBox& houghBox,
46  float x,
47  float y,
48  float signedDriftLength,
49  float dxdz = 0,
50  float dydz = 0,
51  ILayer iCLayer = -1) const
52  {
53  const Vector2D& lowerPhi0Vec(houghBox.template getLowerBound<APhi0>());
54  const Vector2D& upperPhi0Vec(houghBox.template getUpperBound<APhi0>());
55  const SubordinaryHoughBox& subordinaryHoughBox = houghBox.getSubordinaryBox();
56 
57  const float lowerX = x * lowerPhi0Vec.x() + y * lowerPhi0Vec.y();
58  const float upperX = x * upperPhi0Vec.x() + y * upperPhi0Vec.y();
59 
60  float lowerCurv(getLowerCurv(houghBox));
61  float upperCurv(getUpperCurv(houghBox));
62 
63  const bool lowerIsNonCurler = fabs(lowerCurv) < m_curlCurv;
64  const bool upperIsNonCurler = fabs(upperCurv) < m_curlCurv;
65 
66  if (lowerIsNonCurler and upperIsNonCurler) {
67  if (not(lowerX >= 0) and not(upperX >= 0)) return ESign::c_Invalid;
68  }
69 
70  const float lowerY = -x * lowerPhi0Vec.y() + y * lowerPhi0Vec.x();
71  const float upperY = -x * upperPhi0Vec.y() + y * upperPhi0Vec.x();
72 
73  const float upperDXDZ = dxdz * upperPhi0Vec.x() + dydz * upperPhi0Vec.y();
74  const float lowerDXDZ = dxdz * lowerPhi0Vec.x() + dydz * lowerPhi0Vec.y();
75 
76 
77  const float lowerDYDZ = -dxdz * lowerPhi0Vec.y() + dydz * lowerPhi0Vec.x();
78  const float upperDYDZ = -dxdz * upperPhi0Vec.y() + dydz * upperPhi0Vec.x();
79 
80  const ESign lowerDistSign = T::getDistanceSign(subordinaryHoughBox,
81  lowerX, lowerY,
82  signedDriftLength,
83  lowerDXDZ, lowerDYDZ.
84  iCLayer);
85 
86  const ESign upperDistSign = T::getDistanceSign(subordinaryHoughBox,
87  upperX, upperY,
88  signedDriftLength,
89  upperDXDZ, upperDYDZ,
90  iCLayer);
91 
92  return ESignUtil::common(lowerDistSign, upperDistSign);
93  }
94 
95  private:
97  float m_curlCurv = NAN;
98 
99  };
100  }
102 }
Takes a basic object and sweeps it by some angle phi0 range a around the origin.
Definition: Phi0Sweeped.h:26
ESign getDistanceSign(const HoughBox &houghBox, float x, float y, float signedDriftLength, float dxdz=0, float dydz=0, ILayer iCLayer=-1) const
Function that gives the sign of the distance from an observed drift circle to the sweeped object.
Definition: Phi0Sweeped.h:45
SweepBox< APhi0, typename T::HoughBox > HoughBox
The box to which this object correspondes.
Definition: Phi0Sweeped.h:34
typename T::HoughBox SubordinaryHoughBox
The hough box without the sweep in phi0.
Definition: Phi0Sweeped.h:37
float m_curlCurv
The curvature above which the trajectory is considered a curler.
Definition: Phi0Sweeped.h:97
APhi0Sweeped(float curlCurv)
Constructor taking the curling curvature.
Definition: Phi0Sweeped.h:40
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:607
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:617
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:27
static ESign common(ESign n1, ESign n2)
Check if two values have a common sign.
Definition: ESign.h:57
Abstract base class for different kinds of events.