#include "StandardLabels.C" void Chisq_vs_method(void) { TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); TH2D *axes = new TH2D("axes", "#chi^{2}/NDF in BCAL Energy Resolution Fits", 40, 0.0, 5.0, 100, 0.0, 8.0); axes->SetStats(0); axes->SetXTitle(""); axes->SetYTitle("#chi^{2}/NDF"); axes->GetXaxis()->SetBinLabel(8, "all terms"); axes->GetXaxis()->SetBinLabel(16, "floor fixed at 1.3%"); axes->GetXaxis()->SetBinLabel(24, "floor fixed at 0%"); axes->GetXaxis()->SetBinLabel(32, "noise fixed at 0%"); double xstart = 0.8; double deltaX = 0.1; TH1D *degrees12 = new TH1D("degrees12","", 40, xstart, xstart+4.0); xstart += deltaX; TH1D *degrees15 = new TH1D("degrees15","", 40, xstart, xstart+4.0); xstart += deltaX; TH1D *degrees20 = new TH1D("degrees20","", 40, xstart, xstart+4.0); xstart += deltaX; TH1D *degrees30 = new TH1D("degrees30","", 40, xstart, xstart+4.0); degrees12->SetFillColor(kRed); degrees15->SetFillColor(kGreen); degrees20->SetFillColor(kBlue); degrees30->SetFillColor(kMagenta); // no fixed int dBin = 10; int bin = 1; degrees12->SetBinContent(bin, 0.620536); degrees15->SetBinContent(bin, 3.20831); degrees20->SetBinContent(bin, 2.15182); degrees30->SetBinContent(bin, 1.99953); // floor fixed 1.3% bin += dBin; degrees12->SetBinContent(bin, 0.619006); degrees15->SetBinContent(bin, 3.71997); degrees20->SetBinContent(bin, 2.95976); degrees30->SetBinContent(bin, 2.41352); // floor fixed 0% bin += dBin; degrees12->SetBinContent(bin, 0.517113); degrees15->SetBinContent(bin, 2.74998); degrees20->SetBinContent(bin, 1.84442); degrees30->SetBinContent(bin, 1.71389); // noise fixed 0% bin += dBin; degrees12->SetBinContent(bin, 5.25637); degrees15->SetBinContent(bin, 3.27541); degrees20->SetBinContent(bin, 3.55477); degrees30->SetBinContent(bin, 4.43359); axes->Draw(); degrees12->Draw("same"); degrees15->Draw("same"); degrees20->Draw("same"); degrees30->Draw("same"); // Make legend TLegend *leg = new TLegend(0.134, 0.504, 0.261, 0.878); leg->SetFillColor(kWhite); leg->AddEntry(degrees12, "12^{o}"); leg->AddEntry(degrees15, "15^{o}"); leg->AddEntry(degrees20, "20^{o}"); leg->AddEntry(degrees30, "30^{o}"); leg->Draw(); StandardLabels(axes); c1->SaveAs("Chisq_vs_method.png"); c1->SaveAs("Chisq_vs_method.pdf"); }