Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-10 08:12:56

0001 #include "../vtxZDist.h"
0002 
0003 R__LOAD_LIBRARY(../libvtxZDist.so)
0004 
0005 void Run_vtxZDist(
0006   int process_id = 0,
0007   int run_num = 54280,
0008   int nevents = -1,
0009   string input_directory = "/sphenix/user/ChengWei/INTT/INTT/general_codes/CWShih/INTTBcoResolution/macro",
0010   string input_filename = "file_list_54280_intt.txt",
0011   string output_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280/completed/BCO_check",
0012   
0013   // todo : modify here
0014   std::string output_file_name_suffix = "", // note : for data
0015   // std::string output_file_name_suffix = "_TrueXY", // note : for MC
0016 
0017 
0018   bool Apply_cut = false, // note: vtxZQA cut, don't touch
0019   bool ApplyVtxZReWeighting = false, // note : don't touch, regardless data or MC
0020   std::pair<bool, int> ApplyEvtBcoFullDiffCut = {true, 61}, // note : don't touch, regardless data or MC
0021 
0022   bool IsVtxZQACutKnown = true
0023 )
0024 {
0025 
0026   vtxZDist * VZD1 = new vtxZDist(
0027     process_id,
0028     run_num,
0029     nevents,
0030     input_directory,
0031     input_filename,
0032     output_directory,
0033 
0034     output_file_name_suffix,
0035 
0036     Apply_cut,
0037     ApplyVtxZReWeighting,
0038     ApplyEvtBcoFullDiffCut
0039   );
0040 
0041   string final_output_file_name1 = VZD1->GetOutputFileName();
0042   cout<<"final_output_file_name1: "<<final_output_file_name1<<endl;
0043 
0044   system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", output_directory.c_str(), final_output_file_name1.c_str(), output_directory.c_str(), final_output_file_name1.c_str()));  
0045 
0046   VZD1->PrepareEvent();
0047   VZD1->EndRun();
0048 
0049 
0050   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name1.c_str(), output_directory.c_str()));
0051 
0052   if (IsVtxZQACutKnown && Apply_cut == false)
0053   {
0054     vtxZDist * VZD2 = new vtxZDist(
0055       process_id,
0056       run_num,
0057       nevents,
0058       input_directory,
0059       input_filename,
0060       output_directory,
0061 
0062       output_file_name_suffix,
0063 
0064       true, // note : vtxZ QA
0065       ApplyVtxZReWeighting,
0066       ApplyEvtBcoFullDiffCut
0067     );
0068 
0069     string final_output_file_name2 = VZD2->GetOutputFileName();
0070     cout<<"final_output_file_name2: "<<final_output_file_name2<<endl;
0071 
0072     system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", output_directory.c_str(), final_output_file_name2.c_str(), output_directory.c_str(), final_output_file_name2.c_str()));  
0073 
0074     VZD2->PrepareEvent();
0075     VZD2->EndRun();
0076 
0077 
0078     system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name2.c_str(), output_directory.c_str()));
0079   }
0080 
0081   return;
0082 }