Hi Rutger, I had the same kind of problem, but the other way around, i.e. I needed to sort entries in an tree. This is impossible because by definition, trees are "WORMs" (Write Once, Read Many") Everything depends on the size of your ntuples. If they fit in memory, why not having an array of numbers (representing entry numbers in your ntuple) going from 1 to N, N being the number of entries, then randomize this array and use the randomized array as index to retrieve entries from your ntuple and put those entries into another ntuple with the Fill() standard method ? Just my 2 cents worth. Damir Rutger van der Eijk wrote: > > Hi, > > Does anybody know of an easy way to randomize the entries of a ntuple? > > The problem I have is that I have a TNtuple with lets say 1000 entries. > However due to some reason (clear to me, but not important to you) the > entries are in a certain order. I want to remove this order by randomizing > the entry order. > > I thought of randomly swapping entries within the ntpl. But I didn't find > a method to do so (something like refill...). > > If I could use STL within CINT I would just make a list<int>, where the > integer is the index number. Then randomize the list with random_shuffle > (stl algorithm), and finally copy the elements of the ntpl into another > ntpl in the order defined by the randomized list<int>. > > I don't see how I can easily do this with ROOT inside CINT. (defining > list<int> gives me > > Limitation: Can't instantiate precompiled template list<int> > FILE:/user/r36/mycmt/ot/ott/current/macros/rtNtplDipCorrector.C LINE:139 > > Any suggestions how to do this with ROOT list/vector classes? > > Rutger -- ===================================================================== | Damir Buskulic | Universite de Savoie/LAPP | | | Chemin de Bellevue, B.P. 110 | | Tel : +33 (0)450091600 | F-74941 Annecy-le-Vieux Cedex | | e-mail: buskulic@lapp.in2p3.fr | FRANCE | ===================================================================== mailto:buskulic@lapp.in2p3.fr
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET