Fill a TH2Poly in TTree::Draw()

Dear experts,

I used to fill a TH2 histogram from TTree:::Draw().

TH2 * h = new TH2(“hname”,…)

this works great but now I need an histogram where I join only some bins with low statistics.
I’ve done it by using TH2Poly. But when I try to fill it in the same way as I fill the normal TH2 it doesn’t work.

Any idea how to do it?


I guess the filling of a TH2Poly from a TTree is simply not implemented …

Yes I guessed that. I was wondering if it can be added and meanwhile if there is some trick to do it.

The TH2Poly allows to define polygonal bins of arbitrary shape.
The standard TH2[CSIFD] allows to define variable size bins of rectangular shape (note: it may also have fix size bins along X and variable size bins along Y or vice versa) -> maybe this will be sufficient for you.

Filling TH2Poly from trees would make sense any any. May be that’s a request you can had in Jira… so we keep track …