I am using RooFit to plot some generated data and I am having trouble setting the plot options when using RooTreeData.plotOn.
mass = RooRealVar("mass","Reconstructed Candidate Mass",0.0,8.0,"GeV") mean = RooRealVar("mean","Peak Mass",4.0,2.0,6.0,"GeV") sigma = RooRealVar("sigma","Peak Width",1.0,0.1,2.0,"GeV") gauss = RooGaussian("gauss","Gaussian Peak Model",mass,mean,sigma) data=gauss.generate(RooArgSet(mass),1000) frame = mass.frame() data.plotOn(frame)
The last line gives the error
Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: RooPlot* RooDataHist(RooPlot* frame, RooTreeData::PlotOpt o) => takes at least 2 arguments (1 given)
I figured out, that one must to use the RooTreeData::PlotOpt class as an argument, whereas for plotting the “gauss” you don’t need to give the second argument:
This works fine, but I haven’t figured out how to use this PlotOpt class to set for example the number of bins. Again the C++ example does not work, which is obvious looking at the type of “RooFit.Binning”:
In : RooFit.Binning(8) Out: <ROOT.RooCmdArg object ("BinningSpec") at 0x945ec98> In : data.plotOn(frame, RooFit.Binning(8)) TypeError: none of the 2 overloaded methods succeeded. Full details: RooPlot* RooTreeData(RooPlot* frame, const RooLinkedList& cmdList) => could not convert argument 2 RooPlot* RooTreeData(RooPlot* frame, RooTreeData::PlotOpt o) => could not convert argument 2
I can see that the PlotOpt class has a variable “bins” which is of type “RooAbsBinning”, but every time I use this class I get errors like:
In : test=RooAbsBinning() In : test *** Break *** segmentation violation (no debugging symbols found) Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". Attaching to program: /proc/10861/exe, process 10861 [Thread debugging using libthread_db enabled] [New Thread -1210472768 (LWP 10861)] [New Thread -1256252496 (LWP 10881)] (no debugging symbols found)...done. (no debugging symbols found)...done. (no debugging symbols found)...done. (no debugging symbols found)...done. (no debugging symbols found)...done. (no debugging symbols found)...done. (no debugging symbols found)...done. Failed to read a valid object file image from memory. 0xb7f33410 in ?? () Thread 2 (Thread -1256252496 (LWP 10881)): #0 0xb7f33410 in ?? () #1 0xb51f0a98 in ?? () #2 0x00000000 in ?? ()
I would be glad if someone has an working example or tells me that I am going in the wrong direction when I continue to dig on this RooTreeData.PlotOpt class. I am using Root 5.14 with included RooFit 2.10.