File indexing completed on 2025-12-18 09:16:50
0001 #ifndef __ExampleAnalysisModule_H__
0002 #define __ExampleAnalysisModule_H__
0003
0004 #include <TFile.h>
0005 #include <TNtuple.h>
0006 #include <fun4all/SubsysReco.h>
0007 #include <stdint.h>
0008 #include <fstream>
0009 #include <string>
0010
0011 class PHCompositeNode;
0012 class PHG4HitContainer;
0013 class Fun4AllHistoManager;
0014 class TH1F;
0015 class TTree;
0016 class SvtxEvalStack;
0017 class PHG4Particle;
0018 class RawTowerGeom;
0019 class RawTowerContainer;
0020 class SvtxTrack;
0021
0022
0023 class ExampleAnalysisModule : public SubsysReco
0024 {
0025 public:
0026
0027 ExampleAnalysisModule(const std::string &filename = "ExampleAnalysis.root");
0028
0029
0030 virtual ~ExampleAnalysisModule();
0031
0032
0033 int Init(PHCompositeNode *topNode);
0034
0035
0036 int InitRun(PHCompositeNode *topNode);
0037
0038
0039 int process_event(PHCompositeNode *topNode);
0040
0041
0042 int End(PHCompositeNode *topNode);
0043
0044
0045 void
0046 is_sim(bool b)
0047 {
0048 _is_sim = b;
0049 }
0050
0051 class Eval_Run : public TObject
0052 {
0053 public:
0054 Eval_Run()
0055 {
0056 reset();
0057 }
0058 virtual ~Eval_Run()
0059 {
0060 }
0061
0062 void
0063 reset()
0064 {
0065 run = -31454;
0066 event = -31454;
0067 beam_mom = -0;
0068 hodo_h = -31454;
0069 hodo_v = -31454;
0070 C2_sum = -31454;
0071 C1 = -31454;
0072
0073 valid_hodo_v = false;
0074 valid_hodo_h = false;
0075 trigger_veto_pass = false;
0076 good_e = false;
0077 good_anti_e = false;
0078
0079 beam_2CH_mm = -31454;
0080 beam_2CV_mm = -31454;
0081
0082 truth_y = -31454;
0083 truth_z = -31454;
0084
0085 sum_E_CEMC = -31454;
0086 sum_E_HCAL_OUT = -31454;
0087 sum_E_HCAL_IN = -31454;
0088 }
0089
0090 int run;
0091 int event;
0092
0093
0094 float beam_mom;
0095
0096
0097 int hodo_h;
0098 int hodo_v;
0099
0100
0101 float C2_sum;
0102 float C1;
0103
0104
0105 bool valid_hodo_v;
0106 bool valid_hodo_h;
0107
0108
0109 bool trigger_veto_pass;
0110
0111
0112 bool good_e;
0113
0114
0115 bool good_anti_e;
0116
0117
0118 float beam_2CH_mm;
0119 float beam_2CV_mm;
0120
0121
0122 float truth_y;
0123 float truth_z;
0124
0125
0126 double sum_E_CEMC;
0127 double sum_E_HCAL_OUT;
0128 double sum_E_HCAL_IN;
0129
0130 ClassDef(Eval_Run, 10)
0131 };
0132
0133 class Eval_Cluster : public TObject
0134 {
0135 public:
0136 Eval_Cluster()
0137 {
0138 reset();
0139 }
0140
0141 virtual ~Eval_Cluster()
0142 {
0143 }
0144
0145 void
0146 reset()
0147 {
0148 max_col = -1;
0149 max_row = -1;
0150 average_col = 0;
0151 average_row = 0;
0152
0153 sum_E = 0;
0154 }
0155
0156 void
0157 reweight_clus_pol()
0158 {
0159 if (sum_E > 0)
0160 {
0161 average_col /= sum_E;
0162 average_row /= sum_E;
0163 }
0164 else
0165 {
0166 average_col = -31454;
0167 average_row = -31454;
0168 }
0169 }
0170
0171
0172 int max_col;
0173
0174 int max_row;
0175
0176
0177 float average_col;
0178
0179 float average_row;
0180
0181
0182 float sum_E;
0183
0184 ClassDef(Eval_Cluster, 10)
0185 };
0186
0187 private:
0188
0189 enum
0190 {
0191 n_size = 8
0192 };
0193
0194
0195 bool _is_sim;
0196
0197
0198 Fun4AllHistoManager *
0199 get_HistoManager();
0200
0201 std::pair<int, int>
0202 find_max(RawTowerContainer *towers, int cluster_size);
0203
0204
0205 std::string _filename;
0206
0207
0208 unsigned long _ievent;
0209
0210
0211 Eval_Run _eval_run;
0212
0213
0214 Eval_Cluster _eval_5x5_CEMC;
0215 };
0216
0217 #endif