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#include "KfTrajectory.h"
16
17#include <vector>
18
19class CbmMvdHit;
20class CbmStsHit;
21class CbmStsTrack;
22class CbmGlobalTrack;
23class CbmKFVertex;
24class CbmMuchPixelHit;
25class CbmTrdHit;
26class CbmTofHit;
27
28class FairTrackParam;
29class TClonesArray;
30
31
34template<cbm::algo::kf::DoFitTime FlagFitTime = cbm::algo::kf::DoFitTime::Y>
36
37 public:
39 class Trajectory : public cbm::algo::kf::Trajectory<double> {
40 public:
43
44 static ECbmModuleId GetHitSystemId(const Node& node) { return static_cast<ECbmModuleId>(node.userReferences[0]); }
45
46 static int GetHitAddress(const Node& node) { return node.userReferences[1]; }
47
48 static int GetHitIndex(const Node& node) { return node.userReferences[2]; }
49
50 static void SetHitSystemId(Node& node, ECbmModuleId sysId) { node.userReferences[0] = static_cast<int>(sysId); }
51
52 static void SetHitAddress(Node& node, int address) { node.userReferences[1] = address; }
53
54 static void SetHitIndex(Node& node, int index) { node.userReferences[2] = index; }
55
56 void SetHitSystemId(size_t nodeIndex, ECbmModuleId sysId) { SetHitSystemId(fNodes[nodeIndex], sysId); }
57
58 void SetHitAddress(size_t nodeIndex, int address) { SetHitAddress(fNodes[nodeIndex], address); }
59
60 void SetHitIndex(size_t nodeIndex, int index) { SetHitIndex(fNodes[nodeIndex], index); }
61 };
62
63 public:
66
69 void Init();
70
72 void SetParticleHypothesis(int pid);
73
75 void SetMassHypothesis(double mass);
76
78 void SetElectronFlag(bool isElectron);
79
83 void SetIgnorePoorCoordinates(bool ignore = true) { fIgnorePoorCoordinates = ignore; }
84
86 void SetDefaultMomentumForMs(double p) { fDefaultQpForMs = fabs(1. / p); }
87
89 void SetDefaultInverseMomentumForMs(double invP) { fDefaultQpForMs = fabs(invP); }
90
94 void SetEnforceDefaultMomentumForMs(bool enforce = true) { fEnforceDefaultMomentumForMs = enforce; }
95
97 void SetIgnoreMultipleScattering(bool ignore = true) { fIgnoreMultipleScattering = ignore; }
98
100 void SetIgnoreEnergyLosses(bool ignore = true) { fIgnoreEnergyLosses = ignore; }
101
107 bool CreateFromMvdStsTrack(Trajectory& trajectory, int stsTrackIndex, bool addMaterialNodesOutsideHitRange);
108
114 bool CreateFromGlobalTrack(Trajectory& trajectory, int globalTrackIndex, bool addMaterialNodesOutsideHitRange);
115
121 bool CreateFromGlobalTrack(Trajectory& trajectory, const CbmGlobalTrack& globalTrack,
122 bool addMaterialNodesOutsideHitRange);
123
126
129
132
134 bool PropagateToZ(cbm::algo::kf::TrackParamD& track, double z);
135
137 void SetNofIterations(int nofIterations) { fNofIterations = nofIterations; }
138
140 void SetVerbosityLevel(int level) { fVerbosityLevel = level; }
141
143 void SetDebugPrefix(const std::string& pref) { fDebugPrefix = pref + ": "; }
144
146 void SetMaxExtrapolationStep(double step) { fFit.SetMaxExtrapolationStep(step); }
147
149 double GetMaxExtrapolationStep() const { return fFit.GetMaxExtrapolationStep(); }
150
152 void SetFixMaterial(bool isFixed) { fIsMaterialFixed = isFixed; }
153
154 private:
160
162
163 void AddMaterialEffects(const LinearizationAtNode& l, cbm::algo::kf::FitDirection direction);
164
165 // combine two tracks
167
168 private:
169 std::shared_ptr<const cbm::algo::kf::Setup<double>> fKfSetup;
170
171 // input data arrays
172 const TClonesArray* fInputMvdHits{nullptr};
173 const TClonesArray* fInputStsHits{nullptr};
174 const TClonesArray* fInputMuchHits{nullptr};
175 const TClonesArray* fInputTrdHits{nullptr};
176 const TClonesArray* fInputTofHits{nullptr};
177
178 const TClonesArray* fInputGlobalTracks{nullptr};
179 const TClonesArray* fInputStsTracks{nullptr};
180 const TClonesArray* fInputMuchTracks{nullptr};
181 const TClonesArray* fInputTrdTracks{nullptr};
182 const TClonesArray* fInputTofTracks{nullptr};
183
184 //
185
186 bool fIsInitialized = {false};
187
190
192 fFit; // track fit object
193
198 double fDefaultQpForMs{1. / 0.1};
199
202
204
206
208 false};
209
210 double fMass{cbm::algo::kf::defs::PionMass<double>}; // mass hypothesis for the fit
211 bool fIsElectron{false}; // fit track as an electron (with the bermsstrallung effect)
212 int fNofIterations{2}; // number of iterations for the fit
213
214 int fVerbosityLevel{0}; // verbosity level
215 std::string fDebugPrefix{}; // debug info
216
217 //ClassDefNV(CbmKfTrackFitter, 0);
218};
ECbmModuleId
Enumerator for module Identifiers.
Definition CbmDefs.h:45
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.
header file for the kf::Trajectory class
Trajectory with hit information stored in node user references.
static void SetHitAddress(Node &node, int address)
static int GetHitIndex(const Node &node)
static void SetHitSystemId(Node &node, ECbmModuleId sysId)
void SetHitIndex(size_t nodeIndex, int index)
static ECbmModuleId GetHitSystemId(const Node &node)
static void SetHitIndex(Node &node, int index)
static int GetHitAddress(const Node &node)
void SetHitAddress(size_t nodeIndex, int address)
void SetHitSystemId(size_t nodeIndex, ECbmModuleId sysId)
bool PropagateToZ(cbm::algo::kf::TrackParamD &track, double z)
propagate the track in the magnetic field taking material effects into account
void SetDefaultInverseMomentumForMs(double invP)
set the default inverse momentum for the Multiple Scattering calculation
bool CreateFromMvdStsTrack(Trajectory &trajectory, int stsTrackIndex, bool addMaterialNodesOutsideHitRange)
void AddMaterialEffects(const LinearizationAtNode &l, cbm::algo::kf::FitDirection direction)
void SetIgnorePoorCoordinates(bool ignore=true)
const TClonesArray * fInputMuchTracks
std::string fDebugPrefix
bool FitTrajectoryUpstream(const cbm::algo::kf::Trajectory< double > &t, cbm::algo::kf::TrackParamD &parUp)
fit the trajectory upstream and return the track parameters at the first measurement node
void SetDefaultMomentumForMs(double p)
set the default inverse momentum for the Multiple Scattering calculation
bool Smooth(cbm::algo::kf::TrackParamD &t1, const cbm::algo::kf::TrackParamD &t2)
bool fIgnoreMultipleScattering
ignore the multiple scattering effects in the fit
bool FitTrajectoryDownstream(const cbm::algo::kf::Trajectory< double > &t, cbm::algo::kf::TrackParamD &parDn)
fit the trajectory downstream and return the track parameters at the last measurement node
bool fIsMaterialFixed
true if the radiation thickness is fixed to the nodes fRadThick value and should not be recalculated ...
void SetMaxExtrapolationStep(double step)
set max extrapolation step
void SetParticleHypothesis(int pid)
set particle hypothesis (mass and electron flag) via particle PDG
void SetIgnoreMultipleScattering(bool ignore=true)
ignore the multiple scattering effects in the fit
void FilterFirstMeasurement(const cbm::algo::kf::Trajectory< double >::Node &n)
std::shared_ptr< const cbm::algo::kf::Setup< double > > fKfSetup
Kalman Filter setup.
void SetEnforceDefaultMomentumForMs(bool enforce=true)
void SetIgnoreEnergyLosses(bool ignore=true)
ignore the energy loss effects in the fit
bool fIgnoreEnergyLosses
ignore the energy loss effects in the fit
void SetDebugPrefix(const std::string &pref)
set information about the track for debug output
const TClonesArray * fInputTrdTracks
bool FitTrajectory(cbm::algo::kf::Trajectory< double > &t)
fit the trajectory
void SetMassHypothesis(double mass)
set particle mass
cbm::algo::kf::TrackKalmanFilter< double, cbm::algo::kf::FilterSettings< cbm::algo::kf::LinearizationFull, FlagFitTime > > fFit
const TClonesArray * fInputTrdHits
const TClonesArray * fInputStsTracks
void SetFixMaterial(bool isFixed)
set whether the radiation thickness is fixed to the nodes fRadThick value
const TClonesArray * fInputTofHits
void SetElectronFlag(bool isElectron)
set electron flag (bremmstrallung will be applied)
bool fIsInitialized
is the fitter initialized
const TClonesArray * fInputStsHits
void SetVerbosityLevel(int level)
set verbosity level
const TClonesArray * fInputTofTracks
void SetNofIterations(int nofIterations)
set number of iterations for the fit
bool CreateFromGlobalTrack(Trajectory &trajectory, int globalTrackIndex, bool addMaterialNodesOutsideHitRange)
const TClonesArray * fInputMvdHits
const TClonesArray * fInputMuchHits
const TClonesArray * fInputGlobalTracks
double GetMaxExtrapolationStep() const
get max extrapolation step
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 the particle's trajectory along its entire length.
constexpr auto PionMass
Pion mass [GeV/c2].
Definition KfDefs.h:195
TrackParam< double > TrackParamD
double radThick
radiation thickness of the material associated with the node
cbm::algo::kf::LinearizationFull< double > linearizationDn
fitted track parameters downstream the node
cbm::algo::kf::LinearizationFull< double > linearizationUp
fitted track parameters upstream the node
The class represent a node on the trajectory.