RooParametricStepFunction

Hi experts,

I’m approaching RooStats for the first time and I’m trying to use a RooParametricStepFunction as a Prior Pdf for a Bayesian analysis. Anyway, when I put very small values of x (i.e. 1e-31) the step function acts weird.
I thought to rescale the function, but I need to multiply it to other priors before passing it in SetPrior of my Model Config.
I’m currently use the 6.26/06 version of root.

Could you help me to understand the problem?

``````int dim = 3;
int nBins = 2;

double xmin = 0.0;
double xmid = 1e-31;
double xmax = 2e-31;
double binWidth= 1e-31;

// Fill the bin boundaries
std::vector<double> binBoundaries(nBins + 1);
for(int i = 0; i <= nBins; ++i) {
binBoundaries[i] = i * binWidth;
}

// The RooParametricStepFunction needs a TArrayD
TArrayD step_edges{int(binBoundaries.size()), binBoundaries.data()};

RooRealVar Gamma("Gamma", "Gamma", xmin, xmax);

RooArgList step_values;
step_values.addOwned(std::make_unique<RooRealVar> ("coef2", "coef2", 0.1, 0.0, 1.0));
step_values.addOwned(std::make_unique<RooRealVar> ("coef3", "coef3", 0.1, 0.0, 1.0));

RooParametricStepFunction prior("prior", "Prior for decay rate", Gamma, step_values, step_edges, nBins);

RooPlot * xframe = Gamma.frame(xmin, xmax);

prior.plotOn(xframe);

xframe->Draw();

``````

Hi @1892CC, welcome to the ROOT forum and thanks for discovering this bug in RooFit!

I have created a pull request to fix this for the next ROOT release 6.30:

For the already released ROOT versions, I’m afraid there is not much you can do besides rescaling your variables. Or you build and use ROOT master once the fix is merged

Cheers,
Jonas

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