Loading TTree from a directory in root file to TChain

Hello,

I loaded TTree “t0tree” from the directory “Alla_histograms/chist” from file.root
tree may be printed, but i have “segmentation violation” when i’m trying to Draw leaf.

R[code]OOT 5.34/30 (v5-34-30@v5-34-30, Feb 19 2016, 09:57:14 on linuxx8664gcc)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.

root [0] TChain *chain = new TChain(“Alla_histograms/chist”,“t0tree”)
root [1] chain->AddFile("/…/rootfile.root")
(Int_t)1
root [2] chain->Print()


*Chain :Alla_histograms/chist: /mnt/hgfs/DETECTORS_DATA/T0runs/ESD/alice_cern.ch_user_a_alla_treeLHC15o_output246994muon_calo_000_018_AnalysisResults.root *


Collection name=‘chist’, class=‘TList’, size=1


*Tree :t0tree : None here *
*Entries : 149878 : Total = 93655950 bytes File Size = 0 *

  •    :          : Tree compression factor =   1.00                       *
    

*Br 0 :fNevent : fNevent/I *
*Entries : 149878 : Total Size= 603222 bytes All baskets in memory *
*Baskets : 18 : Basket Size= 32000 bytes Compression= 1.00 *



*Br 121 :T0satellite : T0satellite/O *
*Entries : 149878 : Total Size= 151218 bytes All baskets in memory *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 122 :multEstimator : multEstimator/I *
*Entries : 149878 : Total Size= 603474 bytes All baskets in memory *
*Baskets : 18 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 123 :zbg : zbg/O *
*Entries : 149878 : Total Size= 151106 bytes All baskets in memory *
*Baskets : 4 : Basket Size= 32000 bytes Compression= 1.00 *

root [3] chain->Draw(“meanA”)

*** Break *** segmentation violation

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

from libstdcxx.v6.printers import register_libstdcxx_printers

#0 0x00007f70a3f75b4c in __libc_waitpid (pid=82498, stat_loc=stat_loc
entry=0x7ffe0bc6cc80, options=options
entry=0) at …/sysdeps/unix/sysv/linux/waitpid.c:31
#1 0x00007f70a3efb2e2 in do_system (line=) at …/sysdeps/posix/system.c:148
#2 0x00007f70a4c425b3 in TUnixSystem::StackTrace (this=0x185dbb0) at /home/dmitry/alicesw/root/v5-34-30/src/core/unix/src/TUnixSystem.cxx:2419
#3 0x00007f70a4c441cc in TUnixSystem::DispatchSignals (this=0x185dbb0, sig=kSigSegmentationViolation) at /home/dmitry/alicesw/root/v5-34-30/src/core/unix/src/TUnixSystem.cxx:1294
#4
#5 0x0000000000841f0f in ?? ()
#6 0x00007f70a09a6a5c in TChain::LoadTree (this=0x26aed80, entry=0) at /home/dmitry/alicesw/root/v5-34-30/src/tree/tree/src/TChain.cxx:1578
#7 0x00007f70a09a8a9f in TChain::Draw (this=0x26aed80, varexp=0x28cc728 “meanA”, selection=0x7f70a0ac5f17 “”, option=0x7f70a0ac5f17 “”, nentries=1000000000, firstentry=0) at /home/dmitry/alicesw/root/v5-34-30/src/tree/tree/src/TChain.cxx:851
#8 0x00007f70a4e01408 in G__G__Base2_10_0_15 (result7=0x7ffe0bc70570, funcname=, libp=0x7ffe0bc705b0, hash=) at core/base/src/G__Base2.cxx:6459
#9 0x00007f70a34fe72a in Cint::G__ExceptionWrapper (funcp=0x7f70a4e01380 <G__G__Base2_10_0_15(G__value*, char const*, G__param*, int)>, result7=0x7ffe0bc70570, funcname=0x26a6cf0 “”, libp=0x7ffe0bc705b0, hash=0) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/Api.cxx:393
#10 0x00007f70a35e1204 in G__execute_call (result7=0x7ffe0bc70570, libp=0x7ffe0bc705b0, ifunc=0x26a6cf0, ifn=0) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/newlink.cxx:2408
#11 0x00007f70a35e1ba7 in G__call_cppfunc (result7=0x7ffe0bc70570, libp=0x7ffe0bc705b0, ifunc=0x26a6cf0, ifn=0) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/newlink.cxx:2612
#12 0x00007f70a35bcded in G__interpret_func (result7=0x7ffe0bc70570, funcname=0x1879830 “Draw”, libp=0x7ffe0bc705b0, hash=398, p_ifunc=0x26a6cf0, funcmatch=1, memfunc_flag=1) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/ifunc.cxx:5791
#13 0x00007f70a359590a in G__getfunction (item=0x1872fc7 “Draw(“meanA”)”, known3=0x7ffe0bc7be3c, memfunc_flag=1) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/func.cxx:2660
#14 0x00007f70a36ca3a5 in G__getstructmem (store_var_type=112, varname=…, membername=0x1872fc7 “Draw(“meanA”)”, memnamesize=2147483647, tagname=0x1878c00 “chain”, known2=0x7ffe0bc7be3c, varglobal=0x7f70a3998400 <G__global>, objptr=2) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/var.cxx:6821
#15 0x00007f70a36b9e18 in G__getvariable (item=0x1872fc0 “chain->Draw(“meanA”)”, known=0x7ffe0bc7be3c, varglobal=0x7f70a3998400 <G__global>, varlocal=0x0) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/var.cxx:5407
#16 0x00007f70a3585924 in G__getitem (item=0x1872fc0 “chain->Draw(“meanA”)”) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/expr.cxx:1906
#17 0x00007f70a3582f32 in G__getexpr (expression=0x189bee0 “chain->Draw(“meanA”)”) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/expr.cxx:1488
#18 0x00007f70a36144f4 in G__exec_function (statement=…, pc=0x7ffe0bc7e640, piout=0x7ffe0bc7e644, plargestep=0x7ffe0bc7e64c, presult=0x7ffe0bc7e730) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/parse.cxx:645
#19 0x00007f70a3625b4f in G__exec_statement (mparen=0x7ffe0bc7e910) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/parse.cxx:7371
#20 0x00007f70a35555fb in G__exec_tempfile_core (file=0x0, fp=0x26c5da0) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/debug.cxx:266
#21 0x00007f70a355706d in G__exec_tempfile_fp (fp=0x26c5da0) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/debug.cxx:807
#22 0x00007f70a3634821 in G__process_cmd (line=0x28cc830 “chain->Draw(“meanA”)”, prompt=0x1863c58 “”, more=0x1863c50, err=0x7ffe0bc7fbec, rslt=0x7ffe0bc7fc20) at /home/dmitry/alicesw/root/v5-34-30/src/cint/cint/src/pause.cxx:3343
#23 0x00007f70a4bff7ce in TCint::ProcessLine (this=0x1863c10, line=0x28cc830 “chain->Draw(“meanA”)”, error=0x0) at /home/dmitry/alicesw/root/v5-34-30/src/core/meta/src/TCint.cxx:549
#24 0x00007f70a4b68b46 in TApplication::ProcessLine (this=0x19e2460, line=, sync=, err=0x0) at /home/dmitry/alicesw/root/v5-34-30/src/core/base/src/TApplication.cxx:978
#25 0x00007f70a47a6189 in TRint::HandleTermInput (this=0x19e2460) at /home/dmitry/alicesw/root/v5-34-30/src/core/rint/src/TRint.cxx:583
#26 0x00007f70a4c43965 in TUnixSystem::CheckDescriptors (this=this
entry=0x185dbb0) at /home/dmitry/alicesw/root/v5-34-30/src/core/unix/src/TUnixSystem.cxx:1396
#27 0x00007f70a4c448ea in TUnixSystem::DispatchOneEvent (this=0x185dbb0, pendingOnly=) at /home/dmitry/alicesw/root/v5-34-30/src/core/unix/src/TUnixSystem.cxx:1103
#28 0x00007f70a4bc32d9 in TSystem::InnerLoop (this=0x185dbb0) at /home/dmitry/alicesw/root/v5-34-30/src/core/base/src/TSystem.cxx:410
#29 0x00007f70a4bc3074 in TSystem::Run (this=0x185dbb0) at /home/dmitry/alicesw/root/v5-34-30/src/core/base/src/TSystem.cxx:360
#30 0x00007f70a4b6723f in TApplication::Run (this=this
entry=0x19e2460, retrn=retrn
entry=false) at /home/dmitry/alicesw/root/v5-34-30/src/core/base/src/TApplication.cxx:1126
#31 0x00007f70a47a7347 in TRint::Run (this=0x19e2460, retrn=) at /home/dmitry/alicesw/root/v5-34-30/src/core/rint/src/TRint.cxx:454
#32 0x0000000000400fdc in main (argc=1, argv=0x7ffe0bc821a8) at /home/dmitry/alicesw/root/v5-34-30/src/main/src/rmain.cxx:29

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x0000000000841f0f in ?? ()
#6 0x00007f70a09a6a5c in TChain::LoadTree (this=0x26aed80, entry=0) at /home/dmitry/alicesw/root/v5-34-30/src/tree/tree/src/TChain.cxx:1578
#7 0x00007f70a09a8a9f in TChain::Draw (this=0x26aed80, varexp=0x28cc728 “meanA”, selection=0x7f70a0ac5f17 “”, option=0x7f70a0ac5f17 “”, nentries=1000000000, firstentry=0) at /home/dmitry/alicesw/root/v5-34-30/src/tree/tree/src/TChain.cxx:851

[/code]

I also have a crash with chain->GetEntry(10) and chain->Show(10)
The same procedure works propelly if tree is on top of rootfile.root

[code]CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] TChain *chain = new TChain(“t0tree”)
root [1] chain->AddFile("/mnt/hgfs/DETECTORS_DATA/T0runs/RAW/245145/tree245145.19.root")
(Int_t)1
root [2] chain->Show(0)
======> EVENT:0
T0_C_2_CFD_0 = 0
T0_C_2_CFD_1 = 0

T0_A_12_QTC10_4 = 0
event = 0
timestamp = 1448556499
BCID = 0
TRMBCID = 0
fOrbit = 1048576
event = 0
triggers = 0
root [3] chain->GetEntry(10)
(Int_t)4270
root [4]

[/code]
Is it a bug or I’m missing something?

Cheers,
Dmitry

Hi,

This does indeed sounds like a bug … Can you provide the failing file so that we can investigate further.

Thanks,
Philippe.

Sorry for delay, my file in attachment.

I just noticed, that TTree is in TList that is in folder in file.
(TList and Folder are the same in TBrowser)

Can I collect files like that in TChain?

Dmitry
test.root (490 KB)

TTree is in TList that is in folder in file
Can I collect files like that in TChain?

Unfortunately, no. This case has not been forseen in the code of TChain::LoadTree.

The alternative is to replace the list (chist in your case) by a sub-directory, in which case the chain will work with:TChain *chain = new TChain("Alla_histograms/chist/t0tree")

Cheers,
Philippe.

OK, thanks!

regards,
Dmitry