Filling THn

Dear ROOT experts,

For filling a THn, I can use the following function:
Fill (const Double_t *x, Double_t w=1.)

This performs an expensive lookup of the bin number.
If I’m filling many THn with the same dimensions, I would like to avoid many lookups, and ask for the bin number once. Then with the knowledge of the bin number, I would like to use
void FillBin (Long64_t bin, Double_t w)
but this is a protected member function.

As I see it now I have to use a set of other public functions in order to update all information of the THn:
AddBinContent (Long64_t bin, Double_t v=1.)
AddBinError2 (Long64_t bin, Double_t e2)
plus a combination of SetEntries (Double_t entries) and Double_t GetEntries () const

Do I see this correctly? Wouldn’t it be helpful in this case if void FillBin (Long64_t bin, Double_t w) was a public function?

Regards,
Jaap

Hi Jaap,

Good point, FillBin() is now public in the master! Until you have it you can have a tiny class deriving from THn, that makes that function public. You can just cast any THn to your tiny protection killer class :slight_smile:

Cheers, Axel.