Analytical integral for a RooEffProd-like pdf


I am using the RooEffProd but for speed issue I tried to implement my own version in order to
write my own Evaluate() and analyticalIntegral() methods. In this way the numerical integrator
is not run and I should speed things up.
The evaluate method is straightforward (it’s done in a binned way, where different option of interpolation can be used, but this is simply to fix plotting issues in histograms)

But I don’t have a clue how to write analyticalIntegral().
So far I have the integral of pdf() (as sum over all bins)
how do I get the efficiency term?

When I try to evaluate eff()->getVal() I always get fixed values and int intgral is always wrong.
I think there is a problem of normalization.
What is the correct way of evaluating the integral of pdf()*eff()?

I put my try here: