FindBin function: speed as a function of number of bins

Hi all,

hope this is the right forum for this question, but I haven’t found this information in the documentation and it might be useful for someone else. As I’m trying to optimise some code that reads values stored in o(200) TH2Ds with a maximum of o(200x10) bins, I would like to know what the approximate ‘complexity’ of the FindBin function for a TH2D is, in terms of the number of bins.

Thank you,
Caterina

Hi Caterina,

2 cases:
-case 1: your TH2 histograms have a fix bin size. The time for FindBin does not depend on the number of bins.
-case 2: one of your axes (or both) have a variable bin width. FindBin performs a binary search on the table of bin edges, ie the time is proportional to the number of bins for this axis.

Rene