Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:17

0001 /*!
0002  *  \file       GenFitTrackProp.h
0003  *  \brief      Example module to extrapolate SvtxTrack with GenFit swiming
0004  *  \author     Haiwang Yu <yuhw@nmsu.edu>
0005  */
0006 
0007 #ifndef __GenFitTrackProp_H__
0008 #define __GenFitTrackProp_H__
0009 
0010 
0011 
0012 #include <fun4all/SubsysReco.h>
0013 
0014 //#include <g4eval/SvtxEvalStack.h>
0015 
0016 #include <string>
0017 //#include <memory>
0018 
0019 //Forward declerations
0020 
0021 class PHCompositeNode;
0022 
0023 class PHG4TruthInfoContainer;
0024 
0025 class SvtxEvalStack;
0026 
0027 class SvtxClusterMap;
0028 class SvtxTrackMap;
0029 
0030 class TFile;
0031 class TTree;
0032 class TH2D;
0033 
0034 namespace PHGenFit {
0035     class Fitter;
0036 }
0037 
0038 
0039 //Brief: basic ntuple and histogram creation for sim evaluation
0040 class GenFitTrackProp: public SubsysReco
0041 {
0042  public: 
0043   //!Default constructor
0044   GenFitTrackProp(const std::string &name="GenFitTrackProp", const int pid_guess = 211);
0045 
0046   //!Initialization, called for initialization
0047   int Init(PHCompositeNode *);
0048 
0049   int InitRun(PHCompositeNode *);
0050 
0051   //!Process Event, called for each event
0052   int process_event(PHCompositeNode *);
0053 
0054   //!End, write and close files
0055   int End(PHCompositeNode *);
0056 
0057   //! Change output filename
0058   void set_filename(const char* file)
0059   { if(file) _outfile_name = file; }
0060 
0061     int get_pid_guess() const {
0062         return _pid_guess;
0063     }
0064 
0065     void set_pid_guess(int pidGuess) {
0066         _pid_guess = pidGuess;
0067     }
0068 
0069  private:
0070 
0071   //!Get all the nodes
0072   int GetNodes(PHCompositeNode *);
0073 
0074   void fill_tree(PHCompositeNode*);
0075   void reset_variables();
0076 
0077  private:
0078 
0079   /*!
0080    *  Input
0081    */
0082   
0083   //! Node pointers
0084   PHG4TruthInfoContainer* _truth_container;
0085   SvtxTrackMap* _trackmap;
0086 
0087   /*!
0088    *  Processing
0089    */
0090 
0091   //! event processed
0092   int _event;
0093 
0094   //!
0095 
0096   SvtxEvalStack* _svtxevalstack;
0097 
0098   //! Needed to initialize genfit::FieldManager and genfit::MaterialEffect
0099   PHGenFit::Fitter* _fitter;
0100 
0101   std::string _track_fitting_alg_name;
0102 
0103   bool _do_evt_display;
0104 
0105   //!
0106   int _pid_guess;
0107 
0108   /*!
0109    *  Output
0110    */
0111 
0112   //!output filename
0113   std::string _outfile_name;
0114 
0115   //! Eval TTrees
0116   TTree* _eval_tree_tracks;
0117 
0118   int event;
0119 
0120   //! truth track info
0121   int gtrackID;
0122   int gflavor;
0123 
0124   double gpx;
0125   double gpy;
0126   double gpz;
0127 
0128   double gpt;
0129   double geta;
0130 
0131   double gvx;
0132   double gvy;
0133   double gvz;
0134 
0135   //! reco info
0136   int trackID;
0137   int charge;
0138   int nhits;
0139 
0140   double px;
0141   double py;
0142   double pz;
0143   double pt;
0144 
0145   double dca2d;
0146 
0147   double radius80;
0148   double pathlength80;
0149   double pathlength85;
0150 
0151 };
0152 
0153 #endif //* __GenFitTrackProp_H__ *//