Beispiel #1
0
def make_qqplots(ux, uy):
    xyplot = uy.xvar.frame()
    xyplot.SetTitle('')
    xycorr = QQCorrector(ux.xvar, ux.xpdf, uy.xvar, uy.xpdf)
    xycorr.SetName('y')
    ux.data.addColumn(xycorr)
    uy.data.plotOn(xyplot, roo.LineColor(uy.color), roo.MarkerColor(uy.color))
    uy.xpdf.plotOn(xyplot, roo.LineColor(uy.color))
    ux.data.plotOn(xyplot, roo.LineColor(ux.color), roo.MarkerColor(ux.color))

    yxplot = ux.xvar.frame()
    yxplot.SetTitle('')
    yxcorr = QQCorrector(uy.xvar, uy.xpdf, ux.xvar, ux.xpdf)
    yxcorr.SetName('x')
    uy.data.addColumn(yxcorr)
    ux.data.plotOn(yxplot, roo.LineColor(ux.color), roo.MarkerColor(ux.color))
    ux.xpdf.plotOn(yxplot, roo.LineColor(ux.color))
    uy.data.plotOn(yxplot, roo.LineColor(uy.color), roo.MarkerColor(uy.color))

    canvases.next('qqxy')
    xyplot.Draw()

    canvases.next('qqyx')
    yxplot.Draw()

    return xyplot, yxplot
Beispiel #2
0
plot12 = w.var('x').frame()
plot12.SetTitle('')
plot12.GetXaxis().SetTitle('Raw x')
plot12.GetYaxis().SetTitle('Corrected x')
qq12.plotOn(plot12)
canvases.next('qq12').SetGrid()
plot12.Draw()

#______________________________________________________________________________
plot12v2 = qq12.get_correction_plot()
canvases.next('qq12v2').SetGrid()
plot12v2.Draw()

#______________________________________________________________________________
## Persist the corrector in a file as RooHistFunc
qq12.SetName('qqcorr')
qq12.write_to_file('test_qqcorrector.root')

#______________________________________________________________________________
## Persist the corrector in a file as RooHistFunc
qqfile = ROOT.TFile.Open('test_qqcorrector.root', 'update')
graph = qq12.get_interpolation_graph(granularity=20)
graph.SetName('qqcorr_graph')
graph.Write()
qqfile.Close()

#______________________________________________________________________________
## Read the corrector from a file and plot on top of the original
qqfile = ROOT.TFile.Open('test_qqcorrector.root')
qqfile.ls()
workspace = qqfile.Get('qqcorr')