Issue with TLeaf in lxplus

Dear All,

I am trying to read the branches of a root file by TLeaf doing something like -

TFile *f1 = new TFile(“/home/amandip/MEGA/MEGAsync/TRACKER/Results/New_Data/new_ntuple/Tel_data/Run2661_Merged_OuterTracker_converted.root”);
TTree t1 = (TTree)f1->Get(“OuterTracker”);
Int_t nentries_track = (Int_t)t1->GetEntries();
TLeaf *XPOS = t1->GetLeaf(“xPos”);
TLeaf *YPOS = t1->GetLeaf(“yPos”);
for (Int_t i = 0 ; i <nentries_track; i++){ // track event loop
t1->GetEntry(i);

  cout<< XPOS->GetValue()<<"	"<< YPOS->GetValue()<<endl;

}

Which is working fine in local root having version “6.10/04”. Doing same in lxplus using makefile its showing the error-

g++ -I./ -g -std=c++11 root-config --cflags -o NtupleMerger.o -c NtupleMerger.cc
NtupleMerger.cc: In member function ‘void NtupleMerger::filltrigTrackmap()’:
NtupleMerger.cc:162:13: error: invalid use of incomplete type ‘class TLeaf’
cout<< XPOS->GetValue(5)<<endl;
^~
In file included from /cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/CMSSW_9_3_0/external/slc6_amd64_gcc630/bin/…/…/…/…/…/…/…/slc6_amd64_gcc630/lcg/root/6.10.04-ghjeda/include/TTree.h:29:0,
from /cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/CMSSW_9_3_0/external/slc6_amd64_gcc630/bin/…/…/…/…/…/…/…/slc6_amd64_gcc630/lcg/root/6.10.04-ghjeda/include/TChain.h:24,
from NtupleMerger.h:5,
from NtupleMerger.cc:1:
/cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/CMSSW_9_3_0/external/slc6_amd64_gcc630/bin/…/…/…/…/…/…/…/slc6_amd64_gcc630/lcg/root/6.10.04-ghjeda/include/TBranch.h:38:7: note: forward declaration of ‘class TLeaf’
class TLeaf;

I am using the root version “6.10/05” in lxplus. Can you please point me where I am going wrong while using in lxplus.

Thanks,
Amandip

#include "TLeaf.h"

Hi Wile,

I have tried including the TLeaf header it was showing segmentation fault. Here is the stack trace-

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x00007f0be1ea789e in waitpid () from /lib64/libc.so.6
#1 0x00007f0be1e394e9 in do_system () from /lib64/libc.so.6
#2 0x00007f0be3c10d68 in TUnixSystem::StackTrace() () from /cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/CMSSW_9_3_0/external/slc6_amd64_gcc630/lib/libCore.so
#3 0x00007f0be3c1321c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/CMSSW_9_3_0/external/slc6_amd64_gcc630/lib/libCore.so
#4
#5 0x00007f0be3d48500 in ?? ()
#6 0x00000000004791ed in NtupleMerger::NtupleMerger (this=0x7fffdda88a00, dutTuple=…, telTuple=…, runNumber=…) at NtupleMerger.cc:30
#7 0x000000000047aced in main (argc=4, argv=0x7fffdda88de8) at NtupleMerger.cc:343

The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum ROOT Forum.
Only if you are really convinced it is a bug in ROOT then please submit a
report at Sign in to GitHub · GitHub. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00007f0be3d48500 in ?? ()
#6 0x00000000004791ed in NtupleMerger::NtupleMerger (this=0x7fffdda88a00, dutTuple=…, telTuple=…, runNumber=…) at NtupleMerger.cc:30
#7 0x000000000047aced in main (argc=4, argv=0x7fffdda88de8) at NtupleMerger.cc:343

I have also used TTreeReader, successfully locally but getting same crash in lxplus including the headers. Kindly suggest me if this is for root version or may be I need to update the makefile.

Thanks,
Amandip

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