// 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 theta_res_vs_E(void) { gROOT->Reset(); int max_events = 1000000; TChain *fine = chain_fine("event"); TChain *course = chain_course("event"); TCanvas *c1 = new TCanvas(); c1->SetTicks(); TH2D *thetares_fine = new TH2D("thetares_fine", "", 50, 0.0, 2.0, 80, -20.0, 20.0); TH2D *thetares_course = new TH2D("thetares_course", "", 50, 0.0, 2.0, 80, -20.0, 20.0); TCut cut1(""); fine->Project("thetares_fine","(E.recon.p.Theta()-E.thrown.Theta())*57.3:E.thrown.E()",cut1,"",max_events); course->Project("thetares_course","(E.recon.p.Theta()-E.thrown.Theta())*57.3:E.thrown.E()",cut1,"",max_events); thetares_fine->FitSlicesY(); thetares_course->FitSlicesY(); TH1D *thetares_fine_2 = (TH1D*)gROOT->FindObject("thetares_fine_2"); TH1D *thetares_course_2 = (TH1D*)gROOT->FindObject("thetares_course_2"); thetares_fine_2->SetLineColor(kRed); thetares_fine_2->SetLineWidth(2); thetares_course_2->SetLineColor(kBlue); thetares_course_2->SetLineWidth(2); TH2D *axes = new TH2D("axes","BCAL Reconstruction Efficiency", 100, 0.0, 2.0, 100, 0.0, 6.0); axes->SetStats(0); axes->SetYTitle("#sigma(#theta_{rec}-#theta_{gen}) (deg.)"); axes->SetXTitle("E_{#gamma} (GeV)"); axes->Draw(); thetares_fine_2->Draw("same"); thetares_course_2->Draw("same"); TLegend *leg = new TLegend(0.564,0.680, 0.883, 0.872); leg->SetFillColor(kWhite); leg->AddEntry(thetares_fine_2,"Fine Segmentation"); leg->AddEntry(thetares_course_2,"Course Segmentation"); leg->Draw(); char str[256]; sprintf(str,"%d events No cuts on primary conversion point.", fine->GetEntries(cut1)); StandardLabels(axes, "100MeV #leq E #leq 150MeV 10^{o}#leq#theta#leq110^{o}", "Single #gamma", str, "Sigmas from Gaussian Fits"); c1->SaveAs("theta_res_vs_E.png"); c1->SaveAs("theta_res_vs_E.pdf"); }