Belle II Software development
HitInZ0TanLambdaBoxUsingZ.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
10#include <tracking/trackFindingCDC/hough/boxes/Z0TanLambdaBox.h>
11
12#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit3D.h>
13
14#include <tracking/trackFindingCDC/topology/CDCWire.h>
15#include <tracking/trackFindingCDC/topology/WireLine.h>
16
17#include <tracking/trackFindingCDC/numerics/Weight.h>
18
19namespace Belle2 {
24 namespace TrackFindingCDC {
25
34 public:
35
38
44 Weight operator()(const CDCRecoHit3D& recoHit,
45 const HoughBox* z0TanLambdaBox)
46 {
47 const CDCWire& wire = recoHit.getWire();
48 const WireLine& wireLine = wire.getWireLine();
49
50 float lowerZ0 = z0TanLambdaBox->getLowerZ0();
51 float upperZ0 = z0TanLambdaBox->getUpperZ0();
52 const float centerZ0 = 0.5 * (lowerZ0 + upperZ0);
53
54 float lowerTanLambda = z0TanLambdaBox->getLowerTanLambda();
55 float upperTanLambda = z0TanLambdaBox->getUpperTanLambda();
56 const float centerTanLambda = 0.5 * (lowerTanLambda + upperTanLambda);
57
58 float perpS = recoHit.getArcLength2D();
59 const Vector2D& recoPosition = recoHit.getRecoPos2D();
60
61 float hitZ = centerTanLambda * perpS + centerZ0;
62
63 Vector2D pos2D = wireLine.nominalPos2DAtZ(hitZ);
64
65 float distanceToRecoPosition = (pos2D - recoPosition).norm();
66
67 return exp(-distanceToRecoPosition);
68 }
69
74 static bool compareDistances(const HoughBox& z0TanLambdaBox, const CDCRecoHit3D& lhsRecoHit, const CDCRecoHit3D& rhsRecoHit)
75 {
76 const double z0Mean = (z0TanLambdaBox.getLowerZ0() + z0TanLambdaBox.getUpperZ0()) / 2.0;
77 const double tanLambdaMean = (z0TanLambdaBox.getLowerTanLambda() + z0TanLambdaBox.getUpperTanLambda()) / 2.0;
78
79 const double lhsZ = lhsRecoHit.getRecoZ();
80 const double rhsZ = rhsRecoHit.getRecoZ();
81
82 const double lhsS = lhsRecoHit.getArcLength2D();
83 const double rhsS = rhsRecoHit.getArcLength2D();
84
85 const double lhsZDistance = lhsS * tanLambdaMean + z0Mean - lhsZ;
86 const double rhsZDistance = rhsS * tanLambdaMean + z0Mean - rhsZ;
87
88 return lhsZDistance < rhsZDistance;
89 }
90
92 static const char* debugLine() { return "[0] + [1] * x";}
93 };
94 }
96}
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
Definition: CDCRecoHit3D.h:297
const CDCWire & getWire() const
Getter for the wire.
Definition: CDCRecoHit3D.h:226
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
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
const WireLine & getWireLine() const
Getter for the wire line represenation of the wire.
Definition: CDCWire.h:188
Predicate class to check for the containment of hits in a z0 tan lambda hough space part using a diff...
static const char * debugLine()
ROOT-compatible formula for z(s) = z0 + tanlambda * s.
Weight operator()(const CDCRecoHit3D &recoHit, const HoughBox *z0TanLambdaBox)
Return exp{-distance} with distance = distance between the trajectory constructed from the box parame...
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.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition: WireLine.h:31
Vector2D nominalPos2DAtZ(const double z) const
Gives the two dimensional position without wire sag effect of the line at the given z value.
Definition: WireLine.h:52
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.