Integral PDF with a parameter as integration limit

I’m trying to create a PDF which is of the form:

R(t) = \int_p(t)^q(t) f(x)g(x,t)dx

where, as you can see, the variable t appears in the limits of the integration. Is there an easy way to do this in roofit? I have tried the following, with no success.

[code]void testIntegration()
//setup our variables
RooRealVar E(“E”,“E”,5,0,10);
RooRealVar T(“T”,“T”,0.001,0,0.02);
RooConstVar mass(“mass”,“mass”,13000);
//have some gg and f
RooGenericPdf gg(“gg”,“gg”,“1-(massT)/(2pow(E,2))”,RooArgList(E,T,mass));
RooGenericPdf f(“f”,“f”,"-1Epow(E-10,3)",RooArgList(E));
//multiply them together
RooProdPdf fgg(“fgg”,“f times gg”,RooArgList(f,gg),1E-8);
//the PDF should be the integral over E with the boundaries between the minimum energy allowed and 10
RooFormulaVar min(“min”,“min”,“sqrt(mass*T/2)”,RooArgList(mass,T));
RooRealVar max(“max”,“max”,10);

RooAbsPdf* pdf = fgg.createIntegral(RooArgList(E),“integration”);
RooPlot* frame_r= T.frame();


What you have done it should work. If it does not, I would then make my own PDF class using the ROOT::Math::Integrator class to implement the evaluation of the PDF

Best Regards