Belle II Software  release-05-01-25
Phi0Sweeped.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - 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/hough/perigee/Phi0Rep.h>
13 #include <tracking/trackFindingCDC/hough/perigee/CurvRep.h>
14 #include <tracking/trackFindingCDC/hough/boxes/SweepBox.h>
15 #include <tracking/trackFindingCDC/hough/baseelements/SameSignChecker.h>
16 #include <tracking/trackFindingCDC/topology/ILayer.h>
17 
18 namespace Belle2 {
23  namespace TrackFindingCDC {
24 
25 
27  template<class T, class APhi0 = DiscretePhi0>
28  class APhi0Sweeped : public T {
29 
30  public:
32  using T::T;
33 
34  public:
36  using HoughBox = SweepBox<APhi0, typename T::HoughBox>;
37 
39  using SubordinaryHoughBox = typename T::HoughBox;
40 
42  APhi0Sweeped(float curlCurv) : m_curlCurv(curlCurv) {}
43 
44  public:
47  ESign getDistanceSign(const HoughBox& houghBox,
48  float x,
49  float y,
50  float signedDriftLength,
51  float dxdz = 0,
52  float dydz = 0,
53  ILayer iCLayer = -1) const
54  {
55  const Vector2D& lowerPhi0Vec(houghBox.template getLowerBound<APhi0>());
56  const Vector2D& upperPhi0Vec(houghBox.template getUpperBound<APhi0>());
57  const SubordinaryHoughBox& subordinaryHoughBox = houghBox.getSubordinaryBox();
58 
59  const float lowerX = x * lowerPhi0Vec.x() + y * lowerPhi0Vec.y();
60  const float upperX = x * upperPhi0Vec.x() + y * upperPhi0Vec.y();
61 
62  float lowerCurv(getLowerCurv(houghBox));
63  float upperCurv(getUpperCurv(houghBox));
64 
65  const bool lowerIsNonCurler = fabs(lowerCurv) < m_curlCurv;
66  const bool upperIsNonCurler = fabs(upperCurv) < m_curlCurv;
67 
68  if (lowerIsNonCurler and upperIsNonCurler) {
69  if (not(lowerX >= 0) and not(upperX >= 0)) return ESign::c_Invalid;
70  }
71 
72  const float lowerY = -x * lowerPhi0Vec.y() + y * lowerPhi0Vec.x();
73  const float upperY = -x * upperPhi0Vec.y() + y * upperPhi0Vec.x();
74 
75  const float upperDXDZ = dxdz * upperPhi0Vec.x() + dydz * upperPhi0Vec.y();
76  const float lowerDXDZ = dxdz * lowerPhi0Vec.x() + dydz * lowerPhi0Vec.y();
77 
78 
79  const float lowerDYDZ = -dxdz * lowerPhi0Vec.y() + dydz * lowerPhi0Vec.x();
80  const float upperDYDZ = -dxdz * upperPhi0Vec.y() + dydz * upperPhi0Vec.x();
81 
82  const ESign lowerDistSign = T::getDistanceSign(subordinaryHoughBox,
83  lowerX, lowerY,
84  signedDriftLength,
85  lowerDXDZ, lowerDYDZ.
86  iCLayer);
87 
88  const ESign upperDistSign = T::getDistanceSign(subordinaryHoughBox,
89  upperX, upperY,
90  signedDriftLength,
91  upperDXDZ, upperDYDZ,
92  iCLayer);
93 
94  return ESignUtil::common(lowerDistSign, upperDistSign);
95  }
96 
97  private:
99  float m_curlCurv = NAN;
100 
101  };
102  }
104 }
Belle2::TrackFindingCDC::ESignUtil::common
static ESign common(ESign n1, ESign n2)
Check if two values have a common sign.
Definition: ESign.h:67
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::APhi0Sweeped::m_curlCurv
float m_curlCurv
The curvature above which the trajectory is considered a curler.
Definition: Phi0Sweeped.h:107
Belle2::TrackFindingCDC::ESignUtil::ESign
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:37
Belle2::TrackFindingCDC::APhi0Sweeped::HoughBox
SweepBox< APhi0, typename T::HoughBox > HoughBox
The box to which this object correspondes.
Definition: Phi0Sweeped.h:44
Belle2::TrackFindingCDC::APhi0Sweeped::SubordinaryHoughBox
typename T::HoughBox SubordinaryHoughBox
The hough box without the sweep in phi0.
Definition: Phi0Sweeped.h:47
Belle2::TrackFindingCDC::APhi0Sweeped::getDistanceSign
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:55
Belle2::TrackFindingCDC::APhi0Sweeped::APhi0Sweeped
APhi0Sweeped(float curlCurv)
Constructor taking the curling curvature.
Definition: Phi0Sweeped.h:50
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19