Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 int CodeCheck()
0002 {
0003     std::string input_directory_1 = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Feb102025/Run6_EvtZFitWidthChange/EvtVtxZ/ColumnCheck_INTTz/baseline/completed";
0004     std::string input_filename_1 = "Data_ColumnCheck_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc35PhiSize40_00054280_merged.root";
0005     std::string input_hist_1 = "h2D_ClusCountPhiIdZId_Layer";
0006 
0007     std::string input_directory_2 = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Feb102025/Run6_EvtZFitWidthChange/EvtVtxZ/ColumnCheck/baseline/completed"; 
0008     std::string input_filename_2 = "Data_ColumnCheck_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc35PhiSize40_00054280_merged_merged.root";
0009     std::string input_hist_2 = "h2D_ClusCountPhiIdZId_Layer";
0010 
0011     std::string output_directory;
0012     std::string output_filename;
0013 
0014     TFile * f1 = TFile::Open(Form("%s/%s", input_directory_1.c_str(), input_filename_1.c_str()));
0015     TFile * f2 = TFile::Open(Form("%s/%s", input_directory_2.c_str(), input_filename_2.c_str()));
0016 
0017     for (int i = 0; i < 4; i++)
0018     {
0019         TH2D * h1 = (TH2D *)f1->Get(Form("%s%d", input_hist_1.c_str(), i+3));
0020         TH2D * h2 = (TH2D *)f2->Get(Form("%s%d", input_hist_2.c_str(), i+3));
0021 
0022         for (int xi = 1; xi <= h1->GetNbinsX(); xi++)
0023         {
0024             for (int yi = 1; yi <= h1->GetNbinsY(); yi++)
0025             {
0026                 double diff = h1->GetBinContent(xi, yi) - h2->GetBinContent(xi, yi);
0027                 double diff_percent = diff / h1->GetBinContent(xi, yi);
0028 
0029                 if (h1->GetBinContent(xi, yi) != h2->GetBinContent(xi, yi))
0030                 {
0031                     if (fabs(diff_percent) > 0.0001){
0032                         cout<<"Different at "<<xi<<" "<<yi<<", h1: "<<h1->GetBinContent(xi, yi)<<", h2: "<<h2->GetBinContent(xi, yi)<<", Diff: "<<h1->GetBinContent(xi, yi) - h2->GetBinContent(xi, yi)<<endl;
0033                     }
0034                 }
0035             }
0036         }
0037 
0038         std::cout<<std::endl;
0039     }
0040 
0041     return 888;
0042 }