Belle II Software  release-05-01-25
BendFacetRelationVarSet.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/filters/facetRelation/BendFacetRelationVarSet.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/hits/CDCFacet.h>
13 
14 using namespace Belle2;
15 using namespace TrackFindingCDC;
16 
18 {
19  if (not ptrFacetRelation) return false;
20  const Relation<const CDCFacet>& facetRelation = *ptrFacetRelation;
21 
22  const CDCFacet& fromFacet = *facetRelation.first;
23  const CDCFacet& toFacet = *facetRelation.second;
24 
25  const CDCRLWireHit& fromStartRLWireHit = fromFacet.getStartRLWireHit();
26  const CDCRLWireHit& fromMiddleRLWireHit = fromFacet.getMiddleRLWireHit();
27  const CDCRLWireHit& fromEndRLWireHit = fromFacet.getEndRLWireHit();
28 
29  const CDCRLWireHit& toStartRLWireHit = toFacet.getStartRLWireHit();
30  const CDCRLWireHit& toMiddleRLWireHit = toFacet.getMiddleRLWireHit();
31  const CDCRLWireHit& toEndRLWireHit = toFacet.getEndRLWireHit();
32 
33  const ParameterLine2D& fromStartToMiddle = fromFacet.getStartToMiddleLine();
34  const ParameterLine2D& fromStartToEnd = fromFacet.getStartToEndLine();
35  const ParameterLine2D& fromMiddleToEnd = fromFacet.getMiddleToEndLine();
36 
37  const ParameterLine2D& toStartToMiddle = toFacet.getStartToMiddleLine();
38  const ParameterLine2D& toStartToEnd = toFacet.getStartToEndLine();
39  const ParameterLine2D& toMiddleToEnd = toFacet.getMiddleToEndLine();
40 
41  const double fromStartVarL = fromStartRLWireHit.getRefDriftLengthVariance();
42  const double fromMiddleVarL = fromMiddleRLWireHit.getRefDriftLengthVariance();
43  const double fromEndVarL = fromEndRLWireHit.getRefDriftLengthVariance();
44 
45  const double toStartVarL = toStartRLWireHit.getRefDriftLengthVariance();
46  const double toMiddleVarL = toMiddleRLWireHit.getRefDriftLengthVariance();
47  const double toEndVarL = toEndRLWireHit.getRefDriftLengthVariance();
48 
49  // Lets call the four involved hits A, B, C and D.
50  const double fromAB = fromStartToMiddle.tangential().norm();
51  const double fromAC = fromStartToEnd.tangential().norm();
52  const double fromBC = fromMiddleToEnd.tangential().norm();
53 
54  const double toBC = toStartToMiddle.tangential().norm();
55  const double toBD = toStartToEnd.tangential().norm();
56  const double toCD = toMiddleToEnd.tangential().norm();
57 
58  const double sAB = fromAB;
59  const double sBC = (fromBC + toBC) / 2;
60  const double sCD = toCD;
61 
62  const double sAC = fromAC;
63  const double sBD = toBD;
64  // const double sAC = sAB + sBC;
65  // const double sBD = sBC + sCD;
66 
67  const double fromDeltaPhi =
68  fromStartToMiddle.tangential().angleWith(fromStartToEnd.tangential());
69  const double toDeltaPhi =
70  toStartToMiddle.tangential().angleWith(toStartToEnd.tangential());
71 
72  const double deltaPhi = fromDeltaPhi - toDeltaPhi;
73 
74  const double fromCurv = 2 * fromDeltaPhi / sAC;
75  const double toCurv = 2 * toDeltaPhi / sBD;
76  const double deltaCurv = toCurv - fromCurv;
77 
78  const double dPhiA = 1 / sAB;
79  const double dPhiB = 1 / sAB + 2 / sBC;
80  const double dPhiC = 1 / sCD + 2 / sBC;
81  const double dPhiD = 1 / sCD;
82 
83  const double dCurvA = 2 / sAC / sAB;
84  const double dCurvB = 2 / sAC / sAB + (2 / sAC + 2 / sBD) / sBC;
85  const double dCurvC = 2 / sBD / sCD + (2 / sAC + 2 / sBD) / sBC;
86  const double dCurvD = 2 / sBD / sCD;
87 
88  const double varLA = fromStartVarL;
89  const double varLB = (fromMiddleVarL + toStartVarL) / 2;
90  const double varLC = (fromEndVarL + toMiddleVarL) / 2;
91  const double varLD = toEndVarL;
92 
93  const double deltaPhiVar =
94  varLA * dPhiA * dPhiA +
95  varLB * dPhiB * dPhiB +
96  varLC * dPhiC * dPhiC +
97  varLD * dPhiD * dPhiD;
98 
99  const double deltaCurvVar =
100  varLA * dCurvA * dCurvA +
101  varLB * dCurvB * dCurvB +
102  varLC * dCurvC * dCurvC +
103  varLD * dCurvD * dCurvD;
104 
105  const double deltaCurvPull = deltaCurv / std::sqrt(deltaCurvVar);
106  const double deltaPhiPull = deltaPhi / std::sqrt(deltaPhiVar);
107 
108  var<named("delta_phi")>() = std::fabs(deltaPhi);
109  var<named("delta_phi_pull")>() = std::fabs(deltaPhiPull);
110  var<named("delta_curv")>() = std::fabs(deltaCurv);
111  var<named("delta_curv_pull")>() = std::fabs(deltaCurvPull);
112 
113  double r = (fromFacet.getMiddleRecoPos2D().norm() + fromFacet.getMiddleRecoPos2D().norm()) / 2;
114  var<named("delta_phi_pull_per_r")>() = std::fabs(deltaPhiPull) / r;
115  var<named("delta_curv_pull_per_r")>() = std::fabs(deltaCurvPull) / r;
116 
117  return true;
118 }
Belle2::TrackFindingCDC::CDCFacet::getStartToEndLine
ParameterLine2D getStartToEndLine() const
Getter for the tangential line from the first to the third hit.
Definition: CDCFacet.cc:96
Belle2::TrackFindingCDC::Relation
Type for two related objects.
Definition: CDCSegment2D.h:37
Belle2::TrackFindingCDC::ParameterLine2D
A line with a support point and tangential vector.
Definition: ParameterLine2D.h:48
Belle2::TrackFindingCDC::CDCRLWireHit::getRefDriftLengthVariance
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:232
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCFacet::getStartToMiddleLine
ParameterLine2D getStartToMiddleLine() const
Getter for the tangential line from the first to the second hit.
Definition: CDCFacet.cc:88
Belle2::TrackFindingCDC::CDCRLWireHit
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:51
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getMiddleRLWireHit
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
Definition: CDCRLWireHitTriple.h:243
Belle2::TrackFindingCDC::CDCFacet
Class representing a triple of neighboring oriented wire with additional trajectory information.
Definition: CDCFacet.h:42
Belle2::TrackFindingCDC::ParameterLine2D::tangential
const Vector2D & tangential() const
Gives the tangential vector of the line.
Definition: ParameterLine2D.h:135
Belle2::TrackFindingCDC::BendFacetRelationVarSet::extract
bool extract(const Relation< const CDCFacet > *ptrFacetRelation) final
Generate and assign the contained variables.
Definition: BendFacetRelationVarSet.cc:17
Belle2::TrackFindingCDC::Vector2D::norm
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:189
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getEndRLWireHit
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
Definition: CDCRLWireHitTriple.h:249
Belle2::TrackFindingCDC::CDCFacet::getMiddleToEndLine
ParameterLine2D getMiddleToEndLine() const
Getter for the tangential line from the second to the third hit.
Definition: CDCFacet.cc:104
Belle2::TrackFindingCDC::VarSet< BendFacetRelationVarNames >::named
constexpr static int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:88
Belle2::TrackFindingCDC::Vector2D::angleWith
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:211
Belle2::TrackFindingCDC::VarSet< BendFacetRelationVarNames >::var
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:103
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getStartRLWireHit
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
Definition: CDCRLWireHitTriple.h:237
Belle2::TrackFindingCDC::CDCFacet::getMiddleRecoPos2D
Vector2D getMiddleRecoPos2D() const
Getter for the reconstructed position at the second hit on the fit line.
Definition: CDCFacet.cc:78