I have been trying to combine a RooFormulaVar with a RooAbsPdf. To do so I am using a RooEffProd which works fine when using my model for fitting. When I am trying to do a toy study of my model though I am not able to generate the events as I am getting the following error:
[#0] ERROR:Generation – RooEffGenContext::qcdCor_pdf_2b:generateEvent: value of efficiency is larger than assumed maximum of 1.
I have tried converting the RooFormulaVar to RooGenericPdf and then using RooProdPdf instead of the RooEffProd but I am not getting the same results during the fit.
I am attaching a simple code to show my problem.
Thank you in advance.
what are you trying to do exactly? The EffProd, as the name indicates, is only for efficiencies. Is the formula an efficiency?
If you want to scale a PDF with an arbitrary scale factor, you can use the RooAddPdf, which implements something like
c1 * PDF1 + c2 * PDF2 + …
the problem I have now is that my variable mTop is both in the pdf and in the scale factor which from what I understand is not allowed. Any idea? The idea behind all this is that we want to apply a linear, x dependent correction to our pdf. I am attaching the modified code.
Thanks again for the help.
I tried your solution but it does not seem to do exactly what I want. The thing it that RooEffProd and
RooProduct result in different things. The RooEffProd is with red and the RooProduct with blue
I guess this is normal but in my case even though it is not the correct way to get there. How can I get the RooEffProd result using RooProduct. I am also attaching my code in case I do something fundamentally wrong. Thank you again for the help.
This looks like normalisations are just different here. The question is presumably:
Do you want to normalise the PDF first, and then multiply with the efficiency function?
Do you want to take the unnormalised PDF function, and multiply with the efficiency function?
Do you want to (re-)normalise 1. and/or 2.?
One of those three is different between the blue and the red curve.
Regarding the question if something can be done with the EffProd:
If your function is an efficiency, you can use the EffProd. If it is not, the EffProd cannot work, since it cannot generate events if the efficiency function is not within [0,1].