Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include "sPhenixStyle.C" 
0002 
0003 // a function to shift the bin content of a histogram by nbin_shift
0004 TH1D * hist_shift_inX(TH1D* hist_in, int nbin_shift)
0005 {
0006     vector<double> bin_center; bin_center.clear();
0007     vector<double> bin_content; bin_content.clear();
0008 
0009     for (int i = 1; i <= hist_in->GetNbinsX(); i++)
0010     {
0011         double hist_X_min = hist_in->GetXaxis()->GetXmin();
0012         double hist_X_max = hist_in->GetXaxis()->GetXmax();
0013         double hist_X_range = hist_X_max - hist_X_min;
0014 
0015         double shifted_bin_center = (hist_in->GetBinCenter(i) - nbin_shift < hist_X_min) ? (hist_in->GetBinCenter(i) - nbin_shift) + hist_X_range : hist_in->GetBinCenter(i) - nbin_shift;
0016 
0017         bin_center.push_back(shifted_bin_center);
0018         bin_content.push_back(hist_in->GetBinContent(i));
0019     }
0020 
0021     TH1D * hist_out = new TH1D("","",138,-10.5,127.5);
0022     hist_out -> Reset("ICESM");
0023 
0024     for (int i = 0; i < bin_center.size(); i++)
0025     {
0026         hist_out -> SetBinContent(
0027             hist_out -> FindBin(bin_center.at(i) - 0.5),
0028             bin_content.at(i)
0029         );
0030     }
0031 
0032     return hist_out;
0033 }
0034 
0035 float LeftMargin = 0.14;
0036 float RightMargin = 0.07;
0037 
0038 std::string sPH_label_data = "Preliminary";
0039 std::string Collision_str = "Au+Au#kern[0.25]{#sqrt{s_{NN}}} = 200 GeV";
0040 std::string RHIC_str = "Bunch crossing interval: 2 BCOs";
0041 std::string ReadOut_str = "INTT Trigger+Extended readout";
0042 std::string sPHENIX_date = "March 20, 2025";
0043 
0044 std::string file_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Feb102025/INTT_timing_withTrig30cm/completed";
0045 std::string file_name = "BcoDiffNtuple_54280_clonehitremoveBCO_hotchannelremove_hitQA_checkclonehit_merged.root";
0046 std::string hist_name_noindex = "all_felix_BcoDiffHist_";
0047 
0048 // void plot_two_panels() {
0049 //     // Create a canvas
0050 //     TCanvas *c = new TCanvas("c", "Two Panels Example", 800, 800);
0051 //     c->Divide(1, 2, 0, 0); // Divide into 2 vertical pads with no margins
0052     
0053 //     // Create two identical histograms
0054 //     TH1D *h1 = new TH1D("h1", "Histogram 1;X-axis;Y-axis", 50, -4, 4);
0055 //     TH1D *h2 = new TH1D("h2", "Histogram 2;X-axis;Y-axis", 50, -4, 4);
0056     
0057 //     // Fill histograms with random data
0058 //     TRandom randGen;
0059 //     for (int i = 0; i < 1000; i++) {
0060 //         double val = randGen.Gaus(0, 1);
0061 //         h1->Fill(val);
0062 //         h2->Fill(val);
0063 //     }
0064     
0065 //     // Get the two pads
0066 //     TPad *pad1 = (TPad*)c->cd(1);
0067 //     pad1->SetBottomMargin(0);
0068 //     pad1->SetTopMargin(0.1);
0069 //     h1->Draw();
0070     
0071 //     TPad *pad2 = (TPad*)c->cd(2);
0072 //     pad2->SetTopMargin(0);
0073 //     pad2->SetBottomMargin(0.1);
0074 //     h2->Draw();
0075     
0076 //     // Update canvas
0077 //     c->Update();
0078 // }
0079 
0080 std::vector<TH1D *> prepare_hist()
0081 {
0082     int trigger_bin = 2;
0083     int trigger_bin_shift = 55;
0084 
0085     std::vector<TH1D *> hist_vec; hist_vec.clear();
0086     THStack * hs = new THStack("","");
0087 
0088     TFile *file = TFile::Open(Form("%s/%s", file_directory.c_str(), file_name.c_str()));
0089 
0090     for (int i = 0; i < 8; i++)
0091     {
0092         hist_vec.push_back((TH1D*)file->Get(Form("%s%d", hist_name_noindex.c_str(), i)));
0093         
0094         hs->Add(hist_vec.back());
0095     }
0096     
0097     TH1D * hist_first = (TH1D*)hs->GetStack()->Last();
0098     TH1D * hist_sum = hist_shift_inX(hist_first, trigger_bin_shift);
0099     hist_sum -> SetName("hist_sum");
0100     hist_sum -> SetTitle(";Beam crossing (106 ns / crossing);Normalized INTT hit counts");
0101     hist_sum -> SetLineColor(38);
0102 
0103     hist_sum -> Scale(1.0/hist_sum->Integral());
0104 
0105     TH1D * hist_trigger = new TH1D("","",1,-0.5,0.5);
0106     hist_trigger -> SetBinContent(1, hist_sum->GetBinContent(hist_sum -> GetMaximumBin()));
0107     hist_trigger -> SetLineColor(kRed);
0108 
0109     hist_sum -> SetBinContent(hist_sum -> GetMaximumBin(), 0);
0110 
0111     hist_sum -> GetXaxis() -> SetRangeUser(-1.5, 100);
0112 
0113     return {
0114         hist_sum,
0115         hist_trigger
0116     };
0117 }
0118 
0119 int MakePlot_INTTTiming_TwoPanel(int event_id = 0)
0120 {   
0121     SetsPhenixStyle();
0122     TCanvas * c1 = new TCanvas("c1", "c1", 1000, 800);
0123 
0124     c1 -> cd();
0125     TPad * pad1 = new TPad("pad1", "pad1", 0, 0.5, 1, 1);
0126     pad1 -> Draw();
0127     pad1 -> cd();
0128     pad1 -> SetBottomMargin(0.02);
0129     pad1 -> SetTopMargin(0.07);
0130     pad1 -> SetLeftMargin(LeftMargin);
0131     pad1 -> SetRightMargin(RightMargin);
0132     // pad1 -> SetLogy();
0133 
0134     c1 -> cd();
0135     TPad * pad2 = new TPad("pad2", "pad2", 0, 0, 1, 0.5);
0136     pad2 -> Draw();
0137     pad2 -> cd();
0138     pad2 -> SetTopMargin(0.02);
0139     pad2 -> SetLeftMargin(LeftMargin);
0140     pad2 -> SetRightMargin(RightMargin);
0141     pad2 -> SetLogy();
0142 
0143     TLatex * draw_text = new TLatex();
0144     draw_text -> SetNDC();
0145     draw_text -> SetTextSize(0.08);
0146 
0147     double label_shit_x = 0.23;
0148     double label_shit_y = -0.03;
0149 
0150     TLegend * leg = new TLegend(0.15 + label_shit_x,0.41 + label_shit_y,0.85 ,0.57+label_shit_y);
0151     // leg -> SetNColumns(2);
0152     leg -> SetBorderSize(0);
0153     leg -> SetTextSize(0.06);
0154     leg -> SetMargin(0.12);
0155 
0156     TLatex * ltx = new TLatex();
0157     ltx->SetNDC();
0158     ltx->SetTextSize(0.09);
0159     // ltx->SetTextAlign(31);
0160     
0161     std::vector<TH1D *> hist_vec = prepare_hist();
0162     TH1D * hist_sum = hist_vec.at(0);
0163     TH1D * hist_trigger = hist_vec.at(1);
0164     
0165     double Y_text_size = hist_sum -> GetYaxis() -> GetTitleSize();
0166 
0167     hist_sum -> GetYaxis() -> CenterTitle();
0168     hist_sum -> GetXaxis() -> CenterTitle();
0169     hist_sum -> GetYaxis() -> SetNdivisions(505);
0170     hist_sum -> GetXaxis() -> SetTitleSize(Y_text_size * 1.3);
0171     hist_sum -> GetYaxis() -> SetTitleSize(Y_text_size * 1.3);
0172     hist_sum -> GetYaxis() -> SetTitleOffset(0.8);
0173 
0174     leg -> AddEntry(hist_trigger, "Hits associated with trigger", "f");
0175     leg -> AddEntry(hist_sum, "Hits from other beam crossings", "f");
0176 
0177     TH2D * hist_sum_short = (TH2D*) hist_sum -> Clone("hist_sum_short");
0178     TH2D * hist_trigger_short = (TH2D*) hist_trigger -> Clone("hist_trigger_short");
0179 
0180     hist_sum_short -> GetYaxis() -> SetTitleOffset(0.8);
0181     hist_sum_short -> GetYaxis() -> SetTitleSize(Y_text_size * 1.3);
0182     hist_sum_short -> GetXaxis() -> SetTitleOffset(1.0);
0183     hist_sum_short -> GetXaxis() -> SetTitleSize(Y_text_size * 1.3);
0184 
0185     pad1 -> cd();
0186     hist_sum -> GetXaxis() -> SetLabelOffset(999);
0187     hist_sum -> SetMaximum(hist_trigger_short->GetBinContent(hist_trigger_short->GetMaximumBin())*1.1);
0188     hist_sum -> SetMinimum(0);
0189     hist_sum -> Draw("hist");
0190 
0191     ltx->DrawLatex(0.15 + label_shit_x, 0.85 + label_shit_y, Form("#it{#bf{sPHENIX}} %s #it{%s}", sPH_label_data.c_str(), sPHENIX_date.c_str())); 
0192     
0193     draw_text -> DrawLatex(0.15 + label_shit_x, 0.77 + label_shit_y, Collision_str.c_str());
0194     draw_text -> DrawLatex(0.15 + label_shit_x, 0.69 + label_shit_y, RHIC_str.c_str());
0195     draw_text -> DrawLatex(0.15 + label_shit_x, 0.61 + label_shit_y, ReadOut_str.c_str());
0196 
0197     leg -> Draw("same");
0198     hist_trigger->Draw("hist same");
0199 
0200     pad2 -> cd();
0201     
0202 
0203     // hist_sum_short -> SetMinimum(0);
0204     hist_sum_short -> SetMaximum(hist_sum_short->GetBinContent(hist_sum_short->GetMaximumBin())*500);
0205     hist_sum_short->Draw("hist");
0206     hist_trigger_short->Draw("hist same");
0207 
0208     c1 -> Print(Form("%s/INTT_timing_2panel.pdf",file_directory.c_str()));
0209 
0210     return 888;
0211 }
0212 
0213 
0214 int MakePlot_INTTTiming_chop(int event_id = 0)
0215 {   
0216     SetsPhenixStyle();
0217     TCanvas * c1 = new TCanvas("c1", "c1", 900, 800);
0218 
0219     c1 -> cd();
0220     TPad * pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1);
0221     pad1 -> Draw();
0222     pad1 -> cd();
0223     pad1 -> SetBottomMargin(0.15);
0224     pad1 -> SetTopMargin(0.07);
0225     pad1 -> SetLeftMargin(LeftMargin);
0226     pad1 -> SetRightMargin(RightMargin);
0227     pad1 -> SetLogy();
0228 
0229 
0230     TLatex * draw_text = new TLatex();
0231     draw_text -> SetNDC();
0232     draw_text -> SetTextSize(0.04);
0233 
0234     double label_shit_x = 0.12;
0235     double label_shit_y = -0.02;
0236 
0237     TLegend * leg = new TLegend(0.15 + label_shit_x, 0.55 + label_shit_y,0.85 ,0.67+label_shit_y);
0238     // leg -> SetNColumns(2);
0239     leg -> SetBorderSize(0);
0240     leg -> SetTextSize(0.04);
0241     leg -> SetMargin(0.12);
0242 
0243     TLatex * ltx = new TLatex();
0244     ltx->SetNDC();
0245     ltx->SetTextSize(0.045);
0246     // ltx->SetTextAlign(31);
0247     
0248     std::vector<TH1D *> hist_vec = prepare_hist();
0249     TH1D * hist_sum = hist_vec.at(0);
0250     TH1D * hist_trigger = hist_vec.at(1);
0251     
0252     double Y_text_size = hist_sum -> GetYaxis() -> GetTitleSize();
0253 
0254     hist_sum -> GetYaxis() -> CenterTitle();
0255     hist_sum -> GetXaxis() -> CenterTitle();
0256     hist_sum -> GetYaxis() -> SetNdivisions(505);
0257     hist_sum -> GetXaxis() -> SetTitleOffset(1.25);
0258     // hist_sum -> GetYaxis() -> SetTitleSize(Y_text_size * 1.3);
0259     // hist_sum -> GetYaxis() -> SetTitleOffset(0.8);
0260 
0261     leg -> AddEntry(hist_trigger, "Hits associated with trigger", "f");
0262     leg -> AddEntry(hist_sum, "Hits from other beam crossings", "f");
0263 
0264     pad1 -> cd();
0265     // hist_sum -> GetXaxis() -> SetLabelOffset(999);
0266     hist_sum -> SetMaximum(hist_trigger->GetBinContent(hist_trigger->GetMaximumBin())*100);
0267     // hist_sum -> SetMinimum(0);
0268     hist_sum -> Draw("hist");
0269 
0270     ltx->DrawLatex(0.15 + label_shit_x, 0.85 + label_shit_y, Form("#it{#bf{sPHENIX}} %s #it{%s}", sPH_label_data.c_str(), sPHENIX_date.c_str())); 
0271     
0272     draw_text -> DrawLatex(0.15 + label_shit_x, 0.80 + label_shit_y, Collision_str.c_str());
0273     draw_text -> DrawLatex(0.15 + label_shit_x, 0.75 + label_shit_y, RHIC_str.c_str());
0274     draw_text -> DrawLatex(0.15 + label_shit_x, 0.70 + label_shit_y, ReadOut_str.c_str());
0275 
0276     leg -> Draw("same");
0277     hist_trigger->Draw("hist same");
0278 
0279 
0280     c1 -> Print(Form("%s/INTT_timing_chop.pdf",file_directory.c_str()));
0281 
0282     return 888;
0283 }
0284 
0285 
0286 int MakePlot_INTTTiming_smallpad(int event_id = 0)
0287 {    
0288     double label_shit_x = 0.09;
0289     double label_shit_y = -0.02;
0290 
0291     SetsPhenixStyle();
0292     TCanvas * c1 = new TCanvas("c1", "c1", 950, 800);
0293     // c1 -> SetLogy();
0294 
0295     TPad * pad1 = new TPad("pad1", "pad1", 0, 0, 1, 1);
0296     pad1 -> Draw();
0297     pad1 -> cd();
0298     pad1 -> SetRightMargin(RightMargin);
0299     // pad1 -> SetLogy();
0300 
0301     TLatex * draw_text = new TLatex();
0302     draw_text -> SetNDC();
0303     draw_text -> SetTextSize(0.04);
0304 
0305     TLegend * leg = new TLegend(0.21 + label_shit_x, 0.61 + label_shit_y, 0.8, 0.71 + label_shit_y);
0306     // leg -> SetNColumns(2);
0307     leg -> SetBorderSize(0);
0308     leg -> SetTextSize(0.04);
0309     leg -> SetMargin(0.12);
0310 
0311     TLatex * ltx = new TLatex();
0312     ltx->SetNDC();
0313     ltx->SetTextSize(0.045);
0314 
0315 
0316     std::vector<TH1D *> hist_vec = prepare_hist();
0317     TH1D * hist_sum = hist_vec.at(0);
0318     TH1D * hist_trigger = hist_vec.at(1);
0319 
0320     // leg -> AddEntry(hist_sum, "Hits from other bunch crossings", "f");
0321     // leg -> AddEntry(hist_trigger, "Hits associated with trigger", "f");
0322 
0323     leg -> AddEntry(hist_trigger, "Hits associated with trigger", "f");
0324     leg -> AddEntry(hist_sum, "Hits from other beam crossings", "f");
0325 
0326     hist_sum -> GetYaxis() -> CenterTitle();
0327     hist_sum -> GetXaxis() -> CenterTitle();
0328     hist_sum -> SetMaximum(hist_trigger->GetBinContent(1) * 1.3);
0329     hist_sum->Draw("hist");
0330     // hist_trigger->Draw("hist same");
0331     // ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_data.c_str())); 
0332     ltx->DrawLatex(0.21 + label_shit_x, 0.89 + label_shit_y, Form("#it{#bf{sPHENIX}} %s #it{%s}", sPH_label_data.c_str(), sPHENIX_date.c_str())); 
0333     
0334     draw_text -> DrawLatex(0.21 + label_shit_x, 0.83 + label_shit_y, Collision_str.c_str());
0335     draw_text -> DrawLatex(0.21 + label_shit_x, 0.78 + label_shit_y, RHIC_str.c_str());
0336     draw_text -> DrawLatex(0.21 + label_shit_x, 0.73 + label_shit_y, ReadOut_str.c_str());
0337 
0338     leg -> Draw("same");
0339 
0340     hist_trigger->Draw("hist same");
0341 
0342     c1 -> cd();
0343     TPad * pad2 = new TPad("pad2", "pad2", 0.4, 0.25, 0.8, 0.55);
0344     pad2 -> Draw();
0345     pad2 -> cd();
0346     pad2 -> SetLeftMargin(0.2);
0347     // pad2 -> SetLogy();
0348 
0349     TH1D * hist_small = (TH1D*) hist_sum->Clone("hist_small");
0350     hist_small -> SetTitle(";;");
0351     hist_small -> SetMaximum(hist_sum->GetBinContent(hist_sum->GetMaximumBin()) * 0.3);
0352     hist_small -> SetMinimum(0);
0353     hist_small -> GetXaxis() -> SetNdivisions(505);
0354     hist_small -> GetYaxis() -> SetNdivisions(505);
0355     hist_small -> GetXaxis() -> SetRangeUser(39, 80);
0356 
0357     hist_small -> GetXaxis() -> SetLabelSize( hist_small -> GetXaxis() -> GetLabelSize() * 2.3 );
0358     hist_small -> GetXaxis() -> SetTickLength( hist_small -> GetXaxis() -> GetTickLength() * 1.5 );
0359 
0360     hist_small -> GetYaxis() -> SetLabelSize( hist_small -> GetYaxis() -> GetLabelSize() * 2.3 );
0361     hist_small -> GetYaxis() -> SetTickLength( hist_small -> GetYaxis() -> GetTickLength() * 1.5 );
0362 
0363     hist_small->Draw("hist");
0364 
0365 
0366     hist_sum->Draw("hist same");
0367 
0368     pad2->RedrawAxis();
0369 
0370     c1 -> Print(Form("%s/INTT_timing_smallpad.pdf",file_directory.c_str()));
0371 
0372     return 888;
0373 }
0374 
0375 int MakePlot_INTTTiming_bkg(int event_id = 0)
0376 {
0377     std::string file_directory = "/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Feb102025/INTT_timing/completed";
0378     std::string file_name = "BcoDiffNtuple_54280_clonehitremoveBCO_hotchannelremove_hitQA_checkclonehit_merged.root";
0379     std::string hist_name_noindex = "all_felix_BcoDiffHist_";
0380 
0381     std::string sPH_label_data = "Internal";
0382     std::string Collision_str = "Au+Au#kern[0.25]{#sqrt{s_{NN}}} = 200 GeV";
0383     std::string RHIC_str = "Bunch crossing interval: 2 BCOs";
0384     std::string ReadOut_str = "INTT Trigger+Extended readout";
0385 
0386     int trigger_bin = 1;
0387     int trigger_bin_shift = 55;
0388 
0389     TFile *file = TFile::Open(Form("%s/%s", file_directory.c_str(), file_name.c_str()));
0390     
0391     SetsPhenixStyle();
0392     TCanvas * c1 = new TCanvas("c1", "c1", 950, 800);
0393     c1 -> SetLogy();
0394 
0395     TLatex * draw_text = new TLatex();
0396     draw_text -> SetNDC();
0397     draw_text -> SetTextSize(0.04);
0398 
0399     TLegend * leg = new TLegend(0.21,0.77,0.8,0.84);
0400     // leg -> SetNColumns(2);
0401     leg -> SetBorderSize(0);
0402     leg -> SetTextSize(0.03);
0403     leg -> SetMargin(0.12);
0404 
0405     TLatex * ltx = new TLatex();
0406     ltx->SetNDC();
0407     ltx->SetTextSize(0.045);
0408     ltx->SetTextAlign(31);
0409     
0410 
0411     // TTree * tree = (TTree*)file->Get("tree");   
0412     
0413     // std::vector<int> * felix0_bcodiff = 0;
0414     // std::vector<int> * felix1_bcodiff = 0;
0415     // std::vector<int> * felix2_bcodiff = 0;
0416     // std::vector<int> * felix3_bcodiff = 0;
0417     // std::vector<int> * felix4_bcodiff = 0;
0418     // std::vector<int> * felix5_bcodiff = 0;
0419     // std::vector<int> * felix6_bcodiff = 0;
0420     // std::vector<int> * felix7_bcodiff = 0;
0421     
0422     // tree -> SetBranchAddress("felix0_bcodiff", &felix0_bcodiff);
0423     // tree -> SetBranchAddress("felix1_bcodiff", &felix1_bcodiff);
0424     // tree -> SetBranchAddress("felix2_bcodiff", &felix2_bcodiff);
0425     // tree -> SetBranchAddress("felix3_bcodiff", &felix3_bcodiff);
0426     // tree -> SetBranchAddress("felix4_bcodiff", &felix4_bcodiff);
0427     // tree -> SetBranchAddress("felix5_bcodiff", &felix5_bcodiff);
0428     // tree -> SetBranchAddress("felix6_bcodiff", &felix6_bcodiff);
0429     // tree -> SetBranchAddress("felix7_bcodiff", &felix7_bcodiff);
0430 
0431     // TH1D * h1D_evt_bcodiff = new TH1D("h1D_evt_bcodiff", ";BCOs in one RHIC circulation;INTT hit counts", 128, 0, 128);
0432 
0433     // SetsPhenixStyle();
0434 
0435     // TCanvas * c1 = new TCanvas("c1", "c1", 950, 800);
0436 
0437     // // c1 -> Print("test.pdf[");
0438 
0439     // TH2D * h2D_Ratio = new TH2D("",";NInttHits at trigger bco;carry ratio",100,0,25000,100,0,0.1);
0440 
0441     // for (int i = 0; i < 1000000; i++)
0442     // {
0443     //     tree -> GetEntry(i);
0444 
0445     //     for (int i = 0; i < felix0_bcodiff->size(); i++)
0446     //     {
0447     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix0_bcodiff->at(i));
0448     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix1_bcodiff->at(i));
0449     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix2_bcodiff->at(i));
0450     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix3_bcodiff->at(i));
0451     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix4_bcodiff->at(i));
0452     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix5_bcodiff->at(i));
0453     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix6_bcodiff->at(i));
0454     //         h1D_evt_bcodiff->SetBinContent(i+1, h1D_evt_bcodiff->GetBinContent(i+1) + felix7_bcodiff->at(i));
0455     //     }
0456 
0457     //     h2D_Ratio -> Fill(h1D_evt_bcodiff->GetBinContent(trigger_bin), h1D_evt_bcodiff->GetBinContent(57)/h1D_evt_bcodiff->GetBinContent(trigger_bin));
0458 
0459     //     // if (h1D_evt_bcodiff->GetBinContent(57)/h1D_evt_bcodiff->GetBinContent(trigger_bin) < 0.005 && h1D_evt_bcodiff->GetBinContent(trigger_bin) > 1000)
0460     //     // {
0461     //     //     c1 -> SetLogy();
0462     //     //     h1D_evt_bcodiff -> Draw("hist");
0463     //     //     c1 -> Print("test.pdf");
0464     //     // }
0465 
0466 
0467 
0468     //     h1D_evt_bcodiff -> Reset("ICESM");
0469     // }
0470 
0471     // h2D_Ratio -> GetXaxis() -> SetNdivisions(505);
0472     // h2D_Ratio -> Draw("colz0");
0473 
0474     // c1 -> Print("test.pdf]");
0475 
0476 
0477     std::vector<TH1D *> hist_vec; hist_vec.clear();
0478     THStack * hs = new THStack("","");
0479 
0480     for (int i = 0; i < 8; i++)
0481     {
0482         hist_vec.push_back((TH1D*)file->Get(Form("%s%d", hist_name_noindex.c_str(), i)));
0483         
0484         hs->Add(hist_vec.back());
0485     }
0486 
0487     // c1 -> SetLogy(1);
0488     
0489     TH1D * hist_first = (TH1D*)hs->GetStack()->Last();
0490 
0491     TH1D * hist_sum = hist_shift_inX(hist_first, trigger_bin_shift);
0492     
0493     hist_sum -> Scale(1.0/hist_sum->Integral());
0494     hist_sum -> SetMaximum(hist_sum->GetBinContent(hist_sum->GetMaximumBin())*10000);
0495     // hist_sum -> SetMinimum(1);
0496 
0497     hist_sum -> SetName("hist_sum");
0498     // hist_sum -> SetTitle(";BCOs in the RHIC circulations;INTT hit counts");
0499     hist_sum -> SetTitle(";Crossing relative to RHIC clock [BCO];INTT hit counts [arb. unit]");
0500     hist_sum -> SetLineColor(kBlack);
0501     hist_sum -> GetYaxis() -> CenterTitle();
0502     hist_sum -> GetXaxis() -> CenterTitle();
0503     hist_sum -> GetYaxis() -> SetNdivisions(505);
0504 
0505     
0506 
0507     TH1D * hist_trigger = (TH1D*) hist_sum->Clone("hist_trigger");
0508     hist_trigger -> Reset("ICESM");
0509     hist_trigger -> SetBinContent(trigger_bin, hist_sum->GetBinContent(trigger_bin));
0510     hist_trigger -> SetLineColor(kRed);
0511 
0512     // leg -> AddEntry(hist_sum, "Hits from other bunch crossings", "f");
0513     // leg -> AddEntry(hist_trigger, "Hits associated with trigger", "f");
0514 
0515     leg -> AddEntry(hist_trigger, "Hits associated with trigger", "f");
0516     leg -> AddEntry(hist_sum, "Hits from other bunch crossings", "f");
0517 
0518     hist_sum->Draw("hist");
0519     // hist_trigger->Draw("hist same");
0520     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_data.c_str())); 
0521     
0522     draw_text -> DrawLatex(0.17, 0.965, Collision_str.c_str());
0523     draw_text -> DrawLatex(0.21, 0.89, RHIC_str.c_str());
0524     draw_text -> DrawLatex(0.21, 0.85, ReadOut_str.c_str());
0525 
0526     leg -> Draw("same");
0527 
0528     hist_trigger->Draw("hist same");
0529 
0530     c1 -> Print(Form("hist_sum.pdf"));
0531 
0532     return 888;
0533 }
0534 
0535 int MakePlot_INTTTiming()
0536 {
0537     MakePlot_INTTTiming_TwoPanel();
0538     MakePlot_INTTTiming_chop();
0539     MakePlot_INTTTiming_smallpad();
0540 
0541     return 888;
0542 }