Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:41

0001 /*!
0002  *  \file       TpcPrototypeGenFitTrkFinder.h
0003  *  \brief      Refit SvtxTracks with PHGenFit.
0004  *  \details    Refit SvtxTracks with PHGenFit.
0005  *  \author     Haiwang Yu <yuhw@nmsu.edu>
0006  */
0007 
0008 #ifndef TRACKRECO_TpcPrototypeGenFitTrkFinder_H
0009 #define TRACKRECO_TpcPrototypeGenFitTrkFinder_H
0010 
0011 #include <fun4all/SubsysReco.h>
0012 
0013 #include <string>
0014 #include <vector>
0015 
0016 
0017 namespace PHGenFit
0018 {
0019   class Fitter;
0020 }
0021 
0022 class AssocInfoContainer;
0023 class PHCompositeNode;
0024 class SvtxTrackMap;
0025 class SvtxVertexMap;
0026 class TClonesArray;
0027 class TTree;
0028 class TrkrCluster;
0029 class TrkrClusterContainer;
0030 
0031 //! \brief  find tracks
0032 class TpcPrototypeGenFitTrkFinder : public SubsysReco
0033 {
0034  public:
0035   //! Default constructor
0036   TpcPrototypeGenFitTrkFinder(const std::string& name = "TpcPrototypeGenFitTrkFinder", int layers = 16);
0037 
0038   //! dtor
0039   ~TpcPrototypeGenFitTrkFinder();
0040 
0041   //!Initialization, called for initialization
0042   int Init(PHCompositeNode*);
0043 
0044   //!Initialization Run, called for initialization of a run
0045   int InitRun(PHCompositeNode*);
0046 
0047   //!Process Event, called for each event
0048   int process_event(PHCompositeNode*);
0049 
0050   //!End, write and close files
0051   int End(PHCompositeNode*);
0052 
0053   //! For evalution
0054   //! Change eval output filename
0055   void set_eval_filename(const std::string & file)
0056   {
0057       _eval_outname = file;
0058   }
0059   std::string get_eval_filename() const
0060   {
0061     return _eval_outname;
0062   }
0063 
0064   void fill_eval_tree(PHCompositeNode*);
0065   void init_eval_tree();
0066   void reset_eval_variables();
0067 
0068   bool is_do_eval() const
0069   {
0070     return _do_eval;
0071   }
0072 
0073   void set_do_eval(bool doEval)
0074   {
0075     _do_eval = doEval;
0076   }
0077 
0078   bool is_do_evt_display() const
0079   {
0080     return _do_evt_display;
0081   }
0082 
0083   void set_do_evt_display(bool doEvtDisplay)
0084   {
0085     _do_evt_display = doEvtDisplay;
0086   }
0087 
0088   const std::string& get_track_fitting_alg_name() const
0089   {
0090     return _track_fitting_alg_name;
0091   }
0092 
0093   void set_track_fitting_alg_name(const std::string& trackFittingAlgName)
0094   {
0095     _track_fitting_alg_name = trackFittingAlgName;
0096   }
0097 
0098   int get_primary_pid_guess() const
0099   {
0100     return _primary_pid_guess;
0101   }
0102 
0103   void set_primary_pid_guess(int primaryPidGuess)
0104   {
0105     _primary_pid_guess = primaryPidGuess;
0106   }
0107 
0108  private:
0109   //! Event counter
0110   int _event;
0111 
0112   //! Get all the nodes
0113   int GetNodes(PHCompositeNode*);
0114 
0115   //!Create New nodes
0116   int CreateNodes(PHCompositeNode*);
0117 
0118   typedef std::vector<const TrkrCluster*> tracklet_t;
0119 
0120   double getChi2Ndf(const tracklet_t & tracklet);
0121 
0122   PHGenFit::Fitter* _fitter;
0123 
0124   //! KalmanFitterRefTrack, KalmanFitter, DafSimple, DafRef
0125   std::string _track_fitting_alg_name;
0126 
0127   int nLayer;
0128   unsigned int minLayer;
0129   unsigned int maxTracklet;
0130   int _primary_pid_guess;
0131   double rphiWindow;
0132   double ZWindow;
0133 
0134   //! Input Node pointers
0135   //  PHG4TruthInfoContainer* _truth_container;
0136   TrkrClusterContainer* _clustermap;
0137   SvtxTrackMap* _trackmap;
0138   AssocInfoContainer *_assoc_container;
0139   SvtxVertexMap* _vertexmap;
0140 
0141   //! Evaluation
0142   //! switch eval out
0143   bool _do_eval;
0144 
0145   //! eval output filename
0146   std::string _eval_outname;
0147 
0148   TTree* _eval_tree;
0149   int _tca_ntrack;
0150   TClonesArray* _tca_trackmap;
0151 
0152   TTree* _cluster_eval_tree;
0153   float _cluster_eval_tree_x;
0154   float _cluster_eval_tree_y;
0155   float _cluster_eval_tree_z;
0156   float _cluster_eval_tree_gx;
0157   float _cluster_eval_tree_gy;
0158   float _cluster_eval_tree_gz;
0159 
0160   bool _do_evt_display;
0161 };
0162 
0163 #endif