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