Bug in asTF?

Hi,

I’m trying to implement the integral of a PDF and it’s uncertainty as in Integral uncertainty with RooFit. I’ve run into what I think might be a bug. The values returned by a pdf and the value returned by the TF1 derived using asTF don’t match.

Here’s an example which reproduces the problem:

{
    TFile f("limits/sig_chi_600_200_combined_meas_model.root");

    RooWorkspace* wspace = (RooWorkspace*)f.Get("combined");

    RooRealVar *obs_of = wspace->obj("obs_x_of");

    RooProdPdf *sum_shape_of = wspace->obj("of_model");

    RooArgSet *sum_params_of = sum_shape_of->getParameters(*obs_of);
    RemoveConstantParameters(sum_params_of);

    TF1* sum_tf = sum_shape_of->asTF(RooArgList(*obs_of), *sum_params_of);
    obs_of->setVal(42);
    cout << sum_shape_of->getVal() << "\t" << sum_tf->Eval(42) << endl;
}

I suspect this might be related to the normalization, but I don’t have any proof. I’ve also attached the workspace. I’d really appreciate it if someone could look into this or show me a workaround.

In particular, I’ve noticed that the RooRealIntegral object returned by createIntegral inherits a getPropagatedError method that doesn’t seem to work.
sig_chi_600_200_combined_meas_model.root (191 KB)

Figured it out. I had a constant parameter with an invalid range. The value was outside of the range. Somewhere in asTF, it calls setVal on all of the parameters. This changed the value of that parameter to be in the range.