Belle II Software  release-08-01-10
InPhi0TanLBox.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/axes/StandardAxes.h>
11 #include <tracking/trackFindingCDC/hough/boxes/Box.h>
12 #include <tracking/trackFindingCDC/topology/ILayer.h>
13 
14 namespace Belle2 {
19  namespace TrackFindingCDC {
20 
22  class InPhi0TanLBox {
23 
24  public:
26  explicit InPhi0TanLBox(float curlCurv)
27  : m_curlCurv(curlCurv)
28  {}
29 
30  public:
33 
34  public:
36  ESign getDistanceSign(const HoughBox& houghBox,
37  float x,
38  float y,
39  float l,
40  float dxdz,
41  float dydz,
42  ILayer /*iCLayer*/ = -1) const
43  {
44  const std::array<DiscretePhi0, 2>& phi0Vec = houghBox.getBounds<DiscretePhi0>();
45  const std::array<ContinuousTanL, 2>& tanL = houghBox.getBounds<ContinuousTanL>();
46 
47  std::array<float, 2> xRot;
48  xRot[0] = x * phi0Vec[0]->x() + y * phi0Vec[0]->y();
49  xRot[1] = x * phi0Vec[1]->x() + y * phi0Vec[1]->y();
50 
51  std::array<float, 2> yRot;
52  yRot[0] = -x * phi0Vec[0]->y() + y * phi0Vec[0]->x();
53  yRot[1] = -x * phi0Vec[1]->y() + y * phi0Vec[1]->x();
54 
55  std::array<float, 2> dxdzRot;
56  dxdzRot[0] = dxdz * phi0Vec[0]->x() + dydz * phi0Vec[0]->y();
57  dxdzRot[1] = dxdz * phi0Vec[1]->x() + dydz * phi0Vec[1]->y();
58 
59  std::array<float, 2> dydzRot;
60  dydzRot[0] = -dxdz * phi0Vec[0]->y() + dydz * phi0Vec[0]->x();
61  dydzRot[1] = -dxdz * phi0Vec[1]->y() + dydz * phi0Vec[1]->x();
62 
64  const std::array<float, 2>& s = xRot;
65 
66  const bool onlyPositiveArm = 0 < m_curlCurv;
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  // cppcheck-suppress unreadVariable
73  std::array<float, 4> xRotCor;
74  xRotCor[0b00] = xRot[0] + dxdzRot[0] * s[0] * static_cast<float>(tanL[0]);
75  xRotCor[0b01] = xRot[0] + dxdzRot[0] * s[0] * static_cast<float>(tanL[1]);
76  xRotCor[0b10] = xRot[1] + dxdzRot[1] * s[1] * static_cast<float>(tanL[0]);
77  xRotCor[0b11] = xRot[1] + dxdzRot[1] * s[1] * static_cast<float>(tanL[1]);
78 
79  const std::array<float, 4>& sCor = xRotCor;
80 
81  std::array<float, 4> dist;
82  dist[0b00] = -(yRot[0] + dydzRot[0] * sCor[0b00] * static_cast<float>(tanL[0]) + l);
83  dist[0b01] = -(yRot[0] + dydzRot[0] * sCor[0b01] * static_cast<float>(tanL[1]) + l);
84  dist[0b10] = -(yRot[1] + dydzRot[1] * sCor[0b10] * static_cast<float>(tanL[0]) + l);
85  dist[0b11] = -(yRot[1] + dydzRot[1] * sCor[0b11] * static_cast<float>(tanL[1]) + l);
86 
87  return ESignUtil::common(dist);
88  }
89 
90  private:
92  float m_curlCurv;
93  };
94  }
96 }
The base class for all boxes.
Definition: Box.h:33
Type to have values not based on discrete positions from an array.
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 and tan lambda.
Definition: InPhi0TanLBox.h:22
ESign getDistanceSign(const HoughBox &houghBox, float x, float y, float l, float dxdz, float dydz, ILayer=-1) const
Function that gives the sign of the distance from an observed drift circle to the sweeped object.
Definition: InPhi0TanLBox.h:36
float m_curlCurv
Curler curvature - set to value greater zero to activate one arm exclusive finding.
Definition: InPhi0TanLBox.h:92
InPhi0TanLBox(float curlCurv)
Create a new box with the given curler curvature.
Definition: InPhi0TanLBox.h:26
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.