Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHGenFitTrkFitter.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHGenFitTrkFitter.h
1 #ifndef TRACKRECO_PHGENFITTRKFITTER_H
2 #define TRACKRECO_PHGENFITTRKFITTER_H
3 
11 #include <fun4all/SubsysReco.h>
16 
17 #if defined(__CLING__)
18 // needed, it crashes on Ubuntu using singularity with local cvmfs install
19 // shared pointer later on uses this, forward declaration does not cut it
20 #include <phgenfit/Track.h>
21 #else
22 namespace PHGenFit
23 {
24  class Track;
25 } /* namespace PHGenFit */
26 #endif
27 
28 #include <TMatrixFfwd.h> // for TMatrixF
29 #include <TVector3.h> // for TVector3
30 
31 #include <map>
32 #include <memory> // for shared_ptr
33 #include <set>
34 #include <string>
35 #include <vector>
36 
37 class TClonesArray;
38 
39 namespace genfit
40 {
41 class GFRaveVertex;
42 class GFRaveVertexFactory;
43 class Track;
44 } /* namespace genfit */
45 
46 class SvtxTrack;
47 namespace PHGenFit
48 {
49 class Fitter;
50 } /* namespace PHGenFit */
51 
52 class ActsGeometry;
53 class PHCompositeNode;
55 class SvtxTrackMap;
56 class SvtxVertexMap;
57 class SvtxVertex;
60 class TrackSeedContainer;
61 
62 class TTree;
63 
66 {
67  public:
74  {
78  };
79 
81  {
82  MIE,
89  };
90 
92  PHGenFitTrkFitter(const std::string& name = "PHGenFitTrkFitter");
93 
95  int Init(PHCompositeNode*) override;
96 
98  int InitRun(PHCompositeNode*) override;
99 
101  int process_event(PHCompositeNode*) override;
102 
104  int End(PHCompositeNode*) override;
105 
108  void set_eval_filename(const char* file)
109  {
110  if (file)
112  }
114  {
115  return _eval_outname;
116  }
117 
119  void init_eval_tree();
120  void reset_eval_variables();
121 
122  bool is_do_eval() const
123  {
124  return _do_eval;
125  }
126 
127  void set_do_eval(bool doEval)
128  {
129  _do_eval = doEval;
130  }
131 
132  bool is_do_evt_display() const
133  {
134  return _do_evt_display;
135  }
136 
137  void set_do_evt_display(bool doEvtDisplay)
138  {
139  _do_evt_display = doEvtDisplay;
140  }
141 
143  {
144  return _vertexing_method;
145  }
146 
147  void set_vertexing_method(const std::string& vertexingMethod)
148  {
149  _vertexing_method = vertexingMethod;
150  }
151 
153  {
154  return _fit_primary_tracks;
155  }
156 
157  void set_fit_primary_tracks(bool fitPrimaryTracks)
158  {
159  _fit_primary_tracks = fitPrimaryTracks;
160  }
161 
163  {
164  return _output_mode;
165  }
166 
170  void set_output_mode(OutPutMode outputMode)
171  {
172  _output_mode = outputMode;
173  }
174 
176  {
178  }
179 
180  void set_track_fitting_alg_name(const std::string& trackFittingAlgName)
181  {
182  _track_fitting_alg_name = trackFittingAlgName;
183  }
184 
186  {
187  return _primary_pid_guess;
188  }
189 
190  void set_primary_pid_guess(int primaryPidGuess)
191  {
192  _primary_pid_guess = primaryPidGuess;
193  }
194 
195  double get_fit_min_pT() const
196  {
197  return _fit_min_pT;
198  }
199 
200  void set_fit_min_pT(double cutMinPT)
201  {
202  _fit_min_pT = cutMinPT;
203  }
204 
206  {
208  }
209 
210  void set_over_write_svtxtrackmap(bool overWriteSvtxtrackmap)
211  {
212  _over_write_svtxtrackmap = overWriteSvtxtrackmap;
213  }
214 
215  bool is_use_truth_vertex() const
216  {
217  return _use_truth_vertex;
218  }
219 
220  void set_use_truth_vertex(bool useTruthVertex)
221  {
222  _use_truth_vertex = useTruthVertex;
223  }
224 
225  double get_vertex_min_ndf() const
226  {
227  return _vertex_min_ndf;
228  }
229 
230  void set_vertex_min_ndf(double vertexMinPT)
231  {
232  _vertex_min_ndf = vertexMinPT;
233  }
234 
236 
237 
239  void disable_layer( int layer, bool disabled = true );
240 
242  void set_disabled_layers( const std::set<int>& );
243 
245  void clear_disabled_layers();
246 
248  const std::set<int>& get_disabled_layers() const;
249 
251 
253  void set_fit_silicon_mms( bool );
254 
257  { m_use_micromegas = value; }
258 
259  private:
261  int _event = 0;
262 
265 
268 
270 
274 
275  /*
276  * fit track with SvtxTrack as input seed.
277  * \param intrack Input SvtxTrack
278  * \param invertex Input Vertex, if fit track as a primary vertex
279  */
280  std::shared_ptr<PHGenFit::Track> ReFitTrack(PHCompositeNode*, const SvtxTrack* intrack, const SvtxVertex* invertex = nullptr);
281 
283  std::shared_ptr<SvtxTrack> MakeSvtxTrack(const SvtxTrack* svtxtrack, const std::shared_ptr<PHGenFit::Track>& genfit_track, const SvtxVertex* vertex = nullptr);
284 
286  bool FillSvtxVertexMap(
287  const std::vector<genfit::GFRaveVertex*>& rave_vertices,
288  const std::vector<genfit::Track*>& gf_tracks);
289 
290  bool pos_cov_XYZ_to_RZ(
291  const TVector3& n,
292  const TMatrixF& pos_in,
293  const TMatrixF& cov_in,
294  TMatrixF& pos_out,
295  TMatrixF& cov_out) const;
296 
297  //bool _make_separate_nodes;
299 
301 
302  bool _fit_primary_tracks = false;
303 
305  bool _use_truth_vertex = false;
306 
308 
309  std::set<int> _disabled_layers;
310 
313  bool m_fit_silicon_mms = false;
314 
316  bool m_use_micromegas = true;
317 
320 
322  double _fit_min_pT = 0.1;
323  double _vertex_min_ndf = 20;
324 
325  /*
326  need to use shared_ptr and not unique_ptr because root5 cint
327  requires the existence of a copy constructor, which the unique_ptr forbids
328  */
329  std::shared_ptr<PHGenFit::Fitter> _fitter;
330  std::shared_ptr<genfit::GFRaveVertexFactory> _vertex_finder;
331 
333  std::string _vertexing_method = "avr-smoothing:1-minweight:0.5-primcut:9-seccut:9";
334 
337 
341 
342  // track seeds
346 
348 
354 
355  // crossing z correction
357 
358  // distortion corrections
362 
365 
368 
371  bool _do_eval = false;
372 
374  std::string _eval_outname = "PHGenFitTrkFitter_eval.root";
375 
376  TTree* _eval_tree = nullptr;
377  TClonesArray* _tca_particlemap = nullptr;
378  TClonesArray* _tca_vtxmap = nullptr;
379  TClonesArray* _tca_trackmap = nullptr;
380  TClonesArray* _tca_vertexmap = nullptr;
381  TClonesArray* _tca_trackmap_refit = nullptr;
382  TClonesArray* _tca_primtrackmap = nullptr;
383  TClonesArray* _tcam_vertexMap_refit = nullptr;
384 
385  TTree* _cluster_eval_tree = nullptr;
392 
393  bool _do_evt_display = false;
394 
395  std::map<unsigned int, unsigned int> _rave_vertex_gf_track_map;
396 
397 };
398 
399 #endif