Mixed events from a TChain

From: Christian Holm Christensen <cholm_at_nbi.dk>
Date: Sun, 02 Jan 2005 15:36:57 +0100


Hi all,

I think there's a problem with TChain::CloneTree or something like that.

If I create a TTree, and read it back so that each time a read an entry, I also read the previous entry (if available), then it works fine using TTree::CloneTree:

	TTree* tree  = static_cast<TTree*>(file->Get("T"));
	TTree* clone = tree->CloneTree();
	tree->SetBranchAddress("vector", &array);
	clone->SetBranchAddress("vector", &other);
	Int_t entry = 0;
	while (tree->GetEntry(entry) > 0) { 
	  cout << "Got " << array->GetEntries() << " vectors" << endl;
	  if (entry > 0) { 
	    clone->GetEntry(entry - 1);
	    cout << "Got " << other->GetEntries() << " vectors" << endl;
	  }
	  entry++;
        }

However, If I do the same thing with a TChain, the `clone' tree never fills the `other' array:

	TChain* tree = new TChain("T");
	tree->Add("*.root");
	Tree*  clone = tree->CloneTree();
	// Rest as above 

The weird thing is, that the `clone' tree reads the right number of bytes, but never fills the `other' array.

I have attached a small script as well as the output of running that script. Note, that the script first creates 3 files with a TTree in each. Then it reads back (as explained above) one of the files using a TTree, which works fine. Finally, it reads back all three files using a TChain, which fails miserably.

Am I doing something wrong, or does the CloneTree facility not work with a TChain?

I'm using

	ROOT Version 4.01/05 (CVS head around 14 December 2004) 
	Debian GNU/Linux unstable (sid) 
	G++ (GCC) 3.3.5 (Debian 1:3.3.5-5)
	

Yours,

-- 
 ___  |  Christian Holm Christensen 
  |_| |  -------------------------------------------------------------
    | |  Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|           DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|            Denmark                    Office: (+45) 353  25 404
 ____|   Email:   cholm_at_nbi.dk               Web:    www.nbi.dk/~cholm
 | |

Received on Sun Jan 02 2005 - 15:36:41 MET

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