#include "StandardLabels.C" void phi_pipi(void) { TFile *f = new TFile("../hd_root.root"); TH1D *post_kinfit = (TH1D*)gROOT->FindObject("phi_pipi"); TFile *f = new TFile("../hd_root_prekinfit.root"); TH1D *pre_kinfit = (TH1D*)gROOT->FindObject("phi_pipi"); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); pre_kinfit->SetLineColor(kBlue); post_kinfit->SetLineColor(kRed); pre_kinfit->SetLineWidth(2); post_kinfit->SetLineWidth(2); char pre_lab[256]; char post_lab[256]; sprintf(pre_lab, "pre-KinFit"); sprintf(post_lab, "post-KinFit (scaled)"); TLegend *leg = new TLegend(0.116, 0.742, 0.457, 0.877); leg->SetFillColor(kWhite); leg->AddEntry(pre_kinfit, pre_lab); leg->AddEntry(post_kinfit, post_lab); leg->Draw(); double max = post_kinfit->GetMaximum()*1.05; TH2D *axes = new TH2D("axes", pre_kinfit->GetTitle(), 100, -TMath::Pi(), +TMath::Pi(), 100, 0.0, max); axes->SetStats(0); axes->SetXTitle(pre_kinfit->GetXaxis()->GetTitle()); int N_pre = pre_kinfit->GetEntries(); int N_post = post_kinfit->GetEntries(); pre_kinfit->Scale((double)N_post/(double)N_pre); axes->Draw(); pre_kinfit->Draw("same"); post_kinfit->Draw("same"); leg->Draw(); sprintf(pre_lab, "pre-KinFit: Nevents=%d", N_pre); sprintf(post_lab, "post-KinFit: Nevents=%d", N_post); TLatex *lab1 = new TLatex(2.9, max*0.92, pre_lab); lab1->SetTextSize(0.035); lab1->SetTextAlign(32); lab1->Draw(); TLatex *lab2 = new TLatex(2.9, max*0.885, post_lab); lab2->SetTextSize(0.035); lab2->SetTextAlign(32); lab2->Draw(); StandardLabels(axes, "100k events Primakoff #gammap#rightarrowp#pi^{+}#pi^{-}", "", "E_{#gamma}=5.5GeV (no background, #pi mass hypothesis only)"); c1->SaveAs("phi_pipi.pdf"); c1->SaveAs("phi_pipi.png"); }