Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-18 09:17:46

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef CALOTOWERSLOPE_LITECALOEVAL_H
0004 #define CALOTOWERSLOPE_LITECALOEVAL_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <string>
0009 
0010 class TFile;
0011 class TH1;
0012 class TH2;
0013 class TH3;
0014 class TriggerAnalyzer;
0015 
0016 class LiteCaloEval : public SubsysReco
0017 {
0018  public:
0019   int m_myminbin = -1;
0020   int m_mymaxbin = -3;
0021 
0022   enum Calo
0023   {
0024     NONE = 0,
0025     CEMC = 1,
0026     HCALIN = 2,
0027     HCALOUT = 3
0028   };
0029 
0030   LiteCaloEval(const std::string &name = "LiteCaloEval", const std::string &caloname = "CEMC", const std::string &filename = "outJF");
0031 
0032   virtual ~LiteCaloEval() = default;
0033 
0034   int InitRun(PHCompositeNode *topNode) override;
0035 
0036   int process_event(PHCompositeNode *topNode) override;
0037 
0038   int End(PHCompositeNode *topNode) override;
0039 
0040   void CaloType(const Calo i)
0041   {
0042     calotype = i;
0043   }
0044 
0045   /// Setters_____________________________________________
0046 
0047   void setFitMax(float fitMax) { fitmax = fitMax; }
0048 
0049   void setFitMin(float fitMin) { fitmin = fitMin; }
0050 
0051   void set_spectra_binWidth(double binWidth) { binwidth = binWidth; }
0052 
0053   void set_mode(int modeset)  // to distinguish when we want to implement input decal (for simulations work)
0054   {
0055     mode = modeset;
0056   }
0057 
0058   void set_reqMinBias(bool status)
0059   {
0060     reqMinBias = status;
0061     return;
0062   }
0063 
0064   void set_doQA(bool status = true)
0065   {
0066     doQA = status;
0067   }
0068 
0069   void setInputTowerNodeName(const std::string &inpNodenm)
0070   {
0071     _inputnodename = inpNodenm;
0072   }
0073 
0074   void set_UseTowerInfo(int setTowerInfo)
0075   {
0076     m_UseTowerInfo = setTowerInfo;
0077   }
0078 
0079   /// Getters________________________________________
0080 
0081   void Get_Histos(const std::string &infile, const std::string &outfile = "");
0082 
0083   float getFitMax() { return fitmax; }
0084 
0085   float getFitMin() { return fitmin; }
0086 
0087   float get_spectra_binWidth() { return binwidth; }
0088 
0089   /// Others__________________________________________
0090 
0091   void FitRelativeShifts(LiteCaloEval *ref_lce, int modeFitShifts);
0092 
0093   static float spec_QA(TH1 *h_spec, TH1 *h_ref, bool retFloat);
0094 
0095   static bool spec_QA(TH1 *h_spec, TH1 *h_ref);
0096 
0097   void plot_cemc(const std::string &path);
0098 
0099   void draw_spectra(const char *);
0100 
0101   void draw_spectra(const char *, const char *);
0102 
0103   void fit_info(const char *, const int);
0104 
0105   void fit_info(const char *, const char *, const int);
0106 
0107   static bool chk_isChimney(int, int);
0108 
0109  private:
0110   TFile *f_temp{nullptr};
0111   TFile *cal_output{nullptr};
0112 
0113   TH1 *hcal_out_eta_phi[24][64] = {};
0114   TH1 *hcalout_eta[25] = {};
0115   TH2 *hcalout_energy_eta{nullptr};
0116   TH3 *hcalout_e_eta_phi = {};
0117 
0118   TH1 *hcal_in_eta_phi[24][64] = {};
0119   TH1 *hcalin_eta[25] = {};
0120   TH2 *hcalin_energy_eta{nullptr};
0121   TH3 *hcalin_e_eta_phi{nullptr};
0122 
0123   TH1 *cemc_hist_eta_phi[96][258] = {};
0124   TH1 *eta_hist[97] = {};
0125   TH2 *energy_eta_hist{nullptr};
0126   TH3 *e_eta_phi{nullptr};
0127 
0128   TH1 *h_event{nullptr};
0129 
0130   Calo calotype{NONE};
0131   int _ievent{0};
0132 
0133   float fitmin{0.};
0134   float fitmax{0.};
0135 
0136   bool doQA{false};
0137 
0138   double binwidth{0.001};
0139 
0140   std::string _caloname;
0141   std::string _filename;
0142   std::string _inputnodename{"TOWERINFO"};
0143 
0144   bool reqMinBias{true};
0145 
0146   int mode{0};
0147 
0148   TriggerAnalyzer *trigAna{nullptr};
0149 
0150   // flag for using tower info
0151   int m_UseTowerInfo{1};
0152 };
0153 
0154 #endif  // LITECALOEVAL_H