This tutorial shows an example of a combination of two searches using number counting with background uncertainty.
 
[#0] WARNING:ObjectHandling -- NumberCountingPdfFactory: changed value of tau_0 to 100.01 to be consistent with background and its uncertainty.  Also stored these values of tau into workspace with name . tau_0ExpectedNumberCountingData if you test with a different dataset, you should adjust tau appropriately.
 
[#0] WARNING:ObjectHandling -- NumberCountingPdfFactory: changed value of tau_1 to 100.01 to be consistent with background and its uncertainty.  Also stored these values of tau into workspace with name . tau_1ExpectedNumberCountingData if you test with a different dataset, you should adjust tau appropriately.
 
[#1] INFO:InputArguments -- The deprecated RooFit::CloneData(1) option passed to createNLL() is ignored.
[#0] PROGRESS:Minimization -- ProfileLikelihoodCalcultor::DoGLobalFit - find MLE 
[#1] INFO:Minimization -- RooAbsMinimizerFcn::setOptimizeConst: activating const optimization
[#1] INFO:Minimization --  The following expressions will be evaluated in cache-and-track mode: (sigRegion_0,sideband_0,sigRegion_1,sideband_1)
[#0] PROGRESS:Minimization -- ProfileLikelihoodCalcultor::DoMinimizeNLL - using Minuit /  with strategy 1
[#1] INFO:Minimization -- 
  RooFitResult: minimized FCN value: 17.6316, estimated distance to minimum: 2.45732e-12
                covariance matrix quality: Full, accurate covariance matrix
                Status : MINIMIZE=0 
 
    Floating Parameter    FinalValue +/-  Error   
  --------------------  --------------------------
                   b_0    1.0000e+02 +/-  9.99e-01
                   b_1    1.0000e+02 +/-  9.96e-01
          masterSignal    1.0000e+00 +/-  4.78e-01
 
[#0] PROGRESS:Minimization -- ProfileLikelihoodCalcultor::GetHypoTest - do conditional fit 
[#1] INFO:Minimization -- RooAbsMinimizerFcn::setOptimizeConst: activating const optimization
[#0] PROGRESS:Minimization -- ProfileLikelihoodCalcultor::DoMinimizeNLL - using Minuit /  with strategy 1
[#1] INFO:Minimization -- 
  RooFitResult: minimized FCN value: 19.9696, estimated distance to minimum: 1.4697e-07
                covariance matrix quality: Full, accurate covariance matrix
                Status : MINIMIZE=0 
 
    Floating Parameter    FinalValue +/-  Error   
  --------------------  --------------------------
                   b_0    1.0020e+02 +/-  9.96e-01
                   b_1    1.0010e+02 +/-  9.95e-01
 
-------------------------------------------------
The p-value for the null is 0.015294
Corresponding to a significance of 2.16239
-------------------------------------------------
 
 
[#1] INFO:InputArguments -- The deprecated RooFit::CloneData(1) option passed to createNLL() is ignored.
[#0] PROGRESS:Minimization -- ProfileLikelihoodCalcultor::DoGLobalFit - find MLE 
[#1] INFO:Minimization -- RooAbsMinimizerFcn::setOptimizeConst: activating const optimization
[#1] INFO:Minimization --  The following expressions will be evaluated in cache-and-track mode: (sigRegion_0,sideband_0,sigRegion_1,sideband_1)
[#0] PROGRESS:Minimization -- ProfileLikelihoodCalcultor::DoMinimizeNLL - using Minuit /  with strategy 1
[#1] INFO:Minimization -- 
  RooFitResult: minimized FCN value: 17.6316, estimated distance to minimum: 4.62864e-07
                covariance matrix quality: Full, accurate covariance matrix
                Status : MINIMIZE=0 
 
    Floating Parameter    FinalValue +/-  Error   
  --------------------  --------------------------
                   b_0    1.0000e+02 +/-  9.99e-01
                   b_1    1.0000e+02 +/-  9.96e-01
          masterSignal    9.9967e-01 +/-  4.78e-01
 
[#1] INFO:Minimization -- RooProfileLL::evaluate(nll_TopLevelPdf_ExpectedNumberCountingData_Profile[masterSignal]) Creating instance of MINUIT
[#1] INFO:Minimization -- RooProfileLL::evaluate(nll_TopLevelPdf_ExpectedNumberCountingData_Profile[masterSignal]) determining minimum likelihood for current configurations w.r.t all observable
[#1] INFO:Minimization -- RooProfileLL::evaluate(nll_TopLevelPdf_ExpectedNumberCountingData_Profile[masterSignal]) minimum found at (masterSignal=1.00002)
.
[#1] INFO:Minimization -- RooProfileLL::evaluate(nll_TopLevelPdf_ExpectedNumberCountingData_Profile[masterSignal]) Creating instance of MINUIT
[#1] INFO:Minimization -- RooProfileLL::evaluate(nll_TopLevelPdf_ExpectedNumberCountingData_Profile[masterSignal]) determining minimum likelihood for current configurations w.r.t all observable
[#0] ERROR:InputArguments -- RooArgSet::checkForDup: ERROR argument with name masterSignal is already in this set
[#1] INFO:Minimization -- RooProfileLL::evaluate(nll_TopLevelPdf_ExpectedNumberCountingData_Profile[masterSignal]) minimum found at (masterSignal=1.00007)
..........................................................................................................................................................................................................lower limit on master signal = 0.089069
upper limit on master signal = 2.00127
-------------------------------------------------
Consider this parameter point:
RooRealVar::masterSignal = 0 +/- 0.477956  L(0 - 3) 
It is NOT in the interval.
-------------------------------------------------
 
 
-------------------------------------------------
Consider this parameter point:
RooRealVar::masterSignal = 2 +/- 0.477956  L(0 - 3) 
It IS in the interval.
-------------------------------------------------
 
 
   
 
#include <cassert>
 
 
void rs_numberCountingCombination_expected();
void rs_numberCountingCombination_observed();
void rs_numberCountingCombination_observedWithTau();
 
void rs_numberCountingCombination(int flag = 1)
{
   if (flag == 1)
      rs_numberCountingCombination_expected();
   if (flag == 2)
      rs_numberCountingCombination_observed();
   if (flag == 3)
      rs_numberCountingCombination_observedWithTau();
}
 
void rs_numberCountingCombination_expected()
{
 
   
   
 
   
 
   
 
   
   
   
   
   
   
   f.AddModel(s, 2, wspace, 
"TopLevelPdf", 
"masterSignal");
 
 
   
   
   
   f.AddExpData(s, 
b, db, 2, wspace, 
"ExpectedNumberCountingData");
 
 
   
   
 
   
   
   
   
 
   
   
                                   nullParams);
 
   
   assert(htr != 0);
   cout << "-------------------------------------------------" << endl;
   cout << 
"The p-value for the null is " << htr->
NullPValue() << endl;
 
   cout << 
"Corresponding to a significance of " << htr->
Significance() << endl;
 
   cout << "-------------------------------------------------\n\n" << endl;
 
   
 
   
 
   
   
   plc.SetParameters(*paramsOfInterest);
 
   
   
   
 
   lrPlot.SetMaximum(3.);
   lrPlot.Draw();
 
   
   cout << "lower limit on master signal = " << lower << endl;
   cout << "upper limit on master signal = " << upper << endl;
 
   
   
   
   
   
   cout << "-------------------------------------------------" << endl;
   std::cout << "Consider this parameter point:" << std::endl;
      std::cout << "It IS in the interval." << std::endl;
   else
      std::cout << "It is NOT in the interval." << std::endl;
   cout << "-------------------------------------------------\n\n" << endl;
 
   
   cout << "-------------------------------------------------" << endl;
   std::cout << "Consider this parameter point:" << std::endl;
      std::cout << "It IS in the interval." << std::endl;
   else
      std::cout << "It is NOT in the interval." << std::endl;
   cout << "-------------------------------------------------\n\n" << endl;
 
   delete lrint;
   delete htr;
   delete wspace;
   delete poi;
   delete nullParams;
 
   
 
 
 
 
 
}
 
void rs_numberCountingCombination_observed()
{
 
   
   
   
   
 
   
 
   
   
 
   
   
   
   
   
   
   f.AddModel(s, 2, wspace, 
"TopLevelPdf", 
"masterSignal");
 
 
   
   
   f.AddData(mainMeas, bkgMeas, dbMeas, 2, wspace, 
"ObservedNumberCountingData");
 
 
   
   
 
   
   
   
   
 
   
   
                                   nullParams);
 
 
   
   cout << "-------------------------------------------------" << endl;
   cout << 
"The p-value for the null is " << htr->
NullPValue() << endl;
 
   cout << 
"Corresponding to a significance of " << htr->
Significance() << endl;
 
   cout << "-------------------------------------------------\n\n" << endl;
 
   
 
   
 
   
   
   plc.SetParameters(*paramsOfInterest);
 
   
   cout << 
"lower limit on master signal = " << lrint->
LowerLimit(*mu) << endl;
 
   cout << 
"upper limit on master signal = " << lrint->
UpperLimit(*mu) << endl;
 
 
   delete lrint;
   delete htr;
   delete wspace;
   delete nullParams;
   delete poi;
}
 
void rs_numberCountingCombination_observedWithTau()
{
 
   
   
   
   
 
   
 
   
   
 
   
   
   
   
   
   
   f.AddModel(s, 2, wspace, 
"TopLevelPdf", 
"masterSignal");
 
 
   
   
   f.AddDataWithSideband(mainMeas, sideband, tau, 2, wspace, 
"ObservedNumberCountingDataWithSideband");
 
 
   
   
 
   
   
   
   
 
   
   
                                   *poi, 0.05, nullParams);
 
   
   cout << "-------------------------------------------------" << endl;
   cout << 
"The p-value for the null is " << htr->
NullPValue() << endl;
 
   cout << 
"Corresponding to a significance of " << htr->
Significance() << endl;
 
   cout << "-------------------------------------------------\n\n" << endl;
 
   
 
   
 
   
   
   plc.SetParameters(*paramsOfInterest);
 
   
   cout << 
"lower limit on master signal = " << lrint->
LowerLimit(*mu) << endl;
 
   cout << 
"upper limit on master signal = " << lrint->
UpperLimit(*mu) << endl;
 
 
   delete lrint;
   delete htr;
   delete wspace;
   delete nullParams;
   delete poi;
}
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
 
RooAbsArg * first() const
 
bool setRealValue(const char *name, double newVal=0.0, bool verbose=false)
Set value of a RooAbsRealLValye stored in set with given name to newVal No error messages are printed...
 
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
 
RooArgSet is a container object that can hold multiple RooAbsArg objects.
 
RooRealVar represents a variable that can be changed from the outside.
 
HypoTestResult is a base class for results from hypothesis tests.
 
virtual double Significance() const
familiar name for the Null p-value in terms of 1-sided Gaussian significance
 
virtual double NullPValue() const
Return p-value for null hypothesis.
 
This class provides simple and straightforward utilities to plot a LikelihoodInterval object.
 
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
 
double UpperLimit(const RooRealVar ¶m)
return the upper bound of the interval on a given parameter
 
void SetConfidenceLevel(double cl) override
set the confidence level for the interval (e.g 0.682 for a 1-sigma interval)
 
double LowerLimit(const RooRealVar ¶m)
return the lower bound of the interval on a given parameter
 
bool IsInInterval(const RooArgSet &) const override
check if given point is in the interval
 
A factory for building PDFs and data for a number counting combination.
 
The ProfileLikelihoodCalculator is a concrete implementation of CombinedCalculator (the interface cla...
 
The RooWorkspace is a persistable container for RooFit projects.
 
RooAbsPdf * pdf(RooStringView name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
 
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
 
RooAbsData * data(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
 
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
 
Namespace for the RooStats classes.