fitfuncDimitriRelBw = fit.fitTH1withParLimits(nctMu26DimitriRelBwncncHist, 110, 160, dimitriRelBwParameters, pdf.dimitriRelBw, "R", root.kRed, dimitriRelBwParLimits) fitfuncModDimitriRelBw = fit.fitTH1withParLimits( nctMu26ModDimitriRelBwncncHist, 110, 160, modDimitriRelBwParameters, pdf.modDimitriRelBw, "R", root.kRed, modDimitriRelBwParLimits) #================================================================================== # Draw Plots ////////////////////////////////////////////////////////////////////// #================================================================================== # make a TCanvas and a histogram plot with residuals residualExpoCanvas = root.TCanvas("residualCanvas", "residualCanvas") settings.makeResidualHist(residualExpoCanvas, nctMu26ExponcncHist, nctMu26ExponcncHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfunc) residualChebyshevCanvas = root.TCanvas("residualChebyshevCanvas", "residualChebyshevCanvas") settings.makeResidualHist(residualChebyshevCanvas, nctMu26ChebyshevncncHist, nctMu26ChebyshevncncHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncChebyshev) residualDimitriCanvas = root.TCanvas("residualDimitriCanvas", "residualDimitriCanvas") settings.makeResidualHist(residualDimitriCanvas, nctMu26DimitrincncHist, nctMu26DimitrincncHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncDimitri)
fitfuncDimitriRelBw = fit.fitTH1withParLimits( nctMu26for110to310DimitriRelBwFullHist, 110, 310, dimitriRelBwParameters, pdf.dimitriRelBw, "R", root.kRed, dimitriRelBwParLimits) fitfuncModDimitriRelBw = fit.fitTH1withParLimits( nctMu26for110to310ModDimitriRelBwFullHist, 110, 310, modDimitriRelBwParameters, pdf.modDimitriRelBw, "R", root.kRed, modDimitriRelBwParLimits) #================================================================================== # Draw Plots ////////////////////////////////////////////////////////////////////// #================================================================================== # make a TCanvas and a histogram plot with residuals residualExpoCanvas = root.TCanvas("residualCanvas", "residualCanvas") settings.makeResidualHist(residualExpoCanvas, nctMu26for110to310ExpoFullHist, nctMu26for110to310ExpoFullHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfunc) residualChebyshevCanvas = root.TCanvas("residualChebyshevCanvas", "residualChebyshevCanvas") settings.makeResidualHist( residualChebyshevCanvas, nctMu26for110to310ChebyshevFullHist, nctMu26for110to310ChebyshevFullHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncChebyshev) residualBernsteinCanvas = root.TCanvas("residualBernsteinCanvas", "residualBernsteinCanvas") settings.makeResidualHist( residualBernsteinCanvas, nctMu26for110to310BernsteinFullHist, nctMu26for110to310BernsteinFullHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncBernstein)
fitfuncPerExpoBw = fit.fitTH1withParLimits(nctPhotonPerExpoBwFullHist, 110, 160, perExpoBwParameters, pdf.perExpoBw, "R", root.kRed, perExpoBwParLimits) fitfuncPerExpoRelBw = fit.fitTH1withParLimits(nctPhotonPerExpoRelBwFullHist, 110, 160, perExpoRelBwParameters, pdf.perExpoRelBw, "R", root.kRed, perExpoRelBwParLimits) fitfuncDimitriRelBw = fit.fitTH1withParLimits(nctPhotonDimitriRelBwFullHist, 110, 160, dimitriRelBwParameters, pdf.dimitriRelBw, "R", root.kRed, dimitriRelBwParLimits) fitfuncModDimitriRelBw = fit.fitTH1withParLimits(nctPhotonModDimitriRelBwFullHist, 110, 160, modDimitriRelBwParameters, pdf.modDimitriRelBw, "R", root.kRed, modDimitriRelBwParLimits) #================================================================================== # Draw Plots ////////////////////////////////////////////////////////////////////// #================================================================================== # make a TCanvas and a histogram plot with residuals residualExpoCanvas = root.TCanvas("residualCanvas", "residualCanvas") settings.makeResidualHist(residualExpoCanvas, nctPhotonExpoFullHist, nctPhotonExpoFullHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfunc) residualChebyshevCanvas = root.TCanvas("residualChebyshevCanvas", "residualChebyshevCanvas") settings.makeResidualHist(residualChebyshevCanvas, nctPhotonChebyshevFullHist, nctPhotonChebyshevFullHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncChebyshev) residualDimitriCanvas = root.TCanvas("residualDimitriCanvas", "residualDimitriCanvas") settings.makeResidualHist(residualDimitriCanvas, nctPhotonDimitriFullHist, nctPhotonDimitriFullHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncDimitri) residualBwExpoCanvas = root.TCanvas("residualBwExpoCanvas", "residualBwExpoCanvas") settings.makeResidualHist(residualBwExpoCanvas, nctPhotonBwExpoFullHist, nctPhotonBwExpoFullHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncBwExpo) residualRelBwExpoCanvas = root.TCanvas("residualRelBwExpoCanvas", "residualRelBwExpoCanvas") settings.makeResidualHist(residualRelBwExpoCanvas, nctPhotonRelBwExpoFullHist, nctPhotonRelBwExpoFullHist.GetXaxis().GetTitle(),
fitfuncDimitriRelBw = fit.fitTH1withParLimits( nctMu26for110to310DimitriRelBwncncHist, 110, 310, dimitriRelBwParameters, pdf.dimitriRelBw, "R", root.kRed, dimitriRelBwParLimits) fitfuncModDimitriRelBw = fit.fitTH1withParLimits( nctMu26for110to310ModDimitriRelBwncncHist, 110, 310, modDimitriRelBwParameters, pdf.modDimitriRelBw, "R", root.kRed, modDimitriRelBwParLimits) #================================================================================== # Draw Plots ////////////////////////////////////////////////////////////////////// #================================================================================== # make a TCanvas and a histogram plot with residuals residualExpoCanvas = root.TCanvas("residualCanvas", "residualCanvas") settings.makeResidualHist(residualExpoCanvas, nctMu26for110to310ExponcncHist, nctMu26for110to310ExponcncHist.GetXaxis().GetTitle(), "(data - fit)/ data", 1, "PE", root.kBlue, fitfunc) residualChebyshevCanvas = root.TCanvas("residualChebyshevCanvas", "residualChebyshevCanvas") settings.makeResidualHist( residualChebyshevCanvas, nctMu26for110to310ChebyshevncncHist, nctMu26for110to310ChebyshevncncHist.GetXaxis().GetTitle(), "(data - fit)/ data", 1, "PE", root.kBlue, fitfuncChebyshev) residualDimitriCanvas = root.TCanvas("residualDimitriCanvas", "residualDimitriCanvas") settings.makeResidualHist( residualDimitriCanvas, nctMu26for110to310DimitrincncHist, nctMu26for110to310DimitrincncHist.GetXaxis().GetTitle(), "(data - fit)/ data", 1, "PE", root.kBlue, fitfuncDimitri)
fitfuncPerExpoBw = fit.fitTH1withParLimits(nctMu26nnloPerExpoBwccHist, 110, 160, perExpoBwParameters, pdf.perExpoBw, "R", root.kRed, perExpoBwParLimits) fitfuncPerExpoRelBw = fit.fitTH1withParLimits(nctMu26nnloPerExpoRelBwccHist, 110, 160, perExpoRelBwParameters, pdf.perExpoRelBw, "R", root.kRed, perExpoRelBwParLimits) fitfuncDimitriRelBw = fit.fitTH1withParLimits(nctMu26nnloDimitriRelBwccHist, 110, 160, dimitriRelBwParameters, pdf.dimitriRelBw, "R", root.kRed, dimitriRelBwParLimits) fitfuncModDimitriRelBw = fit.fitTH1withParLimits(nctMu26nnloModDimitriRelBwccHist, 110, 160, modDimitriRelBwParameters, pdf.modDimitriRelBw, "R", root.kRed, modDimitriRelBwParLimits) #================================================================================== # Draw Plots ////////////////////////////////////////////////////////////////////// #================================================================================== # make a TCanvas and a histogram plot with residuals residualExpoCanvas = root.TCanvas("residualCanvas", "residualCanvas") settings.makeResidualHist(residualExpoCanvas, nctMu26nnloExpoccHist, nctMu26nnloExpoccHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfunc) residualChebyshevCanvas = root.TCanvas("residualChebyshevCanvas", "residualChebyshevCanvas") settings.makeResidualHist(residualChebyshevCanvas, nctMu26nnloChebyshevccHist, nctMu26nnloChebyshevccHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncChebyshev) residualDimitriCanvas = root.TCanvas("residualDimitriCanvas", "residualDimitriCanvas") settings.makeResidualHist(residualDimitriCanvas, nctMu26nnloDimitriccHist, nctMu26nnloDimitriccHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncDimitri) residualBwExpoCanvas = root.TCanvas("residualBwExpoCanvas", "residualBwExpoCanvas") settings.makeResidualHist(residualBwExpoCanvas, nctMu26nnloBwExpoccHist, nctMu26nnloBwExpoccHist.GetXaxis().GetTitle(), "(fewz - fit)/ fewz", 1, "PE", root.kBlue, fitfuncBwExpo) residualRelBwExpoCanvas = root.TCanvas("residualRelBwExpoCanvas", "residualRelBwExpoCanvas") settings.makeResidualHist(residualRelBwExpoCanvas, nctMu26nnloRelBwExpoccHist, nctMu26nnloRelBwExpoccHist.GetXaxis().GetTitle(),
#================================================================================== # Fit the Histograms ////////////////////////////////////////////////////////////// #================================================================================== # specify number of fit parameters #parameters = numpy.array([0.3, -1, -2, 0.5]) parameters = numpy.array([1, 110, 0.01]) # fit with root #fit.fitTH1(nctPhotonFullHist, 110, 160, parameters, pdf.dimitripdf, "R", root.kRed) fitfunc = fit.fitTH1(nctPhotonFullHist, 110, 160, parameters, pdf.expopdf, "R", root.kRed) #================================================================================== # Draw Plots ////////////////////////////////////////////////////////////////////// #================================================================================== # make a TCanvas and draw the histograms #canvas = root.TCanvas() #nctPhotonFullHist.Draw("P") # make a TCanvas and a histogram plot with residuals residualCanvas = root.TCanvas("residualCanvas", "residualCanvas") settings.makeResidualHist(residualCanvas, nctPhotonFullHist, nctPhotonFullHist.GetXaxis().GetTitle(), "data - fit", 0, "P", root.kBlue, fitfunc) # Save the Plots #canvas.SaveAs("Hist_nctPhotonFull.png")