Belle II Software  release-08-01-10
InPhi0Box.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 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22 
24  class InPhi0Box {
25 
26  public:
28  InPhi0Box(float curlCurv = NAN) : m_curlCurv(std::fabs(curlCurv)) {}
29 
30  public:
33 
34  public:
46  ESign getDistanceSign(const HoughBox& houghBox,
47  float x,
48  float y,
49  float l,
50  float /*dxdz*/ = 0,
51  float /*dydz*/ = 0,
52  ILayer /*iCLayer*/ = -1) const
53  {
54  const std::array<DiscretePhi0, 2>& phi0Vec = houghBox.getBounds<DiscretePhi0>();
55 
56  std::array<float, 2> xRot;
57  xRot[0] = x * phi0Vec[0]->x() + y * phi0Vec[0]->y();
58  xRot[1] = x * phi0Vec[1]->x() + y * phi0Vec[1]->y();
59 
60  const bool onlyPositiveArm = 0 < m_curlCurv;
61  if (onlyPositiveArm) {
62  // Reject hit if it is on the inward going branch but the curvature suggest it is no curler
63  if (xRot[0] < 0 and xRot[1] < 0) return ESign::c_Invalid;
64  }
65 
66  std::array<float, 2> yRotPlusL;
67  yRotPlusL[0] = -x * phi0Vec[0]->y() + y * phi0Vec[0]->x() - l;
68  yRotPlusL[1] = -x * phi0Vec[1]->y() + y * phi0Vec[1]->x() - l;
69 
70  std::array<float, 2> dist;
71  dist[0] = - yRotPlusL[0];
72  dist[1] = - yRotPlusL[1];
73 
74  return ESignUtil::common(dist[0], dist[1]);
75  }
76 
77  private:
79  float m_curlCurv;
80  };
81  }
83 }
The base class for all boxes.
Definition: Box.h:33
Representation for a discrete position in an array of discrete positions.
Definition: DiscreteValue.h:23
Checker if a position is contained in a family of curves over phi0.
Definition: InPhi0Box.h:24
InPhi0Box(float curlCurv=NAN)
Constructor taking the curler curvature - pass a value greater 0 to activate one arm exclusive findin...
Definition: InPhi0Box.h:28
float m_curlCurv
Curler curvature - set a value greater zero to activate one arm exclusive finding.
Definition: InPhi0Box.h:79
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: InPhi0Box.h:46
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:27
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.