#include "../macros/StandardLabels.C" void Eres_vs_E_90degrees(void) { //gROOT->Reset(); TFile *f = new TFile("hd_root_fine.root"); TTree *event = (TTree*)gROOT->FindObject("event"); TH2D *Eres = new TH2D("Eres", "", 25, 120, 685, 200, -1.0, 1.0); event->Project("Eres", "(A.recon.p.E() - A.thrown.E())/A.thrown.E():A.thrown.E()*1000.0"); Eres->FitSlicesY(); TH1D *Eres_2 = (TH1D*)gROOT->FindObject("Eres_2"); TCanvas *c1 = new TCanvas(); c1->SetTicks(); c1->SetGrid(); TH2D *axes = new TH2D("axes", "BCAL Energy Res. for #theta=90^{o}", 100, 120, 685, 100, 0.0, 0.3); axes->SetStats(0); axes->SetXTitle("Generated E_{#gamma} (MeV)"); axes->SetYTitle("Energy Resolution #sigma(#deltaE/E)"); axes->Draw(); TF1 *fun = new TF1("fun", "sqrt(([0]*[0]/(x/1000.0)) + ([1]*[1]))", 160.0, 680.0); fun->SetParameter(0, 0.054); fun->SetParameter(1, 0.023); TF1 *fun2 = new TF1(*fun); Eres_2->Fit(fun, "0"); Eres_2->SetMarkerStyle(20); Eres_2->SetMarkerColor(kRed); Eres_2->Draw("Psame"); fun->Draw("same"); fun2->SetLineColor(kMagenta); fun2->SetLineStyle(2); fun2->Draw("same"); char str[256]; sprintf(str, "#sigma(#deltaE/E) = #frac{%3.1f%%}{#sqrt{E(GeV)}} #oplus %2.1f%%", fun->GetParameter(0)*100.0, fun->GetParameter(1)*100.0); TLatex *lab = new TLatex(420.0, 0.225, str); lab->SetTextAlign(22); lab->SetTextSize(0.04); lab->Draw(); TLatex *lab = new TLatex(275.0.0, 0.061, "from NIM A596 (2008) 327-337 (fig. 11)"); lab->SetTextAlign(22); lab->SetTextSize(0.035); lab->SetTextColor(kMagenta); lab->Draw(); sprintf(str, "#sigma(#deltaE/E) = #frac{%3.1f%%}{#sqrt{E(GeV)}} #oplus %2.1f%%", fun->GetParameter(0)*100.0, fun->GetParameter(1)*100.0); TLatex *lab = new TLatex(275.0, 0.04, "#sigma(#deltaE/E) = #frac{5.4%}{#sqrt{E(GeV)}} #oplus 2.3%"); lab->SetTextAlign(22); lab->SetTextSize(0.03); lab->SetTextColor(kMagenta); lab->Draw(); TArrow *a = new TArrow(275.0, 0.07, 320.0, 0.0925, 0.02, "->"); a->SetLineColor(kMagenta); a->SetLineWidth(2); a->Draw(); StandardLabels(axes, "40k events No cuts on primary conversion point.", "Single #gamma at 90^{o}"); c1->SaveAs("Eres_vs_E_90degrees.png"); c1->SaveAs("Eres_vs_E_90degrees.pdf"); }