Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:12:36

0001 #include "../AvgVtxXY/AvgVtxXY.h"
0002 #include "../EvtVtxZTracklet/EvtVtxZProtoTracklet.h"
0003 #include "../TrackletHistogram/TrackletHistogramNew.h"
0004 #include "../PreparedNdEta/PreparedNdEtaEach.h"
0005 
0006 R__LOAD_LIBRARY(../AvgVtxXY/libavgvtxxy.so)
0007 R__LOAD_LIBRARY(../EvtVtxZTracklet/libEvtVtxZProtoTracklet.so)
0008 R__LOAD_LIBRARY(../TrackletHistogram/libTrackletHistogramNew.so)
0009 R__LOAD_LIBRARY(../PreparedNdEta/libPreparedNdEtaEach.so)
0010 
0011 int Run_GeoOffset_Half(
0012     int process_id = 0,
0013     int run_num = -1,
0014     int nevents = -1,
0015     string input_directory = "/sphenix/user/ChengWei/INTT/INTT/general_codes/CWShih/INTTBcoResolution/macro", // note : 
0016     string input_filename = "file_list_54280_intt.txt", // note : the ntuple
0017     string output_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280/completed/BCO_check",
0018     
0019     // todo : modify here
0020     std::string output_file_name_suffix = "_test1"
0021     std::string AvgVtxXY_input_filename = "AvgVtxXY_GeoOffset_test1",
0022 )
0023 {   
0024 
0025     std::string job_index = std::to_string( process_id );
0026     int job_index_len = 5;
0027     job_index.insert(0, job_index_len - job_index.size(), '0');
0028 
0029     TFile * file_in_geo = TFile::Open(Form("%s/%s_%s.root", input_directory.c_str(), AvgVtxXY_input_filename.c_str(), job_index.c_str()));
0030     
0031 
0032 
0033     // Division : --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0034 
0035     std::pair<bool, TH1D*> Track_vtxZReweight = {false, nullptr};
0036     bool Track_BcoFullDiffCut = false;
0037     bool Track_INTT_vtxZ_QA = true;
0038     std::pair<bool, std::pair<double, double>> Track_isClusQA = {true, {35, 500}}; // note : {adc, phi size}
0039     bool Track_HaveGeoOffsetTag = true;
0040     std::pair<bool, int> Track_SetRandomHits = {false, 0};
0041     bool Track_RandInttZ = false;
0042 
0043     TrackletHistogramNew * THN = new TrackletHistogramNew(
0044         process_id, 
0045         run_num,
0046         nevents,
0047         final_output_directory,
0048         evtVtxZ_output_filename,
0049         final_output_directory,
0050 
0051         output_file_name_suffix,
0052         vertexXYIncm,
0053 
0054         Track_vtxZReweight,
0055         Track_BcoFullDiffCut,
0056         Track_INTT_vtxZ_QA,
0057         Track_isClusQA,
0058         Track_HaveGeoOffsetTag,
0059         Track_SetRandomHits,
0060         Track_RandInttZ
0061     );
0062 
0063     std::string Track_output_filename = THN->GetOutputFileName();
0064     cout<<"Track: final_output_file_name: "<<Track_output_filename<<endl;
0065 
0066     THN -> SetGeoOffset(GeoOffset_map);
0067     THN -> MainProcess();
0068 
0069     std::cout<<"test test: closing in TrackletHistogramNew "<<std::endl;
0070     THN -> EndRun();
0071 
0072     std::cout<<"test test: done with TrackletHistogramNew"<<std::endl;
0073     sleep(30);
0074 
0075     // Division : --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0076 
0077     bool dNdeta_ApplyAlphaCorr = false;
0078     bool dNdeta_isTypeA = false;
0079     std::pair<double,double> dNdeta_cut_INTTvtxZ = {-10, 10};
0080     int dNdeta_SelectedMbin = 70; // note : 0, 1, ---- 10, 70, 100 
0081 
0082     PreparedNdEtaEach * pdndeta = new PreparedNdEtaEach(
0083         process_id, 
0084         run_num,
0085         final_output_directory,
0086         Track_output_filename,
0087         final_output_directory,
0088         output_file_name_suffix,
0089 
0090         dNdeta_ApplyAlphaCorr,
0091         dNdeta_isTypeA,
0092         dNdeta_cut_INTTvtxZ,
0093         dNdeta_SelectedMbin
0094     );
0095 
0096     std::vector<std::string> dNdeta_output_filename = pdndeta->GetOutputFileName();
0097     cout<<"dNdeta: final_output_file_name: "<<dNdeta_output_filename[0]<<endl;
0098     cout<<"dNdeta: final_output_file_name: "<<dNdeta_output_filename[1]<<endl;
0099 
0100     pdndeta -> PrepareStacks();
0101     pdndeta -> DoFittings();
0102     pdndeta -> PrepareMultiplicity();
0103     pdndeta -> PreparedNdEtaHist();
0104     pdndeta -> DeriveAlphaCorrection();
0105 
0106     std::cout<<"test test: closing in PreparedNdEtaEach "<<std::endl;
0107     pdndeta -> EndRun();
0108 
0109     std::cout<<"test test: done with PreparedNdEtaEach"<<std::endl;
0110 
0111     // Division : --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0112 
0113     std::cout<<"test test: closing in AvgVtxXY "<<std::endl;    
0114 
0115     avgXY -> EndRun();
0116 
0117     std::cout<<"test test: done with in AvgVtxXY "<<std::endl;    
0118 
0119     sleep(30);
0120 
0121     system(Form("mv %s %s/completed", final_output_directory.c_str(), output_directory.c_str()));
0122 
0123     return 0;
0124 }