Use self written ROOT class in pyROOT


I am trying to rerun a ROOT fit with externally written RooFit classes which contain extensions to the original. This works with the class RooGExpModelB2, but fails with RooBDecayKin. Both contain small extensions to the originals RooGExpModel and RooBDecay. However both classes are tested and working in a pure ROOT environment, but the latter fails in a pyROOT script.

Here is a minimal example of what I am doing (I just name the two important vars and set all else to 1):

import ROOT

ROOT.gInterpreter.ProcessLine('#include "RooGExpModelB2.h"')
ROOT.gInterpreter.ProcessLine('#include "RooBDecayKin.h"')
ROOT.gInterpreter.ProcessLine('#include "Linkdef.h"')

t = ROOT.RooRealVar("t","t",3.0, -20,20)
cosThetaCMS = ROOT.RooRealVar("cosThetaCMS","thetaCMS", 0, -1, 1)

a = ROOT.RooRealVar("a","a", 1)

GE = ROOT.RooGExpModel("gausExp", "gaus X exp", t, a, a, a, a, a, a, 0,  ROOT.RooGExpModel.Type.Flipped)

dt_pdf = ROOT.RooBDecayKin("dt_pdf","dt_pdf",t, cosThetaCMS, a, a, a, a, a,  a, GE, a)

For anyone wondering, I tried to set the side behavior (Normal, Flipped, DoubleSided) of RooBDecayKin by giving the class an integer value. This was just an attempt to fix things

This gives the Error:

TypeError: cannot instantiate incomplete class 'RooBDecayKin'
Error in <TClass::LoadClassInfo>: no interpreter information for class RooBDecayKin is available even though it has a TClass initialization routine.

I cannot yet put links in the topic, but I can provide the code for the two classes if needed.

Thank you very much in advance!

ROOT Version: 6.26/04
Platform: Centos 7
Compiler: gcc 10.04

Hi @otittel,

I guess the issue manifests here when trying to instantiate the RooBDecayKin class. However, that’s weird given that I suppose that the class is defined in RooBDecayKin.h, which is parsed by the interpreter as per

ROOT.gInterpreter.ProcessLine('#include "RooBDecayKin.h"')

Could you please share the required files so that I could try to reproduce the problem locally?


What about this version?

ROOT.gInterpreter.ProcessLine('#include "RooGExpModelB2.h"')
ROOT.gInterpreter.ProcessLine('#include "RooBDecayKin.h"')

We don’t need too include Linkdef.h; it might be simpler to first include then load the library (depending on what the library is doing).

Dear @Axel and @jalopezg ,

thank you very much for the reply. We actually found a bug in the RooBDecayKin.h in the meantime. This solved the issue.
Sorry for the inconvenience.

1 Like

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