File indexing completed on 2025-08-05 08:15:33
0001
0002
0003 #ifndef HCALCOSMICS_H
0004 #define HCALCOSMICS_H
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <string>
0009
0010
0011 class PHCompositeNode;
0012 class TFile;
0013 class TF1;
0014 class TH1;
0015 class TH2;
0016
0017 class HCalCosmics : public SubsysReco
0018 {
0019 public:
0020
0021 HCalCosmics(const std::string &, const std::string &);
0022
0023 ~HCalCosmics() override = default;
0024
0025
0026 int Init(PHCompositeNode *) override;
0027 int process_event(PHCompositeNode *) override;
0028 int process_towers(PHCompositeNode *);
0029 int End(PHCompositeNode *) override;
0030
0031 void set_tower_threshold(float fac) { tower_threshold = fac; }
0032 void set_vert_threshold(float fac) { vert_threshold = fac; }
0033 void set_veto_threshold(float fac) { veto_threshold = fac; }
0034
0035 void set_adc_tower_threshold(float fac) { adc_tower_threshold = fac; }
0036 void set_adc_vert_threshold(float fac) { adc_vert_threshold = fac; }
0037 void set_adc_veto_threshold(float fac) { adc_veto_threshold = fac; }
0038
0039 void HistBinWidth(double fac) { bin_width = fac; }
0040 void Detector(const std::string &name) { detector = name; }
0041 void TowerPrefix(const std::string &name) { prefix = name; }
0042
0043 void RawHistBinWidth(double fac) { rawbin_width = fac; }
0044 void RawDetector(const std::string &name) { rawdetector = name; }
0045 void RawTowerPrefix(const std::string &name) { rawprefix = name; }
0046
0047 static double gamma_function(const double *x, const double *par);
0048 void fitChannels(const std::string &infile, const std::string &outfilename2);
0049 static TF1 *fitHist(TH1 *);
0050
0051 private:
0052
0053 static const int n_etabin{24};
0054 static const int n_phibin{64};
0055
0056 TFile *outfile{nullptr};
0057 TH1 *h_channel_hist[n_etabin][n_phibin]{{nullptr}};
0058 TH1 *h_adc_hist[n_etabin][n_phibin]{{nullptr}};
0059 TH1 *h_adc_ecut_hist[n_etabin][n_phibin]{{nullptr}};
0060 TH1 *h_gain_hist[n_etabin][n_phibin]{{nullptr}};
0061 TH2 *h_waveformchi2{nullptr};
0062 TH2 *h_waveformchi2_aftercut{nullptr};
0063 TH1 *h_towertime_hist[n_etabin][n_phibin]{{nullptr}};
0064 TH2 *h_time_energy{nullptr};
0065 TH1 *h_mip{nullptr};
0066 TH1 *h_adc{nullptr};
0067 TH1 *h_adc_ecut{nullptr};
0068 TH1 *h_gain{nullptr};
0069 TH1 *h_event{nullptr};
0070
0071
0072 float tower_threshold{0.2498};
0073 float vert_threshold{0.2498};
0074 float veto_threshold{0.17486};
0075
0076 float adc_tower_threshold{500};
0077 float adc_vert_threshold{500};
0078 float adc_veto_threshold{350};
0079
0080 int event{0};
0081
0082 float bin_width{0.01};
0083 float rawbin_width{1};
0084
0085 float m_peak[n_etabin][n_phibin]{};
0086 float m_adc[n_etabin][n_phibin]{};
0087 float m_chi2[n_etabin][n_phibin]{};
0088 float m_time[n_etabin][n_phibin]{};
0089
0090
0091
0092 std::string prefix{"TOWERINFO_CALIB_"};
0093 std::string detector{"HCALOUT"};
0094
0095 std::string rawprefix{"TOWERS_"};
0096 std::string rawdetector{"HCALOUT"};
0097
0098 std::string outfilename;
0099 };
0100
0101 #endif