Belle II Software  release-05-01-25
HitInZ0TanLambdaBoxUsingZ.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun, Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/hough/boxes/Z0TanLambdaBox.h>
13 
14 #include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit3D.h>
15 
16 #include <tracking/trackFindingCDC/topology/CDCWire.h>
17 #include <tracking/trackFindingCDC/topology/WireLine.h>
18 
19 #include <tracking/trackFindingCDC/numerics/Weight.h>
20 
21 namespace Belle2 {
26  namespace TrackFindingCDC {
27 
35  class HitInZ0TanLambdaBoxUsingZ {
36  public:
37 
39  using HoughBox = Z0TanLambdaBox;
40 
46  Weight operator()(const CDCRecoHit3D& recoHit,
47  const HoughBox* z0TanLambdaBox)
48  {
49  const CDCWire& wire = recoHit.getWire();
50  const WireLine& wireLine = wire.getWireLine();
51 
52  float lowerZ0 = z0TanLambdaBox->getLowerZ0();
53  float upperZ0 = z0TanLambdaBox->getUpperZ0();
54  const float centerZ0 = 0.5 * (lowerZ0 + upperZ0);
55 
56  float lowerTanLambda = z0TanLambdaBox->getLowerTanLambda();
57  float upperTanLambda = z0TanLambdaBox->getUpperTanLambda();
58  const float centerTanLambda = 0.5 * (lowerTanLambda + upperTanLambda);
59 
60  float perpS = recoHit.getArcLength2D();
61  const Vector2D& recoPosition = recoHit.getRecoPos2D();
62 
63  float hitZ = centerTanLambda * perpS + centerZ0;
64 
65  Vector2D pos2D = wireLine.nominalPos2DAtZ(hitZ);
66 
67  float distanceToRecoPosition = (pos2D - recoPosition).norm();
68 
69  return exp(-distanceToRecoPosition);
70  }
71 
76  static bool compareDistances(const HoughBox& z0TanLambdaBox, const CDCRecoHit3D& lhsRecoHit, const CDCRecoHit3D& rhsRecoHit)
77  {
78  const double z0Mean = (z0TanLambdaBox.getLowerZ0() + z0TanLambdaBox.getUpperZ0()) / 2.0;
79  const double tanLambdaMean = (z0TanLambdaBox.getLowerTanLambda() + z0TanLambdaBox.getUpperTanLambda()) / 2.0;
80 
81  const double lhsZ = lhsRecoHit.getRecoZ();
82  const double rhsZ = rhsRecoHit.getRecoZ();
83 
84  const double lhsS = lhsRecoHit.getArcLength2D();
85  const double rhsS = rhsRecoHit.getArcLength2D();
86 
87  const double lhsZDistance = lhsS * tanLambdaMean + z0Mean - lhsZ;
88  const double rhsZDistance = rhsS * tanLambdaMean + z0Mean - rhsZ;
89 
90  return lhsZDistance < rhsZDistance;
91  }
92 
94  static const char* debugLine() { return "[0] + [1] * x";}
95  };
96  }
98 }
Belle2::TrackFindingCDC::WireLine::nominalPos2DAtZ
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:62
Belle2::TrackFindingCDC::Z0TanLambdaBox::getLowerTanLambda
float getLowerTanLambda() const
Concise getter for the lower tan lambda bound.
Definition: Z0TanLambdaBox.h:49
Belle2::TrackFindingCDC::CDCRecoHit3D
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:62
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::HitInZ0TanLambdaBoxUsingZ::HoughBox
Z0TanLambdaBox HoughBox
Use a Z0TanLambdaBox.
Definition: HitInZ0TanLambdaBoxUsingZ.h:47
Belle2::TrackFindingCDC::HitInZ0TanLambdaBoxUsingZ::compareDistances
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.
Definition: HitInZ0TanLambdaBoxUsingZ.h:84
Belle2::TrackFindingCDC::CDCRecoHit3D::getRecoZ
double getRecoZ() const
Getter for the z coordinate of the reconstructed position.
Definition: CDCRecoHit3D.h:313
Belle2::TrackFindingCDC::CDCRecoHit3D::getArcLength2D
double getArcLength2D() const
Getter for the travel distance in the xy projection.
Definition: CDCRecoHit3D.h:380
Belle2::TrackFindingCDC::Z0TanLambdaBox::getUpperZ0
float getUpperZ0() const
Concise getter for the upper z0 bound.
Definition: Z0TanLambdaBox.h:45
Belle2::TrackFindingCDC::Z0TanLambdaBox
A rectangular domain for the hough space over phi0 and two dimensional curvature.
Definition: Z0TanLambdaBox.h:29
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::WireLine
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition: WireLine.h:41
Belle2::TrackFindingCDC::HitInZ0TanLambdaBoxUsingZ::debugLine
static const char * debugLine()
ROOT-compatible formula for z(s) = z0 + tanlambda * s.
Definition: HitInZ0TanLambdaBoxUsingZ.h:102
Belle2::TrackFindingCDC::HitInZ0TanLambdaBoxUsingZ::operator()
Weight operator()(const CDCRecoHit3D &recoHit, const HoughBox *z0TanLambdaBox)
Return exp{-distance} with distance = distance between the trajectory constructed from the box parame...
Definition: HitInZ0TanLambdaBoxUsingZ.h:54
Belle2::TrackFindingCDC::CDCWire::getWireLine
const WireLine & getWireLine() const
Getter for the wire line represenation of the wire.
Definition: CDCWire.h:190
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::TrackFindingCDC::Z0TanLambdaBox::getLowerZ0
float getLowerZ0() const
Concise getter for the lower z0 bound.
Definition: Z0TanLambdaBox.h:41
Belle2::TrackFindingCDC::Z0TanLambdaBox::getUpperTanLambda
float getUpperTanLambda() const
Concise getter for the upper tan lambda bound.
Definition: Z0TanLambdaBox.h:53