Atlfast

Please see in file: ATLFMCMaker.cxx, from ftp://pcroot.cern.ch/root/atlfast.tar.gz , line ~190:

m_Fruits = new TClonesArray("TMCParticle",kMAXPART, kFALSE); ..... // Open the Root/Pythia file: m_File = new TFile(fname); // Get the Tree called "t" from the file m_Tree = (TTree*)m_File->Get("T"); // Data will be read in in the standard ClonesArray m_Tree->SetBranchAddress("particles",&m_Fruits); why in this case (read only) m_Fruits = new TClonesArray(…), why not simple m_Fruits = 0 ?

Thanks, Jan

btw, in constructor is small typo in memset functions: kMAXPART*sizeof(Float_t) <-> 0

Jan,

In this example, the constructor is assumed to be called only once.
See $ROOTSYS/Event for a more general case

Rene

But also in the case m_Fruits = 0 is the constructor called only once, after TTree::SetBranchAddress (or not ?), so why to create a new object ?

Thanks, Jan

True when reading, but when writing, you better create your TClonesArray with teh right size.

Rene