{ gROOT->Reset(); 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 = 0; TCanvas* c = new TCanvas("c", "c",10,10,500,500); // c->SetLogy(1); c->SetBottomMargin(0.15); c->SetLeftMargin(0.15); string outfile; int histNum; cout << "Enter which histogram to make: "; cin >> histNum; if ( histNum == 1 ) { h = m_dataHist; outfile = "dataHist.eps"; } else if ( histNum == 2 ) { h = m_trueHist; outfile = "trueHist.eps"; } else if ( histNum == 3 ) { h = m_modelHist; outfile = "modelHist.eps"; } 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) h->SetLineWidth(2.0); h->Draw(); c->Print(outfile.c_str()); }