void draw_hist() { void plotting(string title, string output_filename, TCanvas* c1, TH1F *h_Gen, TH1F *h_Cal, string axisXtitle, string axisYtitle) { 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.80,0.85,0.93,"brNDC"); pave -> SetFillColor(41); pave -> AddText(title.c_str()); TLine *line = pave->AddLine(0.15,0.5,0.4,0.5); line -> SetLineColor(4); line -> SetLineWidth(2); TText *text = pave -> AddText(0.7, 0.58,"Gen Jets"); text -> SetTextColor(4); TLine *line = pave->AddLine(0.15,0.2,0.4,0.2); line -> SetLineColor(8); line -> SetLineWidth(2); TText *text = pave -> AddText(0.7,0.28,"Calo Jets"); text -> SetTextColor(8); pave -> Draw(); c1 -> Update(); //c1 -> Print(output_filename.c_str()); c1->SaveAs(output_filename.c_str()); c1->Clear(); } void plotting(string output_filename, TCanvas* c1, TH1F *hist, string axisXtitle, string axisYtitle) { //hist -> UseCarrentStyle(); hist -> GetXaxis() -> SetTitle(axisXtitle.c_str()); hist -> GetYaxis() -> SetTitle(axisYtitle.c_str()); hist -> Draw(); c1->SaveAs(output_filename.c_str()); c1->Clear(); } void plotting(string output_filename, TCanvas* c1, TProfile *prof, string axisXtitle, string axisYtitle) { //prof -> UseCarrentStyle(); prof -> GetXaxis() -> SetTitle(axisXtitle.c_str()); prof -> GetYaxis() -> SetTitle(axisYtitle.c_str()); prof -> Draw(); c1->SaveAs(output_filename.c_str()); c1->Clear(); } gROOT -> Reset(); gStyle -> SetHistLineWidth(2); gStyle -> SetFrameFillColor(42); gStyle -> SetPadTopMargin(0.05); gStyle -> SetPadRightMargin(0.05); gStyle->SetPadGridX(1); gStyle->SetPadGridY(1); gStyle->SetHistMinimumZero(); gStyle->SetTitleFillColor(41); gStyle->SetTitleX(0.07); gStyle->SetTitleY(0.965); gStyle->SetStatColor(41); 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"); h_numCaloInCone = (TH1F*)tf1->Get("numCaloInCone"); h_dRminGenCalo = (TH1F*)tf1->Get("dRminGenCalo"); p_CaloEnRespVsEta = (TProfile*)tf1->Get("CaloEnRespVsEta"); p_CaloPtRespVsEta = (TProfile*)tf1->Get("CaloPtRespVsEta"); c1 = new TCanvas("c1","Plots",0,0,350,300); c1 -> SetHighLightColor(45); gPad->SetFillColor(41); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1 -> SetLogy(); plotting("Pt distribution","h_pt_iterative.png", c1, h_ptGen, h_ptCal,"p_{t} jets", ""); plotting("Number of jets","h_num_iterative.png", c1, h_numGen, h_numCal,"num jets", ""); c1 -> SetLogy(0); plotting("#eta of jets","h_eta_iterative.png", c1, h_etaGen, h_etaCal,"#eta jets", ""); plotting("#phi of jets","h_phi_iterative.png", c1, h_phiGen, h_phiCal,"#phi jets", ""); gStyle->SetOptStat(1); gStyle->SetOptTitle(1); plotting("h_numCaloInCone_iterative.png", c1, h_numCaloInCone,"Num of jets","" ); plotting("h_dr_iterative.png", c1,h_dRminGenCalo ,"Distance in #eta-#phi space", ""); plotting("h_EnRespVsEta_iterative.png", c1, p_CaloEnRespVsEta, "#left|#eta#right|", "y=#frac{CaloJetEnergy}{GenJetEnergy}"); plotting("h_PtRespVsEta_iterative.png", c1, p_CaloPtRespVsEta, "#left|#eta#right|", "y=#frac{CaloJetPt}{GenJetPt}"); 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"); h_numCaloInCone = (TH1F*)tf2->Get("numCaloInCone"); h_dRminGenCalo = (TH1F*)tf2->Get("dRminGenCalo"); p_CaloEnRespVsEta = (TProfile*)tf2->Get("CaloEnRespVsEta"); p_CaloPtRespVsEta = (TProfile*)tf2->Get("CaloPtRespVsEta"); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1 -> SetLogy(); plotting("Pt distribution","h_pt_midpoint.png", c1, h_ptGen, h_ptCal,"p_{t} jets", ""); plotting("Number of jets","h_num_midpoint.png", c1, h_numGen, h_numCal,"num jets", ""); c1 -> SetLogy(0); plotting("#eta of jets","h_eta_midpoint.png", c1, h_etaGen, h_etaCal,"#eta jets", ""); plotting("#phi of jets","h_phi_midpoint.png", c1, h_phiGen, h_phiCal,"#phi jets", ""); gStyle->SetOptStat(11); gStyle->SetOptTitle(1); plotting("h_numCaloInCone_midpoint.png", c1, h_numCaloInCone,"Num of jets","" ); plotting("h_dr_midpoint.png", c1,h_dRminGenCalo ,"Distance in #eta-#phi dimension" , ""); plotting("h_EnRespVsEta_midpoint.png", c1, p_CaloEnRespVsEta, "#left|#eta#right|", "y=#frac{CaloJetEnergy}{GenJetEnergy}"); plotting("h_PtRespVsEta_midpoint.png", c1, p_CaloPtRespVsEta, "#left|#eta#right|", "y=#frac{CaloJetPt}{GenJetPt}"); }