Hi,
I have a PDF & associated vars that I import to a RooWorkspace through a ModelConfig object and save to be accessed by another function. Simplified version:
(lines defining many RooRealVars)
RooFormulaVar BRconv("BRconv","@0*@1",RooArgList(BR,constBRrange));
RooAbsPdf* bkg = new RooExponential("bkg","bkg", Mass,slope);
RooAbsPdf* signal = new RooGaussian("signal", "signal", Mass, mean, sigma);
RooAbsPdf* signal2 = new RooGaussian("signal2","gauss(x,mean,signal2)",ScaledMass, mean,sigma2);
RooAddPdf sigmodel("sigmodel","sigmodel",RooArgList(*signal,*signal2), f2);
RooAbsPdf* BsMass = new RooAddPdf("BsMass","BsMass",
RooArgList(sigmodel,*bkg),RooArgList(BRconv,Nbkg));
(lines making workspace, importing data, setting up priors and things...)
w->defineSet("poi",RooArgSet(BR));
w->defineSet("obs",RooArgSet(ScaledMass));
// Make model
ModelConfig model("model",w);
model.SetPdf(*w->pdf("BsMass"));
When I then save it and open the workspace somewhere else, a fit to the data with the line
has BR fixed. Note this is not true if instead of BR in the mass fit, I use the number of events in the signal model. Does anyone know why this is?
Cheers,
Sean