Hi, On Mon, 2 Dec 2002, Perfetto Francesco wrote: > 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") Unfortunately C pointers are very stupid. They don't know how much elements the array contains. Imagine that I add TLorentzVector *tlv = new TLorentzVector(0, 1, 2, 3); res->Branch("tlv", "TLorentzVector", &tlv); > res->Branch("p4_ph" ,"TLorentzVector" ,&p4_ph); Do you see any way how TTree can separate this cases? > > Can you tell me where I mistake ? You should use an intelligent container. For example TClonesArray *tca = new TClonesArray("TLorentzVector", 7); res->Branch("tca", "TClonesArray", &tca, 32000, 0); //... new ( (*tca)[0] ) TLorentzVector(); //... ( (TLorentzVector *)tca->At(0) )->SetX(5); res->Fill(); tca->Clear(); ... > On Sat, 30 Nov 2002, Maksim A. Nikulin wrote: .. > > I think you should create TClonesArray of TLorentzVector's or simple class > > which contents C array of TLorenzVector's ... Maksim Nikulin <M.A.Nikulin@inp.nsk.su>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:22 MET