RooMCStudy with Constraints

Hi all,

I’ve tried, but without any success so far, to implement a gaussian constraint on one of the parameters of my model when performing pseudo-experiments with RooMCStudy (ROOT5.28).

Schematically, my code is the following :
RooRealVar myPOI(“myPOI”,“myPOI”,50,0.0,100.0);
RooRealVar param(“param”,“param”,0.2,0.0,1.0);
RooFormulaVar1 formula1(“formula1”,“formula1”,some formula involving param,RooArgList(param));
RooFormulaVar2 formula2(“formula2”,“formula2”,some other formula,RooArgList(whatever));

RooGenericPdf pdf1(“pdf1”,“pdf1”,“Some formula using formula1 and myPOI”,RooArgList(myPOI,formula1));
RooExtendPdf pdf1_ext(“pdf1_ext”,“pdf1_ext”,pdf1,N1);

RooGenericPdf pdf2(“pdf2”,“pdf2”,“Some formula using formula2 and myPOI”,RooArgList(myPOI, formula2));
RooExtendPdf pdf2_ext(“pdf2_ext”,“pdf2_ext”,pdf2,N2);

RooAddPdf model(“model”,“model”,RooArgList(pdf1_ext,pdf2_ext));

RooGaussian param_constraint(“param_constraint”,“param_constraint”,param,RooConst(1.0),RooConst(0.10));

RooProdPdf model_constraint(“model_constraint”,“model with const.”,RooArgSet(model,param_constraint)) ;

RooMCStudy* mcstudy = new RooMCStudy(model_with_constraint,myPOI,Constrain(param),someOptions…);

Unfortunately, I get the following error message ;
ERROR:InputArguments – RooAbsDataStore::initialize(mcs_constr_prodData): Data set cannot contain non-fundamental types, ignoring param_cosntraint

I don’t understand why this does not work ; the pull distribution is too narrow, which is expected, if I understand correctly, as a new value for param has to be drawn for each toy-experiment and it is not the case here.

Many thanks in advance for your help.