File indexing completed on 2025-12-17 09:21:17
0001 #ifndef QA_INTT_INTTMIXUPQA_H
0002 #define QA_INTT_INTTMIXUPQA_H
0003
0004
0005 #include <fun4all/SubsysReco.h>
0006
0007 #include <fstream>
0008 #include <map>
0009 #include <set>
0010
0011 class PHCompositeNode;
0012 class TFile;
0013 class TGraph;
0014 class TH1;
0015 class TH2;
0016
0017 class InttMixupQA : public SubsysReco
0018 {
0019 public:
0020 explicit InttMixupQA(const std::string &name = "InttMixupQA", const int run_num = 0, const int felix_num = 0);
0021
0022 ~InttMixupQA() override = default;
0023
0024 int Init(PHCompositeNode *) override;
0025
0026 int InitRun(PHCompositeNode *) override;
0027
0028
0029 int process_event(PHCompositeNode *) override;
0030
0031 int End(PHCompositeNode *) override;
0032
0033 int SetOutputDir(std::string const &dir);
0034
0035 void SetBcoPeakFileDir(std::string const &path) { bcopeak_dir_ = path; };
0036
0037 void SetHotChanFileDir(std::string const &path) { hotchan_dir_ = path; };
0038
0039 std::string getHistoPrefix() { return "InttMixupQA"; }
0040
0041 private:
0042
0043 int run_num_{0};
0044 int felix_num_{0};
0045 static const int kFelix_num_{8};
0046 static const int kFee_num_{14};
0047 static const int kChip_num_{26};
0048 static const int kChan_num_{128};
0049 static const int kFirst_pid_{3001};
0050 static const int divimul{10};
0051
0052
0053 std::string output_dir_{"./"};
0054 std::string output_basename_{"InttMixupEventQA_run"};
0055 std::string output_root_{"mixup.root"};
0056 std::string output_pdf_{"mixup.pdf"};
0057 std::string output_txt_{"bcopeak.pdf"};
0058 TFile *tf_output_{nullptr};
0059
0060
0061 std::string bcopeak_dir_{"./"};
0062
0063 std::string bcopeak_file[kFelix_num_];
0064 bool force_suffix_{false};
0065 bool is_official_{false};
0066
0067 std::string suffix_;
0068
0069 std::string GetFileSuffix()
0070 {
0071 if (force_suffix_ == false)
0072 {
0073 if (is_official_ == true)
0074 return "_official";
0075 else
0076 return "_special";
0077 }
0078 return suffix_;
0079 };
0080
0081
0082 std::string hotchan_dir_{"./"};
0083 std::string hotchan_file;
0084
0085 std::set<int> bcopar_[kFelix_num_];
0086 std::set<int> otbcopar_[kFelix_num_];
0087 std::map<int, int> hotmap;
0088
0089 int ievent_{0};
0090 int n{kFelix_num_};
0091
0092 int prev_bcofull{0};
0093 uint64_t long_prev_bcofull{0};
0094 int pre_allhit[kFelix_num_]{};
0095
0096 int NmixupEv[kFelix_num_]{};
0097 double mixupfraction[kFelix_num_]{};
0098 double mixupfraction_sum[kFelix_num_]{};
0099
0100 int Nmixup_sum[kFelix_num_]{};
0101 int pre_allhit_sum[kFelix_num_]{};
0102 double Nmixup_ave[kFelix_num_]{};
0103 double pre_allhit_ave[kFelix_num_]{};
0104
0105
0106 double copyfraction[kFelix_num_]{};
0107 double copyfraction_sum[kFelix_num_]{};
0108 int NmixcopyEv[kFelix_num_]{};
0109
0110 double mixupfraction_ave[kFelix_num_]{};
0111 double Mixevent[kFelix_num_]{};
0112 double err[kFelix_num_]{};
0113 double copyfraction_ave[kFelix_num_]{};
0114 double Mixcloevent[kFelix_num_]{};
0115 double thisclone_ave[kFelix_num_]{};
0116
0117 uint64_t first_bcofull{0};
0118
0119 int DEFAULT_BCO_VALUE[kFelix_num_]{};
0120
0121 TGraph *g_evfraction{nullptr};
0122 TGraph *g_cloevfraction{nullptr};
0123 TGraph *g_hitfraction{nullptr};
0124 TGraph *g_copyfraction{nullptr};
0125
0126 std::map<int, int> premap_hit;
0127
0128 TH1 *h_allmulti_[kFelix_num_]{};
0129 TH1 *h_allclone_[kFelix_num_]{};
0130
0131 TH1 *h_mixupmulti[kFelix_num_][divimul]{};
0132 TH1 *h_divmul[kFelix_num_][divimul]{};
0133
0134
0135 TH2 *h_vsprefull_bco[kFelix_num_]{};
0136 TH2 *h_vsfull_bco[kFelix_num_]{};
0137 TH1 *h_prefull_bco[kFelix_num_]{};
0138 TH1 *h_full_bco[kFelix_num_]{};
0139
0140 TH1 *h_prefull_bco_all[kFelix_num_]{};
0141 TH2 *h_vsprefull_bco_all[kFelix_num_]{};
0142 TH1 *h_interval{nullptr};
0143 TH1 *h_mixinterval{nullptr};
0144 TH1 *h_divinter{nullptr};
0145 TH1 *h_bcofull_7{nullptr};
0146 TH1 *h_bco{nullptr};
0147
0148 TH1 *h_mixup[kFelix_num_]{};
0149 TH2 *h_prevsNmix[kFelix_num_]{};
0150 TH1 *h_nocopyhit[kFelix_num_]{};
0151 TH1 *h_copyhit[kFelix_num_]{};
0152 TH1 *h_mixcopy[kFelix_num_]{};
0153 TH2 *h_mixvscopy[kFelix_num_]{};
0154
0155 TFile *tf_bcopeak_[kFelix_num_]{};
0156 TH1 *hbco[kFelix_num_]{};
0157 TH1 *hbco_sub[kFelix_num_]{};
0158 TH2 *h2_bco_felix[kFelix_num_]{};
0159 TH2 *h2_bco_felix_sub[kFelix_num_]{};
0160 TH1 *hbcohist[kFelix_num_]{};
0161 TH1 *hbcohist2[kFelix_num_]{};
0162
0163
0164
0165 TH2 *h_hitfra[kFelix_num_]{};
0166 TH2 *h_bghit[kFelix_num_]{};
0167 TH1 *h_NmixEv{nullptr};
0168 TH1 *h_AllEv{nullptr};
0169
0170 std::ofstream f_felixpeak;
0171 std::ofstream ffraction;
0172 std::ofstream fNhit[kFelix_num_];
0173 std::ofstream f_hotchan;
0174 TFile *fgraph{nullptr};
0175
0176
0177
0178
0179 int bin{8000};
0180 int bin3{100};
0181 uint64_t bit{0xFFFFFFFFFF};
0182 int64_t bin2{10000};
0183
0184
0185
0186 void DrawHists();
0187
0188
0189
0190 void GetBcopeak();
0191
0192 void Readpeak();
0193
0194 void GetBcomyself();
0195
0196 void Hotchancut();
0197 };
0198 #endif