#include using namespace std; #include "StandardLabels.C" void TOF_bars_bggen(void) { TColor::CreateColorWheel(); TFile *f1 = new TFile("../pythia/tof_bggen.root"); TTree *DTOFRawHit = (TTree*)gROOT->FindObject("DTOFRawHit"); TH1D *tof_end0_plane0 = new TH1D("tof_end0_plane0", "", 45, 0.5, 45.5); TH1D *tof_end1_plane0 = (TH1D*)tof_end0_plane0->Clone("tof_end1_plane0"); TH1D *tof_end0_plane1 = (TH1D*)tof_end0_plane0->Clone("tof_end0_plane1"); TH1D *tof_end1_plane1 = (TH1D*)tof_end0_plane0->Clone("tof_end1_plane1"); DTOFRawHit->Project("tof_end0_plane0","bar", "lr==0 && plane==0 && dE>0.00125"); DTOFRawHit->Project("tof_end1_plane0","bar", "lr==1 && plane==0 && dE>0.00125"); DTOFRawHit->Project("tof_end0_plane1","bar", "lr==0 && plane==1 && dE>0.00125"); DTOFRawHit->Project("tof_end1_plane1","bar", "lr==1 && plane==1 && dE>0.00125"); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); double max = tof_end0_plane0->GetMaximum()*1.10; TH2D *axes = new TH2D("axes", "W_{#pi#pi}", 100, 0.0, 46, 100, 0.0, max); axes->SetStats(0); axes->SetXTitle("W_{#pi^{+}#pi^{-}} (GeV)"); axes->Draw(); tof_end0_plane0->SetLineColor(kBlue); tof_end1_plane0->SetLineColor(kRed); tof_end0_plane1->SetLineColor(kMagenta); tof_end1_plane1->SetLineColor(kGreen+3); tof_end0_plane0->SetLineWidth(2); tof_end1_plane0->SetLineWidth(2); tof_end0_plane1->SetLineWidth(2); tof_end1_plane1->SetLineWidth(2); tof_end0_plane0->Draw("same"); tof_end1_plane0->Draw("same"); tof_end0_plane1->Draw("same"); tof_end1_plane1->Draw("same"); TLegend *leg = new TLegend(0.591, 0.591, 0.848, 0.827); leg->AddEntry(tof_end0_plane0, "end=0, plane=0"); leg->AddEntry(tof_end1_plane0, "end=1, plane=0"); leg->AddEntry(tof_end0_plane1, "end=0, plane=1"); leg->AddEntry(tof_end1_plane1, "end=1, plane=1"); leg->Draw(); double avg_rate = tof_end0_plane0->Integral() + tof_end1_plane0->Integral() + tof_end0_plane1->Integral() + tof_end1_plane1->Integral(); avg_rate /= 4.0; char lab[256]; sprintf(lab, "E_{#gamma} = 5.5GeV avg. MIP rate: %dkHz", avg_rate/1000.0); StandardLabels(axes, "400k bggen #pi^{+}#pi^{-} events" , lab , "dE > 0.00125 GeV" , ""); c1->SaveAs("TOF_bars_bggen.png"); c1->SaveAs("TOF_bars_bggen.pdf"); }