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