Belle II Software development
BendFacetVarSet.cc
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#include <tracking/trackFindingCDC/filters/facet/BendFacetVarSet.h>
9
10#include <tracking/trackingUtilities/eventdata/hits/CDCFacet.h>
11
12using namespace Belle2;
13using namespace TrackFindingCDC;
14using namespace TrackingUtilities;
15
17{
18 if (not ptrFacet) return false;
19 const CDCFacet& facet = *ptrFacet;
20
22 facet.adjustFitLine();
23
24 const CDCRLWireHit& startRLWirehit = facet.getStartRLWireHit();
25 const double startDriftLengthVar = startRLWirehit.getRefDriftLengthVariance();
26 const double startDriftLengthSigma = sqrt(startDriftLengthVar);
27 const double startWeight = 1.0 / startDriftLengthVar;
28
29 const CDCRLWireHit& middleRLWirehit = facet.getMiddleRLWireHit();
30 const double middleDriftLengthVar = middleRLWirehit.getRefDriftLengthVariance();
31 const double middleDriftLengthSigma = sqrt(middleDriftLengthVar);
32 const double middleWeight = 1.0 / middleDriftLengthVar;
33
34 const CDCRLWireHit& endRLWirehit = facet.getEndRLWireHit();
35 const double endDriftLengthVar = endRLWirehit.getRefDriftLengthVariance();
36 const double endDriftLengthSigma = sqrt(endDriftLengthVar);
37 const double endWeight = 1.0 / endDriftLengthVar;
38
39 const double sumWeight = startWeight + middleWeight + endWeight;
40
41 const ParameterLine2D& startToMiddleLine = facet.getStartToMiddleLine();
42 const ParameterLine2D& startToEndLine = facet.getStartToEndLine();
43 const ParameterLine2D& middleToEndLine = facet.getMiddleToEndLine();
44
45 const double startDistance = middleToEndLine.distance(startRLWirehit.getRefPos2D()) - startRLWirehit.getSignedRefDriftLength();
46 const double middleDistance = startToEndLine.distance(middleRLWirehit.getRefPos2D()) - middleRLWirehit.getSignedRefDriftLength();
47 const double endDistance = startToMiddleLine.distance(endRLWirehit.getRefPos2D()) - endRLWirehit.getSignedRefDriftLength();
48
49 const double startOptimalStep = startDistance * startWeight / sumWeight;
50 const double middleOptimalStep = middleDistance * middleWeight / sumWeight;
51 const double endOptimalStep = endDistance * endWeight / sumWeight;
52
53 const double startChi2 = startDistance * (startDistance - startOptimalStep) * startWeight;
54 const double middleChi2 = middleDistance * (middleDistance - middleOptimalStep) * middleWeight;
55 const double endChi2 = endDistance * (endDistance - endOptimalStep) * endWeight;
56
57 const Vector2D& startToMiddleTangentialVector = startToMiddleLine.tangential();
58 const Vector2D& startToEndTangentialVector = startToEndLine.tangential();
59 const Vector2D& middleToEndTangentialVector = middleToEndLine.tangential();
60
61 const double startToMiddleLength = startToMiddleTangentialVector.norm();
62 const double startToEndLength = startToEndTangentialVector.norm();
63 const double middleToEndLength = middleToEndTangentialVector.norm();
64
65 const double startPhi = startToMiddleTangentialVector.angleWith(startToEndTangentialVector);
66 const double middlePhi = startToMiddleTangentialVector.angleWith(middleToEndTangentialVector);
67 const double endPhi = startToEndTangentialVector.angleWith(middleToEndTangentialVector);
68
69 const double startToMiddleSigmaPhi = startDriftLengthSigma / startToMiddleLength;
70 const double startToEndSigmaPhi = startDriftLengthSigma / startToEndLength;
71
72 const double middleToStartSigmaPhi = middleDriftLengthSigma / startToMiddleLength;
73 const double middleToEndSigmaPhi = middleDriftLengthSigma / middleToEndLength;
74
75 const double endToStartSigmaPhi = endDriftLengthSigma / startToEndLength;
76 const double endToMiddleSigmaPhi = endDriftLengthSigma / middleToEndLength;
77
78 const double startPhiSigma = hypot3(startToEndSigmaPhi - startToMiddleSigmaPhi,
79 middleToStartSigmaPhi,
80 endToStartSigmaPhi);
81
82 const double middlePhiSigma = hypot3(startToMiddleSigmaPhi,
83 middleToStartSigmaPhi + middleToEndSigmaPhi,
84 endToMiddleSigmaPhi);
85
86 const double endPhiSigma = hypot3(startToEndSigmaPhi,
87 middleToEndSigmaPhi,
88 endToStartSigmaPhi - endToMiddleSigmaPhi);
89
90 const double startPhiPull = startPhi / startPhiSigma;
91 const double middlePhiPull = middlePhi / middlePhiSigma;
92 const double endPhiPull = endPhi / endPhiSigma;
93
94 const double curv = 2 * middlePhi / startToEndLength;
95 const double curvSigma = 2 * middlePhiSigma / startToEndLength;
96 const double curvPull = middlePhiPull / startToEndLength;
97
98 var<named("start_phi")>() = startPhi;
99 var<named("start_phi_sigma")>() = startPhiSigma;
100 var<named("start_phi_pull")>() = startPhiPull;
101 var<named("start_d")>() = startDistance;
102 var<named("start_chi2")>() = startChi2;
103
104 var<named("middle_phi")>() = middlePhi;
105 var<named("middle_phi_sigma")>() = middlePhiSigma;
106 var<named("middle_phi_pull")>() = middlePhiPull;
107 var<named("middle_d")>() = middleDistance;
108 var<named("middle_chi2")>() = middleChi2;
109
110 var<named("end_phi")>() = endPhi;
111 var<named("end_phi_sigma")>() = endPhiSigma;
112 var<named("end_phi_pull")>() = endPhiPull;
113 var<named("end_d")>() = endDistance;
114 var<named("end_chi2")>() = endChi2;
115
116 var<named("s")>() = startToEndLength;
117
118 var<named("curv")>() = curv;
119 var<named("curv_sigma")>() = curvSigma;
120 var<named("curv_pull")>() = curvPull;
121
122 return true;
123}
bool extract(const TrackingUtilities::CDCFacet *ptrFacet) final
Generate and assign the contained variables.
Class representing a triple of neighboring oriented wire with additional trajectory information.
Definition CDCFacet.h:32
void adjustFitLine() const
Adjusts the contained fit line to touch such that it touches the first and third hit.
Definition CDCFacet.cc:62
ParameterLine2D getStartToEndLine() const
Getter for the tangential line from the first to the third hit.
Definition CDCFacet.cc:95
ParameterLine2D getStartToMiddleLine() const
Getter for the tangential line from the first to the second hit.
Definition CDCFacet.cc:87
ParameterLine2D getMiddleToEndLine() const
Getter for the tangential line from the second to the third hit.
Definition CDCFacet.cc:103
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position of the underlying wire.
double getSignedRefDriftLength() const
Getter for the drift length at the reference position of the wire.
A line with a support point and tangential vector.
double distance(const Vector2D &point) const
Gives the signed distance of a point to the line.
const Vector2D & tangential() const
Gives the tangential vector of the line.
static constexpr int named(const char *name)
Definition VarSet.h:78
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition Vector2D.h:36
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition Vector2D.h:228
double norm() const
Calculates the length of the vector.
Definition Vector2D.h:206
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28
Abstract base class for different kinds of events.