8#include <tracking/trackFindingCDC/filters/facet/FitFacetVarSet.h>
10#include <tracking/trackFindingCDC/fitting/FacetFitter.h>
12#include <tracking/trackingUtilities/eventdata/hits/CDCFacet.h>
13#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
15#include <tracking/trackingUtilities/numerics/Quadratic.h>
17#include <Math/Vector2D.h>
20using namespace TrackFindingCDC;
21using namespace TrackingUtilities;
25 if (not ptrFacet)
return false;
34 constexpr const int nSteps = 0;
37 const double s = fitLine->
lengthOnCurve(startWirePos2D, endWirePos2D);
40 var<
named(
"chi2_0_per_s")>() = chi2_0 / s;
42 var<
named(
"fit_0_phi0_sigma")>() = std::sqrt(fitLine.
variance(ELineParameter::c_Phi0));
47 constexpr const int nSteps = 1;
50 const double s = fitLine->
lengthOnCurve(startWirePos2D, endWirePos2D);
53 var<
named(
"chi2_1_per_s")>() = chi2_1 / s;
55 var<
named(
"fit_1_phi0_sigma")>() = std::sqrt(fitLine.
variance(ELineParameter::c_Phi0));
62 const double s = fitLine->
lengthOnCurve(startWirePos2D, endWirePos2D);
65 var<
named(
"chi2_per_s")>() = chi2 / s;
68 constexpr const double erfWidth = 120.0;
69 constexpr const double tanhWidth = 1.64 * erfWidth;
71 var<
named(
"erf")>() = std::erf(chi2 / erfWidth);
72 var<
named(
"tanh")>() = std::tanh(chi2 / tanhWidth);
74 var<
named(
"fit_phi0_sigma")>() = std::sqrt(fitLine.
variance(ELineParameter::c_Phi0));
84 const double startDistance = fitLine->
distance(startWirePos2D) - startL;
85 const double middleDistance = fitLine->
distance(middleWirePos2D) - middleL;
86 const double endDistance = fitLine->
distance(endWirePos2D) - endL;
88 var<
named(
"start_distance")>() = startDistance;
89 var<
named(
"middle_distance")>() = middleDistance;
90 var<
named(
"end_distance")>() = endDistance;
91 var<
named(
"d2")>() = square(startDistance) + square(middleDistance) + square(endDistance);
static double fit(const TrackingUtilities::CDCFacet &facet, int nSteps=100)
Fits a proper line to facet and returns the chi2.
bool extract(const TrackingUtilities::CDCFacet *ptrFacet) final
Generate and assign the contained variables.
Class representing a triple of neighboring oriented wire with additional trajectory information.
const UncertainParameterLine2D & getFitLine() const
Getter for the contained line fit information.
const CDCWireHit & getMiddleWireHit() const
Getter for the hit wire of the second oriented wire hit.
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire 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.
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 getSignedRefDriftLength() const
Getter for the drift length at the reference position of the wire.
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
double distance(const ROOT::Math::XYVector &point) const
Gives the signed distance of a point to 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.
A parameter line including including an line covariance matrix which is interpreted as located in the...
double variance(const ELineParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
static constexpr int named(const char *name)
Abstract base class for different kinds of events.