Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include "../RestDist.h"
0002 
0003 R__LOAD_LIBRARY(../libRestDist.so)
0004 
0005 void Run_RestDist(
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 = "",
0015   std::pair<double, double> vertexXYIncm = {-0.0220728, 0.222956},
0016 
0017   bool Apply_cut = true, // note : vtxZQA
0018   bool ApplyVtxZReWeighting = false,
0019   std::pair<bool, int> ApplyEvtBcoFullDiffCut = {true, 61},
0020   std::pair<bool, std::pair<double,double>> RequireVtxZRange = {true, {-10, 10}},
0021   std::pair<bool, std::pair<double,double>> isClusQA = {true, {35, 40}}, // note : adc, phi size
0022   bool isRotated = true
0023 )
0024 {
0025 
0026   string final_output_file_name;
0027   // Division : ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0028 
0029   // note : with vtxZ range cut, and no ClusQA, no inner rotated
0030   RestDist * RDs1 = new RestDist(
0031     process_id,
0032     run_num,
0033     nevents,
0034     input_directory,
0035     input_filename,
0036     output_directory,
0037 
0038     output_file_name_suffix,
0039     vertexXYIncm,
0040 
0041     Apply_cut,
0042     ApplyVtxZReWeighting,
0043     ApplyEvtBcoFullDiffCut,
0044     
0045     RequireVtxZRange,
0046     {false,{-10,20000}},
0047     false //note: isRotated
0048   );
0049 
0050   final_output_file_name = RDs1->GetOutputFileName();
0051   cout<<"final_output_file_name: "<<final_output_file_name<<endl;
0052 
0053   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()));  
0054 
0055   RDs1->PrepareEvent();
0056   RDs1->EndRun();
0057 
0058 
0059   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0060 
0061   // Division : ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0062 
0063   // note : with vtxZ range cut, and w/ ClusQA, no inner rotated
0064   RestDist * RDs2 = new RestDist(
0065     process_id,
0066     run_num,
0067     nevents,
0068     input_directory,
0069     input_filename,
0070     output_directory,
0071 
0072     output_file_name_suffix,
0073     vertexXYIncm,
0074 
0075     Apply_cut,
0076     ApplyVtxZReWeighting,
0077     ApplyEvtBcoFullDiffCut,
0078     
0079     RequireVtxZRange,
0080     isClusQA,
0081     false //note: isRotated
0082   );
0083 
0084   final_output_file_name = RDs2->GetOutputFileName();
0085   cout<<"final_output_file_name: "<<final_output_file_name<<endl;
0086 
0087   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()));  
0088 
0089   RDs2->PrepareEvent();
0090   RDs2->EndRun();
0091 
0092 
0093   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0094 
0095 
0096   // Division : ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0097   // note : No vtxZ cut, No ClusQA, no inner rotated
0098   RestDist * RDs3 = new RestDist(
0099     process_id,
0100     run_num,
0101     nevents,
0102     input_directory,
0103     input_filename,
0104     output_directory,
0105 
0106     output_file_name_suffix,
0107     vertexXYIncm,
0108 
0109     Apply_cut,
0110     ApplyVtxZReWeighting,
0111     ApplyEvtBcoFullDiffCut,
0112     
0113     {false, {-1000,1000}},
0114     {false,{-10,20000}},
0115     false //note: isRotated
0116   );
0117 
0118   final_output_file_name = RDs3->GetOutputFileName();
0119   cout<<"final_output_file_name: "<<final_output_file_name<<endl;
0120 
0121   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()));  
0122 
0123   RDs3->PrepareEvent();
0124   RDs3->EndRun();
0125 
0126 
0127   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0128 
0129   // Division : ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0130 
0131   // note : with vtxZ range cut, and w/ ClusQA, with inner rotated
0132   RestDist * RDs4 = new RestDist(
0133     process_id,
0134     run_num,
0135     nevents,
0136     input_directory,
0137     input_filename,
0138     output_directory,
0139 
0140     output_file_name_suffix,
0141     vertexXYIncm,
0142 
0143     Apply_cut,
0144     ApplyVtxZReWeighting,
0145     ApplyEvtBcoFullDiffCut,
0146     
0147     RequireVtxZRange,
0148     isClusQA,
0149     isRotated //note: isRotated
0150   );
0151 
0152   // RDs4 -> SetInnerBarrelRotation(25.); // todo: 
0153 
0154   final_output_file_name = RDs4->GetOutputFileName();
0155   cout<<"final_output_file_name: "<<final_output_file_name<<endl;
0156 
0157   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()));  
0158 
0159   RDs4->PrepareEvent();
0160   RDs4->EndRun();
0161 
0162 
0163   system(Form("mv %s/%s %s/completed", output_directory.c_str(), final_output_file_name.c_str(), output_directory.c_str()));
0164 
0165   return;
0166 }