File indexing completed on 2025-08-05 08:14:44
0001 #ifndef __Proto3ShowerCalib_H__
0002 #define __Proto3ShowerCalib_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 RawTowerGeomContainer_Cylinderv1;
0021 class SvtxTrack;
0022
0023
0024 class Proto3ShowerCalib : public SubsysReco
0025 {
0026
0027 public:
0028
0029 Proto3ShowerCalib(const std::string &filename = "cemc_ana.root");
0030 virtual
0031 ~Proto3ShowerCalib();
0032
0033 int
0034 Init(PHCompositeNode *topNode);
0035 int
0036 InitRun(PHCompositeNode *topNode);
0037 int
0038 process_event(PHCompositeNode *topNode);
0039 int
0040 End(PHCompositeNode *topNode);
0041
0042 int
0043 LoadRecalibMap(const std::string & file);
0044
0045 void
0046 is_sim(bool b) {_is_sim = b;}
0047
0048 class Eval_Run : public TObject
0049 {
0050 public:
0051 Eval_Run()
0052 {
0053 reset();
0054 }
0055 virtual
0056 ~Eval_Run()
0057 {
0058 }
0059
0060 void
0061 reset()
0062 {
0063 run = -31454;
0064 event = -31454;
0065 beam_mom = -0;
0066 hodo_h = -31454;
0067 hodo_v = -31454;
0068 C2_sum = -31454;
0069
0070 sum_energy_T = -31454;
0071 EoP = -31454;
0072 truth_y = -31454;
0073 truth_z = -31454;
0074
0075 valid_hodo_v = false;
0076 valid_hodo_h = false;
0077 trigger_veto_pass = false;
0078 good_temp = false;
0079 good_e = false;
0080 good_data = false;
0081 }
0082
0083 int run;
0084 int event;
0085
0086 float beam_mom;
0087 float getbeammom(){return beam_mom;}
0088 int hodo_h;
0089 int hodo_v;
0090
0091 float C2_sum;
0092
0093
0094 float sum_energy_T;
0095
0096 float EoP;
0097
0098 bool valid_hodo_v;
0099 bool valid_hodo_h;
0100 bool trigger_veto_pass;
0101 bool good_temp;
0102 bool good_e;
0103 bool good_data;
0104
0105 float truth_y;
0106 float truth_z;
0107
0108 float beam_2CH_mm;
0109 float beam_2CV_mm;
0110
0111 ClassDef(Eval_Run,4)
0112 };
0113
0114 class Eval_Cluster : public TObject
0115 {
0116 public:
0117 Eval_Cluster()
0118 {
0119 reset();
0120 }
0121
0122 virtual
0123 ~Eval_Cluster()
0124 {
0125 }
0126
0127 void
0128 reset()
0129 {
0130 max_col = -1;
0131 max_row = -1;
0132 average_col = 0;
0133 average_row = 0;
0134 fmodphi = -999;
0135 fmodeta = -999;
0136 sum_E = 0;
0137 }
0138
0139 void
0140 reweight_clus_pol()
0141 {
0142 if (sum_E > 0)
0143 {
0144 average_col /= sum_E;
0145 average_row /= sum_E;
0146 }
0147 else
0148 {
0149 average_col = -31454;
0150 average_row = -31454;
0151
0152 }
0153 }
0154 void setfmods(float eta, float phi)
0155 {
0156 fmodphi = phi;
0157 fmodeta = eta;
0158 }
0159 float getfmodphi()
0160 {
0161 return fmodphi;
0162 }
0163 float getfmodeta()
0164 {
0165 return fmodeta;
0166 }
0167 float getavgcol(){return average_col;}
0168 float getavgrow(){return average_row;}
0169 float getsumE(){return sum_E;}
0170 int max_col;
0171 int max_row;
0172 float fmodphi;
0173 float fmodeta;
0174
0175 float average_col;
0176 float average_row;
0177 float sum_E;
0178
0179 ClassDef(Eval_Cluster,2)
0180 };
0181
0182 private:
0183
0184
0185 enum
0186 {
0187 n_size = 8
0188 };
0189
0190 bool _is_sim;
0191 bool _use_hodoscope_calibs;
0192 Fun4AllHistoManager *
0193 get_HistoManager();
0194
0195 std::pair<int, int>
0196 find_max(RawTowerContainer* towers, int cluster_size);
0197 const static int nfmodbins = 17;
0198 float fmodbins[nfmodbins];
0199 std::string _filename;
0200
0201 unsigned long _ievent;
0202 float hodoscope_recalibrations[8][8];
0203
0204 float clus_3x3_sim_recalibs[nfmodbins-1][nfmodbins-1];
0205 float clus_5x5_sim_recalibs[nfmodbins-1][nfmodbins-1];
0206
0207 fstream fdata;
0208
0209 Eval_Run _eval_run;
0210
0211 Eval_Cluster _eval_3x3_raw;
0212 Eval_Cluster _eval_5x5_raw;
0213
0214 Eval_Cluster _eval_3x3_prod;
0215 Eval_Cluster _eval_5x5_prod;
0216
0217 Eval_Cluster _eval_3x3_temp;
0218 Eval_Cluster _eval_5x5_temp;
0219
0220 Eval_Cluster _eval_3x3_recalib;
0221 Eval_Cluster _eval_5x5_recalib;
0222
0223 std::map<std::pair<int, int>, double> _recalib_const;
0224 };
0225
0226 #endif