I am trying to define a RooWorkspace including a blind variable inside using RooUnblindPrecision.
The model is very simple: a gaussian over a 2nd order polynomial and is described in
void makeModel(RooWorkspace &w)
{
RooRealVar mD("mD","m(D)",1.82,1.92);
// Sig Gau
RooRealVar m("m","mean D+",mDp_pdg,mDp_pdg-0.02,mDp_pdg+0.02,"GeV/c^{2}");
RooRealVar s("s","sigma D+",0.004,0.001,0.01,"GeV/c^{2}");
RooGaussian g("g","gaussian D+",mD,m,s);
// poly Bkg
RooRealVar p0("p0","poly0",.29,-1.,1.); //p0.setConstant(1);
RooRealVar p1("p1","poly1",.029,-1.,1.); //p1.setConstant(1);
RooChebychev poly("poly","polynomial",mD,RooArgList(p0,p1));
// yields
RooRealVar nD("nD","D events",0.29*1e4,0.,1e+8);
nD.setError(1);
RooRealVar nbkg("nbkg","bkg events D",(1-0.29)*1e4,0.,1e+8);
nbkg.setError(1);
// Blinding
RooCategory blindCat("blindCat","blind state Category");
blindCat.defineType("unblind",0);
blindCat.defineType("blind",1);
std::string blindString("blinded");
// RooUnblindPrecision nD_Blind("nD_Blind","nD blind",(std::string(nD.GetName())+blindString).c_str(),100.,10.,nD,blindCat,0);
RooUnblindPrecision nD_Blind("nD_Blind","nD blind","nDblinded",100.,10.,nD,blindCat,1);
// sum
RooAddPdf *model =
new RooAddPdf("model","model",RooArgSet(g,poly),RooArgList(nD_Blind,nbkg));
w.import(*model);
w.Print();
}
I save this model to a file (that is why I’m using RooWorkspace) to easily store results.
TFile *WS = new TFile("res/testBlind_WS.root");
RooWorkspace *w = new RooWorkspace("testBlind_WS");
if (WS->IsZombie()) {
makeModel(*w);
w->writeToFile("res/testBlind_WS.root");
} else
w = (RooWorkspace*)WS->Get("testBlind_WS");
The problem is that, whenever I try to recall the RooWorkspace from file, this error appears:
RooBlindTools::Randomizer: Your String Seed is Bad: ''
*** Break *** segmentation violation
A working example has been attached .
I tested it on ROOTv5.25.04 (RooFit 3.10) and ROOTv5.26.00 (RooFit 3.12)
testBlind.cpp (5.41 KB)