For now, I have some function which can return one PDF. For example,
RooAbsPdf* myPdf = some_function();
How do I fix this pdf (called myPdf) if I don’t know any information of parameters inside “myPdf” ? Namely, can any member function or tricky method do
Yes, ‘fix’ means “fix all parameters inside this pdf returned by some function” to avoid these parameters floating. Because some pdf returned by some function can not be fixed by using
param1.setConstant(kTrue);
…,
can any other idea achieve this if we don’t use “setConstant()” ?
param1.setConstant(kTrue) should fix the parameter of your PDF. If it does not work it means the reference you have to the RooRealVar points to a copy of the one stored in the PDF.
A possible solution is in this case to retrieve it directly from the pdf, by doing for example
auto vars = pdf->getVariables(); auto p = (RooRealVar*) vars->find(param1.getName() ); p->setConstant(kTrue); delete vars;