Belle II Software development
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 <cdc/topology/ILayer.h>
15
16#include <Math/Vector2D.h>
17
18namespace 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 TrackingUtilities::ESign getDistanceSign(const HoughBox& houghBox,
48 float x,
49 float y,
50 float signedDriftLength,
51 float dxdz = 0,
52 float dydz = 0,
53 TrackingUtilities::ILayer iCLayer = -1) const
54 {
55 const ROOT::Math::XYVector& lowerPhi0Vec(houghBox.template getLowerBound<APhi0>());
56 const ROOT::Math::XYVector& 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 TrackingUtilities::ESign lowerDistSign = T::getDistanceSign(subordinaryHoughBox,
83 lowerX, lowerY,
84 signedDriftLength,
85 lowerDXDZ, lowerDYDZ.
86 iCLayer);
87
88 const TrackingUtilities::ESign upperDistSign = T::getDistanceSign(subordinaryHoughBox,
89 upperX, upperY,
90 signedDriftLength,
91 upperDXDZ, upperDYDZ,
92 iCLayer);
93
94 return TrackingUtilities::ESignUtil::common(lowerDistSign, upperDistSign);
95 }
96
97 private:
99 float m_curlCurv = NAN;
100
101 };
102 }
104}
SweepBox< APhi0, typename T::HoughBox > HoughBox
The box to which this object corresponds.
Definition Phi0Sweeped.h:36
TrackingUtilities::ESign getDistanceSign(const HoughBox &houghBox, float x, float y, float signedDriftLength, float dxdz=0, float dydz=0, TrackingUtilities::ILayer iCLayer=-1) const
Function that gives the sign of the distance from an observed drift circle to the sweeped object.
Definition Phi0Sweeped.h:47
typename T::HoughBox SubordinaryHoughBox
The hough box without the sweep in phi0.
Definition Phi0Sweeped.h:39
float m_curlCurv
The curvature above which the trajectory is considered a curler.
Definition Phi0Sweeped.h:99
APhi0Sweeped(float curlCurv)
Constructor taking the curling curvature.
Definition Phi0Sweeped.h:42
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.