Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-09 08:12:13

0001 TH2D * GetHist(std::string directory, std::string file_name, std::string hist_name)
0002 {
0003     TFile * file = new TFile(Form("%s/%s", directory.c_str(), file_name.c_str()), "READ");
0004     TH2D * hist = (TH2D*)file->Get(hist_name.c_str());
0005 
0006     return hist;
0007 }
0008 
0009 int MulMap_comp()
0010 {
0011     // std::string black_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_ananew_20250131/Run6_EvtZFitWidthChange/EvtVtxZ/ColumnCheck/baseline/completed/MulMap/completed";
0012     // std::string black_file_name = "MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc35PhiSize40_00054280.root";
0013     // std::string black_hist_name = "h2D_MulMap";
0014     // std::string black_str = "Old";
0015 
0016     std::string black_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_strangeness_MDC2_ana472_20250310/Run7/EvtVtxZ/ColumnCheck/baseline/completed/MulMap/completed";
0017     std::string black_file_name = "MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc35PhiSize40_00054280.root";
0018     std::string black_hist_name = "h2D_MulMap";
0019     std::string black_str = "HIJING_strange_official";
0020 
0021     std::string red_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_MDC2_ana472_20250307/Run7/EvtVtxZ/ColumnCheck/baseline/completed/MulMap/completed";
0022     std::string red_file_name = "MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc35PhiSize40_00054280.root";
0023     std::string red_hist_name = "h2D_MulMap";
0024     std::string red_str = "official_HIJING";
0025 
0026     std::string output_directory = black_directory;
0027     // std::string output_filename = "comp_h2D_MulMap.root";
0028     std::string output_filename_pdf = "comp_h2D_MulMap"; 
0029 
0030     bool DoNormalize = false;
0031     bool set_log_y = false;
0032 
0033     // TFile * file_out = new TFile(Form("%s/%s", output_directory.c_str(), output_filename.c_str()), "RECREATE");
0034 
0035     TH2D * black_hist = GetHist(black_directory, black_file_name, black_hist_name);
0036     TH2D * red_hist = GetHist(red_directory, red_file_name, red_hist_name);
0037 
0038 
0039     for (int i = 1; i <= black_hist->GetNbinsX(); i++)
0040     {
0041         for (int j = 1; j <= black_hist->GetNbinsY(); j++)
0042         {
0043             double black_content = black_hist->GetBinContent(i, j);
0044             double red_content = red_hist->GetBinContent(i, j);
0045 
0046             if (black_content != red_content)
0047             {
0048                 std::cout << "i = " << i << ", j = " << j <<", center: "<< black_hist->GetXaxis()->GetBinCenter(i) << ", " << black_hist->GetYaxis()->GetBinCenter(j)
0049                 << ", black = " << black_content << ", red = " << red_content << std::endl;
0050             }
0051         }
0052     }
0053 
0054     return 888;
0055 }
0056 
0057 
0058 int MulMap_comp_check()
0059 {
0060     std::string common_folder = "/Run7/EvtVtxZ/ColumnCheck/baseline/noAdcCut/MulMap/completed";
0061     std::string black_file_name = "MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc0PhiSize40_00054280.root";
0062 
0063     std::string black_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_strangeness_MDC2_ana472_20250310" + common_folder;
0064     std::string black_hist_name = "h2D_MulMap";
0065     std::string black_str = "Official_HIJING_strange";
0066 
0067     std::string red_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_MDC2_ana472_20250307" + common_folder;
0068     std::string red_file_name = black_file_name;
0069     std::string red_hist_name = "h2D_MulMap";
0070     std::string red_str = "New_HIJING_MDC2_ana472_20250307";
0071 
0072     std::string output_directory = black_directory;
0073     // std::string output_filename = "comp_h2D_MulMap.root";
0074     std::string output_filename_pdf = "comp_h2D_MulMap"; 
0075 
0076     bool DoNormalize = false;
0077     bool set_log_y = false;
0078 
0079     // TFile * file_out = new TFile(Form("%s/%s", output_directory.c_str(), output_filename.c_str()), "RECREATE");
0080 
0081     TH2D * black_hist = GetHist(black_directory, black_file_name, black_hist_name);
0082     TH2D * red_hist = GetHist(red_directory, red_file_name, red_hist_name);
0083 
0084 
0085     for (int i = 1; i <= black_hist->GetNbinsX(); i++)
0086     {
0087         for (int j = 1; j <= black_hist->GetNbinsY(); j++)
0088         {
0089             double black_content = black_hist->GetBinContent(i, j);
0090             double red_content = red_hist->GetBinContent(i, j);
0091 
0092             if (black_content != red_content)
0093             {
0094                 std::cout << "i = " << i << ", j = " << j <<", center: "<< black_hist->GetXaxis()->GetBinCenter(i) << ", " << black_hist->GetYaxis()->GetBinCenter(j)
0095                 << ", black = " << black_content << ", red = " << red_content << std::endl;
0096             }
0097         }
0098     }
0099 
0100     return 888;
0101 }