Root version to use "TRatioPlot" class


ROOT Version: root 6.04.16-x86_64-slc6-gcc49-opt
Platform: lxplus
Compiler: Not Provided


Dear all,

I’m trying to run the example given at the https://root.cern.ch/doc/v608/classTRatioPlot.html in pyroot and my code is as follows.

from ROOT import *
import ROOT as root

c1 = root.TCanvas("c1", "example")
h1 = root.TH1D("h1","h1",50,0,10)
h1 = root.TH1D("h2","h2",50,0,10)
f1 = root.TF1("f1", "exp(-x/[0])")
f1.SetParameter(0,3)
h1.FillRandom("f1", 1900)
h2.FillRandom("f1", 2000)
h1.Sumw2()
h2.Scale(1.9/2.)
h1.GetXaxis().SetTitle("x")
h1.GetYaxis().SetTitle("y")
rp = root.TRatioPlot(h1,h2)
c1.SetTicks(0,1)
rp.Draw()
c1.Update()
c1.SaveAs("ratioplot.png")

But running this spits the following error.

python newtest.py 
Traceback (most recent call last):
  File "newtest.py", line 16, in <module>
    rp = root.TRatioPlot(h1,h2)
  File "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/ROOT.py", line 447, in __getattr2
    raise AttributeError( name )
AttributeError: TRatioPlot

So I was wondering which root version is required to use the TRatioPlot class in my code?

Thank you

I assume you need ROOT 6.08 or newer.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.