Cannot find generic objects in workspace

Hi,

Below is a very simple reproducer of something that seems a problem:


x=ROOT.RooRealVar('x', '', 0, 10) 
m=ROOT.RooRealVar('m', '', 0, 10) 
s=ROOT.RooRealVar('s', '', 1, 10) 

g=ROOT.RooGaussian('g', '', x, m, s)

w=ROOT.RooWorkspace('wks')
w.Import(g)

obj   = w.genobj('g')
l_obj = w.allGenericObjects()

if not obj:
    print('Not found')

print(l_obj.size())


The workspace has objects, neither function is able to find them:

Cheers.

Please read tips for efficient and successful posting and posting code

_ROOT Version:6.24/06
Platform: linuxx8664gcc
_Compiler: linuxx8664gcc


Hi @rooter_03 ,
we need @moneta 's or @jonas 's help here, let’s ping them – but please consider that things might be slow during the holiday season.

Cheers,
Enrico

Hi @eguiraud

It’s ok, I found a workaround. I am just letting you know so that it gets taken care some day.

Cheers.

Hi,
alright then please consider converting this post into a bug report at github.com/root-project/root/issues .

Cheers,
Enrico

Hi @rooter_03, thanks for reporting!

This is the expected behavior, actually. A RooWorkspace can contain 4 classes of object:

  1. A RooAbsArg, which you can get with arg() (or var()/pdf() if the object is a RooRealVar/RooAbsPdf)
  2. A RooAbsData, which you can get with data()
  3. A RooArgSet, which you can get with set()
  4. Any other object of a class inheriting from TObject, which you can get with genobj()

If you want to retrieve any object, no matter which of the 4 cases it belongs to, you do this with RooWorkspace::obj() and not RooWorkspace::genob()j.

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