Hi Christian, I don't uderstand your problem. With the method I indicated you can also get events ahead of the current on without any problem. Example : tree->GetEntry(15); // Get the current event Event* evold=new Event(*event); // save the current event tree->GetEntry(120); // Get another event for mixing Now you have "evold" and "event" which you can mix as you like. Obviously you can read-in several other events as well if you want some more complex mixing procedure. Cheers, Nick. -- Dr. Nick van Eijndhoven mailto:nick@phys.uu.nl http://www.phys.uu.nl/~nick -------------------------------------------------------------------------- Org.: Utrecht University, Faculty of Physics and Astronomy Address: Princetonplein 5, NL-3584 CC Utrecht, The Netherlands Phone: +31-30-2532331(direct) +31-30-2531492(secr.) Fax: +31-30-2518689 CERN: +41-22-7679751(direct) +41-22-7675857(secr.) Fax: +41-22-7679480 Offices: Buys Ballot laboratory Room 710 (Utrecht) B23 1-020 (CERN) -------------------------------------------------------------------------- Christian Holm Christensen wrote: > > Hi Nick, > > Nick van Eijndhoven <Nick@phys.uu.nl> wrote concerning > Re: [ROOT] Mixed events from TChains [Sun, 26 Jan 2003 14:08:36 +0100] > ---------------------------------------------------------------------- > > Hi Christian, > > What I normally use is the following : > > > > 1) Use GetEntry(ient) to get a certain entry in memory. > > > > 2) Then do something like Event* evtold=new Event(*event) > > to store the current event into the evtold structure. > > > > 3) Then do again GetEntry(ient2) to obtain a different > > event in memory. > > > > 4) Now you have 2 structures filled, namely "event" > > and "evtold" and you can have fun with your mixing :). > > That would obviously work, if you just want the previous event > (basically my work-a-round # 1, though with a cache of exactly one), > but what if you want events ahead of the current one? > > > > I can think of 3 ways of working around this: > > > > > > 1) Make the user set a flag that caches the current event, and they > > > can then call it back from memory storage later on. This obviously > > > doesn't work if you want to read events ahead of the current one. > ... > > Also, the whole point was to avoid too much copying and > (de)allocations. Hence, I'd rather there was some other way to do > this. > > Thank you. > > Yours, > > ___ | Christian Holm Christensen > |_| | ------------------------------------------------------------- > | | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 > _| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91 > _| Denmark Office: (+45) 353 25 305 > ____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm > | |
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET