Home | News | Documentation | Download

Clone RooAbsPdf and underlying parameters

Hi,

I am trying to clone a RooAbsPdf (or a RooAddPdf). The main reason is because I want to store the pdf form before calling the fitTo method and afterwards to see the result of my fit. In ROOT and TF1 what I would do is clone with a different name the TF1 object before the fit call. When I do the same in RooFit what I see is that indeed I gain a new address for my RooAbsPdf but the variables linked with it (verified with Print(“T”)) are still the same, leading to having at the end the same copy of the PDF. Is there a way I could do something like this in RooFit?

Thanks
–John

@moneta could you please maybe suggest something here?

Hi @oshadura,

thanks for the reply and pinging @moneta. Is there any update on my question? Thanks a lot.

Cheers
–John

Hi,

cloning in RooFit is tricky. You can try to use the cloneTree function, but you might need to link correctly variables and pdf in the tree afterwards.
The best is to just clone the parameter values, if this is what you want. The way to do is to create a snapshot(). Here is an example

RooArgSet * par = pdf->getParameters(data)
RooArgset copyPar; 
par->snapshot(copyParameters);  // this copy the parameters from par to copyPar
delete par; 

Hi Lorenzo,

temporarely this is how I handle things, I am taking a snapshot of the parameters and then call the constructor of my PDF again by passing those values. But I was wondering if there was a direct way of doing it, because I have multiple PDF constructors so I didn’t want to care knowing what my PDF is but take a snapshot of it. Thanks for the reply.

Cheers
–John

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.