Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:34

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