#include "StandardLabels.C" void pion_theta(void) { TColor::CreateColorWheel(); TCanvas *c1 = new TCanvas("c1", "", 800, 600); c1->SetTicks(); c1->SetGridy(); TFile *f = new TFile("generated_b.root"); TTree *thrown_tree = (TTree*)gROOT->FindObject("pip_pim"); TH1D *pip = new TH1D("pip","#pi^{+} #theta", 200, 0.0, 3.5); TH1D *pim = (TH1D*)pip->Clone("pim"); thrown_tree->Project("pip","57.3*acos(pip_pz/sqrt(pip_px*pip_px + pip_py*pip_py + pip_pz*pip_pz))"); thrown_tree->Project("pim","57.3*acos(pim_pz/sqrt(pim_px*pim_px + pim_py*pim_py + pim_pz*pim_pz))"); double max = pip->GetMaximum()*1.05; TH2D *axes = new TH2D("axes", "#pi^{#pm} polar angle distribution in lab frame", 100, 0.0, 3.5, 100, 0.0, max); axes->SetStats(0); axes->SetXTitle("#theta (degrees)"); axes->Draw(); pip->SetLineColor(kRed); pim->SetLineColor(kBlue); pip->SetLineWidth(3); pim->SetLineWidth(3); pip->Draw("same"); pim->Draw("same"); TLine *lin = new TLine(1.0, 0.0, 1.0, max); lin->SetLineColor(kGray+2); lin->SetLineStyle(2); lin->SetLineWidth(3.0); lin->Draw(); TLatex *lab = new TLatex(1.02, 500.0, "Acceptance at nominal GlueX target center"); lab->SetTextSize(0.028); lab->SetTextAngle(270.0); lab->SetTextAlign(21); lab->Draw(); TLegend *leg = new TLegend(0.636, 0.621, 0.841, 0.854); leg->SetFillColor(kWhite); leg->AddEntry(pip, "#pi^{+}"); leg->AddEntry(pim, "#pi^{-}"); leg->Draw(); //StandardLabels(axes, "", "", "Generated values for threshold #leq W_{#pi#pi} #leq 400 MeV/c^{2}"); c1->SaveAs("pion_theta.png"); c1->SaveAs("pion_theta.pdf"); }