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:21 MET