{ using namespace RooFit ; using namespace RooStats ; RooWorkspace w("CMGWs","CMGWs"); w.factory("Poisson::countingModel(obs[150,0,300], sum(s[50,0,120]*ratioSigEff[1.,0,2.],b[100]*ratioBkgEff[1.,0.,2.]))"); w.factory("Gaussian::sigConstraint(1,ratioSigEff,0.05)"); // 5% signal efficiency uncertainty w.factory("Gaussian::bkgConstraint(1,ratioBkgEff,0.1)"); // 10% background efficiency uncertainty w.factory("PROD::modelWithConstraints(countingModel,sigConstraint,bkgConstraint)"); RooAbsPdf* modelWithConstraints = w.pdf("modelWithConstraints"); // get the model RooRealVar* obs = w.var("obs"); RooRealVar* s = w.var("s"); // Create an example dataset with 160 observed events obs->setVal(160.); RooDataSet* data = new RooDataSet("exData","exData", RooArgSet(*obs)); data->add(*obs); // Model Config ModelConfig modelConfig(&w); modelConfig.SetPdf(*modelWithConstraints); modelConfig.SetParametersOfInterest(RooArgSet(*s)); // Configure the FC calculator FeldmanCousins fc(*data, modelConfig); fc.UseAdaptiveSampling(true); // Optimise the toys generation fc.FluctuateNumDataEntries(false); // Counting dataset has 1 entry fc.SetNBins(40); // number of points to test per parameter fc.SetTestSize(.05); // Start it! ConfInterval* fcint = fc.GetInterval(); // Get Lower and Upper limits from FeldmanCousins with profile construction double ul = ((PointSetInterval*) fcint)->UpperLimit(*s); double ll = ((PointSetInterval*) fcint)->LowerLimit(*s); cout << "FC interval: [ " << ll << " - " << ul << " ]\n"; }