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/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11
12using namespace Belle2;
13using namespace TrackFindingCDC;
14
16{
17 if (not ptrTrackRelation) return false;
18
19 const CDCTrack* fromTrack = ptrTrackRelation->first;
20 const CDCTrack* toTrack = ptrTrackRelation->second;
21
22 CDCTrajectory3D fromFit = fromTrack->getEndTrajectory3D();
23 CDCTrajectory3D toFit = toTrack->getStartTrajectory3D();
24
25 Vector3D commonOrigin = fromFit.getSupport();
26
27 fromFit.setLocalOrigin(commonOrigin);
28 toFit.setLocalOrigin(commonOrigin);
29
30 const UncertainHelix& fromHelix = fromFit.getLocalHelix();
31 const UncertainHelix& toHelix = toFit.getLocalHelix();
32 UncertainHelix commonHelix = UncertainHelix::average(fromHelix, toHelix);
33
34 finitevar<named("is_fitted")>() = not commonHelix->isInvalid();
35 finitevar<named("curv")>() = commonHelix->curvatureXY();
36 finitevar<named("tanl")>() = commonHelix->tanLambda();
37 finitevar<named("z0")>() = commonOrigin.z();
38
39 using namespace NHelixParameterIndices;
40 finitevar<named("curv_var")>() = commonHelix.variance(c_Curv);
41 finitevar<named("tanl_var")>() = commonHelix.variance(c_TanL);
42 finitevar<named("z0_var")>() = commonHelix.variance(c_Z0);
43
44 finitevar<named("chi2")>() = std::fabs(commonHelix.chi2());
45 finitevar<named("ndf")>() = commonHelix.ndf();
46 finitevar<named("chi2_per_ndf")>() = std::fabs(commonHelix.chi2()) / commonHelix.ndf();
47 finitevar<named("p_value")>() = TMath::Prob(commonHelix.chi2(), commonHelix.ndf());
48 finitevar<named("p_value_cut")>() = TMath::Prob(commonHelix.chi2(), commonHelix.ndf()) < 0.02;
49 return true;
50}
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Particle full three dimensional trajectory.
const UncertainHelix & getLocalHelix() const
Getter for the helix in local coordinates.
double setLocalOrigin(const Vector3D &localOrigin)
Setter for the origin of the local coordinate system.
Vector3D getSupport() const
Getter for the support point of the trajectory in global coordinates, where arcLength2D = 0.
bool extract(const Relation< const CDCTrack > *ptrTrackRelation) final
Generate and assign the contained variables.
bool isInvalid() const
Indicates if the stored parameter combination designates a valid helix.
Definition: Helix.h:74
double tanLambda() const
Getter for the proportinality factor from arc length in xy space to z.
Definition: Helix.h:240
double curvatureXY() const
Getter for the signed curvature in the xy projection.
Definition: Helix.h:204
Type for two related objects.
Definition: Relation.h:21
A general helix class including a covariance matrix.
double variance(const EHelixParameter &i) const
Getter for individual diagonal elements of the covariance matrix.
static UncertainHelix average(const UncertainHelix &fromHelix, const UncertainHelix &toHelix)
Construct the averages of the two given helices by properly considering their covariance matrix.
double chi2() const
Getter for the chi square value of the helix fit.
std::size_t ndf() const
Getter for the number of degrees of freediom used in the helix fit.
AssignFinite< Float_t > finitevar()
Reference getter for the value of the ith variable. Transforms non-finite values to finite value.
Definition: VarSet.h:130
static constexpr int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:78
A three dimensional vector.
Definition: Vector3D.h:33
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:496
Abstract base class for different kinds of events.