Filling THn  SOLVED

Discuss installing and running ROOT here. Please post bug reports in Jira.

Moderator: rootdev

Posts: 4
Joined: Wed Dec 09, 2015 15:01

Filling THn

Unread postby jonderwa » Thu Dec 10, 2015 18:01

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?


User avatar
Posts: 2621
Joined: Wed Sep 03, 2003 22:35
Location: CERN

Re: Filling THn  SOLVED

Unread postby Axel » Tue Dec 15, 2015 12:10

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 :-)

Cheers, Axel.

Return to “ROOT Support”

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 0 guests