GetEntries of a THStack


I was wondering how to get all entries in a THStack.
I tried

but that doesn’ work because GetStack() returns a pointer to a list of TObjects and not to TH1 objects.
Thanks in advance!

((TH1*)(hs -> GetStack() -> Last())) -> GetEntries()

See also: THStack and GetBinContent()

Oh shoot! Of course! I have one more question. How do I get the entries of a certain bin range?


The closest, that I can think of, would be (not the number of entries, but the integral of bin contents):
Double_t TH1::Integral(Int_t binx1, Int_t binx2, Option_t* option = “”) const

Thats a bit complicated since I have changing weights. I guess I have to fill a second histogram without weights then to get my entries.