Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:11:18

0001 #ifndef __PHANA_H__
0002 #define __PHANA_H__
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <string>
0006 
0007 //Forward declerations
0008 class PHCompositeNode;
0009 class PHG4HitContainer;
0010 class PHG4TruthInfoContainer;
0011 class TFile;
0012 class TNtuple;
0013 
0014 
0015 //Brief: basic ntuple and histogram creation for sim evaluation
0016 class PHAna: public SubsysReco
0017 {
0018  public: 
0019   //Default constructor
0020   PHAna(const std::string &name="PHAna");
0021 
0022   //Initialization, called for initialization
0023   int Init(PHCompositeNode *);
0024 
0025   //Process Event, called for each event
0026   int process_event(PHCompositeNode *);
0027 
0028   //End, write and close files
0029   int End(PHCompositeNode *);
0030 
0031   //Change output filename
0032   void set_filename(const char* file)
0033   { if(file) _outfile = file; }
0034 
0035   float Square(float x){ return x*x; }
0036 
0037   //Flags of different kinds of outputs
0038   enum Flag
0039   {
0040     //all disabled
0041     NONE = 0,
0042 
0043     //truth
0044     TRUTH = (1<<0),
0045 
0046     //histograms
0047     HIST = (1<<1),
0048 
0049     //Sampling fractions
0050     SF = (1<<2),
0051 
0052     //Inner HCal Towers
0053     HCALIN_TOWER = (1<<3),
0054     
0055     //All flags ON
0056     ALL = (1<<4)-1
0057   };
0058 
0059   //Set the flag
0060   //Flags should be set like set_flag(PHAna::TRUTH, true) from macro
0061   void set_flag(const Flag& flag, const bool& value)
0062   {
0063    if(value) _flags |= flag;
0064    else _flags &= (~flag);
0065   }
0066 
0067   //User modules
0068   void fill_truth_ntuple(PHCompositeNode*);
0069   void fill_sf_ntuple(PHCompositeNode*);
0070   void create_histos();
0071   void fill_histos(PHCompositeNode*);
0072 
0073  private:
0074   //output filename
0075   std::string _outfile;
0076    
0077   //Event counter
0078   int _event;
0079 
0080   //Get all the nodes
0081   void GetNodes(PHCompositeNode *);
0082   
0083   //flags
0084   unsigned int _flags;
0085 
0086   //TNtuples
0087   TNtuple* _truth;
0088   TNtuple* _sf;
0089   TNtuple* _hcalin_towers;
0090 
0091   //Node pointers
0092   PHG4TruthInfoContainer* _truth_container;
0093   PHG4HitContainer* _hcalout_hit_container;
0094   PHG4HitContainer* _hcalin_hit_container;
0095   PHG4HitContainer* _cemc_hit_container;
0096   PHG4HitContainer* _hcalout_abs_hit_container;
0097   PHG4HitContainer* _hcalin_abs_hit_container;
0098   PHG4HitContainer* _cemc_abs_hit_container;
0099   PHG4HitContainer* _cemc_electronics_hit_container;
0100   PHG4HitContainer* _hcalin_spt_hit_container;
0101 
0102 
0103 };
0104 
0105 #endif //* __PHANA_H__ *//