Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:14: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 /// \class Proto2ShowerCalib
0023 class Proto2ShowerCalib : public SubsysReco
0024 {
0025 
0026 public:
0027 
0028   Proto2ShowerCalib(const std::string &filename = "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   class Eval_Run : public TObject
0045   {
0046   public:
0047     Eval_Run()
0048     {
0049       reset();
0050     }
0051     virtual
0052     ~Eval_Run()
0053     {
0054     }
0055 
0056     void
0057     reset()
0058     {
0059       run = -31454;
0060       event = -31454;
0061       beam_mom = -0;
0062       hodo_h = -31454;
0063       hodo_v = -31454;
0064       C2_sum = -31454;
0065       C1 = -31454;
0066       EoP = -31454;
0067       valid_hodo_v = false;
0068       valid_hodo_h = false;
0069       trigger_veto_pass = false;
0070       good_temp = false;
0071       good_e = false;
0072       good_h = false;
0073     }
0074 
0075     int run;
0076     int event;
0077     float beam_mom;
0078     int hodo_h;
0079     int hodo_v;
0080     float C2_sum;
0081     float C1;
0082     float EoP;
0083     bool valid_hodo_v;
0084     bool valid_hodo_h;
0085     bool trigger_veto_pass;
0086     bool good_temp;
0087     bool good_e;
0088     bool good_h;   
0089 
0090   ClassDef(Eval_Run,2)
0091   };
0092 
0093   class HCAL_shower : public TObject
0094   {
0095    public:
0096     HCAL_shower()
0097     {
0098      reset();
0099     }
0100 
0101     virtual ~HCAL_shower(){}
0102 
0103     void reset()
0104     {
0105      emcal_e = 0.;
0106      hcalin_e = 0.;
0107      hcalout_e = 0.;
0108      sum_e = 0.;    
0109      
0110      emcal_e_recal = 0.;
0111      hcalin_e_recal = 0.;
0112      hcalout_e_recal = 0.;
0113      sum_e_recal = 0.;
0114      hcal_asym = -999;
0115     }
0116 
0117 
0118    float emcal_e;
0119    float hcalin_e;
0120    float hcalout_e;
0121    float sum_e;
0122   
0123    float emcal_e_recal;
0124    float hcalin_e_recal;
0125    float hcalout_e_recal;
0126    float hcal_asym;
0127    float sum_e_recal;
0128   };
0129 
0130 
0131   class Time_Samples : public TObject
0132   {
0133    public:
0134     Time_Samples(){ reset(); }
0135     virtual ~Time_Samples(){}
0136 
0137     void reset()
0138     {
0139      for(int itower=0; itower<16; itower++)
0140      {
0141       for(int isamp=0; isamp<24; isamp++)
0142       {
0143        hcalin_time_samples[itower][isamp] = -9999;
0144        hcalout_time_samples[itower][isamp] = -9999;
0145       }
0146      }
0147 
0148      for(int itower=0; itower<64; itower++)
0149      {
0150       for(int isamp=0; isamp<24; isamp++)
0151       {
0152        emcal_time_samples[itower][isamp] = -9999;
0153       }
0154      }
0155     }
0156    float hcalin_time_samples[16][24];
0157    float hcalout_time_samples[16][24];
0158    float emcal_time_samples[64][24];
0159   };
0160 
0161   void set_sim(const bool b)
0162   { _is_sim = b; }
0163 
0164   void fill_time_samples(const bool);
0165 
0166 private:
0167 
0168   // calorimeter size
0169   enum
0170   {
0171     n_size_emcal = 8,
0172     n_size_hcalin = 4,
0173     n_size_hcalout = 4
0174   };
0175 
0176   Fun4AllHistoManager *
0177   get_HistoManager();
0178 
0179   std::string _filename;
0180 
0181   unsigned long _ievent;
0182 
0183   fstream fdata;
0184 
0185   Eval_Run _eval_run;
0186 
0187   HCAL_shower _shower;
0188 
0189   Time_Samples _time_samples;
0190  
0191   bool _is_sim;
0192   bool _fill_time_samples;
0193   std::map<std::pair<int, int>, double> _emcal_recalib_const;
0194   std::map<std::pair<int, int>, double> _hcalin_recalib_const;
0195   std::map<std::pair<int, int>, double> _hcalout_recalib_const;
0196 
0197 };
0198 
0199 #endif // __Proto2ShowerCalib_H__