Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:11:55

0001 // #include "DAC_Scan_ladder.h"
0002 //#include "InttConversion.h"
0003 #include "/sphenix/user/ChengWei/INTT/INTT_commissioning/INTT_CW/INTT_commissioning/DAC_Scan/InttClustering.h"
0004 #include "sigmaEff.h"
0005 #include "sPhenixStyle.C"
0006 
0007 // todo : the number of number is given by the adc_setting_run !!!
0008 // todo : also the range of the hist.
0009 // todo : the adc follows the following convention
0010 // todo : 1. the increment has to be 4
0011 // todo : remember to check the "adc_conv"
0012 // vector<vector<int>> adc_setting_run = {  
0013 //     // {8  , 12 , 16 , 20 , 24 , 28 , 32 , 36 },
0014 //     // {28 , 32 , 36 , 40 , 44 , 48 , 52 , 56 },
0015 //     {48 , 52 , 56 , 60 , 64 , 68 , 72 , 76 }, // note : 3
0016 //     {68 , 72 , 76 , 80 , 84 , 88 , 92 , 96 }, // note : 4
0017 //     {88 , 92 , 96 , 100, 104, 108, 112, 116}, // note : 5
0018 //     {108, 112, 116, 120, 124, 128, 132, 136}, // note : 6
0019 //     {128, 132, 136, 140, 144, 148, 152, 156}, // note : 7
0020 //     // {148, 152, 156, 160, 164, 168, 172, 176},
0021 //     // {168, 172, 176, 180, 184, 188, 192, 196},
0022 //     // {188, 192, 196, 200, 204, 208, 212, 216}
0023 // };
0024 
0025 // vector<vector<int>> adc_setting_run = {  
0026 //     {15, 30, 60, 90, 120, 150, 180, 210, 240}
0027 //     // {15, 30, 50, 70, 90, 110, 130, 150,170}
0028 //     // {8  , 12 , 16 , 20 , 24 , 28 , 32 , 36 },
0029 //     // {28 , 32 , 36 , 40 , 44 , 48 , 52 , 56 },
0030 //     // {48 , 52 , 56 , 60 , 64 , 68 , 72 , 76 }, // note : 3
0031 //     // {68 , 72 , 76 , 80 , 84 , 88 , 92 , 96 }, // note : 4
0032 //     // {88 , 92 , 96 , 100, 104, 108, 112, 116}, // note : 5
0033 //     // {108, 112, 116, 120, 124, 128, 132, 136}, // note : 6
0034 //     // {128, 132, 136, 140, 144, 148, 152, 156}, // note : 7
0035 //     // {148, 152, 156, 160, 164, 168, 172, 176},
0036 //     // {168, 172, 176, 180, 184, 188, 192, 196},
0037 //     // {188, 192, 196, 200, 204, 208, 212, 216}
0038 // };
0039 
0040 // TString color_code_2[8] = {"#CC768D","#19768D","#DDA573","#009193","#6E9193","#941100","#A08144","#517E66"};
0041 
0042 // struct full_hit_info {
0043 //     int FC;
0044 //     int chip_id;
0045 //     int chan_id;
0046 //     int adc;
0047 // };
0048 
0049 
0050 // struct ladder_info {
0051 //     int FC;
0052 //     TString Port;
0053 //     int ROC;
0054 //     int Direction; // note : 0 : south, 1 : north 
0055 // };
0056 
0057 // struct z_str {
0058 //     int nclu_inner;
0059 //     int nclu_outer;
0060 //     double zvtx;
0061 //     double zvtxE;
0062 //     double rangeL;
0063 //     double rangeR;
0064 //     int N_good;
0065 //     double width_density;
0066 // };
0067 
0068 // double get_radius(double x, double y)
0069 // {
0070 //     return sqrt(pow(x,2)+pow(y,2));
0071 // }
0072 
0073 // double get_radius_sign(double x, double y)
0074 // {
0075 //     double phi = ((y) < 0) ? atan2((y),(x)) * (180./TMath::Pi()) + 360 : atan2((y),(x)) * (180./TMath::Pi());
0076     
0077 //     return (phi > 180) ? sqrt(pow(x,2)+pow(y,2)) * -1 : sqrt(pow(x,2)+pow(y,2)); 
0078 // }
0079 
0080 // 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)
0081 // {
0082 //  if (setgrid_bool == true) {pad -> SetGrid (1, 1);}
0083 //  pad -> SetLeftMargin   (left);
0084 //  pad -> SetRightMargin  (right);
0085 //  pad -> SetTopMargin    (top);
0086 //  pad -> SetBottomMargin (bottom);
0087 //     pad -> SetTicks(1,1);
0088 //     if (set_logY == true)
0089 //     {
0090 //         pad -> SetLogy (1);
0091 //     }
0092     
0093 // }
0094 
0095 // std::vector<double> calculateDistanceAndClosestPoint(double x1, double y1, double x2, double y2, double target_x, double target_y) {
0096     
0097 //     if (x1 != x2)
0098 //     {
0099 //         // Calculate the slope and intercept of the line passing through (x1, y1) and (x2, y2)
0100 //         double a = (y2 - y1) / (x2 - x1);
0101 //         double b = y1 - a * x1;
0102 
0103 //         // cout<<"slope : y="<<a<<"x+"<<b<<endl;
0104         
0105 //         // Calculate the closest distance from (target_x, target_y) to the line y = ax + b
0106 //         double closest_distance = std::abs(a * target_x - target_y + b) / std::sqrt(a * a + 1);
0107 
0108 //         // Calculate the coordinates of the closest point (Xc, Yc) on the line y = ax + b
0109 //         double Xc = (target_x + a * target_y - a * b) / (a * a + 1);
0110 //         double Yc = a * Xc + b;
0111 
0112 //         return { closest_distance, Xc, Yc };
0113 //     }
0114 //     else 
0115 //     {
0116 //         double closest_distance = std::abs(x1 - target_x);
0117 //         double Xc = x1;
0118 //         double Yc = target_y;
0119 
0120 //         return { closest_distance, Xc, Yc };
0121 //     }
0122     
0123     
0124 // }
0125 
0126 // double get_z_vertex(clu_info inner_clu, clu_info outer_clu, double target_x, double target_y)
0127 // {
0128 //     // note : x = z, 
0129 //     // note : y = radius
0130 //     double inner_clu_r = sqrt(pow(inner_clu.x,2)+ pow(inner_clu.y,2));
0131 //     double outer_clu_r = sqrt(pow(outer_clu.x,2)+ pow(outer_clu.y,2));
0132 //     double target_r    = sqrt(pow(target_x,2)   + pow(target_y,2));
0133 
0134 //     // Use the slope equation (y = ax + b) to calculate the x-coordinate for the target y
0135 //     if ( fabs(outer_clu.z - inner_clu.z) < 0.00001 ){
0136 //         return outer_clu.z;
0137 //     }
0138 //     else {
0139 //         double slope = (outer_clu_r - inner_clu_r) / (outer_clu.z - inner_clu.z);
0140 //         double yIntercept = inner_clu_r - slope * inner_clu.z;
0141 //         double xCoordinate = (target_r - yIntercept) / slope;
0142 //         return xCoordinate;
0143 //     }
0144     
0145 // }
0146 
0147 // // Function to calculate the angle between two vectors in degrees using the cross product
0148 // double calculateAngleBetweenVectors(double x1, double y1, double x2, double y2, double targetX, double targetY) {
0149 //     // Calculate the vectors vector_1 (point_1 to point_2) and vector_2 (point_1 to target)
0150 //     double vector1X = x2 - x1;
0151 //     double vector1Y = y2 - y1;
0152 
0153 //     double vector2X = targetX - x1;
0154 //     double vector2Y = targetY - y1;
0155 
0156 //     // Calculate the cross product of vector_1 and vector_2 (z-component)
0157 //     double crossProduct = vector1X * vector2Y - vector1Y * vector2X;
0158     
0159 //     // cout<<" crossProduct : "<<crossProduct<<endl;
0160 
0161 //     // Calculate the magnitudes of vector_1 and vector_2
0162 //     double magnitude1 = std::sqrt(vector1X * vector1X + vector1Y * vector1Y);
0163 //     double magnitude2 = std::sqrt(vector2X * vector2X + vector2Y * vector2Y);
0164 
0165 //     // Calculate the angle in radians using the inverse tangent of the cross product and dot product
0166 //     double dotProduct = vector1X * vector2X + vector1Y * vector2Y;
0167 
0168 //     double angleInRadians = std::atan2(std::abs(crossProduct), dotProduct);
0169 //     // Convert the angle from radians to degrees and return it
0170 //     double angleInDegrees = angleInRadians * 180.0 / M_PI;
0171     
0172 //     double angleInRadians_new = std::asin( crossProduct/(magnitude1*magnitude2) );
0173 //     double angleInDegrees_new = angleInRadians_new * 180.0 / M_PI;
0174     
0175 //     // cout<<"angle : "<<angleInDegrees_new<<endl;
0176 
0177 //     double DCA_distance = sin(angleInRadians_new) * magnitude2;
0178 
0179 //     return DCA_distance;
0180 // }
0181 
0182 // double grEY_stddev (TGraphErrors * input_grr)
0183 // {
0184 //     vector<double> input_vector; input_vector.clear();
0185 //     for (int i = 0; i < input_grr -> GetN(); i++)
0186 //     {  
0187 //         input_vector.push_back( input_grr -> GetPointY(i) );
0188 //     }
0189 
0190 //  double sum=0;
0191 //  double average;
0192 //  double sum_subt = 0;
0193 //  for (int i=0; i<input_vector.size(); i++)
0194 //      {
0195 //          sum+=input_vector[i];
0196 
0197 //      }
0198 //  average=sum/input_vector.size();
0199 //  //cout<<"average is : "<<average<<endl;
0200 
0201 //  for (int i=0; i<input_vector.size(); i++)
0202 //      {
0203 //          //cout<<input_vector[i]-average<<endl;
0204 //          sum_subt+=pow((input_vector[i]-average),2);
0205 
0206 //      }
0207 //  //cout<<"sum_subt : "<<sum_subt<<endl;
0208 //  double stddev;
0209 //  stddev=sqrt(sum_subt/(input_vector.size()-1));  
0210 //  return stddev;
0211 // }    
0212 
0213 // pair<double, double> mirrorPolynomial(double a, double b) {
0214 //     // Interchange 'x' and 'y'
0215 //     double mirroredA = 1.0 / a;
0216 //     double mirroredB = -b / a;
0217 
0218 //     return {mirroredA, mirroredB};
0219 // }
0220 
0221 // // note : pair<reduced chi2, eta of the track>
0222 // // note : vector : {r,z}
0223 // // note : p0 : vertex point {r,z,zerror}
0224 // // note : p1 : inner layer
0225 // // note : p2 : outer layer
0226 // pair<double,double> Get_eta(vector<double>p0, vector<double>p1, vector<double>p2)
0227 // {
0228 //     vector<double> r_vec  = {p0[0], p1[0], p2[0]}; 
0229 //     vector<double> z_vec  = {p0[1], p1[1], p2[1]}; 
0230 //     vector<double> re_vec = {0, 0, 0}; 
0231 //     vector<double> ze_vec = {p0[2], ( fabs( p1[1] ) < 130 ) ? 8. : 10., ( fabs( p2[1] ) < 130 ) ? 8. : 10.}; 
0232 
0233 //     // note : swap the r and z, to have easier fitting 
0234 //     // note : in principle, Z should be in the x axis, R should be in the Y axis
0235 //     TGraphErrors * track_gr = new TGraphErrors(3,&r_vec[0],&z_vec[0],&re_vec[0],&ze_vec[0]);    
0236     
0237 //     double vertical_line = ( fabs( grEY_stddev(track_gr) ) < 0.00001 ) ? 1 : 0;
0238     
0239 //     if (vertical_line) {return {0,0};}
0240 //     else 
0241 //     {
0242 //         TF1 * fit_rz = new TF1("fit_rz","pol1",-500,500);
0243 //         fit_rz -> SetParameters(0,0);
0244 
0245 //         track_gr -> Fit(fit_rz,"NQ");
0246 
0247 //         pair<double,double> ax_b = mirrorPolynomial(fit_rz -> GetParameter(1),fit_rz -> GetParameter(0));
0248 
0249 //         track_gr -> Delete(); 
0250 //         return  {(fit_rz -> GetChisquare() / double(fit_rz -> GetNDF())), -1 * TMath::Log( fabs( tan( atan2(ax_b.first, (ax_b.first > 0) ? 1. : -1. ) / 2 ) ) )};
0251 
0252 //     }
0253 
0254 // }
0255 
0256 // // note : vector : {r,z}
0257 // // note : p0 : vertex point {r,z,zerror}
0258 // // note : p1 : another point from detector
0259 // // note : since only two points -> no strip width considered
0260 // double Get_eta_2P(vector<double>p0, vector<double>p1)
0261 // {    
0262 //     return  -1 * TMath::Log( fabs( tan( atan2(p1[0] - p0[0], p1[1] - p0[1]) / 2 ) ) );
0263 // }
0264 
0265 // double Get_extrapolation(double given_y, double p0x, double p0y, double p1x, double p1y) // note : x : z, y : r
0266 // {
0267 //     if ( fabs(p0x - p1x) < 0.00001 ){ // note : the line is vertical (if z is along the x axis)
0268 //         return p0x;
0269 //     }
0270 //     else {
0271 //         double slope = (p1y - p0y) / (p1x - p0x);
0272 //         double yIntercept = p0y - slope * p0x;
0273 //         double xCoordinate = (given_y - yIntercept) / slope;
0274 //         return xCoordinate;
0275 //     }
0276 // }
0277 
0278 // pair<double,double> Get_possible_zvtx(double rvtx, vector<double> p0, vector<double> p1) // note : inner p0, outer p1, vector {r,z}, -> {y,x}
0279 // {
0280 //     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.}; // note : vector {left edge, right edge}
0281 //     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.}; // note : vector {left edge, right edge}
0282 
0283 //     double edge_first  = Get_extrapolation(rvtx,p0_z_edge[0],p0[0],p1_z_edge[1],p1[0]);
0284 //     double edge_second = Get_extrapolation(rvtx,p0_z_edge[1],p0[0],p1_z_edge[0],p1[0]);
0285 
0286 //     double mid_point = (edge_first + edge_second) / 2.;
0287 //     double possible_width = fabs(edge_first - edge_second) / 2.;
0288 
0289 //     return {mid_point, possible_width}; // note : first : mid point, second : width
0290 
0291 // }
0292 
0293 // vector<z_str> Get_INTT_Z (string full_directory, int z_capacity)
0294 // {
0295 //     cout<<"----------------- loading the Z information ----------------- "<<endl;
0296 //     int z_eID, z_nclu_inner, z_nclu_outer, z_N_good;
0297 //     double z_zvtx, z_zvtxE, z_rangeL, z_rangeR, z_width_density;
0298 
0299 //     TFile * z_file_in = new TFile( Form("%s",full_directory.c_str()) ,"read"); 
0300 //     TTree * z_tree =  (TTree *)z_file_in->Get("tree_Z");
0301 //     z_tree -> SetBranchAddress("eID",&z_eID);
0302 //     z_tree -> SetBranchAddress("nclu_inner",&z_nclu_inner);
0303 //     z_tree -> SetBranchAddress("nclu_outer",&z_nclu_outer);
0304 //     z_tree -> SetBranchAddress("zvtx",&z_zvtx);
0305 //     z_tree -> SetBranchAddress("zvtxE",&z_zvtxE);
0306 //     z_tree -> SetBranchAddress("rangeL",&z_rangeL);
0307 //     z_tree -> SetBranchAddress("rangeR",&z_rangeR);
0308 //     z_tree -> SetBranchAddress("N_good",&z_N_good);
0309 //     z_tree -> SetBranchAddress("Width_density",&z_width_density);
0310 
0311 //     vector<z_str> out_vec(z_capacity,{-1,-1,-1,-1,-1,-1,-1,-1});
0312 //     // cout<<"test1"<<endl;
0313 
0314 //     for (int i = 0; i < z_tree -> GetEntries(); i++){
0315 //         z_tree -> GetEntry(i);
0316 //         // cout<<"test 0 : "<<i<<"  "<<z_eID<<endl;
0317 //         out_vec[z_eID] = {z_nclu_inner,z_nclu_outer,z_zvtx,z_zvtxE,z_rangeL,z_rangeR,z_N_good,z_width_density};
0318 //     }
0319 
0320 
0321 //     cout<<"-----------------  INTT Z info. loader done -----------------"<<endl;
0322 
0323 //     return out_vec;
0324 // }
0325 
0326 // note : use "ls *.root > file_list.txt" to create the list of the file in the folder, full directory in the file_list.txt
0327 // note : set_folder_name = "folder_xxxx"
0328 // note : server_name = "inttx"
0329 void INTT_test(/*pair<double,double>beam_origin*/)
0330 {
0331     
0332     // TCanvas * c4 = new TCanvas("","",850,800);    
0333     // c4 -> cd();
0334     
0335     // TCanvas * c2 = new TCanvas("","",2500,800);    
0336     // c2 -> cd();
0337     // TPad *pad_xy = new TPad(Form("pad_xy"), "", 0.0, 0.0, 0.33, 1.0);
0338     // Characterize_Pad(pad_xy, 0.15, 0.1, 0.1, 0.1 , 0, 0);
0339     // pad_xy -> Draw();
0340 
0341     // TPad *pad_rz = new TPad(Form("pad_rz"), "", 0.33, 0.0, 0.66, 1.0);
0342     // Characterize_Pad(pad_rz, 0.15, 0.1, 0.1, 0.1 , 0, 0);
0343     // pad_rz -> Draw();
0344 
0345     // TPad *pad_z = new TPad(Form("pad_z"), "", 0.66, 0.0, 1.0, 1.0);
0346     // Characterize_Pad(pad_z, 0.15, 0.1, 0.1, 0.1 , 0, 0);
0347     // pad_z -> Draw();
0348 
0349     // TCanvas * c1 = new TCanvas("","",1000,800);
0350     // c1 -> cd();
0351 
0352     
0353     
0354     // // string mother_folder_directory = "/home/phnxrc/INTT/cwshih/DACscan_data/zero_magnet_Takashi_used";
0355     // // string file_name = "beam_inttall-00020869-0000_event_base_ana_cluster_ideal_excludeR1500_100kEvent";
0356     // // string file_name = "beam_inttall-00020869-0000_event_base_ana_cluster_survey_1_XYAlpha_Peek_3.32mm_excludeR1500_100kEvent";
0357 
0358     // string mother_folder_directory = "/sphenix/user/ChengWei/INTT/INTT_commissioning/ZeroField/20869";
0359     // string file_name = "beam_inttall-00020869-0000_event_base_ana_cluster_survey_1_XYAlpha_Peek_3.32mm_excludeR20000_150kEvent_3HotCut";
0360 
0361     // // string mother_folder_directory = "/home/phnxrc/INTT/cwshih/DACscan_data/new_DAC_Scan_0722/AllServer/DAC2";
0362     // // string file_name = "beam_inttall-00023058-0000_event_base_ana_cluster_ideal_excludeR2000_100kEvent";
0363 
0364     // system(Form("mkdir %s/folder_%s_advanced",mother_folder_directory.c_str(),file_name.c_str()));
0365     // system(Form("mkdir %s/folder_%s_advanced/good_track",mother_folder_directory.c_str(),file_name.c_str()));
0366 
0367     // pair<double,double> beam_origin = {-0,2};
0368     // double temp_Y_align = 0.;
0369     // double temp_X_align = -0.;
0370 
0371     // double zvtx_hist_l = -500;
0372     // double zvtx_hist_r = 500;
0373 
0374     // int Nhit_cut = 20000;           // note : if (> Nhit_cut)          -> continue
0375     // int Nhit_cutl = 400;          // note : if (< Nhit_cutl)         -> continue 
0376     // int clu_size_cut = 4;           // note : if (> clu_size_cut)      -> continue
0377     // double clu_sum_adc_cut = 31;    // note : if (< clu_sum_adc_cut)   -> continue
0378     // int N_clu_cut = 15000;          // note : if (> N_clu_cut)         -> continue  unit number
0379     // int N_clu_cutl = 500;           // note : if (< N_clu_cutl)        -> continue  unit number
0380     // double phi_diff_cut = 3.5;      // note : if (< phi_diff_cut)      -> pass      unit degree
0381     // double DCA_cut = 4;             // note : if (< DCA_cut)           -> pass      unit mm
0382     // int zvtx_cal_require = 15;      // note : if (> zvtx_cal_require)  -> pass
0383     // int zvtx_draw_requireL = 15;       
0384     // int zvtx_draw_requireR = 40000;   // note : if ( zvtx_draw_requireL < event && event < zvtx_draw_requireR) -> pass
0385     // double Integrate_portion = 0.4; // todo : it was 0.6826, try to require less event, as most of the tracklets are not that useful
0386     // double Integrate_portion_final = 0.68;
0387     // bool draw_event_display = false;
0388     // int print_rate = 5;
0389     // int z_capacity = 20000; // todo : filled the Z capacity
0390 
0391     // double mean_zvtx = -198.38; // note : unit : mm
0392 
0393     // bool full_event = false;
0394     // long long used_event = 20000;
0395 
0396     // double dNdeta_upper_range = 100;
0397 
0398     // int geo_mode_id = 1;
0399     // string conversion_mode = (geo_mode_id == 0) ? "ideal" : "survey_1_XYAlpha_Peek";
0400     // double peek = 3.32405;
0401 
0402 
0403     // vector<z_str> INTT_Z = Get_INTT_Z (Form("%s/folder_%s_advanced/INTT_zvtx.root",mother_folder_directory.c_str(),file_name.c_str()), z_capacity);
0404 
0405     // TFile * file_in = new TFile(Form("%s/%s.root",mother_folder_directory.c_str(),file_name.c_str()),"read");
0406     // TTree * tree = (TTree *)file_in->Get("tree_clu");
0407     
0408     // long long N_event = (full_event == true) ? tree -> GetEntries() : used_event;
0409     // cout<<Form("N_event in file %s : %lli",file_name.c_str(), N_event)<<endl;
0410 
0411     // int N_hits;
0412     // int N_cluster_inner;
0413     // int N_cluster_outer;
0414     // vector<int>* column_vec = new vector<int>();
0415     // vector<double>* avg_chan_vec = new vector<double>();
0416     // vector<int>* sum_adc_vec = new vector<int>();
0417     // vector<int>* sum_adc_conv_vec = new vector<int>();
0418     // vector<int>* size_vec = new vector<int>();
0419     // vector<double>* x_vec = new vector<double>();
0420     // vector<double>* y_vec = new vector<double>();
0421     // vector<double>* z_vec = new vector<double>();
0422     // vector<int>* layer_vec = new vector<int>();
0423     // vector<double>* phi_vec = new vector<double>();
0424 
0425     // tree -> SetBranchStatus("*",0);
0426     // tree -> SetBranchStatus("nhits",1);
0427     // tree -> SetBranchStatus("nclu_inner",1);
0428     // tree -> SetBranchStatus("nclu_outer",1);
0429     // tree -> SetBranchStatus("column",1);
0430     // tree -> SetBranchStatus("avg_chan",1);
0431     // tree -> SetBranchStatus("sum_adc",1);
0432     // tree -> SetBranchStatus("sum_adc_conv",1);
0433     // tree -> SetBranchStatus("size",1);
0434     // tree -> SetBranchStatus("x",1);
0435     // tree -> SetBranchStatus("y",1);
0436     // tree -> SetBranchStatus("z",1);
0437     // tree -> SetBranchStatus("layer",1);
0438     // tree -> SetBranchStatus("phi",1);
0439 
0440     // tree -> SetBranchAddress("nhits",&N_hits);
0441     // tree -> SetBranchAddress("nclu_inner",&N_cluster_inner);
0442     // tree -> SetBranchAddress("nclu_outer",&N_cluster_outer);
0443 
0444     // tree -> SetBranchAddress("column", &column_vec);
0445     // tree -> SetBranchAddress("avg_chan", &avg_chan_vec);
0446     // tree -> SetBranchAddress("sum_adc", &sum_adc_vec);
0447     // tree -> SetBranchAddress("sum_adc_conv", &sum_adc_conv_vec);
0448     // tree -> SetBranchAddress("size", &size_vec);
0449     // tree -> SetBranchAddress("x", &x_vec);
0450     // tree -> SetBranchAddress("y", &y_vec);
0451     // tree -> SetBranchAddress("z", &z_vec);
0452     // tree -> SetBranchAddress("layer", &layer_vec);
0453     // tree -> SetBranchAddress("phi", &phi_vec);
0454 
0455     // // TFile * out_file = new TFile(Form("%s/folder_%s_advanced/INTT_dNdeta.root",mother_folder_directory.c_str(),file_name.c_str()),"RECREATE");
0456 
0457     // int N_hits_out, N_cluster_inner_out, N_cluster_outer_out, ntrack_out;
0458     // int eID_out;
0459     // double out_xvtx, out_yvtx, out_zvtx, out_zvtxE;
0460     // vector<double> out_inner_x;
0461     // vector<double> out_inner_y;
0462     // vector<double> out_inner_z;
0463     // vector<double> out_inner_r;
0464     // vector<double> out_inner_phi; 
0465     // vector<double> out_inner_zE;
0466     // vector<double> out_outer_x;
0467     // vector<double> out_outer_y;
0468     // vector<double> out_outer_z;
0469     // vector<double> out_outer_r;
0470     // vector<double> out_outer_phi; 
0471     // vector<double> out_outer_zE;
0472     // vector<double> out_eta;
0473     // vector<double> out_eta_rchi2;
0474 
0475     // TTree * tree_out =  new TTree ("tree_eta", "eta info.");
0476     // tree_out -> Branch("eID",&eID_out);
0477     // tree_out -> Branch("nhits",&N_hits_out);
0478     // tree_out -> Branch("nclu_inner",&N_cluster_inner_out);
0479     // tree_out -> Branch("nclu_outer",&N_cluster_outer_out);
0480     // tree_out -> Branch("ntrack",&ntrack_out);
0481     // tree_out -> Branch("xvtx",&out_xvtx);
0482     // tree_out -> Branch("yvtx",&out_yvtx);
0483     // tree_out -> Branch("zvtx",&out_zvtx);
0484     // tree_out -> Branch("zvtxE",&out_zvtxE);
0485     
0486     // tree_out -> Branch("inner_x",&out_inner_x); // note : inner
0487     // tree_out -> Branch("inner_y",&out_inner_y);
0488     // tree_out -> Branch("inner_z",&out_inner_z);
0489     // tree_out -> Branch("inner_r",&out_inner_r);
0490     // tree_out -> Branch("inner_phi",&out_inner_phi);
0491     // tree_out -> Branch("inner_zE",&out_inner_zE); 
0492     // tree_out -> Branch("outer_x",&out_outer_x); // note : outer
0493     // tree_out -> Branch("outer_y",&out_outer_y);
0494     // tree_out -> Branch("outer_z",&out_outer_z);
0495     // tree_out -> Branch("outer_r",&out_outer_r);
0496     // tree_out -> Branch("outer_phi",&out_outer_phi);
0497     // tree_out -> Branch("outer_zE",&out_outer_zE); 
0498     // tree_out -> Branch("eta",&out_eta); // note : track
0499     // tree_out -> Branch("eta_rchi",&out_eta_rchi2);
0500 
0501     // TLatex *draw_text = new TLatex();
0502     // draw_text -> SetNDC();
0503     // draw_text -> SetTextSize(0.02);
0504 
0505     // vector<clu_info> temp_sPH_inner_nocolumn_vec; temp_sPH_inner_nocolumn_vec.clear();
0506     // vector<clu_info> temp_sPH_outer_nocolumn_vec; temp_sPH_outer_nocolumn_vec.clear();
0507     // vector<vector<double>> temp_sPH_nocolumn_vec(2);
0508     // vector<vector<double>> temp_sPH_nocolumn_rz_vec(2);
0509 
0510     // TH1F * dNdeta_hist = new TH1F("","",29,-2.9,2.9);
0511     // // TH1F * dNdeta_hist = new TH1F("","",145,-2.9,2.9);
0512     // dNdeta_hist -> SetMarkerStyle(20);
0513     // dNdeta_hist -> SetMarkerSize(0.8);
0514     // dNdeta_hist -> SetMarkerColor(TColor::GetColor("#1A3947"));
0515     // dNdeta_hist -> SetLineColor(TColor::GetColor("#1A3947"));
0516     // dNdeta_hist -> SetLineWidth(2);
0517     // dNdeta_hist -> GetYaxis() -> SetTitle("dN_{ch}/d#eta");
0518     // dNdeta_hist -> GetXaxis() -> SetTitle("#eta");
0519     // dNdeta_hist -> GetYaxis() -> SetRangeUser(0,50);
0520     // dNdeta_hist -> SetTitleSize(0.06, "X");
0521     // dNdeta_hist -> SetTitleSize(0.06, "Y");
0522     // dNdeta_hist -> GetXaxis() -> SetTitleOffset (0.71);
0523     // dNdeta_hist -> GetYaxis() -> SetTitleOffset (1.1);
0524     // dNdeta_hist -> GetXaxis() -> CenterTitle(true);
0525     // dNdeta_hist -> GetYaxis() -> CenterTitle(true);
0526 
0527     // // TH1F * dNdeta_2P_inner_hist = new TH1F("","",29,-2.9,2.9);
0528     // TH1F * dNdeta_2P_inner_hist = new TH1F("","",145,-2.9,2.9);
0529     // dNdeta_2P_inner_hist -> SetMarkerStyle(20);
0530     // dNdeta_2P_inner_hist -> SetMarkerSize(0.8);
0531     // dNdeta_2P_inner_hist -> SetMarkerColor(TColor::GetColor("#1A3947"));
0532     // dNdeta_2P_inner_hist -> SetLineColor(TColor::GetColor("#1A3947"));
0533     // dNdeta_2P_inner_hist -> SetLineWidth(2);
0534     // dNdeta_2P_inner_hist -> GetYaxis() -> SetTitle("dN_{ch}/d#eta");
0535     // dNdeta_2P_inner_hist -> GetXaxis() -> SetTitle("#eta");
0536     // dNdeta_2P_inner_hist -> GetYaxis() -> SetRangeUser(0,50);
0537     // dNdeta_2P_inner_hist -> SetTitleSize(0.06, "X");
0538     // dNdeta_2P_inner_hist -> SetTitleSize(0.06, "Y");
0539     // dNdeta_2P_inner_hist -> GetXaxis() -> SetTitleOffset (0.71);
0540     // dNdeta_2P_inner_hist -> GetYaxis() -> SetTitleOffset (1.1);
0541     // dNdeta_2P_inner_hist -> GetXaxis() -> CenterTitle(true);
0542     // dNdeta_2P_inner_hist -> GetYaxis() -> CenterTitle(true);
0543 
0544     // TH1F * dNdeta_2P_outer_hist = new TH1F("","",29,-2.9,2.9);
0545     // dNdeta_2P_outer_hist -> SetMarkerStyle(20);
0546     // dNdeta_2P_outer_hist -> SetMarkerSize(0.8);
0547     // dNdeta_2P_outer_hist -> SetMarkerColor(TColor::GetColor("#1A3947"));
0548     // dNdeta_2P_outer_hist -> SetLineColor(TColor::GetColor("#1A3947"));
0549     // dNdeta_2P_outer_hist -> SetLineWidth(2);
0550     // dNdeta_2P_outer_hist -> GetYaxis() -> SetTitle("dN_{ch}/d#eta");
0551     // dNdeta_2P_outer_hist -> GetXaxis() -> SetTitle("#eta");
0552     // dNdeta_2P_outer_hist -> GetYaxis() -> SetRangeUser(0,50);
0553     // dNdeta_2P_outer_hist -> SetTitleSize(0.06, "X");
0554     // dNdeta_2P_outer_hist -> SetTitleSize(0.06, "Y");
0555     // dNdeta_2P_outer_hist -> GetXaxis() -> SetTitleOffset (0.71);
0556     // dNdeta_2P_outer_hist -> GetYaxis() -> SetTitleOffset (1.1);
0557     // dNdeta_2P_outer_hist -> GetXaxis() -> CenterTitle(true);
0558     // dNdeta_2P_outer_hist -> GetYaxis() -> CenterTitle(true);
0559 
0560     // double N_good_event = 0;
0561 
0562     // TH2F * Good_inner_outer_pos_xy_nzB = new TH2F("","Good_inner_outer_pos_xy_nzB",360,-150,150,360,-150,150);
0563     // Good_inner_outer_pos_xy_nzB -> SetStats(0);
0564     // Good_inner_outer_pos_xy_nzB -> GetXaxis() -> SetTitle("X axis");
0565     // Good_inner_outer_pos_xy_nzB -> GetYaxis() -> SetTitle("Y axis");
0566 
0567     // TH2F * Good_inner_outer_pos_xy_nzA = new TH2F("","Good_inner_outer_pos_xy_nzA",360,-150,150,360,-150,150);
0568     // Good_inner_outer_pos_xy_nzA -> SetStats(0);
0569     // Good_inner_outer_pos_xy_nzA -> GetXaxis() -> SetTitle("X axis");
0570     // Good_inner_outer_pos_xy_nzA -> GetYaxis() -> SetTitle("Y axis");
0571 
0572     // TH2F * Good_inner_outer_pos_xy_pzA = new TH2F("","Good_inner_outer_pos_xy_pzA",360,-150,150,360,-150,150);
0573     // Good_inner_outer_pos_xy_pzA -> SetStats(0);
0574     // Good_inner_outer_pos_xy_pzA -> GetXaxis() -> SetTitle("X axis");
0575     // Good_inner_outer_pos_xy_pzA -> GetYaxis() -> SetTitle("Y axis");
0576 
0577     // TH2F * Good_inner_outer_pos_xy_pzB = new TH2F("","Good_inner_outer_pos_xy_pzB",360,-150,150,360,-150,150);
0578     // Good_inner_outer_pos_xy_pzB -> SetStats(0);
0579     // Good_inner_outer_pos_xy_pzB -> GetXaxis() -> SetTitle("X axis");
0580     // Good_inner_outer_pos_xy_pzB -> GetYaxis() -> SetTitle("Y axis");
0581 
0582     // TH2F * Good_track_space = new TH2F("","Good_track_space",200,-300,300,200,-300,300);
0583     // Good_track_space -> SetStats(0);
0584     // Good_track_space -> GetXaxis() -> SetTitle("X axis");
0585     // Good_track_space -> GetYaxis() -> SetTitle("Y axis");
0586 
0587     // // dNdeta_hist -> GetXaxis() -> SetLimits(-10,10);
0588     // // dNdeta_hist -> GetXaxis() -> SetNdivisions  (505);
0589 
0590     // TF1 * zvtx_finder = new TF1("zvtx_finder","pol0",-1,3000); 
0591 
0592     
0593     // vector<vector<double>> good_track_xy_vec; good_track_xy_vec.clear();
0594     // vector<vector<double>> good_track_rz_vec; good_track_rz_vec.clear();
0595     // vector<vector<double>> good_comb_rz_vec; good_comb_rz_vec.clear();
0596     // vector<vector<double>> good_comb_xy_vec; good_comb_xy_vec.clear();
0597     // vector<vector<double>> good_comb_phi_vec; good_comb_phi_vec.clear();
0598     // vector<vector<double>> good_tracklet_rz; good_tracklet_rz.clear();
0599     // TLine * track_line = new TLine();
0600     // track_line -> SetLineWidth(1);
0601     // track_line -> SetLineColorAlpha(38,0.5);
0602 
0603     // TLine * coord_line = new TLine();
0604     // coord_line -> SetLineWidth(1);
0605     // coord_line -> SetLineColor(16);
0606     // coord_line -> SetLineStyle(2);
0607 
0608 
0609     // int N_event_pass_number = 0;
0610 
0611     // vector<double> DCA_info_vec; DCA_info_vec.clear(); 
0612     // pair<double,double> Get_eta_pair;
0613 
0614 
0615     MemInfo_t test_aaa;
0616     gSystem->GetMemInfo(&test_aaa);
0617     sleep(20);
0618 
0619     cout<<"Memory usage ? "<<test_aaa.fMemUsed<<endl;
0620 
0621 
0622 
0623 }