Belle II Software  release-05-01-25
InPhi0CurvBox.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/Box.h>
15 #include <tracking/trackFindingCDC/topology/ILayer.h>
16 
17 #include <array>
18 #include <cmath>
19 
20 namespace Belle2 {
25  namespace TrackFindingCDC {
26 
28  class InPhi0CurvBox {
29 
30  public:
35  explicit InPhi0CurvBox(float curlCurv = NAN) : m_curlCurv(curlCurv) {}
36 
37  public:
40 
41  public:
50  ESign getDistanceSign(const HoughBox& houghBox,
51  float x,
52  float y,
53  float l,
54  float /*dxdz*/ = 0,
55  float /*dydz*/ = 0,
56  ILayer /*iCLayer*/ = -1) const
57  {
58  const std::array<DiscretePhi0, 2>& phi0Vec = houghBox.getBounds<DiscretePhi0>();
59  const std::array<DiscreteCurv, 2>& curv = houghBox.getBounds<DiscreteCurv>();
60 
61  std::array<float, 2> xRot;
62  xRot[0] = x * phi0Vec[0]->x() + y * phi0Vec[0]->y();
63  xRot[1] = x * phi0Vec[1]->x() + y * phi0Vec[1]->y();
64 
65  const bool isNonCurler = static_cast<float>(curv[1]) <= m_curlCurv and static_cast<float>(curv[0]) >= -m_curlCurv;
66  const bool onlyPositiveArm = isNonCurler;
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> yRotPlusL;
73  yRotPlusL[0] = -x * phi0Vec[0]->y() + y * phi0Vec[0]->x() + l;
74  yRotPlusL[1] = -x * phi0Vec[1]->y() + y * phi0Vec[1]->x() + l;
75 
76  const float r2 = x * x + y * y - l * l;
77  std::array<float, 2> r2TimesHalfCurv;
78  r2TimesHalfCurv[0] = r2 * (static_cast<float>(curv[0]) / 2.0);
79  r2TimesHalfCurv[1] = r2 * (static_cast<float>(curv[1]) / 2.0);
80 
81  // Using binary notation encoding lower and upper box bounds to fill the flat array.
82  std::array<float, 4> dist;
83 
84  dist[0b00] = r2TimesHalfCurv[0] - yRotPlusL[0];
85  dist[0b10] = r2TimesHalfCurv[0] - yRotPlusL[1];
86 
87  dist[0b01] = r2TimesHalfCurv[1] - yRotPlusL[0];
88  dist[0b11] = r2TimesHalfCurv[1] - yRotPlusL[1];
89 
90  return ESignUtil::common(dist);
91  }
92 
93  private:
95  float m_curlCurv;
96  };
97  }
99 }
Belle2::TrackFindingCDC::Box
The base class for all boxes.
Definition: Box.h:43
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::InPhi0CurvBox::m_curlCurv
float m_curlCurv
Curler curvature - set to value greater zero to activate on arm exclusive finding.
Definition: InPhi0CurvBox.h:103
Belle2::TrackFindingCDC::DiscreteValue
Representation for a discrete position in an array of discrete positions.
Definition: DiscreteValue.h:33
Belle2::TrackFindingCDC::ESignUtil::ESign
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:37
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::InPhi0CurvBox::getDistanceSign
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 familiy of curves.
Definition: InPhi0CurvBox.h:58
Belle2::TrackFindingCDC::InPhi0CurvBox::InPhi0CurvBox
InPhi0CurvBox(float curlCurv=NAN)
Constructor taking the curler curvature Curlers with high curvature than the curler curvature may obt...
Definition: InPhi0CurvBox.h:43