File indexing completed on 2025-08-05 08:11:55
0001
0002
0003 #include "/sphenix/user/ChengWei/INTT/INTT_commissioning/INTT_CW/INTT_commissioning/DAC_Scan/InttConversion_new.h"
0004 #include "/sphenix/user/ChengWei/INTT/INTT_commissioning/INTT_CW/INTT_commissioning/DAC_Scan/InttClustering.h"
0005 #include "sigmaEff.h"
0006 #include "sPhenixStyle.C"
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 vector<vector<int>> adc_setting_run = {
0027 {15, 30, 60, 90, 120, 150, 180, 210, 240}
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 };
0040
0041 TString color_code_2[8] = {"#CC768D","#19768D","#DDA573","#009193","#6E9193","#941100","#A08144","#517E66"};
0042
0043 struct full_hit_info {
0044 int FC;
0045 int chip_id;
0046 int chan_id;
0047 int adc;
0048 };
0049
0050
0051 struct ladder_info {
0052 int FC;
0053 TString Port;
0054 int ROC;
0055 int Direction;
0056 };
0057
0058 double gaus_func(double *x, double *par)
0059 {
0060
0061
0062
0063
0064 return par[0] * TMath::Gaus(x[0],par[1],par[2]) + par[3];
0065 }
0066
0067 double double_gaus_func(double *x, double *par)
0068 {
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 double gaus1 = par[0] * TMath::Gaus(x[0],par[1],par[2]) + par[3];
0079 double gaus2 = par[4] * TMath::Gaus(x[0],par[5],par[6]);
0080
0081 return gaus1 + gaus2;
0082 }
0083
0084 double get_radius(double x, double y)
0085 {
0086 return sqrt(pow(x,2)+pow(y,2));
0087 }
0088
0089 double get_radius_sign(double x, double y)
0090 {
0091 double phi = ((y) < 0) ? atan2((y),(x)) * (180./TMath::Pi()) + 360 : atan2((y),(x)) * (180./TMath::Pi());
0092
0093 return (phi > 180) ? sqrt(pow(x,2)+pow(y,2)) * -1 : sqrt(pow(x,2)+pow(y,2));
0094 }
0095
0096 double sin_func(double *x, double *par)
0097 {
0098 return par[0] * sin(par[1] * x[0] + par[2]) + par[3];
0099 }
0100
0101 double cos_func(double *x, double *par)
0102 {
0103 return -1 * par[0] * cos(par[1] * (x[0] + par[2])) + par[3];
0104 }
0105
0106 void Characterize_Pad (TPad *pad, float left = 0.15, float right = 0.1, float top = 0.1, float bottom = 0.12, bool set_logY = false, int setgrid_bool = 0)
0107 {
0108 if (setgrid_bool == true) {pad -> SetGrid (1, 1);}
0109 pad -> SetLeftMargin (left);
0110 pad -> SetRightMargin (right);
0111 pad -> SetTopMargin (top);
0112 pad -> SetBottomMargin (bottom);
0113 pad -> SetTicks(1,1);
0114 if (set_logY == true)
0115 {
0116 pad -> SetLogy (1);
0117 }
0118
0119 }
0120
0121 std::vector<double> calculateDistanceAndClosestPoint(double x1, double y1, double x2, double y2, double target_x, double target_y) {
0122
0123 if (x1 != x2)
0124 {
0125
0126 double a = (y2 - y1) / (x2 - x1);
0127 double b = y1 - a * x1;
0128
0129
0130
0131
0132 double closest_distance = std::abs(a * target_x - target_y + b) / std::sqrt(a * a + 1);
0133
0134
0135 double Xc = (target_x + a * target_y - a * b) / (a * a + 1);
0136 double Yc = a * Xc + b;
0137
0138 return { closest_distance, Xc, Yc };
0139 }
0140 else
0141 {
0142 double closest_distance = std::abs(x1 - target_x);
0143 double Xc = x1;
0144 double Yc = target_y;
0145
0146 return { closest_distance, Xc, Yc };
0147 }
0148
0149
0150 }
0151
0152 double get_z_vertex(clu_info inner_clu, clu_info outer_clu, double target_x, double target_y)
0153 {
0154
0155
0156 double inner_clu_r = sqrt(pow(inner_clu.x,2)+ pow(inner_clu.y,2));
0157 double outer_clu_r = sqrt(pow(outer_clu.x,2)+ pow(outer_clu.y,2));
0158 double target_r = sqrt(pow(target_x,2) + pow(target_y,2));
0159
0160
0161 if ( fabs(outer_clu.z - inner_clu.z) < 0.00001 ){
0162 return outer_clu.z;
0163 }
0164 else {
0165 double slope = (outer_clu_r - inner_clu_r) / (outer_clu.z - inner_clu.z);
0166 double yIntercept = inner_clu_r - slope * inner_clu.z;
0167 double xCoordinate = (target_r - yIntercept) / slope;
0168 return xCoordinate;
0169 }
0170
0171 }
0172
0173
0174 double calculateAngleBetweenVectors(double x1, double y1, double x2, double y2, double targetX, double targetY) {
0175
0176 double vector1X = x2 - x1;
0177 double vector1Y = y2 - y1;
0178
0179 double vector2X = targetX - x1;
0180 double vector2Y = targetY - y1;
0181
0182
0183 double crossProduct = vector1X * vector2Y - vector1Y * vector2X;
0184
0185
0186
0187
0188 double magnitude1 = std::sqrt(vector1X * vector1X + vector1Y * vector1Y);
0189 double magnitude2 = std::sqrt(vector2X * vector2X + vector2Y * vector2Y);
0190
0191
0192 double dotProduct = vector1X * vector2X + vector1Y * vector2Y;
0193
0194 double angleInRadians = std::atan2(std::abs(crossProduct), dotProduct);
0195
0196 double angleInDegrees = angleInRadians * 180.0 / M_PI;
0197
0198 double angleInRadians_new = std::asin( crossProduct/(magnitude1*magnitude2) );
0199 double angleInDegrees_new = angleInRadians_new * 180.0 / M_PI;
0200
0201
0202
0203 double DCA_distance = sin(angleInRadians_new) * magnitude2;
0204
0205 return DCA_distance;
0206 }
0207
0208 void temp_bkg(TPad * c1, string conversion_mode, double peek, pair<double,double> beam_origin, InttConversion * ch_pos_DB)
0209 {
0210 c1 -> cd();
0211
0212 int N_ladder[4] = {12, 12, 16, 16};
0213 string ladder_index_string[16] = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15"};
0214
0215 vector<double> x_vec; x_vec.clear();
0216 vector<double> y_vec; y_vec.clear();
0217
0218 vector<double> x_vec_2; x_vec_2.clear();
0219 vector<double> y_vec_2; y_vec_2.clear();
0220
0221 TGraph * bkg = new TGraph();
0222 bkg -> SetTitle("INTT event display X-Y plane");
0223 bkg -> SetMarkerStyle(20);
0224 bkg -> SetMarkerSize(0.1);
0225 bkg -> SetPoint(0,0,0);
0226 bkg -> SetPoint(1,beam_origin.first,beam_origin.second);
0227 bkg -> GetXaxis() -> SetLimits(-150,150);
0228 bkg -> GetYaxis() -> SetRangeUser(-150,150);
0229 bkg -> GetXaxis() -> SetTitle("X [mm]");
0230 bkg -> GetYaxis() -> SetTitle("Y [mm]");
0231
0232 bkg -> Draw("ap");
0233
0234 TLine * ladder_line = new TLine();
0235 ladder_line -> SetLineWidth(1);
0236
0237 for (int server_i = 0; server_i < 4; server_i++)
0238 {
0239 for (int FC_i = 0; FC_i < 14; FC_i++)
0240 {
0241 ladder_line -> DrawLine(
0242 ch_pos_DB -> Get_XY_all(Form("intt%i",server_i),FC_i,14,0).x, ch_pos_DB -> Get_XY_all(Form("intt%i",server_i),FC_i,14,0).y,
0243 ch_pos_DB -> Get_XY_all(Form("intt%i",server_i),FC_i,1,0).x, ch_pos_DB -> Get_XY_all(Form("intt%i",server_i),FC_i,1,0).y
0244 );
0245 }
0246 }
0247
0248 ladder_line -> Draw("l same");
0249
0250 }
0251
0252 double grEY_stddev (TGraphErrors * input_grr)
0253 {
0254 vector<double> input_vector; input_vector.clear();
0255 for (int i = 0; i < input_grr -> GetN(); i++)
0256 {
0257 input_vector.push_back( input_grr -> GetPointY(i) );
0258 }
0259
0260 double sum=0;
0261 double average;
0262 double sum_subt = 0;
0263 for (int i=0; i<input_vector.size(); i++)
0264 {
0265 sum+=input_vector[i];
0266
0267 }
0268 average=sum/input_vector.size();
0269
0270
0271 for (int i=0; i<input_vector.size(); i++)
0272 {
0273
0274 sum_subt+=pow((input_vector[i]-average),2);
0275
0276 }
0277
0278 double stddev;
0279 stddev=sqrt(sum_subt/(input_vector.size()-1));
0280 return stddev;
0281 }
0282
0283 pair<double, double> mirrorPolynomial(double a, double b) {
0284
0285 double mirroredA = 1.0 / a;
0286 double mirroredB = -b / a;
0287
0288 return {mirroredA, mirroredB};
0289 }
0290
0291
0292
0293
0294
0295
0296 pair<double,double> Get_eta(vector<double>p0, vector<double>p1, vector<double>p2)
0297 {
0298 vector<double> r_vec = {p0[0], p1[0], p2[0]};
0299 vector<double> z_vec = {p0[1], p1[1], p2[1]};
0300 vector<double> re_vec = {0, 0, 0};
0301 vector<double> ze_vec = {p0[2], ( fabs( p1[1] ) < 130 ) ? 8. : 10., ( fabs( p2[1] ) < 130 ) ? 8. : 10.};
0302
0303
0304
0305 TGraphErrors * track_gr = new TGraphErrors(3,&r_vec[0],&z_vec[0],&re_vec[0],&ze_vec[0]);
0306
0307 double vertical_line = ( fabs( grEY_stddev(track_gr) ) < 0.00001 ) ? 1 : 0;
0308
0309 if (vertical_line) {return {0,0};}
0310 else
0311 {
0312 TF1 * fit_rz = new TF1("fit_rz","pol1",-500,500);
0313 fit_rz -> SetParameters(0,0);
0314
0315 track_gr -> Fit(fit_rz,"NQ");
0316
0317 pair<double,double> ax_b = mirrorPolynomial(fit_rz -> GetParameter(1),fit_rz -> GetParameter(0));
0318
0319 return {(fit_rz -> GetChisquare() / double(fit_rz -> GetNDF())), -1 * TMath::Log( fabs( tan( atan2(ax_b.first, (ax_b.first > 0) ? 1. : -1. ) / 2 ) ) )};
0320
0321 }
0322
0323 }
0324
0325
0326
0327
0328
0329 double Get_eta_2P(vector<double>p0, vector<double>p1)
0330 {
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342 return -1 * TMath::Log( fabs( tan( atan2(p1[0] - p0[0], p1[1] - p0[1]) / 2 ) ) );
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355 }
0356
0357 double Get_extrapolation(double given_y, double p0x, double p0y, double p1x, double p1y)
0358 {
0359 if ( fabs(p0x - p1x) < 0.00001 ){
0360 return p0x;
0361 }
0362 else {
0363 double slope = (p1y - p0y) / (p1x - p0x);
0364 double yIntercept = p0y - slope * p0x;
0365 double xCoordinate = (given_y - yIntercept) / slope;
0366 return xCoordinate;
0367 }
0368 }
0369
0370 pair<double,double> Get_possible_zvtx(double rvtx, vector<double> p0, vector<double> p1)
0371 {
0372 vector<double> p0_z_edge = { ( fabs( p0[1] ) < 130 ) ? p0[1] - 8. : p0[1] - 10., ( fabs( p0[1] ) < 130 ) ? p0[1] + 8. : p0[1] + 10.};
0373 vector<double> p1_z_edge = { ( fabs( p1[1] ) < 130 ) ? p1[1] - 8. : p1[1] - 10., ( fabs( p1[1] ) < 130 ) ? p1[1] + 8. : p1[1] + 10.};
0374
0375 double edge_first = Get_extrapolation(rvtx,p0_z_edge[0],p0[0],p1_z_edge[1],p1[0]);
0376 double edge_second = Get_extrapolation(rvtx,p0_z_edge[1],p0[0],p1_z_edge[0],p1[0]);
0377
0378 double mid_point = (edge_first + edge_second) / 2.;
0379 double possible_width = fabs(edge_first - edge_second) / 2.;
0380
0381 return {mid_point, possible_width};
0382
0383 }
0384
0385 void TH2F_threshold(TH2F * input_hist, double threshold)
0386 {
0387 for (int xi = 0; xi < input_hist -> GetNbinsX(); xi++){
0388 for(int yi = 0; yi < input_hist -> GetNbinsY(); yi++){
0389 if (input_hist -> GetBinContent(xi + 1, yi +1) < threshold){ input_hist -> SetBinContent(xi + 1, yi +1, 0); }
0390 }
0391 }
0392 }
0393
0394
0395
0396
0397 void INTT_xyvtx(string run_ID, int geo_mode_id, string file_event, bool full_event, int run_Nevent)
0398 {
0399
0400 SetsPhenixStyle();
0401
0402 TCanvas * c4 = new TCanvas("","",1200,800);
0403 c4 -> cd();
0404
0405 TCanvas * c2 = new TCanvas("","",2500,800);
0406 c2 -> cd();
0407 TPad *pad_xy = new TPad(Form("pad_xy"), "", 0.0, 0.0, 0.33, 1.0);
0408 Characterize_Pad(pad_xy, 0.15, 0.1, 0.1, 0.1 , 0, 0);
0409 pad_xy -> Draw();
0410
0411 TPad *pad_rz = new TPad(Form("pad_rz"), "", 0.33, 0.0, 0.66, 1.0);
0412 Characterize_Pad(pad_rz, 0.15, 0.1, 0.1, 0.1 , 0, 0);
0413 pad_rz -> Draw();
0414
0415 TPad *pad_z = new TPad(Form("pad_z"), "", 0.66, 0.0, 1.0, 1.0);
0416 Characterize_Pad(pad_z, 0.15, 0.1, 0.1, 0.1 , 0, 0);
0417 pad_z -> Draw();
0418
0419 TCanvas * c1 = new TCanvas("","",950,800);
0420 c1 -> cd();
0421
0422
0423 vector<string> conversion_mode_BD = {"ideal", "survey_1_XYAlpha_Peek_3.32mm", "full_survey_3.32"};
0424
0425
0426
0427
0428
0429
0430
0431
0432 string mother_folder_directory = "/sphenix/user/ChengWei/INTT/INTT_commissioning/ZeroField/" + run_ID;
0433
0434 string file_name = "beam_inttall-000" +run_ID+ "-0000_event_base_ana_cluster_"+ conversion_mode_BD[geo_mode_id] +"_excludeR1500_"+ file_event +"kEvent_3HotCut";
0435
0436 cout<<"the input file name : "<<file_name<<endl;
0437 sleep(5);
0438
0439
0440
0441
0442 system(Form("mkdir %s/folder_%s_advanced",mother_folder_directory.c_str(),file_name.c_str()));
0443 system(Form("mkdir %s/folder_%s_advanced/good_track",mother_folder_directory.c_str(),file_name.c_str()));
0444
0445 pair<double,double> beam_origin = {-0.457 + 0.0276, 2.657 - 0.2814};
0446
0447
0448
0449 double temp_Y_align = 0.;
0450 double temp_X_align = -0.;
0451
0452 double zvtx_hist_l = -500;
0453 double zvtx_hist_r = 500;
0454
0455 int Nhit_cut = 1500;
0456 int Nhit_cutl = 100;
0457 int clu_size_cut = 4;
0458 double clu_sum_adc_cut = 31;
0459 int N_clu_cut = 15000;
0460 int N_clu_cutl = 0;
0461 double phi_diff_cut = 5.72;
0462 double DCA_cut = 4;
0463 int zvtx_cal_require = 15;
0464 int zvtx_draw_requireL = 15;
0465 int zvtx_draw_requireR = 40000;
0466 double Integrate_portion = 0.4;
0467 double Integrate_portion_final = 0.68;
0468 bool draw_event_display = false;
0469 int print_rate = 5;
0470
0471
0472
0473
0474 long long used_event = run_Nevent;
0475
0476
0477
0478
0479 int geo_mode_id_draw = 1;
0480 string conversion_mode = (geo_mode_id_draw == 0) ? "ideal" : "survey_1_XYAlpha_Peek";
0481 double peek = 3.32405;
0482
0483
0484 InttConversion * ch_pos_DB = new InttConversion(conversion_mode_BD[geo_mode_id], peek);
0485
0486 TFile * file_in = new TFile(Form("%s/%s.root",mother_folder_directory.c_str(),file_name.c_str()),"read");
0487 TTree * tree = (TTree *)file_in->Get("tree_clu");
0488
0489 long long N_event = (full_event == true) ? tree -> GetEntries() : used_event;
0490 cout<<Form("N_event in file %s : %lli",file_name.c_str(), N_event)<<endl;
0491
0492 int N_hits;
0493 int N_cluster_inner;
0494 int N_cluster_outer;
0495 Long64_t bco_full;
0496 vector<int>* column_vec = new vector<int>();
0497 vector<double>* avg_chan_vec = new vector<double>();
0498 vector<int>* sum_adc_vec = new vector<int>();
0499 vector<int>* sum_adc_conv_vec = new vector<int>();
0500 vector<int>* size_vec = new vector<int>();
0501 vector<double>* x_vec = new vector<double>();
0502 vector<double>* y_vec = new vector<double>();
0503 vector<double>* z_vec = new vector<double>();
0504 vector<int>* layer_vec = new vector<int>();
0505 vector<double>* phi_vec = new vector<double>();
0506
0507 tree -> SetBranchStatus("*",0);
0508 tree -> SetBranchStatus("nhits",1);
0509 tree -> SetBranchStatus("nclu_inner",1);
0510 tree -> SetBranchStatus("nclu_outer",1);
0511
0512 tree -> SetBranchStatus("column",1);
0513 tree -> SetBranchStatus("avg_chan",1);
0514 tree -> SetBranchStatus("sum_adc",1);
0515 tree -> SetBranchStatus("sum_adc_conv",1);
0516 tree -> SetBranchStatus("size",1);
0517 tree -> SetBranchStatus("x",1);
0518 tree -> SetBranchStatus("y",1);
0519 tree -> SetBranchStatus("z",1);
0520 tree -> SetBranchStatus("layer",1);
0521 tree -> SetBranchStatus("phi",1);
0522
0523
0524 tree -> SetBranchAddress("nhits",&N_hits);
0525 tree -> SetBranchAddress("nclu_inner",&N_cluster_inner);
0526 tree -> SetBranchAddress("nclu_outer",&N_cluster_outer);
0527
0528 tree -> SetBranchAddress("column", &column_vec);
0529 tree -> SetBranchAddress("avg_chan", &avg_chan_vec);
0530 tree -> SetBranchAddress("sum_adc", &sum_adc_vec);
0531 tree -> SetBranchAddress("sum_adc_conv", &sum_adc_conv_vec);
0532 tree -> SetBranchAddress("size", &size_vec);
0533 tree -> SetBranchAddress("x", &x_vec);
0534 tree -> SetBranchAddress("y", &y_vec);
0535 tree -> SetBranchAddress("z", &z_vec);
0536 tree -> SetBranchAddress("layer", &layer_vec);
0537 tree -> SetBranchAddress("phi", &phi_vec);
0538
0539 TLatex *draw_text = new TLatex();
0540 draw_text -> SetNDC();
0541 draw_text -> SetTextSize(0.03);
0542
0543 vector<clu_info> temp_sPH_inner_nocolumn_vec; temp_sPH_inner_nocolumn_vec.clear();
0544 vector<clu_info> temp_sPH_outer_nocolumn_vec; temp_sPH_outer_nocolumn_vec.clear();
0545 vector<vector<double>> temp_sPH_nocolumn_vec(2);
0546 vector<vector<double>> temp_sPH_nocolumn_rz_vec(2);
0547
0548 TH2F * angle_correlation = new TH2F("","angle_correlation",361,0,361,361,0,361);
0549 angle_correlation -> SetStats(0);
0550 angle_correlation -> GetXaxis() -> SetTitle("Inner Phi [degree]");
0551 angle_correlation -> GetYaxis() -> SetTitle("Outer Phi [degree]");
0552
0553 TH2F * angle_diff_DCA_dist = new TH2F("","angle_diff_DCA_dist",100,-1.5,1.5,100,-3.5,3.5);
0554 angle_diff_DCA_dist -> SetStats(0);
0555 angle_diff_DCA_dist -> GetXaxis() -> SetTitle("Inner - Outer [degree]");
0556 angle_diff_DCA_dist -> GetYaxis() -> SetTitle("DCA distance [mm]");
0557
0558 TH1F * angle_diff = new TH1F("","angle_diff",100,0,3);
0559 angle_diff -> SetStats(0);
0560 angle_diff -> GetXaxis() -> SetTitle("|Inner - Outer| [degree]");
0561 angle_diff -> GetYaxis() -> SetTitle("Entry");
0562
0563 TH1F * DCA_distance_1D = new TH1F("","DCA_distance_1D",100,-6,6);
0564 DCA_distance_1D -> SetStats(0);
0565 DCA_distance_1D -> GetXaxis() -> SetTitle("DCA distance");
0566 DCA_distance_1D -> GetYaxis() -> SetTitle("Entry");
0567
0568 TH2F * angle_diff_inner_phi = new TH2F("","angle_diff_inner_phi",361,0,361,100,-1.5,1.5);
0569 angle_diff_inner_phi -> SetStats(0);
0570 angle_diff_inner_phi -> GetXaxis() -> SetTitle("Inner phi [degree]");
0571 angle_diff_inner_phi -> GetYaxis() -> SetTitle("Inner - Outer [degree]");
0572
0573 TH2F * inner_pos_xy = new TH2F("","inner_pos_xy",360,-100,100,360,-100,100);
0574 inner_pos_xy -> SetStats(0);
0575 inner_pos_xy -> GetXaxis() -> SetTitle("X axis");
0576 inner_pos_xy -> GetYaxis() -> SetTitle("Y axis");
0577
0578 TH2F * outer_pos_xy = new TH2F("","outer_pos_xy",360,-150,150,360,-150,150);
0579 outer_pos_xy -> SetStats(0);
0580 outer_pos_xy -> GetXaxis() -> SetTitle("X axis");
0581 outer_pos_xy -> GetYaxis() -> SetTitle("Y axis");
0582
0583 TH2F * inner_outer_pos_xy = new TH2F("","inner_outer_pos_xy",360,-150,150,360,-150,150);
0584 inner_outer_pos_xy -> SetStats(0);
0585 inner_outer_pos_xy -> GetXaxis() -> SetTitle("X axis");
0586 inner_outer_pos_xy -> GetYaxis() -> SetTitle("Y axis");
0587
0588 TH1F * z_pos_diff = new TH1F("","z_pos_diff",360,-150,150);
0589 z_pos_diff -> GetXaxis() -> SetTitle("Inner zpos - Outer zpos [mm]");
0590 z_pos_diff -> GetYaxis() -> SetTitle("Eentry");
0591
0592 TH2F * z_pos_diff_angle_diff = new TH2F("","z_pos_diff_angle_diff",100,-25,25,200,-11,11);
0593 z_pos_diff_angle_diff -> SetStats(0);
0594 z_pos_diff_angle_diff -> GetXaxis() -> SetTitle("Inner zpos - Outer zpos [mm]");
0595 z_pos_diff_angle_diff -> GetYaxis() -> SetTitle("Inner phi - Outer phi [degree]");
0596
0597 TH1F * Nhits_good = new TH1F("","Nhits_good",360,0,1000);
0598 Nhits_good -> GetXaxis() -> SetTitle("N hits in one event");
0599 Nhits_good -> GetYaxis() -> SetTitle("Eentry");
0600
0601 TH1F * z_pos_inner = new TH1F("","z_pos_inner",200,-150,150);
0602 z_pos_inner -> GetXaxis() -> SetTitle("Inner zpos [mm]");
0603 z_pos_inner -> GetYaxis() -> SetTitle("Eentry");
0604
0605 TH1F * z_pos_outer = new TH1F("","z_pos_outer",200,-150,150);
0606 z_pos_outer -> GetXaxis() -> SetTitle("Outer zpos [mm]");
0607 z_pos_outer -> GetYaxis() -> SetTitle("Eentry");
0608
0609 TH2F * z_pos_inner_outer = new TH2F("","z_pos_inner_outer",100,-150,150, 100,-150,150);
0610 z_pos_inner_outer -> SetStats(0);
0611 z_pos_inner_outer -> GetXaxis() -> SetTitle("Inner zpos [mm]");
0612 z_pos_inner_outer -> GetYaxis() -> SetTitle("Outer pos [mm]");
0613
0614 TH2F * DCA_point = new TH2F("","DCA_point",100,-10,10,100,-10,10);
0615 DCA_point -> SetStats(0);
0616 DCA_point -> GetXaxis() -> SetTitle("X pos [mm]");
0617 DCA_point -> GetYaxis() -> SetTitle("Y pos [mm]");
0618
0619 TH2F * DCA_distance_inner_phi = new TH2F("","DCA_distance_inner_phi",100,0,360,100,-10,10);
0620 DCA_distance_inner_phi -> SetStats(0);
0621 DCA_distance_inner_phi -> GetXaxis() -> SetTitle("Inner phi [degree]");
0622 DCA_distance_inner_phi -> GetYaxis() -> SetTitle("DCA [mm]");
0623
0624 TH2F * DCA_distance_outer_phi = new TH2F("","DCA_distance_outer_phi",100,0,360,100,-10,10);
0625 DCA_distance_outer_phi -> SetStats(0);
0626 DCA_distance_outer_phi -> GetXaxis() -> SetTitle("Outer phi [degree]");
0627 DCA_distance_outer_phi -> GetYaxis() -> SetTitle("DCA [mm]");
0628
0629 TH1F * N_cluster_outer_pass = new TH1F("","N_cluster_outer_pass",100,0,100);
0630 N_cluster_outer_pass -> GetXaxis() -> SetTitle("N_cluster");
0631 N_cluster_outer_pass -> GetYaxis() -> SetTitle("Eentry");
0632
0633 TH1F * N_cluster_inner_pass = new TH1F("","N_cluster_inner_pass",100,0,100);
0634 N_cluster_inner_pass -> GetXaxis() -> SetTitle("N_cluster");
0635 N_cluster_inner_pass -> GetYaxis() -> SetTitle("Eentry");
0636
0637 TH2F * N_cluster_correlation = new TH2F("","N_cluster_correlation",100,0,500,100,0,500);
0638 N_cluster_correlation -> SetStats(0);
0639 N_cluster_correlation -> GetXaxis() -> SetTitle("inner N_cluster");
0640 N_cluster_correlation -> GetYaxis() -> SetTitle("Outer N_cluster");
0641
0642 TH1F * temp_event_zvtx = new TH1F("","Z vertex dist",125,zvtx_hist_l,zvtx_hist_r);
0643 temp_event_zvtx -> GetXaxis() -> SetTitle("Z vertex position [mm]");
0644 temp_event_zvtx -> GetYaxis() -> SetTitle("Entry");
0645 vector<float> temp_event_zvtx_vec; temp_event_zvtx_vec.clear();
0646 vector<float> temp_event_zvtx_info; temp_event_zvtx_info.clear();
0647 TLine * effi_sig_range_line = new TLine();
0648 effi_sig_range_line -> SetLineWidth(3);
0649 effi_sig_range_line -> SetLineColor(TColor::GetColor("#A08144"));
0650 effi_sig_range_line -> SetLineStyle(2);
0651 TF1 * gaus_fit = new TF1("",gaus_func,-10,10,4);
0652 gaus_fit -> SetLineColor(2);
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664 TF1 * double_gaus_fit = new TF1("",double_gaus_func,-10,10,7);
0665 double_gaus_fit -> SetLineColor(3);
0666 double_gaus_fit -> SetParNames("G1 size", "G1 mean", "G1 width", "Offset", "G2 size", "G2 mean", "G2 width");
0667 TF1 * gaus_1 = new TF1("",gaus_func,-10,10,4);
0668 gaus_1 -> SetLineColor(6);
0669 gaus_1 -> SetLineStyle(7);
0670 TF1 * gaus_2 = new TF1("",gaus_func,-10,10,4);
0671 gaus_2 -> SetLineColor(6);
0672 gaus_2 -> SetLineStyle(7);
0673
0674 double N_good_event = 0;
0675
0676 TH2F * Good_inner_outer_pos_xy_nzB = new TH2F("","Good_inner_outer_pos_xy_nzB",360,-150,150,360,-150,150);
0677 Good_inner_outer_pos_xy_nzB -> SetStats(0);
0678 Good_inner_outer_pos_xy_nzB -> GetXaxis() -> SetTitle("X axis");
0679 Good_inner_outer_pos_xy_nzB -> GetYaxis() -> SetTitle("Y axis");
0680
0681 TH2F * Good_inner_outer_pos_xy_nzA = new TH2F("","Good_inner_outer_pos_xy_nzA",360,-150,150,360,-150,150);
0682 Good_inner_outer_pos_xy_nzA -> SetStats(0);
0683 Good_inner_outer_pos_xy_nzA -> GetXaxis() -> SetTitle("X axis");
0684 Good_inner_outer_pos_xy_nzA -> GetYaxis() -> SetTitle("Y axis");
0685
0686 TH2F * Good_inner_outer_pos_xy_pzA = new TH2F("","Good_inner_outer_pos_xy_pzA",360,-150,150,360,-150,150);
0687 Good_inner_outer_pos_xy_pzA -> SetStats(0);
0688 Good_inner_outer_pos_xy_pzA -> GetXaxis() -> SetTitle("X axis");
0689 Good_inner_outer_pos_xy_pzA -> GetYaxis() -> SetTitle("Y axis");
0690
0691 TH2F * Good_inner_outer_pos_xy_pzB = new TH2F("","Good_inner_outer_pos_xy_pzB",360,-150,150,360,-150,150);
0692 Good_inner_outer_pos_xy_pzB -> SetStats(0);
0693 Good_inner_outer_pos_xy_pzB -> GetXaxis() -> SetTitle("X axis");
0694 Good_inner_outer_pos_xy_pzB -> GetYaxis() -> SetTitle("Y axis");
0695
0696 TH2F * Good_track_space = new TH2F("","Good_track_space",200,-300,300,200,-300,300);
0697 Good_track_space -> SetStats(0);
0698 Good_track_space -> GetXaxis() -> SetTitle("X axis");
0699 Good_track_space -> GetYaxis() -> SetTitle("Y axis");
0700
0701
0702
0703
0704 TF1 * zvtx_finder = new TF1("zvtx_finder","pol0",-1,3000);
0705
0706
0707 vector<vector<double>> good_track_xy_vec; good_track_xy_vec.clear();
0708 vector<vector<double>> good_track_rz_vec; good_track_rz_vec.clear();
0709 vector<vector<double>> good_comb_rz_vec; good_comb_rz_vec.clear();
0710 vector<vector<double>> good_comb_xy_vec; good_comb_xy_vec.clear();
0711 vector<vector<double>> good_comb_phi_vec; good_comb_phi_vec.clear();
0712 vector<vector<double>> good_tracklet_rz; good_tracklet_rz.clear();
0713 TLine * track_line = new TLine();
0714 track_line -> SetLineWidth(1);
0715 track_line -> SetLineColorAlpha(38,0.5);
0716
0717 TLine * coord_line = new TLine();
0718 coord_line -> SetLineWidth(1);
0719 coord_line -> SetLineColor(16);
0720 coord_line -> SetLineStyle(2);
0721
0722
0723 vector<float> avg_event_zvtx_vec; avg_event_zvtx_vec.clear();
0724 TH1F * avg_event_zvtx = new TH1F("","avg_event_zvtx",125,zvtx_hist_l,zvtx_hist_r);
0725
0726
0727
0728 avg_event_zvtx -> SetLineColor(TColor::GetColor("#1A3947"));
0729 avg_event_zvtx -> SetLineWidth(2);
0730 avg_event_zvtx -> GetYaxis() -> SetTitle("Entry");
0731 avg_event_zvtx -> GetXaxis() -> SetTitle("Z vertex position [mm]");
0732 avg_event_zvtx -> GetYaxis() -> SetRangeUser(0,50);
0733 avg_event_zvtx -> SetTitleSize(0.06, "X");
0734 avg_event_zvtx -> SetTitleSize(0.06, "Y");
0735 avg_event_zvtx -> GetXaxis() -> SetTitleOffset (0.82);
0736 avg_event_zvtx -> GetYaxis() -> SetTitleOffset (1.1);
0737 avg_event_zvtx -> GetXaxis() -> CenterTitle(true);
0738 avg_event_zvtx -> GetYaxis() -> CenterTitle(true);
0739 avg_event_zvtx -> GetXaxis() -> SetNdivisions (505);
0740
0741 TH1F * zvtx_evt_width = new TH1F("","zvtx_evt_width",150,0,800);
0742 zvtx_evt_width -> GetXaxis() -> SetTitle(" mm ");
0743 zvtx_evt_width -> GetYaxis() -> SetTitle("entry");
0744
0745 TH2F * zvtx_evt_fitError_corre = new TH2F("","zvtx_evt_fitError_corre",200,0,10000,200,0,20);
0746 zvtx_evt_fitError_corre -> GetXaxis() -> SetTitle(" # of clusters ");
0747 zvtx_evt_fitError_corre -> GetYaxis() -> SetTitle(" #pm mm ");
0748
0749 TH2F * zvtx_evt_width_corre = new TH2F("","zvtx_evt_width_corre",200,0,10000,200,0,300);
0750 zvtx_evt_width_corre -> GetXaxis() -> SetTitle(" # of clusters ");
0751 zvtx_evt_width_corre -> GetYaxis() -> SetTitle(" mm ");
0752
0753 TH2F * zvtx_evt_nclu_corre = new TH2F("","zvtx_evt_nclu_corre",200,0,10000,200,-500,500);
0754 zvtx_evt_nclu_corre -> GetXaxis() -> SetTitle(" # of clusters ");
0755 zvtx_evt_nclu_corre -> GetYaxis() -> SetTitle(" zvtx [mm] ");
0756 zvtx_evt_nclu_corre -> GetXaxis() -> SetNdivisions (505);
0757
0758 TH1F * width_density = new TH1F("","width_density",200,0,1);
0759 width_density -> GetXaxis() -> SetTitle(" N good zvtx / width ");
0760 width_density -> GetYaxis() -> SetTitle(" Entry ");
0761
0762 int inner_1_check = 0; int inner_2_check = 0; int inner_3_check = 0; int inner_4_check = 0;
0763 int outer_1_check = 0; int outer_2_check = 0; int outer_3_check = 0; int outer_4_check = 0;
0764 vector<int> used_outer_check(temp_sPH_outer_nocolumn_vec.size(),0);
0765 vector<float> N_comb; vector<float> N_comb_e; vector<float> z_mid; vector<float> z_range;
0766 vector<double> effi_N_comb; vector<double> effi_z_mid; vector<double> effi_N_comb_e; vector<double> effi_z_range;
0767
0768 int N_event_pass_number = 0;
0769 int greatest_N_clu = 0;
0770
0771 if (draw_event_display) c2 -> Print(Form("%s/folder_%s_advanced/temp_event_display.pdf(",mother_folder_directory.c_str(),file_name.c_str()));
0772
0773 for (int event_i = 0; event_i < N_event; event_i++)
0774 {
0775 if (event_i % 1000 == 0) cout<<"code running... "<<event_i<<endl;
0776
0777
0778
0779 tree -> GetEntry(event_i);
0780 unsigned int length = column_vec -> size();
0781
0782 if (event_i == 13) cout<<"test, eID : "<<event_i<<" Nhits "<<N_hits<<endl;
0783
0784 if (N_hits > Nhit_cut) {continue;}
0785 if (N_hits < Nhit_cutl) {continue;}
0786
0787 N_event_pass_number += 1;
0788
0789 if (N_cluster_inner == 0 || N_cluster_outer == 0) {continue;}
0790 if (N_cluster_inner == -1 || N_cluster_outer == -1) {continue;}
0791 if ((N_cluster_inner + N_cluster_outer) < zvtx_cal_require) {continue;}
0792 if (N_cluster_inner < 10) {continue;}
0793 if (N_cluster_outer < 10) {continue;}
0794
0795
0796
0797
0798 for (int clu_i = 0; clu_i < length; clu_i++)
0799 {
0800 if (size_vec -> at(clu_i) > clu_size_cut) continue;
0801
0802 if (sum_adc_conv_vec -> at(clu_i) < clu_sum_adc_cut) continue;
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824 temp_sPH_nocolumn_vec[0].push_back( (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? x_vec -> at(clu_i) + temp_X_align : x_vec -> at(clu_i) );
0825 temp_sPH_nocolumn_vec[1].push_back( (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? y_vec -> at(clu_i) + temp_Y_align : y_vec -> at(clu_i) );
0826
0827 double clu_radius = get_radius(
0828 (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? x_vec -> at(clu_i) + temp_X_align : x_vec -> at(clu_i),
0829 (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? y_vec -> at(clu_i) + temp_Y_align : y_vec -> at(clu_i)
0830 );
0831 temp_sPH_nocolumn_rz_vec[0].push_back(z_vec -> at(clu_i));
0832 temp_sPH_nocolumn_rz_vec[1].push_back( ( phi_vec -> at(clu_i) > 180 ) ? clu_radius * -1 : clu_radius );
0833
0834
0835 if (layer_vec -> at(clu_i) == 0)
0836 temp_sPH_inner_nocolumn_vec.push_back({
0837 column_vec -> at(clu_i),
0838 avg_chan_vec -> at(clu_i),
0839 sum_adc_vec -> at(clu_i),
0840 sum_adc_conv_vec -> at(clu_i),
0841 size_vec -> at(clu_i),
0842 (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? x_vec -> at(clu_i) + temp_X_align : x_vec -> at(clu_i),
0843 (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? y_vec -> at(clu_i) + temp_Y_align : y_vec -> at(clu_i),
0844 z_vec -> at(clu_i),
0845 layer_vec -> at(clu_i),
0846 phi_vec -> at(clu_i)
0847 });
0848
0849 if (layer_vec -> at(clu_i) == 1)
0850 temp_sPH_outer_nocolumn_vec.push_back({
0851 column_vec -> at(clu_i),
0852 avg_chan_vec -> at(clu_i),
0853 sum_adc_vec -> at(clu_i),
0854 sum_adc_conv_vec -> at(clu_i),
0855 size_vec -> at(clu_i),
0856 (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? x_vec -> at(clu_i) + temp_X_align : x_vec -> at(clu_i),
0857 (phi_vec -> at(clu_i) > 90 && phi_vec -> at(clu_i) < 270 ) ? y_vec -> at(clu_i) + temp_Y_align : y_vec -> at(clu_i),
0858 z_vec -> at(clu_i),
0859 layer_vec -> at(clu_i),
0860 phi_vec -> at(clu_i)
0861 });
0862 }
0863
0864
0865 inner_1_check = 0;
0866 inner_2_check = 0;
0867 inner_3_check = 0;
0868 inner_4_check = 0;
0869 for (int inner_i = 0; inner_i < temp_sPH_inner_nocolumn_vec.size(); inner_i++) {
0870 if (temp_sPH_inner_nocolumn_vec[inner_i].phi >= 0 && temp_sPH_inner_nocolumn_vec[inner_i].phi < 90) inner_1_check = 1;
0871 if (temp_sPH_inner_nocolumn_vec[inner_i].phi >= 90 && temp_sPH_inner_nocolumn_vec[inner_i].phi < 180) inner_2_check = 1;
0872 if (temp_sPH_inner_nocolumn_vec[inner_i].phi >= 180 && temp_sPH_inner_nocolumn_vec[inner_i].phi < 270) inner_3_check = 1;
0873 if (temp_sPH_inner_nocolumn_vec[inner_i].phi >= 270 && temp_sPH_inner_nocolumn_vec[inner_i].phi < 360) inner_4_check = 1;
0874
0875 if ( (inner_1_check + inner_2_check + inner_3_check + inner_4_check) == 4 ) break;
0876 }
0877
0878 outer_1_check = 0;
0879 outer_2_check = 0;
0880 outer_3_check = 0;
0881 outer_4_check = 0;
0882 for (int outer_i = 0; outer_i < temp_sPH_outer_nocolumn_vec.size(); outer_i++) {
0883 if (temp_sPH_outer_nocolumn_vec[outer_i].phi >= 0 && temp_sPH_outer_nocolumn_vec[outer_i].phi < 90) outer_1_check = 1;
0884 if (temp_sPH_outer_nocolumn_vec[outer_i].phi >= 90 && temp_sPH_outer_nocolumn_vec[outer_i].phi < 180) outer_2_check = 1;
0885 if (temp_sPH_outer_nocolumn_vec[outer_i].phi >= 180 && temp_sPH_outer_nocolumn_vec[outer_i].phi < 270) outer_3_check = 1;
0886 if (temp_sPH_outer_nocolumn_vec[outer_i].phi >= 270 && temp_sPH_outer_nocolumn_vec[outer_i].phi < 360) outer_4_check = 1;
0887
0888 if ( (outer_1_check + outer_2_check + outer_3_check + outer_4_check) == 4 ) break;
0889 }
0890
0891
0892
0893 N_cluster_outer_pass -> Fill(temp_sPH_outer_nocolumn_vec.size());
0894 N_cluster_inner_pass -> Fill(temp_sPH_inner_nocolumn_vec.size());
0895 N_cluster_correlation -> Fill( temp_sPH_inner_nocolumn_vec.size(), temp_sPH_outer_nocolumn_vec.size() );
0896
0897 if ( (temp_sPH_inner_nocolumn_vec.size() + temp_sPH_outer_nocolumn_vec.size()) > greatest_N_clu) {greatest_N_clu = (temp_sPH_inner_nocolumn_vec.size() + temp_sPH_outer_nocolumn_vec.size());}
0898
0899 if ((temp_sPH_inner_nocolumn_vec.size() + temp_sPH_outer_nocolumn_vec.size()) > N_clu_cut || (temp_sPH_inner_nocolumn_vec.size() + temp_sPH_outer_nocolumn_vec.size()) < N_clu_cutl)
0900 {
0901 temp_event_zvtx_info = {-1000,-1000,-1000};
0902 temp_event_zvtx_vec.clear();
0903 temp_event_zvtx -> Reset("ICESM");
0904 good_track_xy_vec.clear();
0905 good_track_rz_vec.clear();
0906 good_comb_rz_vec.clear();
0907 good_comb_xy_vec.clear();
0908 good_comb_phi_vec.clear();
0909 temp_sPH_nocolumn_rz_vec.clear(); temp_sPH_nocolumn_rz_vec = vector<vector<double>>(2);
0910 temp_sPH_nocolumn_vec.clear(); temp_sPH_nocolumn_vec = vector<vector<double>>(2);
0911 temp_sPH_inner_nocolumn_vec.clear();
0912 temp_sPH_outer_nocolumn_vec.clear();
0913 continue;
0914 }
0915
0916 if ( (inner_1_check + inner_2_check + inner_3_check + inner_4_check + outer_1_check + outer_2_check + outer_3_check + outer_4_check) != 8 )
0917 {
0918 cout<<"some quater of INTT doens't work !! eID : "<<event_i<<endl;
0919 temp_event_zvtx_info = {-1000,-1000,-1000};
0920 temp_event_zvtx_vec.clear();
0921 temp_event_zvtx -> Reset("ICESM");
0922 good_track_xy_vec.clear();
0923 good_track_rz_vec.clear();
0924 good_comb_rz_vec.clear();
0925 good_comb_xy_vec.clear();
0926 good_comb_phi_vec.clear();
0927 temp_sPH_nocolumn_rz_vec.clear(); temp_sPH_nocolumn_rz_vec = vector<vector<double>>(2);
0928 temp_sPH_nocolumn_vec.clear(); temp_sPH_nocolumn_vec = vector<vector<double>>(2);
0929 temp_sPH_inner_nocolumn_vec.clear();
0930 temp_sPH_outer_nocolumn_vec.clear();
0931 continue;
0932 }
0933
0934 N_comb.clear();
0935 N_comb_e.clear();
0936
0937
0938
0939
0940
0941
0942
0943
0944
0945
0946 for ( int inner_i = 0; inner_i < temp_sPH_inner_nocolumn_vec.size(); inner_i++ )
0947 {
0948
0949 for ( int outer_i = 0; outer_i < temp_sPH_outer_nocolumn_vec.size(); outer_i++ )
0950 {
0951
0952
0953
0954 vector<double> DCA_info_vec = calculateDistanceAndClosestPoint(
0955 temp_sPH_inner_nocolumn_vec[inner_i].x, temp_sPH_inner_nocolumn_vec[inner_i].y,
0956 temp_sPH_outer_nocolumn_vec[outer_i].x, temp_sPH_outer_nocolumn_vec[outer_i].y,
0957 beam_origin.first, beam_origin.second
0958 );
0959
0960 double DCA_sign = calculateAngleBetweenVectors(
0961 temp_sPH_outer_nocolumn_vec[outer_i].x, temp_sPH_outer_nocolumn_vec[outer_i].y,
0962 temp_sPH_inner_nocolumn_vec[inner_i].x, temp_sPH_inner_nocolumn_vec[inner_i].y,
0963 beam_origin.first, beam_origin.second
0964 );
0965
0966 angle_correlation -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].phi,temp_sPH_outer_nocolumn_vec[outer_i].phi);
0967 angle_diff -> Fill(fabs(temp_sPH_inner_nocolumn_vec[inner_i].phi - temp_sPH_outer_nocolumn_vec[outer_i].phi));
0968
0969
0970 if (DCA_info_vec[0] != fabs(DCA_sign) && fabs( DCA_info_vec[0] - fabs(DCA_sign) ) > 0.1 ){
0971 cout<<"different DCA : "<<DCA_info_vec[0]<<" "<<DCA_sign<<" diff : "<<DCA_info_vec[0] - fabs(DCA_sign)<<endl;}
0972
0973 if (fabs(temp_sPH_inner_nocolumn_vec[inner_i].phi - temp_sPH_outer_nocolumn_vec[outer_i].phi) < phi_diff_cut)
0974 {
0975
0976
0977
0978
0979
0980
0981
0982
0983
0984
0985
0986
0987
0988
0989
0990
0991
0992
0993 angle_diff_inner_phi -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].phi, temp_sPH_inner_nocolumn_vec[inner_i].phi - temp_sPH_outer_nocolumn_vec[outer_i].phi);
0994
0995 if (temp_sPH_inner_nocolumn_vec[inner_i].phi > 270)
0996 angle_diff_DCA_dist -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].phi - temp_sPH_outer_nocolumn_vec[outer_i].phi, DCA_sign);
0997
0998 DCA_point -> Fill( DCA_info_vec[1], DCA_info_vec[2] );
0999
1000 z_pos_diff -> Fill( temp_sPH_inner_nocolumn_vec[inner_i].z - temp_sPH_outer_nocolumn_vec[outer_i].z );
1001 z_pos_diff_angle_diff -> Fill( temp_sPH_inner_nocolumn_vec[inner_i].z - temp_sPH_outer_nocolumn_vec[outer_i].z, temp_sPH_inner_nocolumn_vec[inner_i].phi - temp_sPH_outer_nocolumn_vec[outer_i].phi );
1002 Nhits_good -> Fill(N_hits);
1003 z_pos_inner -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].z);
1004 z_pos_outer -> Fill(temp_sPH_outer_nocolumn_vec[outer_i].z);
1005 z_pos_inner_outer -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].z, temp_sPH_outer_nocolumn_vec[outer_i].z);
1006
1007
1008 DCA_distance_inner_phi -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].phi, DCA_sign );
1009 DCA_distance_outer_phi -> Fill(temp_sPH_outer_nocolumn_vec[outer_i].phi, DCA_sign );
1010 DCA_distance_1D -> Fill(DCA_sign);
1011
1012
1013
1014
1015 }
1016
1017
1018 }
1019 }
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077 if ( draw_event_display == true && N_comb.size() > zvtx_cal_require)
1078 {
1079 TGraph * temp_event_xy = new TGraph(temp_sPH_nocolumn_vec[0].size(),&temp_sPH_nocolumn_vec[0][0],&temp_sPH_nocolumn_vec[1][0]);
1080 temp_event_xy -> SetTitle("INTT event display X-Y plane");
1081 temp_event_xy -> GetXaxis() -> SetLimits(-150,150);
1082 temp_event_xy -> GetYaxis() -> SetRangeUser(-150,150);
1083 temp_event_xy -> GetXaxis() -> SetTitle("X [mm]");
1084 temp_event_xy -> GetYaxis() -> SetTitle("Y [mm]");
1085 temp_event_xy -> SetMarkerStyle(20);
1086 temp_event_xy -> SetMarkerColor(2);
1087 temp_event_xy -> SetMarkerSize(1);
1088 TGraph * temp_event_rz = new TGraph(temp_sPH_nocolumn_rz_vec[0].size(),&temp_sPH_nocolumn_rz_vec[0][0],&temp_sPH_nocolumn_rz_vec[1][0]);
1089 temp_event_rz -> SetTitle("INTT event display r-Z plane");
1090 temp_event_rz -> GetXaxis() -> SetLimits(-500,500);
1091 temp_event_rz -> GetYaxis() -> SetRangeUser(-150,150);
1092 temp_event_rz -> GetXaxis() -> SetTitle("Z [mm]");
1093 temp_event_rz -> GetYaxis() -> SetTitle("Radius [mm]");
1094 temp_event_rz -> SetMarkerStyle(20);
1095 temp_event_rz -> SetMarkerColor(2);
1096 temp_event_rz -> SetMarkerSize(1);
1097
1098 pad_xy -> cd();
1099 temp_bkg(pad_xy, conversion_mode, peek, beam_origin, ch_pos_DB);
1100 temp_event_xy -> Draw("p same");
1101 for (int track_i = 0; track_i < good_track_xy_vec.size(); track_i++){
1102 track_line -> DrawLine(good_track_xy_vec[track_i][0],good_track_xy_vec[track_i][1],good_track_xy_vec[track_i][2],good_track_xy_vec[track_i][3]);
1103 }
1104 track_line -> Draw("l same");
1105 draw_text -> DrawLatex(0.2, 0.85, Form("eID : %i, Total event hit : %i, innter Ncluster : %i, outer Ncluster : %i",event_i,N_hits,temp_sPH_inner_nocolumn_vec.size(),temp_sPH_outer_nocolumn_vec.size()));
1106
1107 pad_rz -> cd();
1108 temp_event_rz -> Draw("ap");
1109
1110 coord_line -> DrawLine(0,-150,0,150);
1111 coord_line -> DrawLine(-500,0,500,0);
1112 for (int track_i = 0; track_i < good_track_rz_vec.size(); track_i++){
1113 track_line -> DrawLine(good_track_rz_vec[track_i][0],good_track_rz_vec[track_i][1],good_track_rz_vec[track_i][2],good_track_rz_vec[track_i][3]);
1114 }
1115 draw_text -> DrawLatex(0.2, 0.85, Form("Negative radius : Clu_{outer} > 180^{0}"));
1116
1117
1118
1119 pad_z -> cd();
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144 if(draw_event_display && (event_i % print_rate) == 0){c2 -> Print(Form("%s/folder_%s_advanced/temp_event_display.pdf",mother_folder_directory.c_str(),file_name.c_str()));}
1145 pad_xy -> Clear();
1146 pad_rz -> Clear();
1147 pad_z -> Clear();
1148
1149 temp_event_xy -> Delete();
1150 temp_event_rz -> Delete();
1151
1152
1153 }
1154
1155
1156 for ( int inner_i = 0; inner_i < temp_sPH_inner_nocolumn_vec.size(); inner_i++ )
1157 {
1158 inner_pos_xy -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].x,temp_sPH_inner_nocolumn_vec[inner_i].y);
1159 inner_outer_pos_xy -> Fill(temp_sPH_inner_nocolumn_vec[inner_i].x,temp_sPH_inner_nocolumn_vec[inner_i].y);
1160 }
1161
1162 for ( int outer_i = 0; outer_i < temp_sPH_outer_nocolumn_vec.size(); outer_i++ )
1163 {
1164 outer_pos_xy -> Fill(temp_sPH_outer_nocolumn_vec[outer_i].x,temp_sPH_outer_nocolumn_vec[outer_i].y);
1165 inner_outer_pos_xy -> Fill(temp_sPH_outer_nocolumn_vec[outer_i].x,temp_sPH_outer_nocolumn_vec[outer_i].y);
1166 }
1167
1168
1169
1170 temp_event_zvtx_info = {-1000,-1000,-1000};
1171 temp_event_zvtx_vec.clear();
1172 temp_event_zvtx -> Reset("ICESM");
1173 good_track_xy_vec.clear();
1174 good_track_rz_vec.clear();
1175 good_comb_rz_vec.clear();
1176 good_comb_xy_vec.clear();
1177 good_comb_phi_vec.clear();
1178 temp_sPH_nocolumn_rz_vec.clear(); temp_sPH_nocolumn_rz_vec = vector<vector<double>>(2);
1179 temp_sPH_nocolumn_vec.clear(); temp_sPH_nocolumn_vec = vector<vector<double>>(2);
1180 temp_sPH_inner_nocolumn_vec.clear();
1181 temp_sPH_outer_nocolumn_vec.clear();
1182 N_comb.clear();
1183 N_comb_e.clear();
1184 z_mid.clear();
1185 z_range.clear();
1186 }
1187
1188 if (draw_event_display) {c2 -> Print(Form("%s/folder_%s_advanced/temp_event_display.pdf)",mother_folder_directory.c_str(),file_name.c_str()));}
1189 c2 -> Clear();
1190 c1 -> Clear();
1191
1192
1193 c1 -> cd();
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236 TLatex *ltx = new TLatex();
1237 ltx->SetNDC();
1238 ltx->SetTextSize(0.045);
1239
1240 N_cluster_inner_pass -> Draw("hist");
1241 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1242 c1 -> Print(Form("%s/folder_%s_advanced/N_cluster_inner_pass.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1243 c1 -> Clear();
1244
1245 N_cluster_outer_pass -> Draw("hist");
1246 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1247 c1 -> Print(Form("%s/folder_%s_advanced/N_cluster_outer_pass.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1248 c1 -> Clear();
1249
1250 N_cluster_correlation -> Draw("colz0");
1251 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1252 c1 -> Print(Form("%s/folder_%s_advanced/N_cluster_correlation.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1253 c1 -> Clear();
1254
1255 DCA_point -> Draw("colz0");
1256 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1257 c1 -> Print(Form("%s/folder_%s_advanced/DCA_point_X%.3fY%.3f_.pdf",mother_folder_directory.c_str(),file_name.c_str(),beam_origin.first,beam_origin.second));
1258 c1 -> Clear();
1259
1260 DCA_distance_inner_phi -> Draw("colz0");
1261 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1262 c1 -> Print(Form("%s/folder_%s_advanced/DCA_distance_inner_phi_X%.3fY%.3f_.pdf",mother_folder_directory.c_str(),file_name.c_str(),beam_origin.first,beam_origin.second));
1263 c1 -> Clear();
1264
1265
1266 TH2F * DCA_distance_inner_phi_peak = (TH2F*)DCA_distance_inner_phi -> Clone();
1267 TF1 * cos_fit = new TF1("cos_fit",cos_func,0,360,4);
1268 cos_fit -> SetParNames("[A]", "[B]", "[C]", "[D]");
1269 cos_fit -> SetParameters(6.5, 0.015, -185, 0.3);
1270 cos_fit -> SetLineColor(2);
1271 TH2F_threshold(DCA_distance_inner_phi_peak,60);
1272 TProfile * DCA_distance_inner_phi_peak_profile = DCA_distance_inner_phi_peak->ProfileX();
1273 DCA_distance_inner_phi_peak_profile -> Fit(cos_fit,"N","",50,250);
1274
1275
1276 DCA_distance_inner_phi_peak -> Draw("colz0");
1277 DCA_distance_inner_phi_peak_profile -> Draw("same");
1278 cos_fit -> Draw("l same");
1279 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1280 c1 -> Print(Form("%s/folder_%s_advanced/DCA_distance_inner_phi_peak_X%.3fY%.3f_.pdf",mother_folder_directory.c_str(),file_name.c_str(),beam_origin.first,beam_origin.second));
1281 c1 -> Clear();
1282
1283
1284 DCA_distance_outer_phi -> Draw("colz0");
1285 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1286 c1 -> Print(Form("%s/folder_%s_advanced/DCA_distance_outer_phi_X%.3fY%.3f_.pdf",mother_folder_directory.c_str(),file_name.c_str(),beam_origin.first,beam_origin.second));
1287 c1 -> Clear();
1288
1289 z_pos_inner_outer -> Draw("colz0");
1290 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1291 c1 -> Print(Form("%s/folder_%s_advanced/z_pos_inner_outer.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1292 c1 -> Clear();
1293
1294 z_pos_inner -> Draw("hist");
1295 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1296 c1 -> Print(Form("%s/folder_%s_advanced/z_pos_inner.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1297 c1 -> Clear();
1298
1299 z_pos_outer -> Draw("hist");
1300 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1301 c1 -> Print(Form("%s/folder_%s_advanced/z_pos_outer.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1302 c1 -> Clear();
1303
1304 Nhits_good -> Draw("hist");
1305 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1306 c1 -> Print(Form("%s/folder_%s_advanced/Nhits_good.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1307 c1 -> Clear();
1308
1309 angle_correlation -> Draw("colz0");
1310 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1311 c1 -> Print(Form("%s/folder_%s_advanced/angle_correlation.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1312 c1 -> Clear();
1313
1314 z_pos_diff -> Draw("hist");
1315 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1316 c1 -> Print(Form("%s/folder_%s_advanced/z_pos_diff.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1317 c1 -> Clear();
1318
1319 z_pos_diff_angle_diff -> Draw("colz0");
1320 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1321 c1 -> Print(Form("%s/folder_%s_advanced/z_pos_diff_angle_diff.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1322 c1 -> Clear();
1323
1324
1325 double_gaus_fit -> SetParameters(angle_diff -> GetBinContent(angle_diff -> GetMaximumBin()), angle_diff -> GetBinCenter(angle_diff -> GetMaximumBin()), 1, 0, angle_diff -> GetBinContent(angle_diff -> GetMaximumBin())/2., angle_diff -> GetBinCenter(angle_diff -> GetMaximumBin()), 3);
1326
1327 angle_diff -> Fit(double_gaus_fit,"N");
1328 gaus_1->SetParameters(double_gaus_fit -> GetParameter(0),double_gaus_fit -> GetParameter(1), double_gaus_fit -> GetParameter(2), 0);
1329 angle_diff -> Draw("hist");
1330 angle_diff -> SetMinimum(0);
1331 gaus_1 -> Draw("lsame");
1332
1333 double_gaus_fit -> Draw("lsame");
1334 draw_text -> DrawLatex(0.4, 0.87, Form("Sig. gaus mean : %.3f degree", double_gaus_fit -> GetParameter(1)));
1335 draw_text -> DrawLatex(0.4, 0.83, Form("Sig. gaus width : %.3f degree", double_gaus_fit -> GetParameter(2)));
1336 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1337 c1 -> Print(Form("%s/folder_%s_advanced/angle_diff.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1338 c1 -> Clear();
1339
1340
1341 double_gaus_fit -> SetParameters(DCA_distance_1D -> GetBinContent(DCA_distance_1D -> GetMaximumBin()), DCA_distance_1D -> GetBinCenter(DCA_distance_1D -> GetMaximumBin()), 1, 0, DCA_distance_1D -> GetBinContent(DCA_distance_1D -> GetMaximumBin())/2., DCA_distance_1D -> GetBinCenter(DCA_distance_1D -> GetMaximumBin()), 3);
1342
1343 DCA_distance_1D -> Fit(double_gaus_fit,"N");
1344 gaus_1->SetParameters(double_gaus_fit -> GetParameter(0),double_gaus_fit -> GetParameter(1), double_gaus_fit -> GetParameter(2), 0);
1345 DCA_distance_1D -> SetMinimum(0);
1346 DCA_distance_1D -> Draw("hist");
1347
1348 double_gaus_fit -> Draw("lsame");
1349 gaus_1 -> Draw("lsame");
1350 draw_text -> DrawLatex(0.2, 0.87, Form("Sig. gaus mean : %.3f mm", double_gaus_fit -> GetParameter(1)));
1351 draw_text -> DrawLatex(0.2, 0.83, Form("Sig. gaus width : %.3f mm", double_gaus_fit -> GetParameter(2)));
1352 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1353 c1 -> Print(Form("%s/folder_%s_advanced/DCA_distance_1D_X%.3fY%.3f_.pdf",mother_folder_directory.c_str(),file_name.c_str(),beam_origin.first,beam_origin.second));
1354 c1 -> Clear();
1355
1356
1357 angle_diff_DCA_dist -> Draw("colz0");
1358 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1359 c1 -> Print(Form("%s/folder_%s_advanced/angle_diff_DCA_dist.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1360 c1 -> Clear();
1361
1362 angle_diff_inner_phi -> Draw("colz0");
1363 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1364 c1 -> Print(Form("%s/folder_%s_advanced/angle_diff_inner_phi.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1365 c1 -> Clear();
1366
1367 inner_pos_xy -> Draw("colz0");
1368 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1369 c1 -> Print(Form("%s/folder_%s_advanced/inner_pos_xy.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1370 c1 -> Clear();
1371
1372 outer_pos_xy -> Draw("colz0");
1373 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1374 c1 -> Print(Form("%s/folder_%s_advanced/outer_pos_xy.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1375 c1 -> Clear();
1376
1377 inner_outer_pos_xy -> Draw("colz0");
1378 ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
1379 c1 -> Print(Form("%s/folder_%s_advanced/inner_outer_pos_xy.pdf",mother_folder_directory.c_str(),file_name.c_str()));
1380 c1 -> Clear();
1381
1382 cout<<"the geatest N clu event under the fNhits cut : "<<greatest_N_clu<<endl;
1383 }