File indexing completed on 2025-08-06 08:15:37
0001 #ifndef __Proto2ShowerCalib_H__
0002 #define __Proto2ShowerCalib_H__
0003
0004 #include <fun4all/SubsysReco.h>
0005 #include <TNtuple.h>
0006 #include <TFile.h>
0007 #include <string>
0008 #include <stdint.h>
0009 #include <fstream>
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 Proto2ShowerCalib : public SubsysReco
0024 {
0025
0026 public:
0027
0028 Proto2ShowerCalib(const std::string &filename = "cemc_ana.root");
0029 virtual
0030 ~Proto2ShowerCalib();
0031
0032 int
0033 Init(PHCompositeNode *topNode);
0034 int
0035 InitRun(PHCompositeNode *topNode);
0036 int
0037 process_event(PHCompositeNode *topNode);
0038 int
0039 End(PHCompositeNode *topNode);
0040
0041 int
0042 LoadRecalibMap(const std::string & file);
0043
0044 void
0045 is_sim(bool b) {_is_sim = b;}
0046
0047 class Eval_Run : public TObject
0048 {
0049 public:
0050 Eval_Run()
0051 {
0052 reset();
0053 }
0054 virtual
0055 ~Eval_Run()
0056 {
0057 }
0058
0059 void
0060 reset()
0061 {
0062 run = -31454;
0063 event = -31454;
0064 beam_mom = -0;
0065 hodo_h = -31454;
0066 hodo_v = -31454;
0067 C2_sum = -31454;
0068
0069 sum_energy_T = -31454;
0070 EoP = -31454;
0071 truth_y = -31454;
0072 truth_z = -31454;
0073
0074 valid_hodo_v = false;
0075 valid_hodo_h = false;
0076 trigger_veto_pass = false;
0077 good_temp = false;
0078 good_e = false;
0079 good_data = false;
0080 }
0081
0082 int run;
0083 int event;
0084
0085 float beam_mom;
0086
0087 int hodo_h;
0088 int hodo_v;
0089
0090 float C2_sum;
0091
0092
0093 float sum_energy_T;
0094
0095 float EoP;
0096
0097 bool valid_hodo_v;
0098 bool valid_hodo_h;
0099 bool trigger_veto_pass;
0100 bool good_temp;
0101 bool good_e;
0102 bool good_data;
0103
0104 float truth_y;
0105 float truth_z;
0106
0107 ClassDef(Eval_Run,3)
0108 };
0109
0110 class Eval_Cluster : public TObject
0111 {
0112 public:
0113 Eval_Cluster()
0114 {
0115 reset();
0116 }
0117
0118 virtual
0119 ~Eval_Cluster()
0120 {
0121 }
0122
0123 void
0124 reset()
0125 {
0126 max_col = -1;
0127 max_row = -1;
0128 average_col = 0;
0129 average_row = 0;
0130
0131 sum_E = 0;
0132 }
0133
0134 void
0135 reweight_clus_pol()
0136 {
0137 if (sum_E > 0)
0138 {
0139 average_col /= sum_E;
0140 average_row /= sum_E;
0141 }
0142 else
0143 {
0144 average_col = -31454;
0145 average_row = -31454;
0146
0147 }
0148 }
0149
0150 int max_col;
0151 int max_row;
0152
0153 float average_col;
0154 float average_row;
0155 float sum_E;
0156
0157 ClassDef(Eval_Cluster,2)
0158 };
0159
0160 private:
0161
0162
0163 enum
0164 {
0165 n_size = 8
0166 };
0167
0168 bool _is_sim;
0169
0170 Fun4AllHistoManager *
0171 get_HistoManager();
0172
0173 std::pair<int, int>
0174 find_max(RawTowerContainer* towers, int cluster_size);
0175
0176 std::string _filename;
0177
0178 unsigned long _ievent;
0179
0180 fstream fdata;
0181
0182 Eval_Run _eval_run;
0183
0184 Eval_Cluster _eval_3x3_raw;
0185 Eval_Cluster _eval_5x5_raw;
0186
0187 Eval_Cluster _eval_3x3_prod;
0188 Eval_Cluster _eval_5x5_prod;
0189
0190 Eval_Cluster _eval_3x3_temp;
0191 Eval_Cluster _eval_5x5_temp;
0192
0193 Eval_Cluster _eval_3x3_recalib;
0194 Eval_Cluster _eval_5x5_recalib;
0195
0196 std::map<std::pair<int, int>, double> _recalib_const;
0197 };
0198
0199 #endif