Fail to use ROOT.gInterpreter.Declare in ROOT 6.30/04

Dear root experts,

I’m using ROOT 6.30/04, I have a header file HH.h and the python file aa.py, I tried to use the HH.h in aa.py using “ROOT.gInterpreter.Declare”. However I got following error:

cling JIT session error: Failed to materialize symbols: { (main, { _ZN4TH2DD1Ev, _ZN4TH2DC1Ev }) }
Error in <TClingCallFunc::make_ctor_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
__attribute__((used)) extern "C" void __ctor_11(void** ret, void* arena, unsigned long nary)
{
   if (!arena) {
      if (!nary) {
         *ret = new TH2D;
      }
      else {
         *ret = new TH2D[nary];
      }
   }
   else {
      if (!nary) {
         *ret = new (arena) TH2D;
      }
      else {
         *ret = new (arena) TH2D[nary];
      }
   }
}

  ==== SOURCE END ====
Error in <TClingCallFunc::ExecDefaultConstructor>: Called with no wrapper, not implemented!
Error in <TClingClassInfo::New()>: Call of default constructor failed to return an object for class: TH2D
Error in <TClass::New>: cannot create object of class TH2D
Error in <TKey::ReadObj>: Cannot create new object of class TH2D

if I comment out “TH2D*h2_eleID=(TH2D*)f_eleID->Get("EleIDSF");” in the HH.h, the error is gone. Could you please tell me how to fix it. BTW, everything is fine when I use ROOT 6.14/09

HH.h (398 Bytes)
aa.py (485 Bytes)

Hi,

I cannot reproduce the issue.
If I create a mockup file like this:

{ TFile f("eleIDSF.root","RECREATE");
TH2D h("EleIDSF","EleIDSF",20,0,1,20,0,1); }

And then change the python file into the following to parse the HH.h file:

import ROOT
import time
import os
import math
from math import sqrt
import argparse

RDataFrame = ROOT.RDataFrame

def main():
  HH_header_path = os.path.join("HH.h")
  ROOT.gInterpreter.Declare('#include "{}"'.format(HH_header_path))
  print('TEST!')

if __name__ == "__main__":
  start = time.time()
  start1 = time.process_time() 
  print("Job starts")
  main()
  end = time.time()
  end1 = time.process_time()
  print("wall time:", end-start)
  print("process time:", end1-start1)

Everything runs fine.
Could you try to reduce the reproducer to the minimum?

Best,
D

Hi Danilo,

Thanks very much for helping. Actually I am trying to read the root file and using the TH2D object inside. After put the HH_header_path inside main seems reduce the error. However, when I try to extract the TH2D object, there are warnings

[melu@lxplus811 WWW]$ python3 aa.py 
Job starts
cling JIT session error: Failed to materialize symbols: { (main, { _ZN12TPaletteAxisD1Ev, _ZN12TPaletteAxisC1Ev }) }
Error in <TClingCallFunc::make_ctor_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
__attribute__((used)) extern "C" void __ctor_11(void** ret, void* arena, unsigned long nary)
{
   if (!arena) {
      if (!nary) {
         *ret = new TPaletteAxis;
      }
      else {
         *ret = new TPaletteAxis[nary];
      }
   }
   else {
      if (!nary) {
         *ret = new (arena) TPaletteAxis;
      }
      else {
         *ret = new (arena) TPaletteAxis[nary];
      }
   }
}

  ==== SOURCE END ====
Error in <TClingCallFunc::ExecDefaultConstructor>: Called with no wrapper, not implemented!
Error in <TClingClassInfo::New()>: Call of default constructor failed to return an object for class: TPaletteAxis
Error in <TClass::New>: cannot create object of class TPaletteAxis
Error in <TBufferFile::ReadObject>: could not create object of class TPaletteAxis
Error in <TBufferFile::CheckByteCount>: object of class TList read too few bytes: 103 instead of 353
TEST!
wall time: 0.0990290641784668
process time: 0.09813286700000001

I put all the files in the attachment, and I’m running at lxplus8 with default env.

Another interesting thing is that, if I only extract two TH2D objs, i.e.,

TFile*f_eleID=TFile::Open("eleIDSF.root");
TH2D*h2_eleID=(TH2D*)f_eleID->Get("EleIDSF");

TFile*f_muID=TFile::Open("muIDSF.root");
TH2D*h2_muID=(TH2D*)f_muID->Get("MuIDSF");

the warning is gone.

BTW, may I ask what do you mean by “reduce the reproducer”.

HH.h (584 Bytes)
aa.py (487 Bytes)
TriggerSF_mu.root (5.6 KB)
muIDSF.root (15.5 KB)
eleIDSF.root (15.8 KB)

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