Projecting categories with binned dataset

Dear all,
I’ve been trying to build a binned dataset using different categories but I’m failing to project them correctly
for visualization purposes. Given this I’m also worried if the results of the combined fit I perform to this dataset are valid.
To reproduce the problem I have made a simple script which can be found here:

binnedProjections.C (1.43 KB)

It seems that for some reason the shape of the projected category is correct but the normalization is not.
See the output.

Thank you very much in advance for your help,

Hi again,
I have modified a bit my script to illustrate that the problem depends on the CTOR used for RooDataHist

binnedProjections.C (1.99 KB)

after compiling you can run in the three modes (FISHY, FINE or FINEV2) to reproduce the issue reported in my previous mail.
The problem seems to be there only if we use the following CTOR

RooDataHist(const char* name, const char* title, const RooArgList& vars, RooCategory& indexCat, mapstd::string,TH1* histMap, Double_t initWgt = 1.0)