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/trackFindingCDC/eventdata/hits/CDCFacet.h>
11
12using namespace Belle2;
13using namespace TrackFindingCDC;
14
16{
17 if (not ptrFacetRelation) return false;
18 const Relation<const CDCFacet>& facetRelation = *ptrFacetRelation;
19
20 const CDCFacet& fromFacet = *facetRelation.first;
21 const CDCFacet& toFacet = *facetRelation.second;
22
23 const CDCRLWireHit& fromStartRLWireHit = fromFacet.getStartRLWireHit();
24 const CDCRLWireHit& fromMiddleRLWireHit = fromFacet.getMiddleRLWireHit();
25 const CDCRLWireHit& fromEndRLWireHit = fromFacet.getEndRLWireHit();
26
27 const CDCRLWireHit& toStartRLWireHit = toFacet.getStartRLWireHit();
28 const CDCRLWireHit& toMiddleRLWireHit = toFacet.getMiddleRLWireHit();
29 const CDCRLWireHit& toEndRLWireHit = toFacet.getEndRLWireHit();
30
31 const ParameterLine2D& fromStartToMiddle = fromFacet.getStartToMiddleLine();
32 const ParameterLine2D& fromStartToEnd = fromFacet.getStartToEndLine();
33 const ParameterLine2D& fromMiddleToEnd = fromFacet.getMiddleToEndLine();
34
35 const ParameterLine2D& toStartToMiddle = toFacet.getStartToMiddleLine();
36 const ParameterLine2D& toStartToEnd = toFacet.getStartToEndLine();
37 const ParameterLine2D& toMiddleToEnd = toFacet.getMiddleToEndLine();
38
39 const double fromStartVarL = fromStartRLWireHit.getRefDriftLengthVariance();
40 const double fromMiddleVarL = fromMiddleRLWireHit.getRefDriftLengthVariance();
41 const double fromEndVarL = fromEndRLWireHit.getRefDriftLengthVariance();
42
43 const double toStartVarL = toStartRLWireHit.getRefDriftLengthVariance();
44 const double toMiddleVarL = toMiddleRLWireHit.getRefDriftLengthVariance();
45 const double toEndVarL = toEndRLWireHit.getRefDriftLengthVariance();
46
47 // Lets call the four involved hits A, B, C and D.
48 const double fromAB = fromStartToMiddle.tangential().norm();
49 const double fromAC = fromStartToEnd.tangential().norm();
50 const double fromBC = fromMiddleToEnd.tangential().norm();
51
52 const double toBC = toStartToMiddle.tangential().norm();
53 const double toBD = toStartToEnd.tangential().norm();
54 const double toCD = toMiddleToEnd.tangential().norm();
55
56 const double sAB = fromAB;
57 const double sBC = (fromBC + toBC) / 2;
58 const double sCD = toCD;
59
60 const double sAC = fromAC;
61 const double sBD = toBD;
62 // const double sAC = sAB + sBC;
63 // const double sBD = sBC + sCD;
64
65 const double fromDeltaPhi =
66 fromStartToMiddle.tangential().angleWith(fromStartToEnd.tangential());
67 const double toDeltaPhi =
68 toStartToMiddle.tangential().angleWith(toStartToEnd.tangential());
69
70 const double deltaPhi = fromDeltaPhi - toDeltaPhi;
71
72 const double fromCurv = 2 * fromDeltaPhi / sAC;
73 const double toCurv = 2 * toDeltaPhi / sBD;
74 const double deltaCurv = toCurv - fromCurv;
75
76 const double dPhiA = 1 / sAB;
77 const double dPhiB = 1 / sAB + 2 / sBC;
78 const double dPhiC = 1 / sCD + 2 / sBC;
79 const double dPhiD = 1 / sCD;
80
81 const double dCurvA = 2 / sAC / sAB;
82 const double dCurvB = 2 / sAC / sAB + (2 / sAC + 2 / sBD) / sBC;
83 const double dCurvC = 2 / sBD / sCD + (2 / sAC + 2 / sBD) / sBC;
84 const double dCurvD = 2 / sBD / sCD;
85
86 const double varLA = fromStartVarL;
87 const double varLB = (fromMiddleVarL + toStartVarL) / 2;
88 const double varLC = (fromEndVarL + toMiddleVarL) / 2;
89 const double varLD = toEndVarL;
90
91 const double deltaPhiVar =
92 varLA * dPhiA * dPhiA +
93 varLB * dPhiB * dPhiB +
94 varLC * dPhiC * dPhiC +
95 varLD * dPhiD * dPhiD;
96
97 const double deltaCurvVar =
98 varLA * dCurvA * dCurvA +
99 varLB * dCurvB * dCurvB +
100 varLC * dCurvC * dCurvC +
101 varLD * dCurvD * dCurvD;
102
103 const double deltaCurvPull = deltaCurv / std::sqrt(deltaCurvVar);
104 const double deltaPhiPull = deltaPhi / std::sqrt(deltaPhiVar);
105
106 var<named("delta_phi")>() = std::fabs(deltaPhi);
107 var<named("delta_phi_pull")>() = std::fabs(deltaPhiPull);
108 var<named("delta_curv")>() = std::fabs(deltaCurv);
109 var<named("delta_curv_pull")>() = std::fabs(deltaCurvPull);
110
111 double r = (fromFacet.getMiddleRecoPos2D().norm() + fromFacet.getMiddleRecoPos2D().norm()) / 2;
112 var<named("delta_phi_pull_per_r")>() = std::fabs(deltaPhiPull) / r;
113 var<named("delta_curv_pull_per_r")>() = std::fabs(deltaCurvPull) / r;
114
115 return true;
116}
bool extract(const Relation< const 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:94
Vector2D getMiddleRecoPos2D() const
Getter for the reconstructed position at the second hit on the fit line.
Definition: CDCFacet.cc:76
ParameterLine2D getStartToMiddleLine() const
Getter for the tangential line from the first to the second hit.
Definition: CDCFacet.cc:86
ParameterLine2D getMiddleToEndLine() const
Getter for the tangential line from the second to the third hit.
Definition: CDCFacet.cc:102
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 ...
Definition: CDCRLWireHit.h:41
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:222
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)
Getter for the index from the name.
Definition: VarSet.h:78
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:93
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:197
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:175
Abstract base class for different kinds of events.