I’m trying to use some compiled code in PyROOT. I compile it as standalone code, producing two .so files, and they work with other compiled C ROOT code, but I can’t yet figure out how to make it work in Python. Could someone point out what I’m doing wrong?
my simpleminded script:
from ROOT import gSystem
gSystem.Load(’/CalibrationDataInterfaceROOT_cxx’)
gSystem.Load(’/libBTagCalib’)
all fine to here
from ROOT import CalibrationDataInterfaceROOT
gives ImportError: cannot import name CalibrationDataInterfaceROOT
do I need to put “#pragma link” sorts of things into the C code?
how did you compile the C++ code? Did you generate dictionaries for it? You say that you use it from C. For C, python has the ctypes module if need be.
The code have two headers and two source files. From them, the standalone make command that the developers provide creates:
BTagCalib_Dict.h
BTagCalib_Dict.C
obj libBTagCalib.so
obj/CalibrationDataInterfaceBase.o
obj/CalibrationDataInterfaceROOT.o
obj/BTagCalib_Dict.o
obj/dep/CalibrationDataInterfaceROOT.d
obj/dep/CalibrationDataInterfaceBase.d
The BTagCalib_Dict.h file has things like
extern G__linked_taginfo G__BTagCalib_DictLN_AnalysiscLcLCalibrationDataInterfaceROOT;
which I guess is the CalibrationDataInterfaceROOT that I’m trying to import.
I just gSystem.Load the libBTagCalib.so file. Do I need to add in the others as well?