Gaussian constraints in ML fit using workspace

Dear experts,

I have the following problem. I can not really understand how to plug Gaussian constraints in a ML fit using a workspace with roostats. I have done it with roofit and it goes like this:
First you make the Gaussian constrain, then you multiply the gaussian with your model and finally you proceed to the fit including the constraint term as presented below:

1) RooGaussian const ("const","const",constrain, RooConst(mean),RooConst(sigma));
2) RooProdPdf model_const("model_const","model with constraints",RooArgSet(model, const));
3) result_c = model_const.fitTo(data, Constrain(const), Save());[/code]

The same thing for roostats starts:
1)w.factory("Gaussian: const (.... ,  ... , ...)");
2)w.factory("PROD:model (pdf, const)");
RooAbsPdf * pdf = w.pdf("model");[/code]

but when it comes for the fit if I try:
[code]3) RooFitResult * result = pdf->fitTo(data, RooFit::Save(true), RooFit::Minimizer("Minuit2","Migrad"));
it excludes the constraint and if I try the same as before:
[code]3) RooFitResult * result = pdf->fitTo(data, Constrain(const), RooFit::Save(true), RooFit::Minimizer("Minuit2","Migrad"));

it doesn’t work

Are there any ideas of tackling the problem?

Thank you in advance,


If you define the final model as the product of your original model with the Gaussian defining the constraint should be fine. Of course one of the variable associated to the Gaussian constraint (either the sigma or the observable) should be a non-const parameter of your original model.

In case you have still problem, please attach the workspace and a macro showing the issue

Best Regards


Yeah, finally I had the observable constant all the time. I thought that when you associate it with a Gaussian it becomes a floating parameter at once but I was wrong. Thank you for your help!!