RE: Crash in LoadTree

From: Philippe Canal <>
Date: Thu, 28 Jul 2005 14:03:48 -0500

Hi Antonio,

It is hard to tell what actually happened. Most likely an object on the stack or already deleted, is being delete by the TFile (so the culprit is likely to be a TTree or an histogram).

Your best bet is to run you program with valgrind --tool=memcheck (see which should be able to tell which object is the problem.


-----Original Message-----
From: [] On Behalf Of Antonio Sidoti(Roma)
Sent: Thursday, July 28, 2005 11:59 AM
Subject: [ROOT] Crash in LoadTree

I have a problem looping on a TChain containing two or more root files. My macro is a test macro (not very different from the one obtained from the MakeClass function with just some cout added). Everything is almost OK if I run on a TChain made with just one file. "Almost" because I get a segmentation violation when I quit root (root> .q). If I run on a TChain that contains two or more files I get a segmentation violation while I finish to read the first file. It doesn't seem to me that these root files are corrupted (I can load them, draw variables from TTree, etc...). I attach a piece of log file. I am using root 4.04/02. What should I do to fix that ? I attach also my script code (test.C). Best Regards,
Thanks a lot,

Loading Tree
PIPPO Load Tree

cat test.C

#define lut_cxx
#include "test.h"
#define DEBUG

using namespace std;
//#define M_PI 3.14592654

void lut::FitAll(Int_t stphi, Int_t steta, Int_t iadd, Bool_t verb, Float_t muphi, Float_t mueta){
  if (fChain == 0) return;
  Long64_t nentries = fChain->GetEntriesFast();   Int_t nbytes = 0, nb = 0;
  cout << "Total of " << nentries << " entries" << endl;   for (Long64_t jentry=0; jentry<nentries;jentry++) { // 1st loop on events     cout << "Loading Tree" << endl;
    Long64_t ientry = LoadTree(jentry);
    if (ientry < 0) break;
    nb = fChain->GetEntry(jentry); nbytes += nb;     cout << "file Name:" << endl;
    cout << "file Name:" << fChain->GetCurrentFile()->GetName() << endl;
    cout << endl;
    cout << "Entry:" << jentry << endl;
    cout << "CICCIO " << fChain->GetTree()->GetEntries() << endl;

  cout << "End first loop on events" << endl; } Received on Thu Jul 28 2005 - 21:32:42 MEST

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