Belle II Software development
HitInQuadraticBox.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#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit3D.h>
10#include <tracking/trackFindingCDC/hough/boxes/PQBox.h>
11#include <tracking/trackFindingCDC/hough/baseelements/SameSignChecker.h>
12
13namespace Belle2 {
18 namespace TrackFindingCDC {
19
29 public:
30
32 using HoughBox = PQBox;
33
38 Weight operator()(const CDCRecoHit3D& recoHit,
39 const HoughBox* pqBox)
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 }
63
68 static bool compareDistances(const HoughBox& pqBox, const CDCRecoHit3D& lhsRecoHit, const CDCRecoHit3D& rhsRecoHit)
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 }
84
86 static const char* debugLine() { return "([0] + 4*[1])*x - [1] / 25 * x * x";}
87 };
88 }
90}
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
double getRecoZ() const
Getter for the z coordinate of the reconstructed position.
Definition: CDCRecoHit3D.h:303
double getArcLength2D() const
Getter for the travel distance in the xy projection.
Definition: CDCRecoHit3D.h:370
Predicate class to check for the containment of hits in a p q hough space part.
static const char * debugLine()
ROOT-compatible formula for z(s) = (p + 4q)*s - q/25 * s^2.
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.
Weight operator()(const CDCRecoHit3D &recoHit, const HoughBox *pqBox)
Checks if the wire hit is contained in a p q hough space.
A rectangular domain for the hough space over p and q.
Definition: PQBox.h:19
float getUpperP() const
Concise getter for the upper p bound.
Definition: PQBox.h:35
float getLowerQ() const
Concise getter for the lower q bound.
Definition: PQBox.h:39
float getUpperQ() const
Concise getter for the upper q bound.
Definition: PQBox.h:43
float getLowerP() const
Concise getter for the lower p bound.
Definition: PQBox.h:31
static bool sameSign(double n1, double n2)
Check if two values have the same sign.
Abstract base class for different kinds of events.