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/trackingUtilities/eventdata/hits/CDCRecoHit3D.h>
13
14#include <cdc/topology/CDCWire.h>
15#include <cdc/topology/WireLine.h>
16
17#include <tracking/trackingUtilities/numerics/Weight.h>
18
19namespace Belle2 {
24 namespace TrackFindingCDC {
25
34 public:
35
38
44 TrackingUtilities::Weight operator()(const TrackingUtilities::CDCRecoHit3D& recoHit,
45 const HoughBox* z0TanLambdaBox)
46 {
47 const CDC::CDCWire& wire = recoHit.getWire();
48 const CDC::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 TrackingUtilities::Vector2D& recoPosition = recoHit.getRecoPos2D();
60
61 float hitZ = centerTanLambda * perpS + centerZ0;
62
63 TrackingUtilities::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 TrackingUtilities::CDCRecoHit3D& lhsRecoHit,
75 const TrackingUtilities::CDCRecoHit3D& rhsRecoHit)
76 {
77 const double z0Mean = (z0TanLambdaBox.getLowerZ0() + z0TanLambdaBox.getUpperZ0()) / 2.0;
78 const double tanLambdaMean = (z0TanLambdaBox.getLowerTanLambda() + z0TanLambdaBox.getUpperTanLambda()) / 2.0;
79
80 const double lhsZ = lhsRecoHit.getRecoZ();
81 const double rhsZ = rhsRecoHit.getRecoZ();
82
83 const double lhsS = lhsRecoHit.getArcLength2D();
84 const double rhsS = rhsRecoHit.getArcLength2D();
85
86 const double lhsZDistance = lhsS * tanLambdaMean + z0Mean - lhsZ;
87 const double rhsZDistance = rhsS * tanLambdaMean + z0Mean - rhsZ;
88
89 return lhsZDistance < rhsZDistance;
90 }
91
93 static const char* debugLine() { return "[0] + [1] * x";}
94 };
95 }
97}
Class representing a sense wire in the central drift chamber.
Definition CDCWire.h:50
const WireLine & getWireLine() const
Getter for the wire line representation of the wire.
Definition CDCWire.h:180
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition WireLine.h:33
ROOT::Math::XYVector 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:57
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.
static bool compareDistances(const HoughBox &z0TanLambdaBox, const TrackingUtilities::CDCRecoHit3D &lhsRecoHit, const TrackingUtilities::CDCRecoHit3D &rhsRecoHit)
Compares distances from two hits to the track represented by the given box.
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCRecoHit3D &recoHit, const HoughBox *z0TanLambdaBox)
Return exp{-distance} with distance = distance between the trajectory constructed from the box parame...
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.
Class representing a three dimensional reconstructed hit.
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
const CDC::CDCWire & getWire() const
Getter for the wire.
double getRecoZ() const
Getter for the z coordinate of the reconstructed position.
double getArcLength2D() const
Getter for the travel distance in the xy projection.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition Vector2D.h:36
Abstract base class for different kinds of events.