Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include "../PreparedNdEtaClusEach.h"
0002 
0003 R__LOAD_LIBRARY(../libPreparedNdEtaClusEach.so)
0004 
0005 
0006 std::map<std::string, TH1D*> GetAlphaCorrectionH1DMap(std::string alpha_correction_input_directory, std::vector<std::string> map_name_in){
0007   
0008   TFile * file_in = TFile::Open(alpha_correction_input_directory.c_str());
0009   std::map<std::string, TH1D*> h1D_alpha_correction_map; h1D_alpha_correction_map.clear();
0010   
0011   
0012   for (TObject* keyAsObj : *file_in->GetListOfKeys()){
0013     auto key = dynamic_cast<TKey*>(keyAsObj);
0014     std::string hist_name  = key->GetName();
0015     std::string class_name = key->GetClassName();
0016 
0017     if (class_name != "TH1D") {continue;}
0018     if (std::find(map_name_in.begin(), map_name_in.end(), hist_name) == map_name_in.end()) {continue;}
0019 
0020     h1D_alpha_correction_map.insert(
0021       std::make_pair(
0022         hist_name,
0023         (TH1D*)file_in->Get(hist_name.c_str())
0024       )
0025     );
0026   }
0027 
0028   for (auto &pair : h1D_alpha_correction_map){
0029     // pair.second->SetDirectory(0);
0030     std::cout << "alpha correction name : " << pair.first << std::endl;
0031   }
0032 
0033   return h1D_alpha_correction_map;
0034 }
0035 
0036 string Run_PreparedNdEtaClusEach(
0037   int process_id = 1,
0038   int run_num = -1,
0039   string input_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run24NewCode_TrackHist/completed",
0040   string input_filename = "MC_TrackletHistogram_vtxZReweight_INTT_vtxZ_QA_SecondRun_merged_001.root",
0041   string output_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run24NewCode_dNdEta",
0042   
0043   // todo : modify here
0044   std::string output_file_name_suffix = "_SecondRun",
0045 
0046   bool ApplyAlphaCorr = false,
0047   bool isTypeA = false,
0048   std::pair<double,double> cut_INTTvtxZ = {-10, 10},
0049   int SelectedMbin = 70
0050 )
0051 {
0052 
0053   PreparedNdEtaClusEach * PNEE = new PreparedNdEtaClusEach(
0054     process_id,
0055     run_num,
0056     input_directory,
0057     input_filename,
0058     output_directory,
0059 
0060     output_file_name_suffix,
0061 
0062     ApplyAlphaCorr,
0063     isTypeA,
0064     cut_INTTvtxZ,
0065     SelectedMbin
0066   );
0067   
0068   std::string final_output_file_name = PNEE->GetOutputFileName();
0069   system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str(), final_output_file_name.c_str()));  
0070   
0071 
0072   PNEE -> PrepareStacks();
0073   std::cout<<111<<endl;
0074   PNEE -> PreparedNdEtaHist();
0075   std::cout<<222<<endl;
0076   PNEE -> DeriveAlphaCorrection();
0077   std::cout<<333<<endl;
0078   PNEE -> EndRun();
0079 
0080   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0081 
0082 
0083   string dNdEta_file_out = output_directory + "/completed/" + final_output_file_name;
0084 
0085   std::cout<<"dNdEta_file_out: "<<dNdEta_file_out<<std::endl;
0086 
0087 
0088   return dNdEta_file_out;
0089 }
0090 
0091 
0092 string Run_PreparedNdEtaClusEach_ApplyAlphaCorr(
0093   int process_id = 2,
0094   int run_num = -1,
0095   string input_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run24NewCode_TrackHist/completed",
0096   string input_filename = "MC_TrackletHistogram_vtxZReweight_INTT_vtxZ_QA_SecondRun_merged_002.root",
0097   string output_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run24NewCode_dNdEta",
0098   
0099   // todo : modify here
0100   std::string output_file_name_suffix = "_SecondRun", 
0101 
0102   bool ApplyAlphaCorr = true,
0103   bool isTypeA = false,
0104   std::pair<double,double> cut_INTTvtxZ = {-10, 10},
0105   int SelectedMbin = 70,
0106   std::pair<bool, std::pair<double,double>> setEtaRange = {true, {-1.9, 1.9}},
0107 
0108   string alpha_correction_input_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run24NewCode_dNdEta/completed/MC_PreparedNdEtaClusEach_AllSensor_VtxZ10_Mbin70_SecondRun_00001_dNdEta.root"
0109 )
0110 {
0111 
0112   PreparedNdEtaClusEach * PNEE = new PreparedNdEtaClusEach(
0113     process_id,
0114     run_num,
0115     input_directory,
0116     input_filename,
0117     output_directory,
0118 
0119     output_file_name_suffix,
0120 
0121     ApplyAlphaCorr,
0122     isTypeA,
0123     cut_INTTvtxZ,
0124     SelectedMbin
0125   );
0126 
0127   PNEE -> SetAlphaCorrectionH1DMap(
0128     GetAlphaCorrectionH1DMap(
0129       alpha_correction_input_directory,
0130       PNEE->GetAlphaCorrectionNameMap()
0131     )
0132   );
0133 
0134   if (setEtaRange.first) {PNEE -> SetSelectedEtaRange(setEtaRange.second);}
0135 
0136   std::string final_output_file_name = PNEE->GetOutputFileName();
0137   system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str(), final_output_file_name.c_str()));  
0138   
0139 
0140   PNEE -> PrepareStacks();
0141   std::cout<<111<<endl;
0142   PNEE -> PreparedNdEtaHist();
0143   std::cout<<222<<endl;
0144   PNEE -> DeriveAlphaCorrection();
0145   std::cout<<333<<endl;
0146   PNEE -> EndRun();
0147 
0148   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0149 
0150 
0151   string dNdEta_file_out = output_directory + "/completed/" + final_output_file_name;
0152 
0153   std::cout<<"dNdEta_file_out: "<<dNdEta_file_out<<std::endl;
0154 
0155 
0156   return dNdEta_file_out;
0157 }
0158 
0159 
0160 
0161 string Run_PreparedNdEtaClusEach_ApplyAlphaCorr_54280(
0162   int process_id = 0,
0163   int run_num = 54280,
0164   string input_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Dec042024/completed/Run24NewCode_TrackHist/completed",
0165   string input_filename = "Data_TrackletHistogram_BcoFullDiffCut_INTT_vtxZ_QA_SecondRun_00054280_merged.root",
0166   string output_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Dec042024/completed/Run24NewCode_TrackHist/completed/Run24NewCode_dNdEta",
0167   
0168   // todo : modify here
0169   std::string output_file_name_suffix = "_SecondRun", 
0170 
0171   bool ApplyAlphaCorr = true,
0172   bool isTypeA = false,
0173   std::pair<double,double> cut_INTTvtxZ = {-10, 10},
0174   int SelectedMbin = 70,
0175   std::pair<bool, std::pair<double,double>> setEtaRange = {true, {-1.9, 1.9}},
0176 
0177   string alpha_correction_input_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run24NewCode_dNdEta/completed/MC_PreparedNdEtaClusEach_AllSensor_VtxZ10_Mbin70_SecondRun_00001_dNdEta.root"
0178 )
0179 {
0180 
0181   PreparedNdEtaClusEach * PNEE = new PreparedNdEtaClusEach(
0182     process_id,
0183     run_num,
0184     input_directory,
0185     input_filename,
0186     output_directory,
0187 
0188     output_file_name_suffix,
0189 
0190     ApplyAlphaCorr,
0191     isTypeA,
0192     cut_INTTvtxZ,
0193     SelectedMbin
0194   );
0195 
0196   PNEE -> SetAlphaCorrectionH1DMap(
0197     GetAlphaCorrectionH1DMap(
0198       alpha_correction_input_directory,
0199       PNEE->GetAlphaCorrectionNameMap()
0200     )
0201   );
0202 
0203   if (setEtaRange.first) {PNEE -> SetSelectedEtaRange(setEtaRange.second);}
0204 
0205   std::string final_output_file_name = PNEE->GetOutputFileName();
0206   system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str(), final_output_file_name.c_str()));  
0207   
0208 
0209   PNEE -> PrepareStacks();
0210   std::cout<<111<<endl;
0211   PNEE -> PreparedNdEtaHist();
0212   std::cout<<222<<endl;
0213   PNEE -> DeriveAlphaCorrection();
0214   std::cout<<333<<endl;
0215   PNEE -> EndRun();
0216 
0217   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0218 
0219 
0220   string dNdEta_file_out = output_directory + "/completed/" + final_output_file_name;
0221 
0222   std::cout<<"dNdEta_file_out: "<<dNdEta_file_out<<std::endl;
0223 
0224   return dNdEta_file_out;
0225 }
0226 
0227 int DataMcComp(string data_directory_in, string MC_directory_in, string output_directory_in, string output_filename_in)
0228 {
0229     TFile * file_in_data = TFile::Open(data_directory_in.c_str());
0230     TFile * file_in_mc = TFile::Open(MC_directory_in.c_str());
0231 
0232     TH1D * data_h1D_inner_NClusEtaPerEvt        = (TH1D*)file_in_data->Get("h1D_inner_NClusEtaPerEvt");
0233     TH1D * data_h1D_inner_NClusEtaPerEvtPostAC  = (TH1D*)file_in_data->Get("h1D_inner_NClusEtaPerEvtPostAC");
0234     TH1D * data_h1D_outer_NClusEtaPerEvt       = (TH1D*)file_in_data->Get("h1D_outer_NClusEtaPerEvt");
0235     TH1D * data_h1D_outer_NClusEtaPerEvtPostAC = (TH1D*)file_in_data->Get("h1D_outer_NClusEtaPerEvtPostAC");
0236 
0237     data_h1D_inner_NClusEtaPerEvt -> SetMarkerColor(1);
0238     data_h1D_inner_NClusEtaPerEvt -> SetLineColor(1);
0239 
0240     data_h1D_outer_NClusEtaPerEvt -> SetMarkerColor(1);
0241     data_h1D_outer_NClusEtaPerEvt -> SetLineColor(1);
0242 
0243     data_h1D_inner_NClusEtaPerEvtPostAC -> SetMarkerColor(1);
0244     data_h1D_inner_NClusEtaPerEvtPostAC -> SetLineColor(1);
0245 
0246     data_h1D_outer_NClusEtaPerEvtPostAC -> SetMarkerColor(1);
0247     data_h1D_outer_NClusEtaPerEvtPostAC -> SetLineColor(1);
0248 
0249 
0250 
0251     TH1D * MC_h1D_inner_NClusEtaPerEvt = (TH1D*)file_in_mc->Get("h1D_inner_NClusEtaPerEvt");
0252     TH1D * MC_h1D_outer_NClusEtaPerEvt = (TH1D*)file_in_mc->Get("h1D_outer_NClusEtaPerEvt");
0253     TH1D * MC_h1D_inner_NClusEtaPerEvtPostAC = (TH1D*)file_in_mc->Get("h1D_inner_NClusEtaPerEvtPostAC");
0254     TH1D * MC_h1D_outer_NClusEtaPerEvtPostAC = (TH1D*)file_in_mc->Get("h1D_outer_NClusEtaPerEvtPostAC");
0255 
0256     MC_h1D_inner_NClusEtaPerEvt -> SetMarkerColor(2); // note : red
0257     MC_h1D_inner_NClusEtaPerEvt -> SetLineColor(2);
0258 
0259     MC_h1D_outer_NClusEtaPerEvt -> SetMarkerColor(2);
0260     MC_h1D_outer_NClusEtaPerEvt -> SetLineColor(2);
0261 
0262     MC_h1D_inner_NClusEtaPerEvtPostAC -> SetMarkerColor(2);
0263     MC_h1D_inner_NClusEtaPerEvtPostAC -> SetLineColor(2);
0264 
0265     MC_h1D_outer_NClusEtaPerEvtPostAC -> SetMarkerColor(2);
0266     MC_h1D_outer_NClusEtaPerEvtPostAC -> SetLineColor(2);
0267 
0268     
0269 
0270     TH1D * h1D_TruedNdEta = (TH1D*)file_in_mc->Get("h1D_TruedNdEta");
0271     h1D_TruedNdEta -> SetLineColor(3); // note : green 
0272 
0273 
0274     TFile * file_out = new TFile(Form("%s/%s",output_directory_in.c_str(), output_filename_in.c_str()), "RECREATE");
0275     TCanvas * c1 = new TCanvas("c1", "c1", 800, 600);
0276 
0277     c1 -> cd();
0278     data_h1D_inner_NClusEtaPerEvt -> Draw("ep");
0279     MC_h1D_inner_NClusEtaPerEvt -> Draw("hist same");
0280     c1 -> Write("h1D_inner_NClusEtaPerEvt");
0281     c1 -> Clear();
0282 
0283     c1 -> cd();
0284     data_h1D_outer_NClusEtaPerEvt -> Draw("ep");
0285     MC_h1D_outer_NClusEtaPerEvt -> Draw("hist same");
0286     c1 -> Write("h1D_outer_NClusEtaPerEvt");
0287     c1 -> Clear();
0288 
0289     c1 -> cd();
0290     data_h1D_inner_NClusEtaPerEvtPostAC -> Draw("ep");
0291     MC_h1D_inner_NClusEtaPerEvtPostAC -> Draw("hist same");
0292     h1D_TruedNdEta -> SetFillColorAlpha(2,0);
0293     h1D_TruedNdEta -> Draw("hist same");
0294     c1 -> Write("h1D_inner_NClusEtaPerEvtPostAC");
0295     c1 -> Clear();
0296 
0297     c1 -> cd();
0298     data_h1D_outer_NClusEtaPerEvtPostAC -> Draw("ep");
0299     MC_h1D_outer_NClusEtaPerEvtPostAC -> Draw("hist same");
0300     h1D_TruedNdEta -> Draw("hist same");
0301     c1 -> Write("h1D_outer_NClusEtaPerEvtPostAC");
0302     c1 -> Clear();
0303 
0304     file_out -> Close();
0305 
0306     
0307 
0308     return 0;
0309 }
0310 
0311 int McMcComp(string MC1_directory_in, string MC2_directory_in, string output_directory_in, string output_filename_in)
0312 {
0313     TFile * file_in_data = TFile::Open(MC1_directory_in.c_str());
0314     TFile * file_in_mc = TFile::Open(MC2_directory_in.c_str());
0315 
0316     TH1D * data_h1D_inner_NClusEtaPerEvt = (TH1D*)file_in_data->Get("h1D_inner_NClusEtaPerEvt");
0317     TH1D * data_h1D_outer_NClusEtaPerEvt = (TH1D*)file_in_data->Get("h1D_outer_NClusEtaPerEvt");
0318     TH1D * data_h1D_inner_NClusEtaPerEvtPostAC = (TH1D*)file_in_data->Get("h1D_inner_NClusEtaPerEvtPostAC");
0319     TH1D * data_h1D_outer_NClusEtaPerEvtPostAC = (TH1D*)file_in_data->Get("h1D_outer_NClusEtaPerEvtPostAC");
0320 
0321     data_h1D_inner_NClusEtaPerEvt -> SetMarkerColor(1);
0322     data_h1D_inner_NClusEtaPerEvt -> SetLineColor(1);
0323 
0324     data_h1D_outer_NClusEtaPerEvt -> SetMarkerColor(1);
0325     data_h1D_outer_NClusEtaPerEvt -> SetLineColor(1);
0326 
0327     data_h1D_inner_NClusEtaPerEvtPostAC -> SetMarkerColor(1);
0328     data_h1D_inner_NClusEtaPerEvtPostAC -> SetLineColor(1);
0329 
0330     data_h1D_outer_NClusEtaPerEvtPostAC -> SetMarkerColor(1);
0331     data_h1D_outer_NClusEtaPerEvtPostAC -> SetLineColor(1);
0332 
0333     TH1D * data_h1D_TruedNdEta = (TH1D*)file_in_data->Get("h1D_TruedNdEta");
0334     data_h1D_TruedNdEta -> SetFillColorAlpha(1,0);
0335     data_h1D_TruedNdEta -> SetLineColor(4); // note : blue
0336 
0337 
0338 
0339     TH1D * MC_h1D_inner_NClusEtaPerEvt = (TH1D*)file_in_mc->Get("h1D_inner_NClusEtaPerEvt");
0340     TH1D * MC_h1D_outer_NClusEtaPerEvt = (TH1D*)file_in_mc->Get("h1D_outer_NClusEtaPerEvt");
0341     TH1D * MC_h1D_inner_NClusEtaPerEvtPostAC = (TH1D*)file_in_mc->Get("h1D_inner_NClusEtaPerEvtPostAC");
0342     TH1D * MC_h1D_outer_NClusEtaPerEvtPostAC = (TH1D*)file_in_mc->Get("h1D_outer_NClusEtaPerEvtPostAC");
0343 
0344     MC_h1D_inner_NClusEtaPerEvt -> SetMarkerColor(2);
0345     MC_h1D_inner_NClusEtaPerEvt -> SetLineColor(2);
0346 
0347     MC_h1D_outer_NClusEtaPerEvt -> SetMarkerColor(2);
0348     MC_h1D_outer_NClusEtaPerEvt -> SetLineColor(2);
0349 
0350     MC_h1D_inner_NClusEtaPerEvtPostAC -> SetMarkerColor(2);
0351     MC_h1D_inner_NClusEtaPerEvtPostAC -> SetLineColor(2);
0352 
0353     MC_h1D_outer_NClusEtaPerEvtPostAC -> SetMarkerColor(2);
0354     MC_h1D_outer_NClusEtaPerEvtPostAC -> SetLineColor(2);
0355 
0356     
0357 
0358     TH1D * MC_h1D_TruedNdEta = (TH1D*)file_in_mc->Get("h1D_TruedNdEta");
0359     MC_h1D_TruedNdEta -> SetFillColorAlpha(2,0);
0360     MC_h1D_TruedNdEta -> SetLineColor(3); // note : green
0361 
0362 
0363     TFile * file_out = new TFile((output_directory_in+"/"+output_filename_in).c_str(), "RECREATE");
0364     TCanvas * c1 = new TCanvas("c1", "c1", 800, 600);
0365 
0366     c1 -> cd();
0367     data_h1D_inner_NClusEtaPerEvt -> Draw("ep");
0368     MC_h1D_inner_NClusEtaPerEvt -> Draw("hist same");
0369     c1 -> Write("h1D_inner_NClusEtaPerEvt");
0370     c1 -> Clear();
0371 
0372     c1 -> cd();
0373     data_h1D_outer_NClusEtaPerEvt -> Draw("ep");
0374     MC_h1D_outer_NClusEtaPerEvt -> Draw("hist same");
0375     c1 -> Write("h1D_outer_NClusEtaPerEvt");
0376     c1 -> Clear();
0377 
0378     c1 -> cd();
0379     data_h1D_inner_NClusEtaPerEvtPostAC -> Draw("ep");
0380     MC_h1D_inner_NClusEtaPerEvtPostAC -> Draw("hist same");
0381     MC_h1D_TruedNdEta -> Draw("hist same");
0382     data_h1D_TruedNdEta -> Draw("hist same");
0383     c1 -> Write("h1D_inner_NClusEtaPerEvtPostAC");
0384     c1 -> Clear();
0385 
0386     c1 -> cd();
0387     data_h1D_outer_NClusEtaPerEvtPostAC -> Draw("ep");
0388     MC_h1D_outer_NClusEtaPerEvtPostAC -> Draw("hist same");
0389     MC_h1D_TruedNdEta -> Draw("hist same");
0390     data_h1D_TruedNdEta -> Draw("hist same");
0391     c1 -> Write("h1D_outer_NClusEtaPerEvtPostAC");
0392     c1 -> Clear();
0393 
0394     c1 -> cd();
0395     MC_h1D_TruedNdEta -> Draw("hist");
0396     data_h1D_TruedNdEta -> Draw("ep same");
0397     c1 -> Write("h1D_TruedNdEta");
0398     c1 -> Clear();
0399 
0400     file_out -> Close();
0401 
0402     
0403 
0404     return 0;
0405 }
0406 
0407 int CombinedMacro()
0408 {   
0409     // note : for all common
0410     std::string output_file_name_suffix = ""; 
0411 
0412     std::pair<bool, int> isMCWithNoiseHit = {false, 0};
0413     bool isTypeA = false;
0414     std::pair<double,double> cut_INTTvtxZ = {-10, 10};
0415     int SelectedMbin = 70;
0416     std::pair<double,double> cut_EtaRange = {-1.9, 1.9};
0417     
0418     string output_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Dec042024/completed/Run3/EvtVtxZ/completed/ClusHist_WithClusQA/completed";
0419     string output_suffix = "dNdEta";
0420     
0421     
0422     output_suffix += (isTypeA) ? "_TypeA" : "_AllSensor";
0423     output_suffix += Form("_VtxZ%d_Mbin%d", (int)cut_INTTvtxZ.second, SelectedMbin);
0424     output_suffix += (isMCWithNoiseHit.first) ? Form("_Noise%dHit", isMCWithNoiseHit.second) : "";
0425     string final_output_directory = output_directory + "/" + output_suffix;
0426     
0427     // string alpha_correction_input_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run24NewCode_dNdEta/completed/MC_PreparedNdEtaClusEach_AllSensor_VtxZ10_Mbin70_SecondRun_00001_dNdEta.root";    
0428     
0429     // note : MC common
0430     string MC_input_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_Ntuple_HIJING_ana443_20241102/Run3/EvtVtxZ/completed/ClusHist_WithClusQA/completed";
0431     string MC_output_directory = final_output_directory;
0432 
0433     // note : MC1 deriving the alpha corrections
0434     string MC1_input_filename = "MC_ClusHist_vtxZReweight_VtxZQA_ClusQAAdc35PhiSize500_merged_001.root";
0435     int    MC1_process_id = 1;
0436     int    MC1_run_num = -1;
0437     bool   MC1_ApplyAlphaCorr = false;
0438     std::pair<bool, std::pair<double,double>> MC1_setEtaRange = {false, cut_EtaRange};
0439 
0440     // note : MC2 applying the alpha corrections
0441     string MC2_input_filename = "MC_ClusHist_vtxZReweight_VtxZQA_ClusQAAdc35PhiSize500_merged_002.root";
0442     int    MC2_process_id = 2;
0443     int    MC2_run_num = -1;
0444     bool   MC2_ApplyAlphaCorr = true;
0445     std::pair<bool, std::pair<double,double>> MC2_setEtaRange = {true, cut_EtaRange};
0446     
0447     // note : for data
0448     string data_input_directory  = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Dec042024/completed/Run3/EvtVtxZ/completed/ClusHist_WithClusQA/completed";
0449     string data_input_filename   = "Data_ClusHist_BcoFullDiffCut_VtxZQA_ClusQAAdc35PhiSize500_00054280_merged.root";
0450     string data_output_directory = final_output_directory;
0451     int    data_process_id = 0;
0452     int    data_run_num = 54280;
0453     bool   data_ApplyAlphaCorr = true;
0454     std::pair<bool, std::pair<double,double>> data_setEtaRange = {true, cut_EtaRange};
0455 
0456     system(Form("if [ ! -d %s/completed ]; then mkdir -p %s/completed; fi;", final_output_directory.c_str(), final_output_directory.c_str()));
0457 
0458     string MC1_dNdeta_file = Run_PreparedNdEtaClusEach(
0459         MC1_process_id,
0460         MC1_run_num,
0461         MC_input_directory,
0462         MC1_input_filename,
0463         MC_output_directory,
0464 
0465         output_file_name_suffix,
0466 
0467         MC1_ApplyAlphaCorr,
0468         isTypeA,
0469         cut_INTTvtxZ,
0470         SelectedMbin
0471     );
0472 
0473     string alpha_correction_input_directory = MC1_dNdeta_file;
0474 
0475 
0476     string MC2_dNdeta_file = Run_PreparedNdEtaClusEach_ApplyAlphaCorr(
0477         MC2_process_id,
0478         MC2_run_num,
0479         MC_input_directory,
0480         MC2_input_filename,
0481         MC_output_directory,
0482 
0483         output_file_name_suffix,
0484 
0485         MC2_ApplyAlphaCorr,
0486         isTypeA,
0487         cut_INTTvtxZ,
0488         SelectedMbin,
0489         MC2_setEtaRange,
0490 
0491         alpha_correction_input_directory
0492     );
0493 
0494 
0495     string data_dNdeta_file = Run_PreparedNdEtaClusEach_ApplyAlphaCorr_54280(
0496         data_process_id,
0497         data_run_num,
0498         data_input_directory,
0499         data_input_filename,
0500         data_output_directory,
0501 
0502         output_file_name_suffix,
0503 
0504         data_ApplyAlphaCorr,
0505         isTypeA,
0506         cut_INTTvtxZ,
0507         SelectedMbin,
0508         data_setEtaRange,
0509 
0510         alpha_correction_input_directory
0511     );
0512 
0513     DataMcComp(data_dNdeta_file, MC1_dNdeta_file, final_output_directory, "DataMc1Comp.root");
0514     DataMcComp(data_dNdeta_file, MC2_dNdeta_file, final_output_directory, "DataMc2Comp.root");
0515     McMcComp(MC1_dNdeta_file, MC2_dNdeta_file, final_output_directory, "McMcComp.root");
0516     
0517 
0518     return 0;
0519 }