I am re-writing my post as for some reason was deleted while being moved from the Root-Documentation to this thread
I am doing some pseudo and using TRandom3 for creating a list of events to be run over every time for every pseudo… The problem is that as my sample is large , it takes a lot of time to create this “index”… So, is there any other way to randomly loop inside a root file and read events except this method ?
[quote=“Alkass”]I am doing some pseudo and using TRandom3 for creating a list of events to be run over every time for every pseudo… The problem is that as my sample is large , it takes a lot of time to create this “index”… So, is there any other way to randomly loop inside a root file and read events except this method ?
[/quote]
If your events are stored in a tree/chain, then all you need to know (for each sample) is the maximum number of events. Then you can just pick the right number of random events (e.g., int indexOfRandomEvent = gRandom->Uniform (totalNumberOfEvents;) and get them.