// WARNING: This script seems to only work the first // time it is run. Subsequent invocations cause empty // histos. Restart ROOT before re-running! #include "chain_fine.h" #include "chain_course.h" #include "StandardLabels.C" void eff(void) { gROOT->Reset(); int max_events = 1000000; TChain *fine = chain_fine("event"); TChain *course = chain_course("event"); TCanvas *c1 = new TCanvas(); c1->SetTicks(); TH1D *thrown_fine = new TH1D("thrown_fine", "", 220, 0.0, 110.0); TH1D *thrown_course = (TH1D*)thrown_fine->Clone("thrown_course"); TH1D *recon_fine = (TH1D*)thrown_fine->Clone("recon_fine"); TH1D *recon_course = (TH1D*)thrown_fine->Clone("recon_course"); TCut cut1("abs(E.recon.p.E()-E.thrown.E())/E.thrown.E()<0.2"); //TCut cut1("1"); fine->Project("thrown_fine","E.thrown.Theta()*57.3","","",max_events); fine->Project("recon_fine","E.thrown.Theta()*57.3",cut1,"",max_events); course->Project("thrown_course","E.thrown.Theta()*57.3","","",max_events); course->Project("recon_course","E.thrown.Theta()*57.3",cut1,"",max_events); TH1D *eff_fine = (TH1D*)recon_fine->Clone("eff_fine"); TH1D *eff_course = (TH1D*)recon_course->Clone("eff_course"); eff_fine->Divide(thrown_fine); eff_course->Divide(thrown_course); eff_fine->SetLineColor(kRed); eff_fine->SetLineWidth(2); eff_course->SetLineColor(kBlue); eff_course->SetLineWidth(2); TH2D *axes = new TH2D("axes","BCAL Reconstruction Efficiency", 100, 0.0, 110.0, 100, 0.0, 1.05); axes->SetStats(0); axes->SetXTitle("#theta (degrees)"); axes->SetYTitle("Efficiency"); axes->Draw(); eff_fine->Draw("same"); eff_course->Draw("same"); TLegend *leg = new TLegend(0.522, 0.417, 0.841, 0.610); leg->SetFillColor(kWhite); leg->AddEntry(eff_fine,"Fine Segmentation"); leg->AddEntry(eff_course,"Course Segmentation"); leg->Draw(); StandardLabels(axes, "0GeV #leq E #leq 4GeV 10^{o}#leq#theta#leq110^{o}", "Single #gamma", "2M events No cuts on primary conversion point.", "Cut on E_{recon} within 20% of E_{thrown}"); c1->SaveAs("eff.png"); c1->SaveAs("eff.pdf"); }