Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CaloEvaluator.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CaloEvaluator.h
1 #ifndef G4EVAL_CALOEVALUATOR_H
2 #define G4EVAL_CALOEVALUATOR_H
3 
4 //===============================================
8 //===============================================
9 
10 #include <fun4all/SubsysReco.h>
11 
12 #include <set>
13 #include <string>
14 
15 class CaloEvalStack;
16 class PHCompositeNode;
17 class TFile;
18 class TNtuple;
19 class TTree; // Added by Barak
20 
29 class CaloEvaluator : public SubsysReco
30 {
31  public:
32  CaloEvaluator(const std::string &name = "CALOEVALUATOR",
33  const std::string &caloname = "CEMC",
34  const std::string &filename = "g4eval_cemc.root");
35  ~CaloEvaluator() override{};
36 
37  int Init(PHCompositeNode *topNode) override;
38  int process_event(PHCompositeNode *topNode) override;
39  int End(PHCompositeNode *topNode) override;
40 
41  // allow user to set the value of the event number
42  // useful for condor simulation submissions
43  // must be called after Init()
44  void set_event(int ievent)
45  {
46  _ievent = ievent;
47  }
48 
49  void set_strict(bool b) { _strict = b; }
50  // funtions to limit the tracing to only part of the event ---------
51  // and speed up the evaluation
52 
53  // when tracing truth showers limit the trace to showers
54  // that result from truth particles with a particular embed flag set
55  // useful if you only want to know about that electron you
56  // embedded into a central hijing event
57  // (evaluation for truth objects with matching embed flag set unaffected)
59  {
60  _truth_trace_embed_flags.insert(flag);
61  }
62 
63  // limit the tracing of truth particles to those above some
64  // theshold energy. useful for tracing only high energy particles
65  // and ignoring low energy truth particles from a hijing event
66  // (evaluation for objects above threshold unaffected)
68  {
69  _truth_e_threshold = thresh;
70  }
71 
72  // limit the tracing of towers and clusters back to the truth particles
73  // to only those reconstructed objects above a particular energy
74  // threshold (evaluation for objects above threshold unaffected)
76  {
77  _reco_e_threshold = thresh;
78  }
79 
80  // functions to limit the output size ------------------
81  // will no evaluate or write out these particular ntuples
82  // mostly intended for size savings, but some time savings will result
85  void set_do_tower_eval(bool b) { _do_tower_eval = b; }
87 
88  private:
89  // subroutines
90  void printInputInfo(PHCompositeNode *topNode);
91  void fillOutputNtuples(PHCompositeNode *topNode);
92  void printOutputInfo(PHCompositeNode *topNode);
93 
94  CaloEvalStack *_caloevalstack = nullptr;
95  TFile *_tfile = nullptr;
96  TNtuple *_ntp_cluster = nullptr;
97  TNtuple *_ntp_gpoint = nullptr;
98  TNtuple *_ntp_gshower = nullptr;
99  TNtuple *_ntp_tower = nullptr;
100  TTree *_tower_debug = nullptr; // Added by Barak
101 
102  unsigned int _ievent = 0;
103  unsigned int _towerID_debug = 0;
104  unsigned int m_EvtCounter = 0;
105 
106  int _ieta_debug = 0;
107  int _iphi_debug = 0;
108 
109  float _eta_debug = 0.;
110  float _phi_debug = 0.;
111  float _e_debug = 0.;
112  float _x_debug = 0.;
113  float _y_debug = 0.;
114  float _z_debug = 0.;
115  float _truth_e_threshold = 0.;
116  float _reco_e_threshold = 0.;
117 
118  bool _do_cluster_eval = true;
119  bool _do_gpoint_eval = true;
120  bool _do_gshower_eval = true;
121  bool _do_tower_eval = true;
122  bool _strict = false;
123 
126  std::set<int> _truth_trace_embed_flags;
127 };
128 
129 #endif // G4EVAL_CALOEVALUATOR_H