#include "StandardLabels.C" // This macro superceeds the Wpipi.C macro (at the moment) // to make a plot based on the cpp_analysis plugin that // uses the ANALYSIS package. void W_pipi(void) { TFile *f = new TFile("../hd_root.root"); TH1D *post_kinfit = (TH1D*)gROOT->FindObject("W_pipi"); TH1D *thrown = (TH1D*)gROOT->FindObject("W_pipi_thrown"); TFile *f = new TFile("../hd_root_prekinfit.root"); TH1D *pre_kinfit = (TH1D*)gROOT->FindObject("W_pipi"); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); pre_kinfit->SetLineColor(kBlue); post_kinfit->SetLineColor(kRed); thrown->SetLineColor(kBlack); pre_kinfit->SetLineWidth(2); post_kinfit->SetLineWidth(2); thrown->SetLineWidth(2); char pre_lab[256]; char post_lab[256]; char thrown_lab[256]; sprintf(pre_lab, "pre-KinFit"); sprintf(post_lab, "post-KinFit"); sprintf(thrown_lab, "generated"); TLegend *leg = new TLegend(0.516, 0.742, 0.857, 0.877); leg->SetFillColor(kWhite); leg->AddEntry(thrown, thrown_lab); leg->AddEntry(pre_kinfit, pre_lab); leg->AddEntry(post_kinfit, post_lab); thrown->SetStats(0); //post_kinfit->GetXaxis()->SetRangeUser(-1.0, 1.0); thrown->Draw(); post_kinfit->Draw("same"); pre_kinfit->Draw("same"); leg->Draw(); double max = post_kinfit->GetMaximum()*1.05; int N_pre = pre_kinfit->GetEntries(); int N_post = post_kinfit->GetEntries(); sprintf(pre_lab, "pre-KinFit: Nevents=%d", N_pre); sprintf(post_lab, "post-KinFit: Nevents=%d", N_post); TLatex *lab1 = new TLatex(95., max*0.69, pre_lab); lab1->SetTextSize(0.035); lab1->SetTextAlign(32); lab1->Draw(); TLatex *lab2 = new TLatex(95., max*0.62, post_lab); lab2->SetTextSize(0.035); lab2->SetTextAlign(32); lab2->Draw(); StandardLabels1D(pre_kinfit, "100k events Primakoff #gammap#rightarrowp#pi^{+}#pi^{-}", "", "E_{#gamma}=5.5GeV (no background, #pi mass hypothesis only)"); c1->SaveAs("W_pipi.pdf"); c1->SaveAs("W_pipi.png"); }