{ gROOT->Reset(); TFile* file = new TFile("PLFit.root"); // file->ls(); TH1D* h_chi2_00 = (TH1D*)(file->Get("h_chi2_00")); TH1D* h_chi2_01 = (TH1D*)(file->Get("h_chi2_01")); TH1D* h_chi2_12 = (TH1D*)(file->Get("h_chi2_12")); TH1D* h_chi2_23 = (TH1D*)(file->Get("h_chi2_23")); TH1D* h_chi2_34 = (TH1D*)(file->Get("h_chi2_34")); TH1D* h_chi2_45 = (TH1D*)(file->Get("h_chi2_45")); 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; string title1, title2; cout << "Enter which histogram to make: "; cin >> histNum; if ( histNum == 1 ) { h = h_chi2_00; int binLo = h->FindBin(0.); int binHi = h->FindBin(400.); h->GetXaxis()->SetRange(binLo, binHi); title1 = "n_{par} = 0"; outfile = "chi2_00.eps"; } else if ( histNum == 2 ) { h = h_chi2_01; int binLo = h->FindBin(0.); int binHi = h->FindBin(200.); h->GetXaxis()->SetRange(binLo, binHi); title1 = "H_{0} : n_{par} = 0"; title2 = "H_{1} : n_{par} = 1"; outfile = "chi2_01.eps"; } else if ( histNum == 3 ) { h = h_chi2_12; int binLo = h->FindBin(0.); int binHi = h->FindBin(100.); h->GetXaxis()->SetRange(binLo, binHi); title1 = "H_{0} : n_{par} = 1"; title2 = "H_{1} : n_{par} = 2"; outfile = "chi2_12.eps"; } else if ( histNum == 4 ) { h = h_chi2_23; int binLo = h->FindBin(0.); int binHi = h->FindBin(200.); h->GetXaxis()->SetRange(binLo, binHi); title1 = "H_{0} : n_{par} = 2"; title2 = "H_{1} : n_{par} = 3"; // title = "n_{par} = 3"; outfile = "chi2_23.eps"; } else if ( histNum == 5 ) { h = h_chi2_34; int binLo = h->FindBin(0.); int binHi = h->FindBin(20.); h->GetXaxis()->SetRange(binLo, binHi); title1 = "H_{0} : n_{par} = 3"; title2 = "H_{1} : n_{par} = 4"; // title = "n_{par} = 4"; outfile = "chi2_34.eps"; } else if ( histNum == 6 ) { h = h_chi2_45; int binLo = h->FindBin(0.); int binHi = h->FindBin(20.); h->GetXaxis()->SetRange(binLo, binHi); title1 = "H_{0} : n_{par} = 4"; title2 = "H_{1} : n_{par} = 5"; // title = "n_{par} = 5"; outfile = "chi2_45.eps"; } h->SetTitle(""); h->SetXTitle("q"); 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(); TLatex* tl = new TLatex(); tl->SetNDC(true); tl->DrawLatex(0.62, 0.75, title1.c_str()); tl->DrawLatex(0.62, 0.7, title2.c_str()); c->Print(outfile.c_str()); }