Belle II Software development
HitInZ0TanLambdaBox Class Reference

Predicate class to check for the containment of hits in a z0 tan lambda hough space part. More...

#include <HitInZ0TanLambdaBox.h>

Public Types

using HoughBox = Z0TanLambdaBox
 Use a Z0TanLambdaBox.
 

Public Member Functions

Weight operator() (const CDCRecoHit3D &recoHit, const HoughBox *z0TanLambdaBox)
 Checks if the wire hit is contained in a z0 tan lambda hough space.
 

Static Public Member Functions

static bool compareDistances (const HoughBox &z0TanLambdaBox, 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) = z0 + tanlambda * s.
 

Detailed Description

Predicate class to check for the containment of hits in a z0 tan lambda hough space part.

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 25 of file HitInZ0TanLambdaBox.h.

Member Typedef Documentation

◆ HoughBox

Use a Z0TanLambdaBox.

Definition at line 29 of file HitInZ0TanLambdaBox.h.

Member Function Documentation

◆ compareDistances()

static bool compareDistances ( const HoughBox z0TanLambdaBox,
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 65 of file HitInZ0TanLambdaBox.h.

66 {
67 const double z0Mean = (z0TanLambdaBox.getLowerZ0() + z0TanLambdaBox.getUpperZ0()) / 2.0;
68 const double tanLambdaMean = (z0TanLambdaBox.getLowerTanLambda() + z0TanLambdaBox.getUpperTanLambda()) / 2.0;
69
70 const double lhsZ = lhsRecoHit.getRecoZ();
71 const double rhsZ = rhsRecoHit.getRecoZ();
72
73 const double lhsS = lhsRecoHit.getArcLength2D();
74 const double rhsS = rhsRecoHit.getArcLength2D();
75
76 const double lhsZDistance = lhsS * tanLambdaMean + z0Mean - lhsZ;
77 const double rhsZDistance = rhsS * tanLambdaMean + z0Mean - rhsZ;
78
79 return lhsZDistance < rhsZDistance;
80 }

◆ debugLine()

static const char * debugLine ( )
inlinestatic

ROOT-compatible formula for z(s) = z0 + tanlambda * s.

Definition at line 83 of file HitInZ0TanLambdaBox.h.

83{ return "[0] + [1] * x";}

◆ operator()()

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

Checks if the wire hit is contained in a z0 tan lambda hough space.

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

Definition at line 35 of file HitInZ0TanLambdaBox.h.

37 {
38 float lowerZ0 = z0TanLambdaBox->getLowerZ0();
39 float upperZ0 = z0TanLambdaBox->getUpperZ0();
40
41 float lowerTanLambda = z0TanLambdaBox->getLowerTanLambda();
42 float upperTanLambda = z0TanLambdaBox->getUpperTanLambda();
43
44 float perpS = recoHit.getArcLength2D();
45 float reconstructedZ = recoHit.getRecoZ();
46
47 float distLowerZ0LowerTanLambda = perpS * lowerTanLambda - reconstructedZ + lowerZ0;
48 float distUpperZ0LowerTanLambda = perpS * lowerTanLambda - reconstructedZ + upperZ0;
49 float distLowerZ0UpperTanLambda = perpS * upperTanLambda - reconstructedZ + lowerZ0;
50 float distUpperZ0UpperTanLambda = perpS * upperTanLambda - reconstructedZ + upperZ0;
51
52 const bool sameSign = SameSignChecker::sameSign(distLowerZ0LowerTanLambda, distUpperZ0LowerTanLambda,
53 distLowerZ0UpperTanLambda, distUpperZ0UpperTanLambda);
54 if (not sameSign) {
55 return 1.0;
56 } else {
57 return NAN;
58 }
59 }
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: