Belle II Software development
BendFacetRelationVarSet.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/facetRelation/BendFacetRelationVarSet.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 ptrFacetRelation) return false;
19 const Relation<const CDCFacet>& facetRelation = *ptrFacetRelation;
20
21 const CDCFacet& fromFacet = *facetRelation.first;
22 const CDCFacet& toFacet = *facetRelation.second;
23
24 const CDCRLWireHit& fromStartRLWireHit = fromFacet.getStartRLWireHit();
25 const CDCRLWireHit& fromMiddleRLWireHit = fromFacet.getMiddleRLWireHit();
26 const CDCRLWireHit& fromEndRLWireHit = fromFacet.getEndRLWireHit();
27
28 const CDCRLWireHit& toStartRLWireHit = toFacet.getStartRLWireHit();
29 const CDCRLWireHit& toMiddleRLWireHit = toFacet.getMiddleRLWireHit();
30 const CDCRLWireHit& toEndRLWireHit = toFacet.getEndRLWireHit();
31
32 const ParameterLine2D& fromStartToMiddle = fromFacet.getStartToMiddleLine();
33 const ParameterLine2D& fromStartToEnd = fromFacet.getStartToEndLine();
34 const ParameterLine2D& fromMiddleToEnd = fromFacet.getMiddleToEndLine();
35
36 const ParameterLine2D& toStartToMiddle = toFacet.getStartToMiddleLine();
37 const ParameterLine2D& toStartToEnd = toFacet.getStartToEndLine();
38 const ParameterLine2D& toMiddleToEnd = toFacet.getMiddleToEndLine();
39
40 const double fromStartVarL = fromStartRLWireHit.getRefDriftLengthVariance();
41 const double fromMiddleVarL = fromMiddleRLWireHit.getRefDriftLengthVariance();
42 const double fromEndVarL = fromEndRLWireHit.getRefDriftLengthVariance();
43
44 const double toStartVarL = toStartRLWireHit.getRefDriftLengthVariance();
45 const double toMiddleVarL = toMiddleRLWireHit.getRefDriftLengthVariance();
46 const double toEndVarL = toEndRLWireHit.getRefDriftLengthVariance();
47
48 // Lets call the four involved hits A, B, C and D.
49 const double fromAB = fromStartToMiddle.tangential().norm();
50 const double fromAC = fromStartToEnd.tangential().norm();
51 const double fromBC = fromMiddleToEnd.tangential().norm();
52
53 const double toBC = toStartToMiddle.tangential().norm();
54 const double toBD = toStartToEnd.tangential().norm();
55 const double toCD = toMiddleToEnd.tangential().norm();
56
57 const double sAB = fromAB;
58 const double sBC = (fromBC + toBC) / 2;
59 const double sCD = toCD;
60
61 const double sAC = fromAC;
62 const double sBD = toBD;
63 // const double sAC = sAB + sBC;
64 // const double sBD = sBC + sCD;
65
66 const double fromDeltaPhi =
67 fromStartToMiddle.tangential().angleWith(fromStartToEnd.tangential());
68 const double toDeltaPhi =
69 toStartToMiddle.tangential().angleWith(toStartToEnd.tangential());
70
71 const double deltaPhi = fromDeltaPhi - toDeltaPhi;
72
73 const double fromCurv = 2 * fromDeltaPhi / sAC;
74 const double toCurv = 2 * toDeltaPhi / sBD;
75 const double deltaCurv = toCurv - fromCurv;
76
77 const double dPhiA = 1 / sAB;
78 const double dPhiB = 1 / sAB + 2 / sBC;
79 const double dPhiC = 1 / sCD + 2 / sBC;
80 const double dPhiD = 1 / sCD;
81
82 const double dCurvA = 2 / sAC / sAB;
83 const double dCurvB = 2 / sAC / sAB + (2 / sAC + 2 / sBD) / sBC;
84 const double dCurvC = 2 / sBD / sCD + (2 / sAC + 2 / sBD) / sBC;
85 const double dCurvD = 2 / sBD / sCD;
86
87 const double varLA = fromStartVarL;
88 const double varLB = (fromMiddleVarL + toStartVarL) / 2;
89 const double varLC = (fromEndVarL + toMiddleVarL) / 2;
90 const double varLD = toEndVarL;
91
92 const double deltaPhiVar =
93 varLA * dPhiA * dPhiA +
94 varLB * dPhiB * dPhiB +
95 varLC * dPhiC * dPhiC +
96 varLD * dPhiD * dPhiD;
97
98 const double deltaCurvVar =
99 varLA * dCurvA * dCurvA +
100 varLB * dCurvB * dCurvB +
101 varLC * dCurvC * dCurvC +
102 varLD * dCurvD * dCurvD;
103
104 const double deltaCurvPull = deltaCurv / std::sqrt(deltaCurvVar);
105 const double deltaPhiPull = deltaPhi / std::sqrt(deltaPhiVar);
106
107 var<named("delta_phi")>() = std::fabs(deltaPhi);
108 var<named("delta_phi_pull")>() = std::fabs(deltaPhiPull);
109 var<named("delta_curv")>() = std::fabs(deltaCurv);
110 var<named("delta_curv_pull")>() = std::fabs(deltaCurvPull);
111
112 double r = (fromFacet.getMiddleRecoPos2D().norm() + fromFacet.getMiddleRecoPos2D().norm()) / 2;
113 var<named("delta_phi_pull_per_r")>() = std::fabs(deltaPhiPull) / r;
114 var<named("delta_curv_pull_per_r")>() = std::fabs(deltaCurvPull) / r;
115
116 return true;
117}
bool extract(const TrackingUtilities::Relation< const TrackingUtilities::CDCFacet > *ptrFacetRelation) final
Generate and assign the contained variables.
Class representing a triple of neighboring oriented wire with additional trajectory information.
Definition CDCFacet.h:32
ParameterLine2D getStartToEndLine() const
Getter for the tangential line from the first to the third hit.
Definition CDCFacet.cc:95
Vector2D getMiddleRecoPos2D() const
Getter for the reconstructed position at the second hit on the fit line.
Definition CDCFacet.cc:77
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.
A line with a support point and tangential vector.
const Vector2D & tangential() const
Gives the tangential vector of the line.
Type for two related objects.
Definition Relation.h:21
static constexpr int named(const char *name)
Definition VarSet.h:78
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
Abstract base class for different kinds of events.