Belle II Software development
FitAxialSegmentPairVarSet.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/axialSegmentPair/FitAxialSegmentPairVarSet.h>
9
10#include <tracking/trackFindingCDC/fitting/CDCRiemannFitter.h>
11
12#include <tracking/trackFindingCDC/eventdata/tracks/CDCAxialSegmentPair.h>
13
14#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
15#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit2D.h>
16#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
17
18using namespace Belle2;
19using namespace TrackFindingCDC;
20
22{
23 if (not ptrAxialSegmentPair) return false;
24
25 const CDCAxialSegmentPair& axialSegmentPair = *ptrAxialSegmentPair;
26
27 const CDCSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
28 const CDCSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
29
30 const CDCSegment2D& fromSegment = *ptrFromSegment;
31 const CDCSegment2D& toSegment = *ptrToSegment;
32
33 const CDCRiemannFitter& riemannFitter = CDCRiemannFitter::getFitter();
34
35 CDCTrajectory2D commonTrajectory2D = riemannFitter.fit(fromSegment, toSegment);
36 axialSegmentPair.setTrajectory2D(commonTrajectory2D);
37
38 double noRLChi2 = 0;
39 for (const CDCRecoHit2D& recoHit2D : fromSegment) {
40 double dist = std::fabs(commonTrajectory2D.getDist2D(recoHit2D.getRefPos2D())) - recoHit2D.getRefDriftLength();
41 noRLChi2 += dist * dist / recoHit2D.getRefDriftLengthVariance();
42 }
43 for (const CDCRecoHit2D& recoHit2D : toSegment) {
44 double dist = std::fabs(commonTrajectory2D.getDist2D(recoHit2D.getRefPos2D())) - recoHit2D.getRefDriftLength();
45 noRLChi2 += dist * dist / recoHit2D.getRefDriftLengthVariance();
46 }
47
48 finitevar<named("is_fitted")>() = commonTrajectory2D.isFitted();
49 finitevar<named("curv")>() = commonTrajectory2D.getCurvature();
50
51 using namespace NPerigeeParameterIndices;
52 finitevar<named("curv_var")>() = commonTrajectory2D.getLocalVariance(c_Curv);
53
54 finitevar<named("chi2")>() = std::fabs(commonTrajectory2D.getChi2());
55 finitevar<named("chi2_no_rl")>() = noRLChi2;
56 finitevar<named("chi2_per_ndf")>() = std::fabs(commonTrajectory2D.getChi2() / commonTrajectory2D.getNDF());
57 finitevar<named("chi2_no_rl_per_ndf")>() = noRLChi2 / commonTrajectory2D.getNDF();
58 finitevar<named("ndf")>() = commonTrajectory2D.getNDF();
59 finitevar<named("p_value")>() = commonTrajectory2D.getPValue();
60 return true;
61}
Class representing a pair of reconstructed axial segements in adjacent superlayer.
void setTrajectory2D(const CDCTrajectory2D &trajectory2D) const
Setter for the trajectory of the two dimensional trajectory.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
Class implementing the Riemann fit for two dimensional trajectory circle.
static const CDCRiemannFitter & getFitter()
Static getter for a general Riemann fitter.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
Particle trajectory as it is seen in xy projection represented as a circle.
double getChi2() const
Getter for the chi2 value of the circle fit.
double getPValue() const
Getter for p-value.
bool isFitted() const
Checks if the circle is already set to a valid value.
double getLocalVariance(EPerigeeParameter i) const
Getter for an individual diagonal element of the covariance matrix of the local helix parameters.
size_t getNDF() const
Getter for the number of degrees of freedom of the circle fit.
double getDist2D(const Vector2D &point) const
Calculates the distance from the point to the trajectory as seen from the xy projection.
double getCurvature() const
Getter for the curvature as seen from the xy projection.
bool extract(const CDCAxialSegmentPair *ptrAxialSegmentPair) final
Generate and assign the contained variables.
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
Abstract base class for different kinds of events.