Belle II Software development
HitInZ0TanLambdaBox.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/Z0TanLambdaBox.h>
11#include <tracking/trackFindingCDC/hough/baseelements/SameSignChecker.h>
12
13namespace Belle2 {
18 namespace TrackFindingCDC {
19
26 public:
27
30
35 Weight operator()(const CDCRecoHit3D& recoHit,
36 const HoughBox* z0TanLambdaBox)
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 }
60
65 static bool compareDistances(const HoughBox& z0TanLambdaBox, const CDCRecoHit3D& lhsRecoHit, const CDCRecoHit3D& rhsRecoHit)
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 }
81
83 static const char* debugLine() { return "[0] + [1] * x";}
84 };
85 }
87}
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 z0 tan lambda hough space part.
static const char * debugLine()
ROOT-compatible formula for z(s) = z0 + tanlambda * s.
Weight operator()(const CDCRecoHit3D &recoHit, const HoughBox *z0TanLambdaBox)
Checks if the wire hit is contained in a z0 tan lambda hough space.
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 bool sameSign(double n1, double n2)
Check if two values have the same sign.
A rectangular domain for the hough space over phi0 and two dimensional curvature.
float getLowerTanLambda() const
Concise getter for the lower tan lambda bound.
float getUpperZ0() const
Concise getter for the upper z0 bound.
float getLowerZ0() const
Concise getter for the lower z0 bound.
float getUpperTanLambda() const
Concise getter for the upper tan lambda bound.
Abstract base class for different kinds of events.