Re: [ROOT] Bug in TChain::Merge

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Nov 30 2000 - 17:30:06 MET


Hi George,
I am at DESY this week and not much time to investigate this problem.
Could you send me a small tar file with a subset of your classes and two
data files that I could use to understand the problem?

Rene Brun

On Wed, 29 Nov 2000, George A. Heintzelman wrote:

> 
> Hi rooters,
> 
> I think there is a bug in TChain::Merge. I have a chain of files, each 
> of which has trees with a single branch, made by a TBranch (splitlevel 
> = 1) on this class:
> 
> 
> class GAHPairTreeElem: public TObject {
> public:
>   // Not using f convention because this is a struct:
>   GAHPairTreeElem() {};
>   GAHPairTreeElem(int Create);
>   TClonesArray *Tracks;
>   TClonesArray *Pairs;
>   void Clear();  // Called to clear both clonesarrays in my loops.
> ClassDef(GAHPairTreeElem,1)
> };
> 
> By the construction of this, number of Pairs = combinations(2 tracks) 
> in each event.
> 
> Because I need to do some random access on this tree when I create a 
> mixed-event background for the pairs, I want to merge the chain into a 
> single tree for faster access. When I do so, I run into trouble if 
> either 0 tracks or 0 pairs are in any entry. It looks like in that 
> case, the clonesarray from the previous event is held over. (See scans 
> below)
> 
> I ran into this problem as well in my own loops over entries, but was 
> able to work around it by calling Clear on the clonesarrays myself 
> in-between loading events; but I can't do that when I'm using the 
> TChain::Merge facility.
> 
> I'm using Root 2.25/02, but I don't think TBranchClones code has 
> changed much lately.
> 
> Here's the scan of the first part of the chain:
> 
> ************************************
> *    Row   *   Tracks_ *    Pairs_ *
> ************************************
> *        0 *         1 *         0 *
> *        1 *         1 *         0 *
> *        2 *         1 *         0 *
> *        3 *         0 *         0 *
> *        4 *         1 *         0 *
> *        5 *         2 *         1 *
> *        6 *         1 *         0 *
> *        7 *         1 *         0 *
> *        8 *         3 *         3 *
> *        9 *         2 *         1 *
> *       10 *         0 *         0 *
> *       11 *         2 *         1 *
> *       12 *         1 *         0 *
> *       13 *         1 *         0 *
> *       14 *         0 *         0 *
> *       15 *         0 *         0 *
> *       16 *         0 *         0 *
> *       17 *         1 *         0 *
> *       18 *         1 *         0 *
> *       19 *         1 *         0 *
> *       20 *         0 *         0 *
> *       21 *         0 *         0 *
> *       22 *         1 *         0 *
> *       23 *         0 *         0 *
> *       24 *         0 *         0 *
> ************************************
> 
> And here's the scan of the merged tree created from that chain:
> ************************************
> *    Row   *   Tracks_ *    Pairs_ *
> ************************************
> *        0 *         1 *         0 *
> *        1 *         1 *         0 *
> *        2 *         1 *         0 *
> *        3 *         1 *         0 *
> *        4 *         1 *         0 *
> *        5 *         2 *         1 *
> *        6 *         1 *         1 *
> *        7 *         1 *         1 *
> *        8 *         3 *         3 *
> *        9 *         2 *         1 *
> *       10 *         2 *         1 *
> *       11 *         2 *         1 *
> *       12 *         1 *         1 *
> *       13 *         1 *         1 *
> *       14 *         1 *         1 *
> *       15 *         1 *         1 *
> *       16 *         1 *         1 *
> *       17 *         1 *         1 *
> *       18 *         1 *         1 *
> *       19 *         1 *         1 *
> *       20 *         1 *         1 *
> *       21 *         1 *         1 *
> *       22 *         1 *         1 *
> *       23 *         1 *         1 *
> *       24 *         1 *         1 *
> ************************************
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET