Const evaluate function in RooAbsPDF

Hi,

I have a PDF class with 2 parameters (x,y) for example. I also added a TH2D into the class in order to generate and save Prob(x,y). This allows me to generate Prob(x,y) once and evaluate it in RooAbsPDF::evaluate(). This is really nice, but now we like to add a third parameter z. Z will change Prob(x,y | z) so we have to regenerate each time z changes. But the RooAbsPDF::evaluate() declared as a const so it does not allow me to change the TH2 Prob in evaluate or any function called from RooAbsPDF::evaluate(). I was wondering if it would be possible to get around this. Is it possible to make RooAbsPDF::evaluate() non-const?

Thanks,

Wing

Is z a parameter of the pdf ? In that case you should re-generate the Prob(x,y) inside setVal.
Otherwise the simplest solution is to use const_cast or mutable data members.

Lorenzo

Hi Lorenzo,

Yes, z is a parameter for the PDF. I used mutable to allow me to modify it in evaulate() const.

Thanks,

Wing