Belle II Software development
HitInQuadraticBox Class Reference

Predicate class to check for the containment of hits in a p q hough space part. More...

#include <HitInQuadraticBox.h>

Public Types

using HoughBox = PQBox
 Use a PQBox.
 

Public Member Functions

Weight operator() (const CDCRecoHit3D &recoHit, const HoughBox *pqBox)
 Checks if the wire hit is contained in a p q hough space.
 

Static Public Member Functions

static bool compareDistances (const HoughBox &pqBox, const CDCRecoHit3D &lhsRecoHit, const CDCRecoHit3D &rhsRecoHit)
 Compares distances from two hits to the track represented by the given box.
 
static const char * debugLine ()
 ROOT-compatible formula for z(s) = (p + 4q)*s - q/25 * s^2.
 

Detailed Description

Predicate class to check for the containment of hits in a p q hough space part.

FIXME physical names of parameters? z(s) = 0 + (p + 4q)*s - q/25 * s^2 p - z coordinate of track in outer layers of CDC (in units of 100cm //CDC radius is 113) q - divergence of track from straight line in the middle of CDC (in units of 100cm) Note this part this code defines the performance of the search in the hough plain quite significantly and there is probably room for improvement.

Definition at line 28 of file HitInQuadraticBox.h.

Member Typedef Documentation

◆ HoughBox

using HoughBox = PQBox

Use a PQBox.

Definition at line 32 of file HitInQuadraticBox.h.

Member Function Documentation

◆ compareDistances()

static bool compareDistances ( const HoughBox pqBox,
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 68 of file HitInQuadraticBox.h.

69 {
70 const double pMean = (pqBox.getLowerP() + pqBox.getUpperP()) / 2.0;
71 const double qMean = (pqBox.getLowerQ() + pqBox.getUpperQ()) / 2.0;
72
73 const double lhsZ = lhsRecoHit.getRecoZ();
74 const double rhsZ = rhsRecoHit.getRecoZ();
75
76 const double lhsS = lhsRecoHit.getArcLength2D();
77 const double rhsS = rhsRecoHit.getArcLength2D();
78
79 const double lhsZDistance = (pMean + 4 * qMean) * lhsS - qMean / 25 * lhsS * lhsS - lhsZ;
80 const double rhsZDistance = (pMean + 4 * qMean) * rhsS - qMean / 25 * rhsS * rhsS - rhsZ;
81
82 return lhsZDistance < rhsZDistance;
83 }

◆ debugLine()

static const char * debugLine ( )
inlinestatic

ROOT-compatible formula for z(s) = (p + 4q)*s - q/25 * s^2.

Definition at line 86 of file HitInQuadraticBox.h.

86{ return "([0] + 4*[1])*x - [1] / 25 * x * x";}

◆ operator()()

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

Checks if the wire hit is contained in a p q hough space.

Returns 1.0 if it is contained, returns NAN if it is not contained.

Definition at line 38 of file HitInQuadraticBox.h.

40 {
41 float lowerP = pqBox->getLowerP();
42 float upperP = pqBox->getUpperP();
43
44 float lowerQ = pqBox->getLowerQ();
45 float upperQ = pqBox->getUpperQ();
46
47 float perpS = recoHit.getArcLength2D();
48 float reconstructedZ = recoHit.getRecoZ();
49
50 float distLowerPLowerQ = (lowerP + 4 * lowerQ) * perpS - lowerQ / 25 * perpS * perpS - reconstructedZ;
51 float distUpperPLowerQ = (upperP + 4 * lowerQ) * perpS - lowerQ / 25 * perpS * perpS - reconstructedZ;
52 float distLowerPUpperQ = (lowerP + 4 * upperQ) * perpS - upperQ / 25 * perpS * perpS - reconstructedZ;
53 float distUpperPUpperQ = (upperP + 4 * upperQ) * perpS - upperQ / 25 * perpS * perpS - reconstructedZ;
54
55 const bool sameSign = SameSignChecker::sameSign(distLowerPLowerQ, distUpperPLowerQ,
56 distLowerPUpperQ, distUpperPUpperQ);
57 if (not sameSign) {
58 return 1.0;
59 } else {
60 return NAN;
61 }
62 }
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:77

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