Belle II Software development
InPhi0ImpactCurvBox.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/boxes/Box.h>
11#include <tracking/trackFindingCDC/topology/ILayer.h>
12
13#include <array>
14#include <cmath>
15
16namespace Belle2 {
21 namespace TrackFindingCDC {
22
25
26 public:
31 explicit InPhi0ImpactCurvBox(float curlCurv = NAN)
32 : m_curlCurv(curlCurv)
33 {}
34
35 public:
38
39 public:
48 ESign getDistanceSign(const HoughBox& houghBox,
49 float x,
50 float y,
51 float l,
52 float /*dxdz*/ = 0,
53 float /*dydz*/ = 0,
54 ILayer /*iCLayer*/ = -1) const
55 {
56 const std::array<DiscretePhi0, 2>& phi0Vec = houghBox.getBounds<DiscretePhi0>();
57 const std::array<DiscreteCurv, 2>& curv = houghBox.getBounds<DiscreteCurv>();
58
59 std::array<float, 2> xRot;
60 xRot[0] = x * phi0Vec[0]->x() + y * phi0Vec[0]->y();
61 xRot[1] = x * phi0Vec[1]->x() + y * phi0Vec[1]->y();
62
63 const bool isNonCurler = (static_cast<float>(curv[1]) <= m_curlCurv and
64 static_cast<float>(curv[0]) >= -m_curlCurv);
65 const bool onlyPositiveArm = isNonCurler;
66
67 if (onlyPositiveArm) {
68 // Reject hit if it is on the inward going branch but the curvature suggest it is no curler
69 if (xRot[0] < 0 and xRot[1] < 0) return ESign::c_Invalid;
70 }
71
72 std::array<float, 2> yRot;
73 yRot[0] = -x * phi0Vec[0]->y() + y * phi0Vec[0]->x();
74 yRot[1] = -x * phi0Vec[1]->y() + y * phi0Vec[1]->x();
75
76 const std::array<ContinuousImpact, 2>& impact = houghBox.getBounds<ContinuousImpact>();
77
78 // Using binary notation encoding lower and upper box bounds to fill the flat array.
79 std::array<float, 4> yRotMinusI;
80 yRotMinusI[0b00] = yRot[0] - impact[0];
81 yRotMinusI[0b01] = yRot[0] - impact[1];
82 yRotMinusI[0b10] = yRot[1] - impact[0];
83 yRotMinusI[0b11] = yRot[1] - impact[1];
84
85 const float l2 = l * l;
86 std::array<float, 4> r2MinusI;
87 r2MinusI[0b00] = xRot[0] * xRot[0] + yRotMinusI[0b00] * yRotMinusI[0b00] - l2;
88 r2MinusI[0b01] = xRot[0] * xRot[0] + yRotMinusI[0b01] * yRotMinusI[0b01] - l2;
89 r2MinusI[0b10] = xRot[1] * xRot[1] + yRotMinusI[0b10] * yRotMinusI[0b10] - l2;
90 r2MinusI[0b11] = xRot[1] * xRot[1] + yRotMinusI[0b11] * yRotMinusI[0b11] - l2;
91
92
93 // Using binary notation encoding lower and upper box bounds to fill the flat array.
94 std::array<ESign, 2> distSign;
95 for (int c_Curv = 0; c_Curv < 2; ++c_Curv) {
96 std::array<float, 4> dist;
97 float curvHalf = static_cast<float>(curv[c_Curv]) / 2;
98 dist[0b00] = - yRotMinusI[0b00] + r2MinusI[0b00] * curvHalf - l;
99 dist[0b01] = - yRotMinusI[0b01] + r2MinusI[0b01] * curvHalf - l;
100 dist[0b10] = - yRotMinusI[0b10] + r2MinusI[0b10] * curvHalf - l;
101 dist[0b11] = - yRotMinusI[0b11] + r2MinusI[0b11] * curvHalf - l;
102 distSign[c_Curv] = ESignUtil::common(dist);
103 }
104
105 return ESignUtil::common(distSign[0], distSign[1]);
106
107 }
108
109 private:
112 };
113 }
115}
The base class for all boxes.
Definition Box.h:33
Box< DiscretePhi0, ContinuousImpact, DiscreteCurv > HoughBox
The box to which this object corresponds.
InPhi0ImpactCurvBox(float curlCurv=NAN)
Constructor taking the curler curvature Curlers with high curvature than the curler curvature may obt...
float m_curlCurv
Curler curvature - set to value greater zero to activate on arm exclusive finding.
ESign getDistanceSign(const HoughBox &houghBox, float x, float y, float l, float=0, float=0, ILayer=-1) const
Function that gives the sign of the distance from an observed drift circle to the family of curves.
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.