Belle II Software development
InPhi0CurvBox.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/Box.h>
13#include <tracking/trackingUtilities/numerics/ESign.h>
14#include <cdc/topology/ILayer.h>
15
16#include <array>
17#include <cmath>
18
19namespace Belle2 {
24 namespace TrackFindingCDC {
25
28
29 public:
34 explicit InPhi0CurvBox(float curlCurv = NAN) : m_curlCurv(curlCurv) {}
35
36 public:
39
40 public:
49 TrackingUtilities::ESign getDistanceSign(const HoughBox& houghBox,
50 float x,
51 float y,
52 float l,
53 float /*dxdz*/ = 0,
54 float /*dydz*/ = 0,
55 CDC::ILayer /*iCLayer*/ = -1) const
56 {
57 const std::array<DiscretePhi0, 2>& phi0Vec = houghBox.getBounds<DiscretePhi0>();
58 const std::array<DiscreteCurv, 2>& curv = houghBox.getBounds<DiscreteCurv>();
59
60 std::array<float, 2> xRot;
61 xRot[0] = x * phi0Vec[0]->x() + y * phi0Vec[0]->y();
62 xRot[1] = x * phi0Vec[1]->x() + y * phi0Vec[1]->y();
63
64 const bool isNonCurler = static_cast<float>(curv[1]) <= m_curlCurv and static_cast<float>(curv[0]) >= -m_curlCurv;
65 const bool onlyPositiveArm = isNonCurler;
66 if (onlyPositiveArm) {
67 // Reject hit if it is on the inward going branch but the curvature suggest it is no curler
68 if (xRot[0] < 0 and xRot[1] < 0) return TrackingUtilities::ESign::c_Invalid;
69 }
70
71 std::array<float, 2> yRotPlusL;
72 yRotPlusL[0] = -x * phi0Vec[0]->y() + y * phi0Vec[0]->x() + l;
73 yRotPlusL[1] = -x * phi0Vec[1]->y() + y * phi0Vec[1]->x() + l;
74
75 const float r2 = x * x + y * y - l * l;
76 std::array<float, 2> r2TimesHalfCurv;
77 r2TimesHalfCurv[0] = r2 * (static_cast<float>(curv[0]) / 2.0);
78 r2TimesHalfCurv[1] = r2 * (static_cast<float>(curv[1]) / 2.0);
79
80 // Using binary notation encoding lower and upper box bounds to fill the flat array.
81 std::array<float, 4> dist;
82
83 dist[0b00] = r2TimesHalfCurv[0] - yRotPlusL[0];
84 dist[0b10] = r2TimesHalfCurv[0] - yRotPlusL[1];
85
86 dist[0b01] = r2TimesHalfCurv[1] - yRotPlusL[0];
87 dist[0b11] = r2TimesHalfCurv[1] - yRotPlusL[1];
88
90 }
91
92 private:
95 };
96 }
98}
The base class for all boxes.
Definition Box.h:33
InPhi0CurvBox(float curlCurv=NAN)
Constructor taking the curler curvature Curlers with high curvature than the curler curvature may obt...
Box< DiscretePhi0, DiscreteCurv > HoughBox
The box to which this object corresponds.
TrackingUtilities::ESign getDistanceSign(const HoughBox &houghBox, float x, float y, float l, float=0, float=0, CDC::ILayer=-1) const
Function that gives the sign of the distance from an observed drift circle to the family of curves.
float m_curlCurv
Curler curvature - set to value greater zero to activate on arm exclusive finding.
signed short ILayer
The type of the layer ids enumerating layers within a superlayer.
Definition ILayer.h:18
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.