Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include "sPhenixStyle.C"
0002 
0003 void INTT_centrality()
0004 {
0005     string mother_folder_directory = "/sphenix/user/ChengWei/INTT/INTT_commissioning/ZeroField/20869";
0006     string file_name = "beam_inttall-00020869-0000_event_base_ana_cluster_full_survey_3.32_excludeR40000_200kEvent_3HotCut";
0007     SetsPhenixStyle();
0008 
0009     TFile * file_in = new TFile(Form("%s/%s.root",mother_folder_directory.c_str(),file_name.c_str()),"read");
0010     TTree * tree = (TTree *)file_in->Get("tree_clu");
0011 
0012     int N_hits;
0013     int N_cluster_inner;
0014     int N_cluster_outer;
0015     vector<int>* column_vec = new vector<int>();
0016     vector<double>* avg_chan_vec = new vector<double>();
0017     vector<int>* sum_adc_vec = new vector<int>();
0018     vector<int>* sum_adc_conv_vec = new vector<int>();
0019     vector<int>* size_vec = new vector<int>();
0020     vector<double>* x_vec = new vector<double>();
0021     vector<double>* y_vec = new vector<double>();
0022     vector<double>* z_vec = new vector<double>();
0023     vector<int>* layer_vec = new vector<int>();
0024     vector<double>* phi_vec = new vector<double>();
0025 
0026     tree -> SetBranchStatus("*",0);
0027     tree -> SetBranchStatus("nclu_inner",1);
0028     tree -> SetBranchStatus("nclu_outer",1);
0029     tree -> SetBranchAddress("nclu_inner",&N_cluster_inner);
0030     tree -> SetBranchAddress("nclu_outer",&N_cluster_outer);
0031     
0032     // tree -> SetBranchAddress("nhits",&N_hits);
0033     // tree -> SetBranchAddress("column", &column_vec);
0034     // tree -> SetBranchAddress("avg_chan", &avg_chan_vec);
0035     // tree -> SetBranchAddress("sum_adc", &sum_adc_vec);
0036     // tree -> SetBranchAddress("sum_adc_conv", &sum_adc_conv_vec);
0037     // tree -> SetBranchAddress("size", &size_vec);
0038     // tree -> SetBranchAddress("x", &x_vec);
0039     // tree -> SetBranchAddress("y", &y_vec);
0040     // tree -> SetBranchAddress("z", &z_vec);
0041     // tree -> SetBranchAddress("layer", &layer_vec);
0042     // tree -> SetBranchAddress("phi", &phi_vec);
0043 
0044     TLine * coord_line = new TLine();
0045     coord_line -> SetLineWidth(1);
0046     coord_line -> SetLineColor(2);
0047     // coord_line -> SetLineStyle(2);
0048 
0049     TH1F * INTT_N_clu = new TH1F("","",100,0,8000);
0050     INTT_N_clu -> GetXaxis() -> SetTitle("N clusters");
0051     INTT_N_clu -> GetYaxis() -> SetTitle("Entry");
0052 
0053     vector<long long>N_clu_vec; N_clu_vec.clear();
0054 
0055     for (int i = 0; i < tree -> GetEntries(); i++)
0056     {
0057         tree -> GetEntry(i);
0058 
0059         if (N_cluster_inner == -1 || N_cluster_outer == -1) continue;
0060 
0061         INTT_N_clu -> Fill(N_cluster_inner + N_cluster_outer);
0062         N_clu_vec.push_back(N_cluster_inner + N_cluster_outer);
0063     }
0064 
0065     double total_entry = INTT_N_clu -> Integral(1,100);
0066 
0067     int sort_clu_index[N_clu_vec.size()];
0068     cout<<N_clu_vec.size()<<endl;
0069     TMath::Sort(int(N_clu_vec.size()), &N_clu_vec[0], sort_clu_index);
0070 
0071     
0072     TCanvas * c1 = new TCanvas("","",1200,800);
0073     INTT_N_clu -> Draw("hist");
0074     c1 -> SetLogy(1);
0075 
0076     for (int i = 1; i < 20; i++)
0077     {
0078         cout<<"centrality line : "<<i * 5<<" %%, "<< int(total_entry * (i * 5. /100.))<<" entry_line : "<<N_clu_vec[ sort_clu_index[ int(total_entry * (i * 5. /100.)) ] ]<<endl;
0079 
0080         coord_line -> DrawLine(N_clu_vec[ sort_clu_index[ int(total_entry * (i * 5. /100.)) ] ], 0, N_clu_vec[ sort_clu_index[ int(total_entry * (i * 5. /100.)) ] ], INTT_N_clu -> GetBinContent( int( N_clu_vec[ sort_clu_index[ int(total_entry * (i * 5. /100.)) ] ] / double(INTT_N_clu -> GetBinWidth(1)) ) + 1 ));
0081     }
0082 
0083     TLatex *ltx = new TLatex();
0084     ltx->SetNDC();
0085     ltx->SetTextSize(0.045);
0086     ltx->DrawLatex(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, "#it{#bf{sPHENIX INTT}} Work-in-progress");
0087     ltx->DrawLatex(0.48, 0.835, "Run 20869");
0088     ltx->DrawLatex(0.48, 0.785, "Au+Au #sqrt{s_{NN}} = 200 GeV");
0089     ltx->DrawLatex(0.48, 0.735, "Interval : 5%");
0090 
0091     c1 -> Print(Form("%s/folder_%s_advanced/INTT_centrality.pdf",mother_folder_directory.c_str(),file_name.c_str()));
0092     
0093 
0094 }