File indexing completed on 2025-08-09 08:12:19
0001 #include "../TrackletHistogramNew.h"
0002
0003 R__LOAD_LIBRARY(../libTrackletHistogramNew.so)
0004
0005 TH1D * GetReweighting_hist(string input_map_directory, string map_name)
0006 {
0007 TFile * file_in = TFile::Open(Form("%s", input_map_directory.c_str()));
0008 TH1D * h1D_INTT_vtxZ_reweighting = (TH1D*)file_in->Get(map_name.c_str());
0009 return h1D_INTT_vtxZ_reweighting;
0010 }
0011
0012 TH2D * GetGoodColMap (std::string ColMulMask_map_dir_in, std::string ColMulMask_map_file_in, std::string map_name_in)
0013 {
0014 TFile * f = TFile::Open(Form("%s/%s", ColMulMask_map_dir_in.c_str(), ColMulMask_map_file_in.c_str()));
0015 TH2D * h = (TH2D*)f->Get(map_name_in.c_str());
0016 return h;
0017 }
0018
0019 void Run_PrepareHist_MC(
0020 int process_id = 0,
0021 int run_num = 54280,
0022 int nevents = -1,
0023 string input_directory = "/sphenix/user/ChengWei/INTT/INTT/general_codes/CWShih/INTTBcoResolution/macro",
0024 string input_filename = "file_list_54280_intt.txt",
0025 string output_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280/completed/BCO_check",
0026
0027
0028 std::string output_file_name_suffix = "",
0029
0030
0031 std::pair<double, double> vertexXYIncm = {-0.0218667, 0.223296},
0032
0033
0034 std::string zvtx_weight_file_index = "_001",
0035
0036
0037 std::pair<bool, TH1D*> vtxZReweight = {true, nullptr},
0038 bool BcoFullDiffCut = false,
0039 bool INTT_vtxZ_QA = true,
0040
0041
0042 bool HaveGeoOffsetTag = false,
0043 std::pair<bool, int> SetRandomHits = {false, 0},
0044 bool RandInttZ = false,
0045 bool ColMulMask = true,
0046
0047 std::string ColMulMask_map_mother_dir = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_MDC2_ana472_20250307/Run7/EvtVtxZ/ColumnCheck"
0048 )
0049 {
0050
0051 std::string vtxZReWeighting_input_directory = Form("/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_AMPT_MDC2_ana472_20250310/Run7/EvtVtxZ/completed/VtxZDist/completed/vtxZ_comp_WithVtxZQA%s/INTTvtxZReWeight.root",zvtx_weight_file_index.c_str());
0052
0053 std::string map_name = "AMPT_noZWeight_WithVtxZQA_Inclusive70";
0054
0055 std::cout<<"vtxZReWeighting_input_directory: "<<vtxZReWeighting_input_directory<<std::endl;
0056
0057 if (vtxZReweight.first) {vtxZReweight.second = (TH1D*)(GetReweighting_hist(vtxZReWeighting_input_directory, map_name))->Clone();}
0058
0059
0060
0061
0062 std::string final_output_directory = output_directory + "/baseline";
0063 system(Form("mkdir -p %s/completed", final_output_directory.c_str()));
0064
0065 std::pair<bool, std::pair<double, double>> isClusQA = {true, {35,40}};
0066
0067 std::string ColMulMask_map_dir = ColMulMask_map_mother_dir + "/baseline/completed/MulMap/completed";
0068 std::string ColMulMask_map_file = Form("MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc%.0fPhiSize%.0f_00054280.root", isClusQA.second.first, isClusQA.second.second);
0069
0070 TrackletHistogramNew * TLHN = new TrackletHistogramNew(
0071 process_id,
0072 run_num,
0073 nevents,
0074 input_directory,
0075 input_filename,
0076 final_output_directory,
0077
0078 output_file_name_suffix,
0079 vertexXYIncm,
0080
0081 vtxZReweight,
0082 BcoFullDiffCut,
0083 INTT_vtxZ_QA,
0084 isClusQA,
0085 HaveGeoOffsetTag,
0086 SetRandomHits,
0087 RandInttZ,
0088 ColMulMask
0089 );
0090
0091 if (ColMulMask){
0092 TLHN -> SetGoodColMap(
0093 GetGoodColMap(ColMulMask_map_dir, ColMulMask_map_file, TLHN->GetGoodColMapName())
0094 );
0095 }
0096
0097 string final_output_file_name = TLHN->GetOutputFileName();
0098 cout<<"final_output_file_name: "<<final_output_file_name<<endl;
0099 system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", final_output_directory.c_str(), final_output_file_name.c_str(), final_output_directory.c_str(), final_output_file_name.c_str()));
0100
0101 TLHN -> MainProcess();
0102 TLHN -> EndRun();
0103
0104 system(Form("mv %s/%s %s/completed", final_output_directory.c_str(), final_output_file_name.c_str(), final_output_directory.c_str()));
0105
0106
0107
0108 final_output_directory = output_directory + "/noAdcCut";
0109 system(Form("mkdir -p %s/completed", final_output_directory.c_str()));
0110
0111 isClusQA = {true, {0,40}};
0112
0113 ColMulMask_map_dir = ColMulMask_map_mother_dir + "/noAdcCut/completed/MulMap/completed";
0114 ColMulMask_map_file = Form("MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc%.0fPhiSize%.0f_00054280.root", isClusQA.second.first, isClusQA.second.second);
0115
0116 TrackletHistogramNew * TLHN1 = new TrackletHistogramNew(
0117 process_id,
0118 run_num,
0119 nevents,
0120 input_directory,
0121 input_filename,
0122 final_output_directory,
0123
0124 output_file_name_suffix,
0125 vertexXYIncm,
0126
0127 vtxZReweight,
0128 BcoFullDiffCut,
0129 INTT_vtxZ_QA,
0130 isClusQA,
0131 HaveGeoOffsetTag,
0132 SetRandomHits,
0133 RandInttZ,
0134 ColMulMask
0135 );
0136
0137 if (ColMulMask){
0138 TLHN1 -> SetGoodColMap(
0139 GetGoodColMap(ColMulMask_map_dir, ColMulMask_map_file, TLHN1->GetGoodColMapName())
0140 );
0141 }
0142
0143 string final_output_file_name1 = TLHN1->GetOutputFileName();
0144 cout<<"final_output_file_name1: "<<final_output_file_name1<<endl;
0145 system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", final_output_directory.c_str(), final_output_file_name1.c_str(), final_output_directory.c_str(), final_output_file_name1.c_str()));
0146
0147 TLHN1 -> MainProcess();
0148 TLHN1 -> EndRun();
0149
0150 system(Form("mv %s/%s %s/completed", final_output_directory.c_str(), final_output_file_name1.c_str(), final_output_directory.c_str()));
0151
0152
0153
0154 final_output_directory = output_directory + "/50AdcCut";
0155 system(Form("mkdir -p %s/completed", final_output_directory.c_str()));
0156
0157 isClusQA = {true, {50,40}};
0158
0159 ColMulMask_map_dir = ColMulMask_map_mother_dir + "/50AdcCut/completed/MulMap/completed";
0160 ColMulMask_map_file = Form("MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc%.0fPhiSize%.0f_00054280.root", isClusQA.second.first, isClusQA.second.second);
0161
0162 TrackletHistogramNew * TLHN2 = new TrackletHistogramNew(
0163 process_id,
0164 run_num,
0165 nevents,
0166 input_directory,
0167 input_filename,
0168 final_output_directory,
0169
0170 output_file_name_suffix,
0171 vertexXYIncm,
0172
0173 vtxZReweight,
0174 BcoFullDiffCut,
0175 INTT_vtxZ_QA,
0176 isClusQA,
0177 HaveGeoOffsetTag,
0178 SetRandomHits,
0179 RandInttZ,
0180 ColMulMask
0181 );
0182
0183 if (ColMulMask){
0184 TLHN2 -> SetGoodColMap(
0185 GetGoodColMap(ColMulMask_map_dir, ColMulMask_map_file, TLHN2->GetGoodColMapName())
0186 );
0187 }
0188
0189 string final_output_file_name2 = TLHN2->GetOutputFileName();
0190 cout<<"final_output_file_name2: "<<final_output_file_name2<<endl;
0191 system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", final_output_directory.c_str(), final_output_file_name2.c_str(), final_output_directory.c_str(), final_output_file_name2.c_str()));
0192
0193 TLHN2 -> MainProcess();
0194 TLHN2 -> EndRun();
0195
0196 system(Form("mv %s/%s %s/completed", final_output_directory.c_str(), final_output_file_name2.c_str(), final_output_directory.c_str()));
0197
0198
0199
0200 final_output_directory = output_directory + "/noPhiCut";
0201 system(Form("mkdir -p %s/completed", final_output_directory.c_str()));
0202
0203 isClusQA = {true, {35,350}};
0204
0205 ColMulMask_map_dir = ColMulMask_map_mother_dir + "/noPhiCut/completed/MulMap/completed";
0206 ColMulMask_map_file = Form("MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc%.0fPhiSize%.0f_00054280.root", isClusQA.second.first, isClusQA.second.second);
0207
0208 TrackletHistogramNew * TLHN3 = new TrackletHistogramNew(
0209 process_id,
0210 run_num,
0211 nevents,
0212 input_directory,
0213 input_filename,
0214 final_output_directory,
0215
0216 output_file_name_suffix,
0217 vertexXYIncm,
0218
0219 vtxZReweight,
0220 BcoFullDiffCut,
0221 INTT_vtxZ_QA,
0222 isClusQA,
0223 HaveGeoOffsetTag,
0224 SetRandomHits,
0225 RandInttZ,
0226 ColMulMask
0227 );
0228
0229 if (ColMulMask){
0230 TLHN3 -> SetGoodColMap(
0231 GetGoodColMap(ColMulMask_map_dir, ColMulMask_map_file, TLHN3->GetGoodColMapName())
0232 );
0233 }
0234
0235 string final_output_file_name3 = TLHN3->GetOutputFileName();
0236 cout<<"final_output_file_name3: "<<final_output_file_name3<<endl;
0237 system(Form("if [ -f %s/completed/%s ]; then rm %s/completed/%s; fi;", final_output_directory.c_str(), final_output_file_name3.c_str(), final_output_directory.c_str(), final_output_file_name3.c_str()));
0238
0239 TLHN3 -> MainProcess();
0240 TLHN3 -> EndRun();
0241
0242 system(Form("mv %s/%s %s/completed", final_output_directory.c_str(), final_output_file_name3.c_str(), final_output_directory.c_str()));
0243
0244 return;
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286 }