Problem with ROOT in Cpp

Dear all,

I’m working with a ROOT File and a C++ code, which includes

    Mono->SetBranchAddress("var1", &var1);
    Mono->SetBranchAddress("var2", &var2);
    ... 

For a already produced root file, the code runs as I supposed. However, for the new files I’m producing, with all the same branches, is producing a series of errors.

Including:

Error in <TList::Clear>: A list is accessing an object (0x2c3a140) already deleted (list name = TList)

and most specially

Error in <TList::Clear>: A list is accessing an object (0x1fe9fd0) already deleted (list name = TList)


 *** Break *** bus error



#5  0x00007fb85afe90db in int TStreamerInfoActions::VectorLooper::ReadCollectionBasicType<double>(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.14.09-pafccj6/lib/libRIO.so
#6  0x00007fb85aeb4e14 in TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) [clone .localalias.117] () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.14.09-pafccj6/lib/libRIO.so
#7  0x00007fb84eae7f4f in TBranchElement::ReadLeavesMember(TBuffer&) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.14.09-pafccj6/lib/libTree.so
#8  0x00007fb84ead91e4 in TBranch::GetEntry(long long, int) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.14.09-pafccj6/lib/libTree.so
#9  0x00007fb84eaef2b9 in TBranchElement::GetEntry(long long, int) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.14.09-pafccj6/lib/libTree.so
#10 0x00007fb84eb3ff41 in TTree::GetEntry(long long, int) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.14.09-pafccj6/lib/libTree.so

Investigating the format of the ROOT files, I found:

For the one that is working:

(TFile *) 0x16642b0
root [2] .ls
TFile**		input.root	
 TFile*		input.root	
  KEY: TNtuple	monopoles;2	monopoles [current cycle]
  KEY: TNtuple	monopoles;1	monopoles [backup cycle]

The files that is yielding the ** bus error **:

(TFile *) 0x1d899f0
root [1] .ls
TFile**		2016METRunC_9X.root	
 TFile*		2016METRunC_9X.root	
  KEY: TTree	monopoles;1	Monopole Variables

Using a code, I tried to make the transformation TTree->TNtuple.

(TFile *) 0x1f46310
root [1] .ls
TFile**		2016METRunC_9X_test.root	
 TFile*		2016METRunC_9X_test.root	
  KEY: TNtuple	monopoles;1	TNtuple from TTree

I got rid of the bus error, but didn’t manage to get the same result as the first file (already produced), even with the NTuple format.

A similar

Error in <TList::Clear>: A list is accessing an object (0x2c3a140) already deleted (list name = TList)

is continues to be yielded.

I wonder if any of you stopped at a similar problem or had a similar experience.

Best regards,
Thales

Hi Thales,

Thanks for the post and welcome to the ROOT Community!

I do not understand very well what is going on. Are you trying to write a TTree and encounter errors when doing so? Are you reading a TNTuple? Maybe both, but it would be perhaps better to tackle the problems one by one.

Could you try to clarify?

Cheers,
Danilo

Dear Danilo,

Thanks for the welcome and the answer.

The scenario is the following:

I have three root files with the same branches (at least in the names) and a code that performs some analysis and read from these branches (using SetBranchAddress).

The first root file runs in the cod, but I don’t know how it was produced, but I can see that have the format KEY:TNtuple.

The second root file doesn’t run in the code, producing segmentation violations and a ** bus error **, completely new to me. This root file was produced by me, but it is a KEY: TTree.

In order to try to solve this issue I made a external code that aims to transform the root file (the third root file) with TTree in a root file with KEY:TNtuple, similar to the one that runs in the code.

For the third root file the code doesn’t break, however it doesn’t produces any outputs, like if all the data was ignored or not properly read. My best guess would be because of the Error in <TList::Clear>: A list is accessing an object (0x2c3a140) already deleted (list name = TList).

In resume, I think that the problems is around, I have a code that runs on a TNtuple but not in a TTree even with, apparently, same branches.

Are there another possible checks that can be made in the root files?

Best regards,
Thales

I think we will need to see those files to help you further.