RooCachedPdf seems to dont re-cache correctly the RooHistPdf

Dear All,
I’m trying to use RooCachedPdf for the caching of aprivate function that is quite time-consuming.
In my code I have:

RooRealVar * mass = new RooRealVar(“mass”,“mass”,5.0,5.8);

RooRadiativeTail * g_tmp = new RooRadiativeTail(“g_tmp”,“g_tmp”,*mass,*alpha,*mean,*sigma);
RooCachedPdf * g = new RooCachedPdf(“g”,“g”,*g_tmp,*mass);

RooDataSet * data = RooDataSet::read(“test.dat”,RooArgSet(*mass,*tag));

Where RooRadiativeTail is a private class that is quite cpu consuming (as it has to perform a numerical integral for each event). pdf is a RooProdPdf where I have a component that is the RooRadiativeTail (or the RooCachedPdf) and a component depending on the RooCategory tag.

What happen during the fitting procedure is that until there is no necessity to re-fill the cache everything works fine, I get the same values of the -LogL that I get without using the RooCahcedPdf. Then, when one of the parameters of the RooRadiativeTail changes, and thus the RooCahcedPdf is re-computed I get completely different values of the -LogL and the fit starts to screw up.
I’m starting to suppose that there is some bug in the way the cache is refilled. Do you have any idea?
Many thanks,