Belle II Software development
FitSegmentPairRelationVarSet.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/segmentPairRelation/FitSegmentPairRelationVarSet.h>
9
10#include <tracking/trackingUtilities/eventdata/tracks/CDCSegmentPair.h>
11
12#include <Math/Vector3D.h>
13
14using namespace Belle2;
15using namespace TrackFindingCDC;
16using namespace TrackingUtilities;
17
19{
20 if (not ptrSegmentPairRelation) return false;
21
22 const CDCSegmentPair* fromSegmentPair = ptrSegmentPairRelation->first;
23 const CDCSegmentPair* toSegmentPair = ptrSegmentPairRelation->second;
24
25 CDCTrajectory3D fromFit = fromSegmentPair->getTrajectory3D();
26 CDCTrajectory3D toFit = toSegmentPair->getTrajectory3D();
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 return true;
52}
bool extract(const TrackingUtilities::Relation< const TrackingUtilities::CDCSegmentPair > *ptrSegmentPairRelation) final
Generate and assign the contained variables.
Class representing a pair of one reconstructed axial segment and one stereo segment in adjacent super...
CDCTrajectory3D & getTrajectory3D() const
Getter for the three dimensional trajectory.
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.
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.