Hi all,
the very same code that I have been using successfully in ROOT 5.28 (RooFit 3.17?) now crashes with ROOT 5.32 (RooFit 3.50) :
roughly, the code is designed as following :
RooRealVar Nsig,Nbck,x,y,z,u,v;
RooCategory cat("cat","Number of X");
cat.defineType("N0", 0);
cat.defineType("N1", 1);
cat.defineType("N2",2);
// C o n s t r u c t f o r m u l a s
// -------------------------------------------------------------------------------
RooFormulaVar formula_0_1("formula_0_1","formula_0_1","some formula f(x,y,z)",RooArgList(x,y,z));
RooFormulaVar formula_0_2("formula_0_2","formula_0_2","some formula f'(x,y,z)",RooArgList(x,y,z));
RooFormulaVar formula_1_1("formula_1_1","formula_1_1","some formula f''(u,v,z)",RooArgList(u,v,z));
RooFormulaVar formula_1_2("formula_1_2","formula_1_2","some formula f'''(u,v,z)",RooArgList(u,v,z));
// C o n s t r u c t p . d . f 's
// -------------------------------------------------------------------------------
RooGenericPdf pdf_0("pdf_0","pdf_0","(cat==0)*formula_0_1+(cat==1)*formula_0_2",RooArgList(cat,formula_0_1,formula_0_2));
RooExtendPdf pdf_0_ext("pdf_0_ext","pdf_0_ext",pdf_0,Nsig);
RooGenericPdf pdf_1("pdf_1","pdf_1","(cat==0)*formula_1_1+(cat==1)*formula_1_2",RooArgList(cat,formula_1_1,formula_1_2));
RooExtendPdf pdf_1_ext("pdf_1_ext","pdf_1_ext",pdf_1,Nbck);
RooAddPdf model("model","model",RooArgList(pdf_0_ext,pdf_1_ext));
RooMCStudy* mcstudy = new RooMCStudy(model, cat, Binned(1), Extended(1), FitOptions(Save(0), Minos(1), Extended(1), Strategy(2)));
My code now crashes with the following error message ;
[#0] ERROR:InputArguments – RooCategory::isStateInRange(cat) ERROR: must specificy valid range name and state name
What I also noticed is that in order to fit a dataset (no MCStudy this time) ;
RooDataSet* data = model->generate(cat,some nb));
model->fitTo(*data,Optimize(0))
, I now need to specify Optimize(0) as option otherwise the category cat is set to a fixed value and the fit procedure does not converge anymore.
Could someone tell me what has changed in RooFit that now prevents me to use this kind of pdf ?
Suggestions about how to treat a discrete variable in a pdf are also welcome.
Best regards.