How to get number of args a user-made class' __init__ needs?

Hello all,
I’m trying to write a Python script to load classes made by RooClassFactory::makePdf(). I use gROOT.LoadMacro() to load class successfully, now I want to get information about what parameters the class need. I’ve browsed all functions of RooAbsPdf and its parent classes and found nothing (maybe I missed something…)

I’ve also tried Python’s way as


and it didn’t work.

So, is there any way to know what parameters the user-made RooAbsPdf need?

ROOT Version: 6.22
Platform: Ubuntu20.04

@etejedor could please take a look? Thanks!


MyClass is a C++ class, right?

You can try with:

c = ROOT.TClass.GetClass("MyClass")
methods = c.GetListOfMethods()

methods is a list of TMethod instances. You need to find in that list the constructor you are looking for and obtain the number of parameters.



1 Like

Thanks a lot!
That’s quite complicated for me, as your advide I tried command below and figure it out! ( as one line)

# That’s quite complicated