Re: [ROOT] TClonesArray of TLorentzVectors

From: Andre Holzner (Andre.Holzner@cern.ch)
Date: Wed Aug 08 2001 - 20:06:31 MEST


Hello René,

Rene Brun wrote:
> 
> Hi Andre,
> 
> The new operator expects an object, not a pointer. You can do, eg:
> 
> {
>   gSystem->Load("libPhysics.so");
>   TTree *t = new TTree("testtree","testtree");
>   TClonesArray *ca = new TClonesArray("TLorentzVector",10);
>   TClonesArray &clones = *ca;
>   int i;
>   for (i=0; i<10; ++i)
>     new (clones[i]) TLorentzVector(1,2,3,4);
> 
>   ca->ls();
>   t->Branch("leptons",&ca,32000,99);
> }

now I see.. I was passing the address of the TClonesArray
to new (for i = 0 at least) 
instead of the location of the ith element it holds.

sorry for the trivial question & thanks a lot for the help !

André

-- 
------------------+----------------------------------
Andre Holzner     | +41 22 76 76750 
Bureau 32 2-C13   | Building 32     
CERN              | Office 2-C13    
CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:56 MET