Back to home page

sPhenix code displayed by LXR

 
 

    


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 TF1;
0016 class TTree;
0017 class SvtxEvalStack;
0018 class PHG4Particle;
0019 class RawTowerGeom;
0020 class RawTowerContainer;
0021 class SvtxTrack;
0022 
0023 /// \class Proto3ShowerCalib
0024 class Proto3ShowerCalib : public SubsysReco
0025 {
0026 
0027 public:
0028 
0029   Proto3ShowerCalib(const std::string &filename = "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   class Eval_Run : public TObject
0046   {
0047   public:
0048     Eval_Run()
0049     {
0050       reset();
0051     }
0052     virtual
0053     ~Eval_Run()
0054     {
0055     }
0056 
0057     void
0058     reset()
0059     {
0060       run = -31454;
0061       event = -31454;
0062       beam_mom = -0;
0063       hodo_h = -31454;
0064       hodo_v = -31454;
0065       C2_sum = -31454;
0066       C1 = -31454;
0067       EoP = -31454;
0068       valid_hodo_v = false;
0069       valid_hodo_h = false;
0070       trigger_veto_pass = false;
0071       good_temp = false;
0072       good_e = false;
0073       good_h = false;
0074     }
0075 
0076     int run;
0077     int event;
0078     float beam_mom;
0079     int hodo_h;
0080     int hodo_v;
0081     float C2_sum;
0082     float C1;
0083     float EoP;
0084     bool valid_hodo_v;
0085     bool valid_hodo_h;
0086     bool trigger_veto_pass;
0087     bool good_temp;
0088     bool good_e;
0089     bool good_h;
0090 
0091   ClassDef(Eval_Run,2)
0092   };
0093 
0094   class HCAL_shower : public TObject
0095   {
0096    public:
0097     HCAL_shower()
0098     {
0099      reset();
0100     }
0101 
0102     virtual ~HCAL_shower(){}
0103 
0104     void reset()
0105     {
0106      emcal_e = 0.;
0107      hcalin_e = 0.;
0108      hcalout_e = 0.;
0109      sum_e = 0.;
0110      for(int itwr=0; itwr<16; itwr++)
0111      {
0112       hcalin_twr_e[itwr] = 0.;
0113       hcalout_twr_e[itwr] = 0.;
0114      }
0115      for(int itwr=0; itwr<64; itwr++)
0116       emcal_twr_e[itwr] = 0.;
0117 
0118      emcal_e_recal = 0.;
0119      hcalin_e_recal = 0.;
0120      hcalout_e_recal = 0.;
0121      sum_e_recal = 0.;
0122      hcal_asym = -999;
0123     }
0124 
0125    float emcal_e;
0126    float hcalin_e;
0127    float hcalout_e;
0128    float sum_e;
0129    float emcal_twr_e[64];
0130    float hcalin_twr_e[16];
0131    float hcalout_twr_e[16];
0132 
0133    float emcal_e_recal;
0134    float hcalin_e_recal;
0135    float hcalout_e_recal;
0136    float hcal_asym;
0137    float sum_e_recal;
0138   };
0139 
0140   class Scientillators : public TObject
0141   {
0142    public:
0143     Scientillators(){ reset(); }
0144     virtual ~Scientillators(){}
0145     void reset()
0146     {
0147       hcalin_edep = 0.;
0148       hcalout_edep = 0.;
0149       hcalin_lightyield = 0.;
0150       hcalout_lightyield = 0.;
0151     }
0152     float hcalin_edep;
0153     float hcalout_edep;
0154 
0155     float hcalin_lightyield;
0156     float hcalout_lightyield;
0157   };
0158 
0159   class Time_Samples : public TObject
0160   {
0161    public:
0162     Time_Samples(){ reset(); }
0163     virtual ~Time_Samples(){}
0164 
0165     void reset()
0166     {
0167      for(int itower=0; itower<16; itower++)
0168      {
0169       for(int isamp=0; isamp<24; isamp++)
0170       {
0171        hcalin_time_samples[itower][isamp] = -9999;
0172        hcalout_time_samples[itower][isamp] = -9999;
0173       }
0174      }
0175 
0176      for(int itower=0; itower<64; itower++)
0177      {
0178       for(int isamp=0; isamp<24; isamp++)
0179       {
0180        emcal_time_samples[itower][isamp] = -9999;
0181       }
0182      }
0183     }
0184    float hcalin_time_samples[16][24];
0185    float hcalout_time_samples[16][24];
0186    float emcal_time_samples[64][24];
0187   };
0188 
0189   void set_sim(const bool b)
0190   { _is_sim = b; }
0191 
0192   void fill_tower_samples(const bool);
0193   void fill_time_samples(const bool);
0194   void fill_slat_values(const bool);
0195 private:
0196 
0197   // calorimeter size
0198   enum
0199   {
0200     n_size_emcal = 8,
0201     n_size_hcalin = 4,
0202     n_size_hcalout = 4
0203   };
0204 
0205   Fun4AllHistoManager *
0206   get_HistoManager();
0207 
0208   std::string _filename;
0209 
0210   unsigned long _ievent;
0211 
0212   fstream fdata;
0213 
0214   Eval_Run _eval_run;
0215 
0216   HCAL_shower _shower;
0217 
0218   Time_Samples _time_samples;
0219 
0220   Scientillators _slats;
0221 
0222   //Add smearing
0223   TF1 *smearing;
0224   bool _is_sim;
0225   bool _fill_tower_samples;
0226   bool _fill_time_samples;
0227   bool _fill_slats;
0228 
0229   std::map<std::pair<int, int>, double> _emcal_recalib_const;
0230   std::map<std::pair<int, int>, double> _hcalin_recalib_const;
0231   std::map<std::pair<int, int>, double> _hcalout_recalib_const;
0232 
0233 };
0234 
0235 #endif // __Proto3ShowerCalib_H__