Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:14:49

0001 #ifndef __Proto4TowerCalib_H__
0002 #define __Proto4TowerCalib_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 TChain;
0017 class SvtxEvalStack;
0018 class PHG4Particle;
0019 class RawTowerGeom;
0020 class RawTowerContainer;
0021 class SvtxTrack;
0022 
0023 /// \class Proto4TowerCalib to help you get started
0024 class Proto4TowerCalib : public SubsysReco
0025 {
0026  public:
0027   //! constructor
0028   Proto4TowerCalib(const std::string &filename = "Proto4TowerCalib.root");
0029 
0030   //! destructor
0031   virtual ~Proto4TowerCalib();
0032 
0033   //! Standard function called at initialization
0034   int Init(PHCompositeNode *topNode);
0035 
0036   //! Standard function called when a new run is processed
0037   int InitRun(PHCompositeNode *topNode);
0038 
0039   //! Standard function called at each event
0040   int process_event(PHCompositeNode *topNode);
0041 
0042   //! Standard function called at the end of processing. Save your stuff here.
0043   int End(PHCompositeNode *topNode);
0044 
0045   //! Is processing simulation files?
0046   void is_sim(bool b)
0047   {
0048     _is_sim = b;
0049   }
0050 
0051   // TowerCalib Analysis
0052   int InitAna();
0053 
0054   int MakeAna();
0055 
0056   int FinishAna();
0057 
0058   void set_det(std::string detector)
0059   {
0060     _mDet = detector;
0061   }
0062 
0063   void set_colID(int colID)
0064   {
0065     _mCol = colID;
0066   }
0067 
0068 
0069   class HCAL_Tower : public TObject
0070   {
0071    public:
0072     HCAL_Tower()
0073     {
0074      reset();
0075     }
0076 
0077     virtual ~HCAL_Tower(){}
0078 
0079     void reset()
0080     {
0081      // HCALIN
0082      hcalin_e_sim = 0.;
0083 
0084      hcalin_lg_e_raw = 0.;
0085      hcalin_lg_e_calib = 0.;
0086 
0087      for(int itwr=0; itwr<16; itwr++)
0088      {
0089       hcalin_twr_sim[itwr] = 0.;
0090       hcalin_lg_twr_raw[itwr] = 0.;
0091       hcalin_lg_twr_calib[itwr] = 0.;
0092      }
0093 
0094      // HCALOUT
0095      hcalout_e_sim = 0.;
0096      
0097      hcalout_lg_e_raw = 0.;
0098      hcalout_lg_e_calib = 0.;
0099 
0100      hcalout_hg_e_raw = 0.;
0101      hcalout_hg_e_calib = 0.;
0102 
0103      for(int itwr=0; itwr<16; itwr++)
0104      {
0105       hcalout_twr_sim[itwr] = 0.;
0106 
0107       hcalout_lg_twr_raw[itwr] = 0.;
0108       hcalout_lg_twr_calib[itwr] = 0.;
0109 
0110       hcalout_hg_twr_raw[itwr] = 0.;
0111       hcalout_hg_twr_calib[itwr] = 0.;
0112      }
0113 
0114      // total energy and asymmetry
0115      hcal_total_sim = -999.;
0116      hcal_total_raw = -999.;
0117      hcal_total_calib = -999.;
0118 
0119      hcal_asym_sim = -999.;
0120      hcal_asym_raw = -999.;
0121      hcal_asym_calib = -999.;
0122     }
0123 
0124 
0125    // HCALIN
0126    float hcalin_e_sim;
0127    float hcalin_twr_sim[16];
0128 
0129    float hcalin_lg_e_raw;
0130    float hcalin_lg_twr_raw[16];
0131 
0132    float hcalin_lg_e_calib;
0133    float hcalin_lg_twr_calib[16];
0134 
0135    // HCALOUT
0136    float hcalout_e_sim;
0137    float hcalout_twr_sim[16];
0138 
0139    float hcalout_lg_e_raw;
0140    float hcalout_lg_twr_raw[16];
0141 
0142    float hcalout_lg_e_calib;
0143    float hcalout_lg_twr_calib[16];
0144 
0145    float hcalout_hg_e_raw;
0146    float hcalout_hg_twr_raw[16];
0147 
0148    float hcalout_hg_e_calib;
0149    float hcalout_hg_twr_calib[16];
0150 
0151    // total energy and asymmetry
0152    float hcal_total_sim;
0153    float hcal_total_raw;
0154    float hcal_total_calib;
0155 
0156    float hcal_asym_sim;
0157    float hcal_asym_raw;
0158    float hcal_asym_calib;
0159 
0160    ClassDef(HCAL_Tower, 10)
0161   };
0162 
0163  private:
0164   // calorimeter size
0165   enum
0166   {
0167     n_size = 8
0168   };
0169 
0170   //! is processing simulation files?
0171   bool _is_sim;
0172 
0173   //! get manager of histograms
0174   Fun4AllHistoManager *
0175   get_HistoManager();
0176 
0177   std::pair<int, int>
0178   find_max(RawTowerContainer *towers, int cluster_size);
0179 
0180   int getChannelNumber(int column, int row);
0181 
0182   //! output root file name
0183   std::string _filename;
0184 
0185   //! simple event counter
0186   unsigned long _ievent;
0187 
0188   //! hcal infromation. To be copied to output TTree T
0189   HCAL_Tower _tower;
0190 
0191   // TowerCalib Analysis
0192   TFile *mFile_OutPut;
0193   TChain *mChainInPut;
0194   unsigned long _mStartEvent;
0195   unsigned long _mStopEvent;
0196   int _mInPut_flag;
0197   std::string _mList;
0198   std::string _mDet;
0199   int _mCol;
0200   float _mPedestal;
0201 
0202   HCAL_Tower *_mTower;
0203 
0204   TH1F *h_mHCAL[16];
0205   float hcal_twr[16];
0206   bool _is_sig[16];
0207 
0208   bool is_sig(int colID);
0209   int fill_sig(int colID);
0210   int reset_pedestal();
0211 };
0212 
0213 #endif  // __Proto4TowerCalib_H__