RE: Segmantation fault at the END of TChain

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Mon, 11 Jul 2005 17:06:13 -0500


Hi,

Could you make your root file available so that we can try to reproduce the problem (I do not see anything obviously wrong)

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Lashkar Kashif
Sent: Monday, July 11, 2005 9:54 AM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] Segmantation fault at the END of TChain

Hi,

I'm running Root v4.04/02 on Windows XP under cygwin. I chain up several files using TChain and run on a tree. After the code has run over all events, I get segmentation fault (code and backtrace below). Changing the last file on the chain doesn't make a difference. My guess is there should be some sort of a closing statement at the end which is missing?

Thanks in advance for any help- Lashkar

Code:
void main()
{
TChain chain("CBNT/t3333");
chain.Add("~/R-hadron_sim_files/py_mass500.1_154betarec1/filled.beta.51.root
");

chain.Add("~/R-hadron_sim_files/py_mass500.1_154betarec1/filled.beta.52.root
");

Double_t beta;
Int_t fCurrent=-1;

Long64_t nevents = chain.GetEntries();
chain.LoadTree(0);
chain.GetEntry(0);
TLeaf *lbeta = new TLeaf();
lbeta = chain.GetLeaf("beta");

for (Int_t nev=0;nev<nevents;nev++)
 {
   chain.LoadTree(nev);   

   if (chain.GetTreeNumber() != fCurrent)

     {
       chain.GetTree();
       chain.SetBranchAddress("beta", &beta);
       lbeta = chain.GetLeaf("beta");
       fCurrent = chain.GetTreeNumber();
       cout<<"fCurrent = "<<fCurrent<<endl;
     }   

   chain.GetEntry(nev);
   beta = lbeta->GetValue();
   cout<<"beta = "<<beta<<endl;
 }
}

Stack:
Program received signal SIGSEGV, Segmentation fault. 0x610aa6ff in setstate () from /usr/bin/cygwin1.dll (gdb) bt

#0  0x610aa6ff in setstate () from /usr/bin/cygwin1.dll
#1  0x6104ec66 in lsearch () from /usr/bin/cygwin1.dll
#2  0x610844ff in cygwin1!aclcheck () from /usr/bin/cygwin1.dll
#3  0x71146aea in G__destroy () from /home/Lashkar/root/bin/libCint.dll
#4  0x7118d1dd in G__interpret_func () from 
/home/Lashkar/root/bin/libCint.dll
#5  0x7116055a in G__getfunction () from /home/Lashkar/root/bin/libCint.dll
#6  0x71154d19 in G__getitem () from /home/Lashkar/root/bin/libCint.dll
#7  0x71153382 in G__getexpr () from /home/Lashkar/root/bin/libCint.dll
#8  0x711b899e in G__exec_function () from 
/home/Lashkar/root/bin/libCint.dll
#9 0x711bfd9a in G__exec_statement () from /home/Lashkar/root/bin/libCint.dll
#10 0x711342eb in G__exec_tempfile_core ()

   from /home/Lashkar/root/bin/libCint.dll #11 0x71134541 in G__exec_tempfile_fp ()

   from /home/Lashkar/root/bin/libCint.dll #12 0x711ca6b5 in G__process_cmd () from /home/Lashkar/root/bin/libCint.dll #13 0x7147d5a4 in TCint::ProcessLine ()

   from /home/Lashkar/root/bin/libCore.dll #14 0x713b8015 in TApplication::ProcessLine ()

   from /home/Lashkar/root/bin/libCore.dll #15 0x73ff2c96 in _fu117__gException ()

   from /home/Lashkar/root/bin/libRint.dll

#16 0x107fe5a8 in ?? ()
#17 0x10f9f74c in ?? ()
#18 0x00000000 in ?? () from
Received on Tue Jul 12 2005 - 00:10:29 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET