Tioukov Valeri wrote: > > Hi rooters, > > How to solve in the best way the following problem (I think very common): > > I have big bank of events ~30000 and I need the fast access to them by > the event identifier. > > Now my events are stored in the Tree and it is very convinient for > analysis. But then I need to get event by it's identifier it is not > straightforward. One branch (leaf) of the tree is the eventID. So if I > need to get the event NNNN the obvious way is to loop this branch by all entries > upto eventID==NNNN. Due to split algorithme it is not slow, but > for the big number of events the time penalty is significant especially > if I need to do this operation 3000 times. > > To speedup the process I created for this tree the hashtable keeping the > special objects with 2 numbers : eventID and Entry. Using this hashtable > I can fastly find event Entry by the eventID and then get the > event from Tree by the Entry. > It works. But this solution seems to me not very elegant. May be in Root > already exists something more automatic? > > Regards > Valeri Hi Valeri, The THashTable is a good solution. However, it requires a table with 2 integers per entry. Another solution (may be faster) and more economical could be to build an array with the list of your eventIDs and use the TMath::BinarySearch functions recently introduced in TMath. Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:30 MET