Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /*!
0002  *  \file       FastTrackingEval.h
0003  *  \brief      Evaluation module for PHG4TrackFastSim output
0004  *  \details    input: PHG4TruthInfoContainer, SvtxTrackMap with SvtxTrack_FastSim inside
0005  *  \author     Haiwang Yu <yuhw@nmsu.edu>
0006  */
0007 
0008 #ifndef __FastTrackingEval_H__
0009 #define __FastTrackingEval_H__
0010 
0011 #include <fun4all/SubsysReco.h>
0012 #include <string>
0013 
0014 //Forward declerations
0015 class PHCompositeNode;
0016 class PHG4TruthInfoContainer;
0017 class SvtxClusterMap;
0018 class SvtxTrackMap;
0019 class TFile;
0020 class TTree;
0021 class TH2D;
0022 
0023 
0024 //Brief: basic ntuple and histogram creation for sim evaluation
0025 class FastTrackingEval: public SubsysReco
0026 {
0027  public: 
0028   //Default constructor
0029   FastTrackingEval(const std::string &name="FastTrackingEval",
0030            const std::string &filename = "g4eval.root",
0031            const std::string &trackmapname = "SvtxTrackMap");
0032 
0033   //Initialization, called for initialization
0034   int Init(PHCompositeNode *);
0035 
0036   //Process Event, called for each event
0037   int process_event(PHCompositeNode *);
0038 
0039   //End, write and close files
0040   int End(PHCompositeNode *);
0041 
0042   //Change output filename
0043   void set_filename(const char* file)
0044   { if(file) _outfile_name = file; }
0045 
0046   //Flags of different kinds of outputs
0047   enum Flag
0048   {
0049     //all disabled
0050     NONE = 0,
0051   };
0052 
0053   //Set the flag
0054   //Flags should be set like set_flag(FastTrackingEval::TRUTH, true) from macro
0055   void set_flag(const Flag& flag, const bool& value)
0056   {
0057    if(value) _flags |= flag;
0058    else _flags &= (~flag);
0059   }
0060 
0061   //User modules
0062   void fill_tree(PHCompositeNode*);
0063   void reset_variables();
0064 
0065  private:
0066   //output filename
0067   std::string _outfile_name;
0068 
0069   //name of SvtxTrackMap collection
0070   std::string _trackmapname;
0071    
0072   //Event counter
0073   int _event;
0074 
0075   //Get all the nodes
0076   int GetNodes(PHCompositeNode *);
0077   
0078   //flags
0079   unsigned int _flags;
0080 
0081   //TTrees
0082   TTree* _eval_tree_tracks;
0083   int event;
0084   //-- truth
0085   int gtrackID;
0086   int gflavor;
0087   float gpx;
0088   float gpy;
0089   float gpz;
0090   float gpt;
0091   float gp;
0092   float gtheta;
0093   float geta;
0094   float gphi;
0095   float gvx;
0096   float gvy;
0097   float gvz;
0098 
0099   //-- reco
0100   int trackID;
0101   int charge;
0102   int nhits;
0103   float px;
0104   float py;
0105   float pz;
0106   float pt;
0107   float p;
0108   float theta;
0109   float eta;
0110   float phi;
0111   float dca2d;
0112 
0113   //Histos
0114   TH2D* _h2d_Delta_mom_vs_truth_mom;
0115   TH2D* _h2d_Delta_mom_vs_truth_eta;
0116 
0117   //Node pointers
0118   PHG4TruthInfoContainer* _truth_container;
0119   SvtxTrackMap* _trackmap;
0120 
0121 };
0122 
0123 #endif //* __FastTrackingEval_H__ *//