Belle II Software development
HitInHyperBox Class Reference

An algorithm to check if a hit is contained in a hyperbolic cosine hough box. More...

#include <HitInHyperBox.h>

Public Types

using HoughBox = Box< DiscreteQ, DiscreteP, DiscreteZ0 >
 Hough space is 3D with axes q, p, z0 as described above.
 

Public Member Functions

Weight operator() (const CDCRecoHit3D &recoHit, const HoughBox *hyperBox)
 Returns weight of the hit for the given hough box; in this algorithm - 1 if hit inside the box, NaN otherwise.
 

Static Public Member Functions

static bool compareDistances (const HoughBox &hyperBox, const CDCRecoHit3D &lhsRecoHit, const CDCRecoHit3D &rhsRecoHit)
 Compares distances from two hits to the track represented by the given box.
 
static float centerX (const HoughBox &hyperBox)
 Returns center value of the box along first (Q) axis.
 
static float centerY (const HoughBox &hyperBox)
 Returns center value of the box along second (P) axis.
 
static float centerZ (const HoughBox &hyperBox)
 Returns center value of the box along third (Z0) axis.
 
static float deltaX (const HoughBox &hyperBox)
 Returns half width of the box along first (Q) axis.
 
static const char * debugLine ()
 ROOT expression of the track hypothesis.
 

Static Private Member Functions

static double catZ (const double q, const double p, const double R)
 Returns z(R) for the catenary with parameters q = E/p_t and p = p_z/E.
 

Detailed Description

An algorithm to check if a hit is contained in a hyperbolic cosine hough box.

The exact parameterization is z(R) = 1 / mu * (sqrt(1 - p * p) * cosh(R * mu / q + arcsinh(p / sqrt(1 - p * p))) - 1) + z0

q is p_t / E - transverse fraction of energy p is p_z / E - longitudinal fraction of energy mu is gcB / E - inverse of scale; ranges from 0.0375 for E=6GeV, g=0.5 to 2.25 for E=1GeV, g=5.0 z0 is z at R=0 z and R are in units of CDC size

If we apply a constraint z0=0, The tree will not perform well as mu is highly correlated to q (and p)

Instead we relax z0=0 and apply mu=q Then for a better continuity around g=0 (sign flip), we take 1/q as new q

Resulting parameterization is z(R) = q * (sqrt(1 - p * p) * cosh(R + arcsinh(p / sqrt(1 - p * p))) - 1) + z0 Which can still provide reasonable fits.

Additionally, box edges are behaving more or less on same scale near origin and near edges of CDC if z(R) = +-dQ + 1 / (q +- dQ) * (sqrt(1 - p * p) * cosh(R + arcsinh(p / sqrt(1 - p * p))) - 1) + z0

Definition at line 52 of file HitInHyperBox.h.

Member Typedef Documentation

◆ HoughBox

Hough space is 3D with axes q, p, z0 as described above.

Definition at line 56 of file HitInHyperBox.h.

Member Function Documentation

◆ catZ()

static double catZ ( const double  q,
const double  p,
const double  R 
)
inlinestaticprivate

Returns z(R) for the catenary with parameters q = E/p_t and p = p_z/E.

Definition at line 106 of file HitInHyperBox.h.

107 {
108 //100 here is a reference - size of CDC in cm
109 return 100.0 * Unit::cm * q * (std::sqrt(1 - p * p) * std::cosh(R / (100.0 * Unit::cm) + std::asinh(p / std::sqrt(1 - p * p))) - 1);
110 }
double R
typedef autogenerated by FFTW
static const double cm
Standard units with the value = 1.
Definition: Unit.h:47

◆ centerX()

static float centerX ( const HoughBox hyperBox)
inlinestatic

Returns center value of the box along first (Q) axis.

Definition at line 114 of file HitInHyperBox.h.

115 {
116 return *(hyperBox.getCenter<0>());
117 }

◆ centerY()

static float centerY ( const HoughBox hyperBox)
inlinestatic

Returns center value of the box along second (P) axis.

Definition at line 120 of file HitInHyperBox.h.

121 {
122 return *(hyperBox.getCenter<1>());
123 }

◆ centerZ()

static float centerZ ( const HoughBox hyperBox)
inlinestatic

Returns center value of the box along third (Z0) axis.

Definition at line 126 of file HitInHyperBox.h.

127 {
128 return *(hyperBox.getCenter<2>());
129 }

◆ compareDistances()

static bool compareDistances ( const HoughBox hyperBox,
const CDCRecoHit3D lhsRecoHit,
const CDCRecoHit3D rhsRecoHit 
)
inlinestatic

Compares distances from two hits to the track represented by the given box.

The comparison is done based on reconstructed Z coordinates of hits and track Z position.

Definition at line 86 of file HitInHyperBox.h.

87 {
88 const float centerQ = *(hyperBox.getCenter<0>());
89 const float centerP = *(hyperBox.getCenter<1>());
90 const float centerZ0 = *(hyperBox.getCenter<2>());
91
92 const double lhsZ = lhsRecoHit.getRecoZ();
93 const double rhsZ = rhsRecoHit.getRecoZ();
94
95 const double lhsS = lhsRecoHit.getArcLength2D();
96 const double rhsS = rhsRecoHit.getArcLength2D();
97
98 const double lhsZDistance = catZ(centerQ, centerP, lhsS) + centerZ0 - lhsZ;
99 const double rhsZDistance = catZ(centerQ, centerP, rhsS) + centerZ0 - rhsZ;
100
101 return lhsZDistance < rhsZDistance;
102 }
static double catZ(const double q, const double p, const double R)
Returns z(R) for the catenary with parameters q = E/p_t and p = p_z/E.

◆ debugLine()

static const char * debugLine ( )
inlinestatic

ROOT expression of the track hypothesis.

Definition at line 140 of file HitInHyperBox.h.

140{ return "100.0 * [0] * (TMath::Sqrt(1 - [1] * [1]) * TMath::CosH(x / 100.0 + TMath::ASinH([1] / TMath::Sqrt(1 - [1] * [1]))) - 1) + [2]";}

◆ deltaX()

static float deltaX ( const HoughBox hyperBox)
inlinestatic

Returns half width of the box along first (Q) axis.

Definition at line 132 of file HitInHyperBox.h.

133 {
134 const float lowerQ = *(hyperBox.getLowerBound<DiscreteQ>()); //DiscreteValue is based on std::vector<T>::const_iterator
135 const float upperQ = *(hyperBox.getUpperBound<DiscreteQ>());
136 return 0.5 * (upperQ - lowerQ);
137 }

◆ operator()()

Weight operator() ( const CDCRecoHit3D recoHit,
const HoughBox hyperBox 
)
inline

Returns weight of the hit for the given hough box; in this algorithm - 1 if hit inside the box, NaN otherwise.

Definition at line 59 of file HitInHyperBox.h.

61 {
62 const float lowerQ = *(hyperBox->getLowerBound<DiscreteQ>()); //DiscreteValue is based on std::vector<T>::const_iterator
63 const float upperQ = *(hyperBox->getUpperBound<DiscreteQ>());
64 const float deltaQ = 0.5 * (upperQ - lowerQ);
65
66 const float centerP = *(hyperBox->getCenter<1>()); //TODO getCenter(class T) is not implemented
67
68 const float centerZ0 = *(hyperBox->getCenter<2>());
69
70 const double perpS = recoHit.getArcLength2D();
71 const double recoZ = recoHit.getRecoZ();
72
73 const bool sameSign = SameSignChecker::sameSign(catZ(lowerQ, centerP, perpS) + centerZ0 - 100.0 * Unit::cm * deltaQ - recoZ,
74 catZ(upperQ, centerP, perpS) + centerZ0 + 100.0 * Unit::cm * deltaQ - recoZ); //100 is a reference - size of CDC in cm
75 if (not sameSign) {
76 return 1.0;
77 } else {
78 return NAN;
79 }
80 }
static bool sameSign(double n1, double n2)
Check if two values have the same sign.
bool sameSign(double expected, double actual)
Predicate checking that two values have the same sign.
Definition: TestHelpers.cc:76

The documentation for this class was generated from the following file: