Belle II Software development
FitTrackRelationVarSet.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/trackRelation/FitTrackRelationVarSet.h>
9
10#include <tracking/trackingUtilities/eventdata/tracks/CDCTrack.h>
11
12#include <Math/Vector3D.h>
13
14using namespace Belle2;
15using namespace TrackFindingCDC;
16using namespace TrackingUtilities;
17
19{
20 if (not ptrTrackRelation) return false;
21
22 const CDCTrack* fromTrack = ptrTrackRelation->first;
23 const CDCTrack* toTrack = ptrTrackRelation->second;
24
25 CDCTrajectory3D fromFit = fromTrack->getEndTrajectory3D();
26 CDCTrajectory3D toFit = toTrack->getStartTrajectory3D();
27
28 const ROOT::Math::XYZVector& commonOrigin = fromFit.getSupport();
29
30 fromFit.setLocalOrigin(commonOrigin);
31 toFit.setLocalOrigin(commonOrigin);
32
33 const UncertainHelix& fromHelix = fromFit.getLocalHelix();
34 const UncertainHelix& toHelix = toFit.getLocalHelix();
35 UncertainHelix commonHelix = UncertainHelix::average(fromHelix, toHelix);
36
37 finitevar<named("is_fitted")>() = not commonHelix->isInvalid();
38 finitevar<named("curv")>() = commonHelix->curvatureXY();
39 finitevar<named("tanl")>() = commonHelix->tanLambda();
40 finitevar<named("z0")>() = commonOrigin.z();
41
42 using namespace NHelixParameterIndices;
43 finitevar<named("curv_var")>() = commonHelix.variance(c_Curv);
44 finitevar<named("tanl_var")>() = commonHelix.variance(c_TanL);
45 finitevar<named("z0_var")>() = commonHelix.variance(c_Z0);
46
47 finitevar<named("chi2")>() = std::fabs(commonHelix.chi2());
48 finitevar<named("ndf")>() = commonHelix.ndf();
49 finitevar<named("chi2_per_ndf")>() = std::fabs(commonHelix.chi2()) / commonHelix.ndf();
50 finitevar<named("p_value")>() = TMath::Prob(commonHelix.chi2(), commonHelix.ndf());
51 finitevar<named("p_value_cut")>() = TMath::Prob(commonHelix.chi2(), commonHelix.ndf()) < 0.02;
52 return true;
53}
bool extract(const TrackingUtilities::Relation< const TrackingUtilities::CDCTrack > *ptrTrackRelation) final
Generate and assign the contained variables.
Class representing a sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:37
Particle full three dimensional trajectory.
double setLocalOrigin(const ROOT::Math::XYZVector &localOrigin)
Setter for the origin of the local coordinate system.
const UncertainHelix & getLocalHelix() const
Getter for the helix in local coordinates.
ROOT::Math::XYZVector getSupport() const
Getter for the support point of the trajectory in global coordinates, where arcLength2D = 0.
Type for two related objects.
Definition Relation.h:21
static UncertainHelix average(const UncertainHelix &fromHelix, const UncertainHelix &toHelix)
Construct the averages of the two given helices by properly considering their covariance matrix.
static constexpr int named(const char *name)
Definition VarSet.h:78
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
Namespace to hide the contained enum constants.
Abstract base class for different kinds of events.