Re: Bug in TBranchClones::Fill() ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Mar 26 1998 - 19:10:24 MET


Manuel Sanchez Garcia wrote:
> 
> Hello Rooters,
> 
>     I have just seen that when you try to store a TClonesArray in a
> TTree using a TBranchClones with split=1. It happens that if the
> TClonesArray has holes, then Root crashes when doing TTree::Fill.
> 
>     To illustrate the problem i've written the following macro:
> 
> {
>  gROOT->Reset();
>  gSystem->Load("FullHades.so");
>  TClonesArray clones("HRichRaw",1000);
>  TClonesArray* pClones=&clones;
>  HRichRaw *pRaw;
>  TFile f("test.root","RECREATE");
>  TTree *tree=new TTree("T","Test tree");
>  tree->Branch("Data",&pClones,32000,1);
> 
>  Int_t i,j;
>  for (i=0;i<10;i++) {
>    clones.Clear();
>    for (j=0;j<100;j++) {
>      pRaw=new(clones[j]) HRichRaw(gRandom->Gaus(3,1));
>    }
>    for (j=200;j<1000;j++) {
>      // if i use: "for (j=100;j<100;j++) {" then everything works
>      pRaw=new(clones[j]) HRichRaw(gRandom->Gaus(4,1));
>    }
>    tree->Fill();
>  }
> 
>  f.Write();
> }
> 
> This macro gives a Segmentation Violation; meanwhile if i start the
> second loop in j=100 everything works Ok
> 
>     Is this a bug or a feature?

TClonesArray cannot have holes when used in split mode.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:31 MET