{ gROOT->Reset(); string outfile = "fit_5.eps"; string title = "n_{par} = 5"; TFile* file = new TFile("PLFit.root"); // file->ls(); TH1D* m_dataHist = (TH1D*)(file->Get("m_dataHist")); TH1D* m_trueHist = (TH1D*)(file->Get("m_trueHist")); TH1D* m_modelHist = (TH1D*)(file->Get("m_modelHist")); TH1D* h = m_dataHist; TCanvas* c = new TCanvas("c", "c",10,10,500,500); // c->SetLogy(1); c->SetBottomMargin(0.15); c->SetLeftMargin(0.15); h->SetTitle(""); h->SetXTitle("x"); h->SetYTitle("entries"); h->SetMinimum(0.); h->SetMaximum(500.); gStyle->SetOptStat(0); // turn off stat. box gStyle->SetOptLogy(0); // 1 for log scale h->GetXaxis()->SetTitleOffset(1.2); // factor multiplies default offset h->GetYaxis()->SetTitleOffset(1.8); h->GetXaxis()->SetNdivisions(8); // N2*100+N1 (N2=secondary, N1=primary) h->GetYaxis()->SetNdivisions(8); // N2*100+N1 (N2=secondary, N1=primary) m_dataHist->SetLineWidth(2.0); m_dataHist->SetLineStyle(1); m_dataHist->SetLineColor(4); m_dataHist->Draw(); m_modelHist->SetLineWidth(2.0); m_modelHist->SetLineStyle(2); m_modelHist->SetLineColor(2); m_modelHist->Draw("same,l"); TLatex* tl = new TLatex(); tl->SetNDC(true); tl->DrawLatex(0.69, 0.79, title.c_str()); c->Print(outfile.c_str()); }