#include "RooStats/RooStatsUtils.h" #include using namespace RooFit; using namespace RooStats; // the utilities are in the RooStats namespace using std::cout, std::endl; void rs_numbercountingutils() { // From the root prompt, you can see the full list of functions by using tab-completion // ~~~{.bash} // root [0] RooStats::NumberCountingUtils:: // BinomialExpZ // BinomialWithTauExpZ // BinomialObsZ // BinomialWithTauObsZ // BinomialExpP // BinomialWithTauExpP // BinomialObsP // BinomialWithTauObsP // ~~~ // For each of the utilities you can inspect the arguments by tab completion // ~~~{.bash} // root [1] NumberCountingUtils::BinomialExpZ( // Double_t BinomialExpZ(Double_t sExp, Double_t bExp, Double_t fractionalBUncertainty) // ~~~ // ------------------------------------------------- // Here we see common usages where the experimenter // has a relative background uncertainty, without // explicit reference to the auxiliary or sideband // measurement // ------------------------------------------------------------- // Expected p-values and significance with background uncertainty double sExpected = 50; double bExpected = 100; double relativeBkgUncert = 0.1; double pExp = NumberCountingUtils::BinomialExpP(sExpected, bExpected, relativeBkgUncert); double zExp = NumberCountingUtils::BinomialExpZ(sExpected, bExpected, relativeBkgUncert); cout << "expected p-value =" << pExp << " Z value (Gaussian sigma) = " << zExp << endl; // ------------------------------------------------- // Expected p-values and significance with background uncertainty double observed = 150; double pObs = NumberCountingUtils::BinomialObsP(observed, bExpected, relativeBkgUncert); double zObs = NumberCountingUtils::BinomialObsZ(observed, bExpected, relativeBkgUncert); cout << "observed p-value =" << pObs << " Z value (Gaussian sigma) = " << zObs << endl; // --------------------------------------------------------- // Here we see usages where the experimenter has knowledge // about the properties of the auxiliary or sideband // measurement. In particular, the ratio tau of background // in the auxiliary measurement to the main measurement. // Large values of tau mean small background uncertainty // because the sideband is very constraining. // Usage: // ~~~{.bash} // root [0] RooStats::NumberCountingUtils::BinomialWithTauExpP( // Double_t BinomialWithTauExpP(Double_t sExp, Double_t bExp, Double_t tau) // ~~~ // -------------------------------------------------------------- // Expected p-values and significance with background uncertainty double tau = 1; double pExpWithTau = NumberCountingUtils::BinomialWithTauExpP(sExpected, bExpected, tau); double zExpWithTau = NumberCountingUtils::BinomialWithTauExpZ(sExpected, bExpected, tau); cout << "expected p-value =" << pExpWithTau << " Z value (Gaussian sigma) = " << zExpWithTau << endl; // --------------------------------------------------------------- // Expected p-values and significance with background uncertainty double pObsWithTau = NumberCountingUtils::BinomialWithTauObsP(observed, bExpected, tau); double zObsWithTau = NumberCountingUtils::BinomialWithTauObsZ(observed, bExpected, tau); cout << "observed p-value =" << pObsWithTau << " Z value (Gaussian sigma) = " << zObsWithTau << endl; }