void draw_hist() { void plotting(string title, string output_filename, TCanvas* c1, TH1F *h_Gen, TH1F *h_Cal, string axisXtitle, string axisYtitle) { c1->SetHighLightColor(42); h_Gen -> SetLineColor(4); h_Gen -> GetXaxis() -> SetTitle(axisXtitle.c_str()); h_Gen -> GetYaxis() -> SetTitle(axisYtitle.c_str()); h_Gen -> Draw(); h_Cal -> SetLineColor(8); h_Cal -> Draw("same"); TPaveText *pave = new TPaveText(0.55,0.78,0.96,0.90,"brNDC"); pave -> SetFillColor(41); pave -> AddText(title.c_str()); TLine *line = pave->AddLine(0.1,0.5,0.3,0.5); line -> SetLineColor(4); line -> SetLineWidth(2); TText *text = pave -> AddText(0.5, 0.58,"Gen Jets"); text -> SetTextColor(4); TLine *line = pave->AddLine(0.1,0.2,0.3,0.2); line -> SetLineColor(8); line -> SetLineWidth(2); TText *text = pave -> AddText(0.5,0.28,"Calo Jets"); text -> SetTextColor(8); pave -> Draw(); c1 -> Update(); c1->SaveAs(output_filename.c_str()); } gROOT->Reset(); gStyle->SetHistLineWidth(2); gStyle->SetFrameFillColor(42); gStyle->SetPadGridX(1); gStyle->SetPadGridY(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetHistMinimumZero(); TFile* tf1 = new TFile("hist_iterativeCone5.root","OPEN"); TFile* tf2 = new TFile("hist_midPointCone5.root","OPEN"); //TFile* tf3 = new TFile("hist_kt.root","OPEN"); tf1 -> cd(); h_ptCal = (TH1F*)tf1->Get("ptCal"); h_ptGen = (TH1F*)tf1->Get("ptGen"); h_numCal = (TH1F*)tf1->Get("numCal"); h_numGen = (TH1F*)tf1->Get("numGen"); h_etaCal = (TH1F*)tf1->Get("etaCal"); h_etaGen = (TH1F*)tf1->Get("etaGen"); h_phiCal = (TH1F*)tf1->Get("phiCal"); h_phiGen = (TH1F*)tf1->Get("phiGen"); c1 = new TCanvas("c1","Plots",0,0,400,350); gPad -> SetTopMargin(0.05); gPad -> SetRightMargin(0.05); gPad -> SetFillColor(41); c1 -> SetLogy(); plotting("Pt distribution","h_sep28_pt_iterative.png", c1, h_ptGen, h_ptCal,"p_{t} jets", "N / 5Gev bin"); c1->Clear(); plotting("Number of jets","h_sep28_num_iterative.png", c1, h_numGen, h_numCal,"num jets", "N"); c1->Clear(); c1 -> SetLogy(0); plotting("#eta of jets","h_sep28_eta_iterative.png", c1, h_etaGen, h_etaCal,"#eta jets", "N"); c1->Clear(); plotting("#phi of jets","h_sep28_phi_iterative.png", c1, h_phiGen, h_phiCal,"#phi jets", "N"); c1->Clear(); tf2 -> cd(); h_ptCal = (TH1F*)tf2->Get("ptCal"); h_ptGen = (TH1F*)tf2->Get("ptGen"); h_numCal = (TH1F*)tf2->Get("numCal"); h_numGen = (TH1F*)tf2->Get("numGen"); h_etaCal = (TH1F*)tf2->Get("etaCal"); h_etaGen = (TH1F*)tf2->Get("etaGen"); h_phiCal = (TH1F*)tf2->Get("phiCal"); h_phiGen = (TH1F*)tf2->Get("phiGen"); c1 -> SetLogy(); plotting("Pt distribution","h_sep28_pt_midpoint.png", c1, h_ptGen, h_ptCal,"p_{t} jets", "N / 5Gev bin"); c1->Clear(); plotting("Number of jets","h_sep28_num_midpoint.png", c1, h_numGen, h_numCal,"num jets", "N"); c1->Clear(); c1 -> SetLogy(0); plotting("#eta of jets","h_sep28_eta_midpoint.png", c1, h_etaGen, h_etaCal,"#eta jets", "N"); c1->Clear(); plotting("#phi of jets","h_sep28_phi_midpoint.png", c1, h_phiGen, h_phiCal,"#phi jets", "N"); }