File indexing completed on 2025-08-06 08:12:38
0001 vector<string> read_list(string folder_direction, string MC_list_name)
0002 {
0003 vector<string> file_list;
0004 string list_buffer;
0005 ifstream data_list;
0006 data_list.open((folder_direction + "/" + MC_list_name).c_str());
0007
0008 file_list.clear();
0009
0010 while (1)
0011 {
0012 data_list >> list_buffer;
0013 if (!data_list.good())
0014 {
0015 break;
0016 }
0017
0018 if (list_buffer[0] == '#') {continue;}
0019
0020 file_list.push_back(list_buffer);
0021 }
0022 cout<<"size in the" <<MC_list_name<<": "<<file_list.size()<<endl;
0023
0024 return file_list;
0025 }
0026
0027 int CorrectionRange()
0028 {
0029 std::string file_list_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_MDC2_ana472_20250307/Run7/EvtVtxZ/FinalResult_10cm_Pol2BkgFit_DeltaPhi0p026/completed";
0030 std::string file_list_name = "file_list_AccEffiCorr.txt";
0031 std::string h1D_name = "h1D_RotatedBkg_alpha_correction";
0032 std::pair<double, double> range = std::make_pair(-1.1, 1.1);
0033
0034 std::vector<std::string> file_list = read_list(file_list_directory, file_list_name);
0035
0036 TH1D * h1D_AccEffiCorrection = new TH1D("h1D_AccEffiCorrection", "h1D_AccEffiCorrection", 100, 0.7, 1.3);
0037
0038 for (int i = 0; i < file_list.size(); i++)
0039 {
0040 TFile * file_in = TFile::Open(file_list[i].c_str());
0041 TH1D * h1D = (TH1D*)file_in->Get(h1D_name.c_str());
0042
0043 std::cout << "Processing " << file_list[i] << std::endl;
0044
0045 for (int bin_i = 0; bin_i < h1D->GetNbinsX(); bin_i++)
0046 {
0047 double bin_content = h1D->GetBinContent(bin_i + 1);
0048 double bin_center = h1D->GetBinCenter(bin_i + 1);
0049
0050 if (bin_center < range.first || bin_center > range.second) {continue;}
0051
0052 h1D_AccEffiCorrection->Fill(bin_content);
0053
0054 std::cout<<bin_center<<" "<<bin_content<<std::endl;
0055
0056 }
0057
0058 std::cout<<std::endl;
0059
0060 }
0061
0062 h1D_AccEffiCorrection -> Draw("hist");
0063
0064
0065 return 0;
0066
0067 }