Help defining RooGenericPdf for negative values

I would like to define the following pdf:

value = “math expression”

if(value < 0)

return 0


return value

Is there any way to do this using the roopdf classes.

I am currently using RooGenericPDF do define my expression and the fit works for areas where my data is non-zero but when I extend the fit range to where my data goes to 0 the math expression in RooGenericPDF goes negative and the fit fails

I was able to do this using RooClassFactory and defining my own pdf.