File indexing completed on 2025-08-05 08:17:19
0001 #ifndef TRACKRECO_PHGENFITTRKFITTER_H
0002 #define TRACKRECO_PHGENFITTRKFITTER_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <fun4all/SubsysReco.h>
0012
0013 #include <tpc/TpcGlobalPositionWrapper.h>
0014
0015 #if defined(__CLING__)
0016
0017
0018 #include <phgenfit/Track.h>
0019 #else
0020 namespace PHGenFit
0021 {
0022 class Track;
0023 }
0024 #endif
0025
0026 #include <TMatrixFfwd.h> // for TMatrixF
0027 #include <TVector3.h> // for TVector3
0028
0029 #include <map>
0030 #include <memory> // for shared_ptr
0031 #include <set>
0032 #include <string>
0033 #include <vector>
0034
0035 namespace genfit
0036 {
0037 class GFRaveVertex;
0038 class GFRaveVertexFactory;
0039 class Track;
0040 }
0041
0042 class SvtxTrack;
0043 namespace PHGenFit
0044 {
0045 class Fitter;
0046 }
0047
0048 class ActsGeometry;
0049 class PHCompositeNode;
0050 class SvtxTrackMap;
0051 class TrkrClusterContainer;
0052 class TrackSeedContainer;
0053
0054
0055 class PHGenFitTrkFitter : public SubsysReco
0056 {
0057 public:
0058
0059
0060 PHGenFitTrkFitter(const std::string& name = "PHGenFitTrkFitter");
0061
0062
0063 int Init(PHCompositeNode*) override;
0064
0065
0066 int InitRun(PHCompositeNode*) override;
0067
0068
0069 int process_event(PHCompositeNode*) override;
0070
0071
0072 int End(PHCompositeNode*) override;
0073
0074 const std::string& get_track_fitting_alg_name() const
0075 {
0076 return _track_fitting_alg_name;
0077 }
0078
0079 void set_track_fitting_alg_name(const std::string& trackFittingAlgName)
0080 {
0081 _track_fitting_alg_name = trackFittingAlgName;
0082 }
0083
0084 int get_primary_pid_guess() const
0085 {
0086 return _primary_pid_guess;
0087 }
0088
0089 void set_primary_pid_guess(int primaryPidGuess)
0090 {
0091 _primary_pid_guess = primaryPidGuess;
0092 }
0093
0094 double get_fit_min_pT() const
0095 {
0096 return _fit_min_pT;
0097 }
0098
0099 void set_fit_min_pT(double cutMinPT)
0100 {
0101 _fit_min_pT = cutMinPT;
0102 }
0103
0104 double get_vertex_min_ndf() const
0105 {
0106 return _vertex_min_ndf;
0107 }
0108
0109 void set_vertex_min_ndf(double vertexMinPT)
0110 {
0111 _vertex_min_ndf = vertexMinPT;
0112 }
0113
0114
0115
0116
0117
0118 void disable_layer(int layer, bool disabled = true);
0119
0120
0121 void set_disabled_layers(const std::set<int>&);
0122
0123
0124 void clear_disabled_layers();
0125
0126
0127 const std::set<int>& get_disabled_layers() const;
0128
0129
0130
0131
0132 void set_fit_silicon_mms(bool);
0133
0134
0135 void set_use_micromegas(bool value)
0136 {
0137 m_use_micromegas = value;
0138 }
0139
0140 void set_svtx_seed_map_name(const std::string &name) {_seedMap_name = name;}
0141 void set_svtx_track_map_name(const std::string &name) {_trackMap_name = name;}
0142
0143 void disableModuleEdgeCorr() { m_disable_module_edge_corr = true; }
0144 void disableStaticCorr() { m_disable_static_corr = true; }
0145 void disableAverageCorr() { m_disable_average_corr = true; }
0146 void disableFluctuationCorr() { m_disable_fluctuation_corr = true; }
0147
0148 private:
0149
0150 int _event = 0;
0151
0152
0153 int GetNodes(PHCompositeNode*);
0154
0155
0156 int CreateNodes(PHCompositeNode*);
0157
0158
0159
0160
0161
0162
0163 std::shared_ptr<PHGenFit::Track> ReFitTrack(PHCompositeNode*, const SvtxTrack* intrack);
0164
0165
0166 std::shared_ptr<SvtxTrack> MakeSvtxTrack(const SvtxTrack* svtxtrack, const std::shared_ptr<PHGenFit::Track>& genfit_track );
0167
0168 bool pos_cov_XYZ_to_RZ(
0169 const TVector3& n,
0170 const TMatrixF& pos_in,
0171 const TMatrixF& cov_in,
0172 TMatrixF& pos_out,
0173 TMatrixF& cov_out) const;
0174
0175
0176
0177 std::set<int> _disabled_layers;
0178
0179
0180
0181 bool m_fit_silicon_mms = false;
0182
0183
0184 bool m_use_micromegas = true;
0185
0186
0187 std::string _track_fitting_alg_name = "DafRef";
0188
0189 int _primary_pid_guess = 211;
0190 double _fit_min_pT = 0.1;
0191 double _vertex_min_ndf = 20;
0192
0193
0194
0195
0196
0197 std::shared_ptr<PHGenFit::Fitter> _fitter;
0198
0199
0200 ActsGeometry* m_tgeometry = nullptr;
0201
0202
0203 TrkrClusterContainer* m_clustermap = nullptr;
0204
0205
0206 TrackSeedContainer* m_seedMap = nullptr;
0207 TrackSeedContainer* m_tpcSeeds = nullptr;
0208 TrackSeedContainer* m_siliconSeeds = nullptr;
0209
0210
0211 SvtxTrackMap* m_trackMap = nullptr;
0212
0213
0214 TpcGlobalPositionWrapper m_globalPositionWrapper;
0215
0216 std::string _seedMap_name = "SvtxTrackSeedContainer";
0217 std::string _trackMap_name = "SvtxTrackMap";
0218
0219
0220 bool m_disable_module_edge_corr = false;
0221 bool m_disable_static_corr = false;
0222 bool m_disable_average_corr = false;
0223 bool m_disable_fluctuation_corr = false;
0224 };
0225
0226 #endif