#include "StandardLabels.C" void pion_p(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, 1.0, 7.5); TH1D *pim = (TH1D*)pip->Clone("pim"); thrown_tree->Project("pip","sqrt(pip_px*pip_px + pip_py*pip_py + pip_pz*pip_pz)"); thrown_tree->Project("pim","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} momentum distribution in lab frame", 100, 1.0, 7.5, 100, 0.0, max); axes->SetStats(0); axes->SetXTitle("Momentum (GeV/c)"); 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.687, 0.656, 0.892, 0.888); 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_p.png"); c1->SaveAs("pion_p.pdf"); }