Generate and assign the contained variables.
33{
34 if (not ptrFacetRelation) return false;
35
36 const CDCFacet* fromFacet = ptrFacetRelation->first;
37 const CDCFacet* toFacet = ptrFacetRelation->second;
38
39 const UncertainParameterLine2D& fromFitLine = fromFacet->
getFitLine();
40 const UncertainParameterLine2D& toFitLine = toFacet->
getFitLine();
41
44
47
50
51 ROOT::Math::XYVector tangential = VectorUtil::average(fromTangential, toTangential);
52
55
56 var<
named(
"cos_delta")>() = VectorUtil::CosPhi(fromTangential, toTangential);
57
58 var<
named(
"from_middle_cos_delta")>() = fromMiddleCos;
59 var<
named(
"to_middle_cos_delta")>() = toMiddleCos;
60
63 {
64 int nSteps = 0;
65 UncertainParameterLine2D fitLine =
FacetFitter::fit(*fromFacet, *toFacet, nSteps);
66 double s = fitLine->
lengthOnCurve(frontWirePos2D, backWirePos2D);
67 double alpha = ROOT::Math::VectorUtil::DeltaPhi(fitLine->
support(), fitLine->
tangential());
73 var<
named(
"fit_0_cos_delta")>() = VectorUtil::CosPhi(fitLine->
tangential(), tangential);
74 }
75
76 {
77 int nSteps = 1;
78 UncertainParameterLine2D fitLine =
FacetFitter::fit(*fromFacet, *toFacet, nSteps);
79 double s = fitLine->
lengthOnCurve(frontWirePos2D, backWirePos2D);
83 var<
named(
"fit_1_cos_delta")>() = VectorUtil::CosPhi(fitLine->
tangential(), tangential);
84 }
85
86 {
88 double s = fitLine->
lengthOnCurve(frontWirePos2D, backWirePos2D);
93 }
94
95
96 {
97 using namespace NLineParameterIndices;
98 {
100 if (not std::isfinite(phi0_var)) {
101 B2INFO("from addr " << *fromFacet);
104 }
105 }
106 {
108 if (not std::isfinite(phi0_var)) {
109 B2INFO("to addr " << *toFacet);
112 }
113 }
114
115 var<
named(
"phi0_from_sigma")>() = std::sqrt(fromCov(c_Phi0, c_Phi0));
116 var<
named(
"phi0_to_sigma")>() = std::sqrt(toCov(c_Phi0, c_Phi0));
117 var<
named(
"phi0_ref_sigma")>() = std::sqrt(fromCov(c_Phi0, c_Phi0) + toCov(c_Phi0, c_Phi0));
121 std::sqrt((toCov(c_Phi0, c_Phi0) + fromCov(c_Phi0, c_Phi0))));
122
123 LineParameters avgPar;
124 LineCovariance avgCov;
126
127 LineParameters meanPar = (fromPar + toPar) / 2.0;
129
130 LineParameters relAvgPar = avgPar - meanPar;
132
135 std::fabs(relAvgPar(c_Phi0) / std::sqrt(avgCov(c_Phi0, c_Phi0)));
136 var<
named(
"phi0_comb_diff")>() = relAvgPar(c_Phi0);
137 var<
named(
"phi0_comb_sigma")>() = std::sqrt(avgCov(c_Phi0, c_Phi0));
138 }
139
140
141 {
142 CDCObservations2D observations2D(EFitPos::c_RecoPos, EFitVariance::c_Unit);
143 observations2D.append(*fromFacet);
144 observations2D.append(*toFacet);
145
149 }
150
151 {
152 CDCObservations2D observations2D(EFitPos::c_RecoPos, EFitVariance::c_DriftLength);
153 observations2D.append(*fromFacet);
154 observations2D.append(*toFacet);
155
159 }
160
161 {
162 CDCObservations2D observations2D(EFitPos::c_RecoPos, EFitVariance::c_Pseudo);
163 observations2D.append(*fromFacet);
164 observations2D.append(*toFacet);
165
169 }
170
171 {
172 CDCObservations2D observations2D(EFitPos::c_RecoPos, EFitVariance::c_Proper);
173 observations2D.append(*fromFacet);
174 observations2D.append(*toFacet);
175
179 }
180
181 return true;
182}
TrackingUtilities::CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
static const CDCKarimakiFitter & getFitter()
Static getter for a general fitter instance with Karimakis method.
static double fit(const TrackingUtilities::CDCFacet &facet, int nSteps=100)
Fits a proper line to facet and returns the chi2.
ParameterLine2D getStartToEndLine() const
Getter for the tangential line from the first to the third hit.
const UncertainParameterLine2D & getFitLine() const
Getter for the contained line fit information.
ParameterLine2D getStartToMiddleLine() const
Getter for the tangential line from the first to the second hit.
ParameterLine2D getMiddleToEndLine() const
Getter for the tangential line from the second to the third hit.
const CDCWireHit & getEndWireHit() const
Getter for the hit wire of the third oriented wire hit.
const CDCWireHit & getStartWireHit() const
Getter for the hit wire of the first oriented wire hit.
double getChi2() const
Getter for the chi2 value of the circle fit.
double getCurvature() const
Getter for the curvature as seen from the xy projection.
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
const ROOT::Math::XYVector & support() const
Gives the support vector of the line.
const ROOT::Math::XYVector & tangential() const
Gives the tangential vector of the line.
double lengthOnCurve(const ROOT::Math::XYVector &from, const ROOT::Math::XYVector &to) const
Denotes the length on the line between the two points.
const LineCovariance & lineCovariance() const
Getter for the whole covariance matrix of the line parameters.
double chi2() const
Getter for the chi square value of the line fit.
LineParameters lineParameters() const
Getter for the three perigee parameters in the order defined by EPerigeeParameter....
static constexpr int named(const char *name)
@ c_Phi0
Constant to address the azimuth angle of the direction of flight.
static double average(const double angle1, double angle2)
Combines two angular values to the one that lies half way between them on the short arc.
static double normalised(const double angle)
Normalise an angle to lie in the range from [-pi, pi].
static double average(const LineUtil::ParameterVector &fromPar, const LineUtil::CovarianceMatrix &fromCov, const LineUtil::ParameterVector &toPar, const LineUtil::CovarianceMatrix &toCov, LineUtil::ParameterVector &avgPar, LineUtil::CovarianceMatrix &avgCov)
Calculates the weighted average between two line parameter sets with their respective covariance matr...