RE: [ROOT] Problem with CloneTree

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Sep 02 2003 - 18:41:25 MEST


Hi Eric,

In ROOT 3.05.06 and below, using CloneTree __requires__ to
set the addresses of __all__ the branches in the original tree.
If this is not done, ROOT sometimes silently creates a corrupted file.

To fix, the problem use root 3.05.07 or make sure to check that all
the top branches of the original file have their addresses set by
your copying script.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Eric Thomas
Sent: Monday, September 01, 2003 12:13 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Problem with CloneTree


Hi,

I create a CloneTree  with the code below (no selection applied) .
It seems OK, a new tree is created with the same number of entries
as the original file. However, when I re-run the code on the produced
CloneTree,
the code crash after 18 events with following error message:


This file contains 2530 events

event number 0
...
event number 18
Error: C++ exception caught FILE:/tmp/7vWjCb_cint LINE:1
*** Interpreter error recovered ***

I hardly can understand this, since I am running the same code on
(supposed) identical Trees.

I am  running root 3.05  under fermi-linux 7.

Thanks for help!


Eric


// Code extract
 if (fChain == 0) return;

  // Tree of selected events
   TFile *sel_file = new TFile("sel_tree.root","RECREATE");
   sel_file->cd();
   TTree *sel_tree = fChain->CloneTree(0);

   Int_t my_entries = Int_t(fChain->GetEntries());
   cout << endl << endl << " This file contains " << my_entries << " events
" << endl << endl;

   Int_t nbytes = 0, nb = 0;

  for (Int_t jentry=0; jentry<my_entries;jentry++) {
    Int_t ientry = LoadTree(jentry);
    cout << "event number " << jentry<< endl;
    nb = fChain->GetEntry(jentry);   nbytes += nb;
    sel_tree->Fill();

 }// jentry

   sel_file->cd();
   sel_file->Write();
   sel_file->Close();

   delete sel_file;



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET