Thank you @StephanH
There is an error.
error: cannot initialize a variable of type ‘RooArgSet *’ with an rvalue of type 'RooAbsCollection ’
RooArgSet copyOfEverything = RooArgSet(*Rx).snapshot(true); // True means copy the PDF and everything it depends on