Vector in ROOT

hello,
I tried to apply the vector in the Macro. The code is very simple, how event the jobs crash,
Next is my code

#include <vector>
#include <stdlib>
void plot(){
  std::vector<TFile *> ffile;
  std::vector<TTree *> ftree;
  ffile.push_back(new TFile("Tri04eegEff.105613_PythiaExcitedE_1000.Branch0.root"));
  ffile.push_back(new TFile("Tri04eegEff.105613_PythiaExcitedE_1000_Landa5000_full.Branch0.root"));
  ffile.push_back(new TFile("Tri04eegEff.105613_PythiaExcitedE_1000_Landa5000.Branch0.root"));
  for(int i=0; i<ffile.size(); i++){
    TTree* ftmp=(TTree*)ffile[i]->Get("t3333");
    ftmp->SetDirectory(0);
    ftree.push_back(ftmp);
    cout<<" entries = "<<ftmp->GetEntries()<<endl;
  }
  cout<<ftree[0]->GetEntries()<<endl;
}

the jobs crash at the last line
the error are :

[list=][pcuw25] /xdata05/AnaNtup_priv/MadTools/minintuple > root -l plot.C
root [0]
Processing plot.C…
entries = 29931
entries = 25852
entries = 28991

*** Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library “/lib/tls/libthread_db.so.1”.
Attaching to program: /proc/29343/exe, process 29343
(no debugging symbols found)…done.
(no debugging symbols found)…done.
[Thread debugging using libthread_db enabled]
[New Thread -1209042720 (LWP 29343)]
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
0x006d87a2 in _dl_sysinfo_int80 ()
from /lib/ld-linux.so.2
#1 0x00da84b3 in __waitpid_nocancel () from /lib/tls/libc.so.6
#2 0x00d51779 in do_system () from /lib/tls/libc.so.6
#3 0x0062198d in system () from /lib/tls/libpthread.so.0
#4 0x008b379f in TUnixSystem::Exec ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCore.so
#5 0x008b91ad in TUnixSystem::StackTrace ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCore.so
#6 0x008b5e6a in TUnixSystem::DispatchSignals ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCore.so
#7 0x008b5ef8 in SigHandler ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCore.so
#8 0x008b5145 in sighandler ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCore.so
#9
#10 0xf689c3c9 in ?? ()
#11 0x03671b22 in G__G__Tree_103_0_57 ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libTree.so
#12 0x0014ca5f in Cint::G__ExceptionWrapper ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#13 0x00209327 in G__call_cppfunc ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#14 0x001ee8dd in G__interpret_func ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#15 0x001dc9d4 in G__getfunction ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#16 0x0029b5ed in G__getstructmem ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#17 0x002933b7 in G__getvariable ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#18 0x001c096e in G__getitem ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#19 0x001c82ef in G__getexpr ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#20 0x0022f005 in G__exec_statement ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#21 0x001ef703 in G__interpret_func ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#22 0x001dc816 in G__getfunction ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#23 0x001c0cb8 in G__getitem ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#24 0x001c38ff in G__getexpr ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#25 0x001ccc18 in G__calc_internal ()
from /afs/cern.ch/sw/lcg/external/root/5.18.00/slc4_ia32_gcc34/root/lib/libCint.so
#26 0x00242af1 in G__process_cmd ()
[/list],
any ideas?
thanks in advance.
Haiping
[/list][/code]

[quote] ftmp->SetDirectory(0);
[/quote]Why? This detach the TTree from it file … where the data content is still residing…

Philippe.

hello, Philippe
Thanks in advance, but even if I remove this line, the same thing happen,
the jobs crash at the last line.
Haiping

Hi,

Try: root -l plot.C+

Cheers,
Philippe.