#include "StandardLabels.C" void Wpipi(void) { TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); TFile *f = new TFile("generated.root"); TTree *thrown_tree = (TTree*)gROOT->FindObject("thrown_tree"); TH1D *lo = new TH1D("lo","0.28Project("lo","Wpipi" , "0.28Project("mid","Wpipi", "0.32Project("hi","Wpipi" , "0.36SetLineColor(kBlue); mid->SetLineColor(kGreen); hi->SetLineColor(kRed); lo->SetFillColor(kBlue); mid->SetFillColor(kGreen); hi->SetFillColor(kRed); double max = hi->GetMaximum()*1.05; TH2D *axes = new TH2D("axes", "#pi^{+}#pi^{-} invariant mass", 100, 0.25, 0.45, 100, 0.0, max); axes->SetStats(0); axes->SetXTitle("W_{#pi#pi}(GeV)"); axes->Draw(); lo->SetLineWidth(3); mid->SetLineWidth(3); hi->SetLineWidth(3); lo->Draw("same"); mid->Draw("same"); hi->Draw("same"); TLegend *leg = new TLegend(0.141, 0.612, 0.448, 0.869); leg->SetFillColor(kWhite); leg->AddEntry(lo, ".28 < W_{#pi#pi} < .32"); leg->AddEntry(mid, ".32 < W_{#pi#pi} < .36"); leg->AddEntry(hi, ".36 < W_{#pi#pi} < .40"); leg->Draw(); //StandardLabels(axes, "Generated values"); c1->SaveAs("Wpipi.png"); c1->SaveAs("Wpipi.pdf"); c1->SaveAs("Wpipi.eps"); }