CbmRoot
Loading...
Searching...
No Matches
CbmKfTrackFitter.h
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov [committer] */
4
5#pragma once // include this header only once per compilation unit
6
7
8#include "CbmDefs.h"
9#include "KfDefs.h"
10#include "KfMeasurementTime.h"
11#include "KfMeasurementXy.h"
12#include "KfSetup.h"
13#include "KfTrackKalmanFilter.h"
14#include "KfTrackParam.h"
15
16#include <vector>
17
18class CbmMvdHit;
19class CbmStsHit;
20class CbmStsTrack;
21class CbmGlobalTrack;
22class CbmKFVertex;
23class CbmMuchPixelHit;
24class CbmTrdHit;
25class CbmTofHit;
26
27class FairTrackParam;
28class TClonesArray;
29
30
34
35 public:
53
54 double fZ{0.};
55
58
60
61 // TODO: change to the material layer index when the material layer is implemented
63
66 double fRadThick{0.};
67
69
71
73
75 bool fIsXySet{false};
76 bool fIsTimeSet{false};
77 bool fIsRadThickFixed{false};
78 bool fIsFitted{false};
79
82 int fHitAddress{-1};
83 int fHitIndex{-1};
84
85 int fReference1{-1};
86 int fReference2{-1};
87 };
88
90 // TODO: proper interface
91 struct Trajectory {
92 std::vector<TrajectoryNode> fNodes;
93 bool fIsFitted{false};
94 void OrderNodesInZ(); // sort the nodes in Z and set fFirstHitNode and fLastHitNode
95 };
96
99
102 void Init();
103
105 void SetParticleHypothesis(int pid);
106
108 void SetMassHypothesis(double mass);
109
111 void SetElectronFlag(bool isElectron);
112
115
117 void SetDefaultMomentumForMs(double p) { fDefaultQpForMs = fabs(1. / p); }
118
120 void SetDefaultInverseMomentumForMs(double invP) { fDefaultQpForMs = fabs(invP); }
121
124
126 void FixMomentumForMs(bool fix = true) { fIsQpForMsFixed = fix; }
127
129 bool CreateMvdStsTrack(Trajectory& kfTrack, int stsTrackIndex);
130 bool CreateGlobalTrack(Trajectory& kfTrack, int globalTrackIndex);
131 bool CreateGlobalTrack(Trajectory& kfTrack, const CbmGlobalTrack& globalTrack);
132
135
137 void SetDoSmooth(bool doSmooth) { fDoSmooth = doSmooth; }
138
140 void SetVerbosityLevel(int level) { fVerbosityLevel = level; }
141
143 void SetDebugInfo(const std::string& info) { fDebugInfo = info; }
144
145 private:
150
151 void FilterFirstMeasurement(const TrajectoryNode& n);
152
153 void AddMaterialEffects(TrajectoryNode& n, const LinearizationAtNode& l, cbm::algo::kf::FitDirection direction);
154
155 // combine two tracks
157
158 private:
159 std::shared_ptr<const cbm::algo::kf::Setup<double>> fKfSetup;
160
161 // input data arrays
162 TClonesArray* fInputMvdHits{nullptr};
163 TClonesArray* fInputStsHits{nullptr};
164 TClonesArray* fInputMuchHits{nullptr};
165 TClonesArray* fInputTrdHits{nullptr};
166 TClonesArray* fInputTofHits{nullptr};
167
168 TClonesArray* fInputGlobalTracks{nullptr};
169 TClonesArray* fInputStsTracks{nullptr};
170 TClonesArray* fInputMuchTracks{nullptr};
171 TClonesArray* fInputTrdTracks{nullptr};
172 TClonesArray* fInputTofTracks{nullptr};
173
174 //
175
176 bool fIsInitialized = {false}; // is the fitter initialized
179
184 double fDefaultQpForMs{1. / 0.1};
185 bool fIsQpForMsFixed{false};
186
187 double fMass{cbm::algo::kf::defs::PionMass<double>}; // mass hypothesis for the fit
188 bool fIsElectron{false}; // fit track as an electron (with the bermsstrallung effect)
189 bool fDoSmooth{true}; // do the KF-smoothing to define track pars at all the nodes
190 int fVerbosityLevel{0}; // verbosity level
191 std::string fDebugInfo{}; // debug info
192};
ECbmModuleId
Definition CbmDefs.h:39
@ kNotExist
If not found.
Common constant definitions for the Kalman Filter library.
Definition of the KfMeasurementXy class.
Setup representation for the Kalman-filter framework (header)
Track fit utilities for the CA tracking based on the Kalman filter.
TClonesArray * fInputTofTracks
TClonesArray * fInputMuchTracks
void SetSkipUnmeasuredCoordinates(bool skip=true)
skip unmeasured coordinates
cbm::algo::kf::TrackKalmanFilter< double > fFit
void SetElectronFlag(bool isElectron)
set electron flag (bremmstrallung will be applied)
TClonesArray * fInputMvdHits
bool CreateMvdStsTrack(Trajectory &kfTrack, int stsTrackIndex)
set the input data arrays
bool CreateGlobalTrack(Trajectory &kfTrack, int globalTrackIndex)
void FixMomentumForMs(bool fix=true)
fix the inverse momentum for the Multiple Scattering calculation
void SetDefaultMomentumForMs(double p)
set the default inverse momentum for the Multiple Scattering calculation
void SetMassHypothesis(double mass)
set particle mass
void SetVerbosityLevel(int level)
set verbosity level
void FilterFirstMeasurement(const TrajectoryNode &n)
void SetDoSmooth(bool doSmooth)
do the KF-smoothing to define track pars at all the nodes
TClonesArray * fInputStsHits
bool FitTrajectory(CbmKfTrackFitter::Trajectory &t)
fit the track
bool Smooth(cbm::algo::kf::TrackParamD &t1, const cbm::algo::kf::TrackParamD &t2)
void SetNoMultipleScattering()
set the default inverse momentum for the Multiple Scattering calculation
TClonesArray * fInputTrdHits
TClonesArray * fInputStsTracks
TClonesArray * fInputMuchHits
void AddMaterialEffects(TrajectoryNode &n, const LinearizationAtNode &l, cbm::algo::kf::FitDirection direction)
void SetDebugInfo(const std::string &info)
set information about the track for debug output
TClonesArray * fInputGlobalTracks
TClonesArray * fInputTofHits
std::shared_ptr< const cbm::algo::kf::Setup< double > > fKfSetup
TClonesArray * fInputTrdTracks
void SetParticleHypothesis(int pid)
set particle hypothesis (mass and electron flag) via particle PDG
void SetDefaultInverseMomentumForMs(double invP)
set the default inverse momentum for the Multiple Scattering calculation
data class for a reconstructed 3-d hit in the STS
Definition CbmStsHit.h:35
data class for a reconstructed Energy-4D measurement in the TRD
Definition CbmTrdHit.h:40
The class describes a time measurement.
The class describes a 2D - measurement (x, y) in XY coordinate system.
constexpr auto PionMass
Pion mass [GeV/c2].
Definition KfDefs.h:92
cbm::algo::kf::TrackParamD fParamUp
fitted track parameters upstream the node
cbm::algo::kf::TrackParamD fParamDn
fitted track parameters downstream the node
cbm::algo::kf::TrackParamD fParamUp
fitted track parameters upstream the node
double fZ
Z coordinate of the node.
bool fIsFitted
true if the track parameters at the node are fitted
cbm::algo::kf::MeasurementXy< double > fMxy
== Hit information ( if present )
int fHitIndex
hit index in the detector hit array
int fHitAddress
detector ID of the hit
ECbmModuleId fHitSystemId
== External references
int fReference1
some reference can be set by the user
cbm::algo::kf::TrackParamD fParamDn
fitted track parameters downstream the node
bool fIsRadThickFixed
true if the radiation thickness is fixed to the fRadThick value
cbm::algo::kf::MeasurementTime< double > fMt
time measurement at fZ
int fMaterialLayer
== Material information (if present)
int fReference2
some reference can be set by the user
bool fIsTimeSet
true if the time measurement is set
A trajectory to be fitted.
std::vector< TrajectoryNode > fNodes
nodes on the trajectory
bool fIsFitted
true if the trajectory is fitted