Re: [ROOT] A vector of TLorentzVector

From: Perfetto Francesco (Francesco.Perfetto@na.infn.it)
Date: Mon Dec 02 2002 - 19:07:57 MET


Hi,
I thanks you for your suggestion, but I have yet a problem.
Now I can define an array of TLorentzVector but remain me the problem to
put it in a tree. Infact my declaration of tree with a branch of
TLorentzVector (see below) still don't work

TlorentzVector *p4_ph = new TLorentzVector[14]  <<<<----This ok now
...
TTree *res = new TTree("res","res di prova")
res->Branch("p4_ph" ,"TLorentzVector" ,&p4_ph);

Can you tell me where I mistake ?

Ciao, Francesco.

On Sat, 30 Nov 2002, Maksim A. Nikulin wrote:

> Hi
>
> On Fri, 29 Nov 2002, Perfetto Francesco wrote:
>
> > Hi,
> > Is it possible to do a vector of TLorentzVector, and if yes, how do it ?
>
> Yes, of course
>
> > (I must put it in a tree)
>
> I think you should create TClonesArray of TLorentzVector's or simple class
> which contents C array of TLorenzVector's
>
> > I have do the following code, but it don't work:
> > ...
> >  TLorentzVector *p4_ph[7] = new TLorentzVector; // array of 7 elements
>
> This line is wrong. You want 7 objects, but create only one. You define
> (TLorentzVector **) but result of expression new TLorentzVector is
> (TLorentzVector *). Use for example
>
> TLorentzVector *p4_ph = new TLorentzVector[7];
> p1[1].SetPxPyPzE(0, 1, 2, 3);
>
> or
>
> TLorentzVector *p4_ph[7];
> for(Int_t i = 0; i < 7; ++i) {
> 	p4[i] = new TLorentzVector;
> 	p4[i]->SetPxPyPzE(0, 1, 2, 3);
> }
>
> Maksim Nikulin <M.A.Nikulin@inp.nsk.su>
>
>
>
>



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:22 MET