15#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00) 
   16#define protected public 
   49#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00) 
   51#define GETWS(a) a->_myws 
   52#define GETWSSETS(w) w->_namedSets 
   54#define GETWS(a) a->workspace() 
   55#define GETWSSETS(w) w->sets() 
   62#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00) 
   63#define protected public 
   82std::set<int> xRooNLLVar::xRooHypoPoint::allowedStatusCodes = {0};
 
   84xRooNLLVar::~xRooNLLVar() {}
 
   86xRooNLLVar::xRooNLLVar(
RooAbsPdf &pdf, 
const std::pair<RooAbsData *, const RooAbsCollection *> &
data,
 
   89                std::make_pair(std::shared_ptr<RooAbsData>(
data.first, [](
RooAbsData *) {}),
 
   96                       const std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>> &
data,
 
  110   for (
int i = 0; i < opts.
GetSize(); i++) {
 
  113      if (strcmp(opts.
At(i)->
GetName(), 
"GlobalObservables") == 0) {
 
  116         auto gl = 
dynamic_cast<RooCmdArg *
>(opts.
At(i))->getSet(0);
 
  118            throw std::runtime_error(
"GlobalObservables mismatch");
 
  121         if (strcmp(opts.
At(i)->
GetName(), 
"Optimize") == 0) {
 
  132      auto _vars = std::unique_ptr<RooArgSet>(
fPdf->getVariables());
 
  133      auto _funcGlobs = std::unique_ptr<RooArgSet>(
dynamic_cast<RooArgSet *
>(_vars->selectCommon(*
fGlobs)));
 
  137   if (
auto flag = 
dynamic_cast<RooCmdArg *
>(
fOpts->find(
"ReuseNLL"))) {
 
  143   if (
auto range = 
dynamic_cast<RooCmdArg *
>(
fOpts->find(
"RangeWithName"))) {
 
  144      TString rangeName = range->getString(0);
 
  151         std::vector<TString> chanPatterns;
 
  153         bool hasRange(
false);
 
  154         std::string noneCatRanges;
 
  156            chanPatterns.emplace_back(pattern);
 
  157            if (_cat.hasRange(chanPatterns.back()))
 
  160               if (!noneCatRanges.empty())
 
  161                  noneCatRanges += 
",";
 
  162               noneCatRanges += chanPatterns.back();
 
  169            if (noneCatRanges.empty()) {
 
  170               fOpts->Remove(range);
 
  173               range->setString(0, noneCatRanges.c_str());
 
  177               std::make_shared<RooSimultaneous>(
TString::Format(
"%s_reduced", s->GetName()), 
"Reduced model", _cat);
 
  178            for (
auto &
c : _cat) {
 
  179               auto _pdf = s->getPdf(
c.first.c_str());
 
  182               _cat.setIndex(
c.second);
 
  183               bool matchAny = 
false;
 
  184               for (
auto &
p : chanPatterns) {
 
  185                  if (_cat.hasRange(
p) && _cat.inRange(
p)) {
 
  191                  newPdf->addPdf(*_pdf, 
c.first.c_str());
 
  226                                (opts.find(
"GlobalObservables"))
 
  227                                   ? dynamic_cast<
RooCmdArg *>(opts.find(
"GlobalObservables"))->getSet(0)->snapshot()
 
  235   std::cout << 
"PDF: ";
 
  239      std::cout << 
"<null>" << std::endl;
 
  240   std::cout << 
"Data: ";
 
  244      std::cout << 
"<null>" << std::endl;
 
  245   std::cout << 
"NLL Options: " << std::endl;
 
  246   for (
int i = 0; i < 
fOpts->GetSize(); i++) {
 
  250      std::cout << 
" " << 
c->
GetName() << 
" : ";
 
  252         std::cout << 
c->getString(0);
 
  253      else if (
c->getSet(0) && !
c->getSet(0)->empty())
 
  254         std::cout << (
c->getSet(0)->contentsString());
 
  256         std::cout << 
c->getInt(0);
 
  257      std::cout << std::endl;
 
  260      std::cout << 
"Fit Config: " << std::endl;
 
  261      std::cout << 
"  UseParabErrors: " << (
fFitConfig->ParabErrors() ? 
"True" : 
"False")
 
  262                << 
"  [toggles HESSE algorithm]" << std::endl;
 
  263      std::cout << 
"  MinimizerOptions: " << std::endl;
 
  272   if (std::shared_ptr<RooAbsReal>::get())
 
  273      oldName = std::shared_ptr<RooAbsReal>::get()->GetName();
 
  278      fPdf->treeNodeServerList(&s, 
nullptr, 
true, 
false);
 
  279      bool isBinned = 
false;
 
  280      bool hasBinned = 
false; 
 
  283         isBinned = 
a->getInt(0);
 
  285      std::map<RooAbsArg *, bool> origValues;
 
  288            if (
a->InheritsFrom(
"RooRealSumPdf")) {
 
  291               bool setBinned = 
false;
 
  293                  std::unique_ptr<RooArgSet> obs(
a->getObservables(
fData->get()));
 
  294                  if (obs->size() == 1) { 
 
  295                     auto *var = 
static_cast<RooRealVar *
>(obs->first());
 
  296                     std::unique_ptr<std::list<Double_t>> boundaries{
dynamic_cast<RooAbsReal *
>(
a)->binBoundaries(
 
  297                        *var, -std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity())};
 
  299                        if (!std::shared_ptr<RooAbsReal>::get())
 
  300                           Info(
"xRooNLLVar", 
"%s will be evaluated as a Binned PDF (%d bins)", 
a->GetName(),
 
  301                                int(boundaries->size() - 1));
 
  306               origValues[
a] = 
a->getAttribute(
"BinnedLikelihood");
 
  307               a->setAttribute(
"BinnedLikelihood", setBinned);
 
  313         std::set<std::string> setNames;
 
  316               setNames.insert(
a.first);
 
  319         for (
auto &
a : setNames) {
 
  323      std::set<std::string> attribs;
 
  324      if (std::shared_ptr<RooAbsReal>::get())
 
  325         attribs = std::shared_ptr<RooAbsReal>::get()->attributes();
 
  326      this->reset(std::unique_ptr<RooAbsReal>{
fPdf->createNLL(*
fData, *
fOpts)}.release());
 
  331      for (
auto &
a : attribs)
 
  332         std::shared_ptr<RooAbsReal>::get()->setAttribute(
a.c_str());
 
  338         std::shared_ptr<RooAbsReal>::get()->SetName(oldName);
 
  339      if (!origValues.empty()) {
 
  341         std::shared_ptr<RooAbsReal>::get()->getVal();
 
  342         for (
auto &[o, 
v] : origValues)
 
  343            o->setAttribute(
"BinnedLikelihood", 
v);
 
  347   fFuncVars = std::unique_ptr<RooArgSet>{std::shared_ptr<RooAbsReal>::get()->getVariables()};
 
  355std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>>
 
  359      return std::pair(
nullptr, 
nullptr);
 
  360   auto fr = std::make_shared<RooFitResult>(
TUUID().AsString());
 
  364   fr->setConstParList(
l);
 
  365   const_cast<RooArgList&
>(fr->constPars()).setAttribAll(
"global", 
false);
 
  367      std::unique_ptr<RooAbsCollection>(fr->constPars().selectCommon(*
fGlobs))->
setAttribAll(
"global", 
true);
 
  401   if (out && !nll.getAttribute(
"readOnly")) {
 
  402      if (strlen(
fOpts->GetName()) == 0)
 
  405      if (cacheDir && cacheDir->IsWritable()) {
 
  407         if (!cacheDir->GetDirectory(nll.GetName()))
 
  408            cacheDir->mkdir(nll.GetName());
 
  409         if (
auto dir = cacheDir->GetDirectory(nll.GetName()); dir) {
 
  410            if (!dir->FindKey(
fOpts->GetName())) {
 
  411               dir->WriteObject(
fOpts.get(), 
fOpts->GetName());
 
  419      const_cast<RooArgList&
>(out->constPars()).setAttribAll(
"global", 
false);
 
  421         std::unique_ptr<RooAbsCollection>(out->constPars().selectCommon(*
fGlobs))->
setAttribAll(
"global", 
true);
 
  433         fOldData = fNll->getData();
 
  434         fOldName = fNll->get()->GetName();
 
  435         fOldTitle = fNll->get()->getStringAttribute(
"fitresultTitle");
 
  453         fNll->setData(fOldData);
 
  454         fNll->get()->SetName(fOldName);
 
  455         fNll->get()->setStringAttribute(
"fitresultTitle", (fOldTitle == 
"") ? nullptr : fOldTitle);
 
  459   std::unique_ptr<RooAbsCollection> 
fSnap;
 
  460   xRooNLLVar *fNll = 
nullptr;
 
  462   std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>> 
fOldData;
 
  485   if (
size_t(_data->numEntries()) <= entry)
 
  488   *std::unique_ptr<RooAbsCollection>(_pdf->getObservables(_data)) = *_data->get(entry);
 
  491   return -_data->weight() * _pdf->getLogVal(_data->get());
 
  496   auto out = std::shared_ptr<RooArgSet>(
get()->getVariables());
 
  497   if (stripGlobalObs && 
fGlobs) {
 
  498      out->remove(*
fGlobs, 
true, 
true);
 
  509   if (sOpt == 
"sensitivity") {
 
  514   if (sOpt == 
"floating") {
 
  516      auto floats = std::unique_ptr<RooAbsCollection>(_pars->selectByAttrib(
"Constant", 
false));
 
  539      if (
auto a = _pars->find(s); 
a)
 
  543   if (vars.
size() == 1) {
 
  551      bool normRange = 
false;
 
  565      double step = (
v->getMax() - 
v->getMin()) / 100;
 
  566      double init = 
v->getVal();
 
  567      double initVal = 
func()->getVal();
 
  569      auto currTime = std::chrono::steady_clock::now();
 
  570      while (out->
GetN() < 100 && (low > 
v->getMin() || high < v->getMax())) {
 
  571         if (out->
GetN() == 0) {
 
  581         if (low > 
v->getMin()) {
 
  583            auto _v = 
func()->getVal();
 
  584            if (std::isnan(_v) || std::isinf(_v)) {
 
  585               if (bad->
GetN() == 0)
 
  593         if (high < v->getMax()) {
 
  595            auto _v = 
func()->getVal();
 
  596            if (std::isnan(_v) || std::isinf(_v)) {
 
  597               if (bad->
GetN() == 0)
 
  608         if (std::chrono::steady_clock::now() - currTime > std::chrono::seconds(1)) {
 
  609            currTime = std::chrono::steady_clock::now();
 
  621      Error(
"Draw", 
"Name a parameter to scan over: Draw(<name>) , choose from: %s",
 
  622            _pars->empty() ? 
"" : _pars->contentsString().c_str());
 
  626std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>> 
xRooNLLVar::getData()
 const 
  636   return setData(std::dynamic_pointer_cast<RooAbsData>(
data.fComp),
 
  637                  std::shared_ptr<const RooAbsCollection>(
data.globs().argList().snapshot()));
 
  643   if (
fData == _data.first && 
fGlobs == _data.second)
 
  652         throw std::runtime_error(
"Missing globs");
 
  656      std::unique_ptr<RooAbsCollection> _actualGlobs(
fPdf->getObservables(s));
 
  658      s2.
add(*_data.second);
 
  659      std::unique_ptr<RooAbsCollection> _actualGlobs2(
fPdf->getObservables(s2));
 
  660      if (!_actualGlobs->equals(*_actualGlobs2)) {
 
  662         rC.
add(*_actualGlobs2);
 
  666         lC.
add(*_actualGlobs);
 
  669         throw std::runtime_error(
TString::Format(
"globs mismatch: adding %s removing %s", 
r.Data(), 
l.Data()));
 
  674   if (!std::shared_ptr<RooAbsReal>::get()) {
 
  681         throw std::runtime_error(
"not supported");
 
  690   } 
catch (std::runtime_error &) {
 
  694      fFuncVars->setAttribAll(
"Constant", 
false);
 
  696      std::shared_ptr<RooAbsData> __data = 
fData; 
 
  702   throw std::runtime_error(
"Unable to setData");
 
  709   } 
else if (
auto f = std::unique_ptr<RooAbsCollection>(
fConstVars->selectByAttrib(
"Constant", 
false)); !
f->empty()) {
 
  732   if (std::shared_ptr<RooAbsReal>::get())
 
  770      return fData->sumEntries() * log(1.0 * (s->servers().size() - 1)); 
 
  779   for (
int i = 0; i < 
fData->numEntries(); i++) {
 
  810   bool doNull = sWhat.
Contains(
"null");
 
  812   double nSigma = (sWhat.
Contains(
"exp"))
 
  817                      : std::numeric_limits<double>::quiet_NaN();
 
  822   bool readOnly = sWhat.
Contains(
"readonly");
 
  825      RestoreNll(std::shared_ptr<xRooNLLVar> &
v, 
bool r) : rr(
r), var(
v)
 
  827         if (rr && var && var->get()) {
 
  828            _readOnly = var->get()->getAttribute(
"readOnly");
 
  829            var->get()->setAttribute(
"readOnly", rr);
 
  837            var->get()->setAttribute(
"readOnly", _readOnly);
 
  841      bool _readOnly = 
false;
 
  843      std::shared_ptr<xRooNLLVar> &var;
 
  846   RestoreNll rest(nllVar, readOnly);
 
  849      return (toys) ? ts_toys(nSigma) : ts_asymp(nSigma);
 
  851      return (toys) ? pNull_toys(nSigma) : pNull_asymp(nSigma);
 
  853      return (toys) ? pAlt_toys(nSigma) : pAlt_asymp(nSigma);
 
  855      return (toys) ? pCLs_toys(nSigma) : pCLs_asymp(nSigma);
 
  857   throw std::runtime_error(std::string(
"Unknown: ") + 
what);
 
  864   out.
add(*std::unique_ptr<RooAbsCollection>(coords->selectByAttrib(
"poi", 
true)));
 
  872   out.
addClone(*std::unique_ptr<RooAbsCollection>(coords->selectByAttrib(
"poi", 
true)));
 
  877      if (
auto s = 
a->getStringAttribute(
"altVal"); s && strlen(s)) {
 
  880         v->setVal(std::numeric_limits<double>::quiet_NaN());
 
  890   if (me.ufit(
true) && !allowedStatusCodes.count(me.ufit(
true)->status()))
 
  892   if (me.cfit_null(
true) && !allowedStatusCodes.count(me.cfit_null(
true)->status()))
 
  894   if (me.cfit_alt(
true) && !allowedStatusCodes.count(me.cfit_alt(
true)->status()))
 
  897      out += me.asimov(
true)->status() << 3;
 
  903   std::cout << 
"POI: " << poi().contentsString() << 
" , null: " << 
dynamic_cast<RooAbsReal *
>(poi().first())->getVal()
 
  904             << 
" , alt: " << 
dynamic_cast<RooAbsReal *
>(alt_poi().first())->getVal();
 
  905   std::cout << 
" , pllType: " << fPllType << std::endl;
 
  907   std::cout << 
" -        ufit: ";
 
  909      std::cout << fUfit->minNll() << 
" (status=" << fUfit->status() << 
") (" << mu_hat().
GetName()
 
  910                << 
"_hat: " << mu_hat().getVal() << 
" +/- " << mu_hat().getError() << 
")" << std::endl;
 
  912      std::cout << 
"Not calculated" << std::endl;
 
  914   std::cout << 
" -   null cfit: ";
 
  916      std::cout << fNull_cfit->GetName() << 
" " << fNull_cfit->minNll() << 
" (status=" << fNull_cfit->status() << 
")";
 
  918      std::cout << 
"Not calculated";
 
  920   if (!std::isnan(
dynamic_cast<RooAbsReal *
>(alt_poi().
first())->getVal())) {
 
  921      std::cout << std::endl << 
" -    alt cfit: ";
 
  923         std::cout << fAlt_cfit->GetName() << 
" " << fAlt_cfit->minNll() << 
" (status=" << fAlt_cfit->status() << 
")" 
  926         std::cout << 
"Not calculated" << std::endl;
 
  928      std::cout << 
" sigma_mu: ";
 
  929      if (!fAsimov || !fAsimov->fUfit || !fAsimov->fNull_cfit) {
 
  930         std::cout << 
"Not calculated";
 
  932         std::cout << sigma_mu().first << 
" +/- " << sigma_mu().second;
 
  935         std::cout << std::endl;
 
  936         std::cout << 
"   - asimov ufit: ";
 
  938            std::cout << fAsimov->fUfit->GetName() << 
" " << fAsimov->fUfit->minNll()
 
  939                      << 
" (status=" << fAsimov->fUfit->status() << 
")";
 
  941            std::cout << 
"Not calculated";
 
  942         std::cout << std::endl << 
"   - asimov null cfit: ";
 
  943         if (fAsimov->fNull_cfit)
 
  944            std::cout << fAsimov->fNull_cfit->GetName() << 
" " << fAsimov->fNull_cfit->minNll()
 
  945                      << 
" (status=" << fAsimov->fNull_cfit->status() << 
")";
 
  947            std::cout << 
"Not calculated";
 
  949      std::cout << std::endl;
 
  951      std::cout << std::endl;
 
  954      std::cout << 
" -      genFit: " << fGenFit->GetName() << std::endl;
 
  955   if (!nullToys.empty() || !altToys.empty()) {
 
  956      std::cout << 
" *   null toys: " << nullToys.size();
 
  958      while (firstToy < nullToys.size() && std::isnan(std::get<1>(nullToys[firstToy])))
 
  961         std::cout << 
" [ of which " << firstToy << 
" are bad]";
 
  962      std::cout << 
" , alt toys: " << altToys.size();
 
  964      while (firstToy < altToys.size() && std::isnan(std::get<1>(altToys[firstToy])))
 
  967         std::cout << 
" [ of which " << firstToy << 
" are bad]";
 
  968      std::cout << std::endl;
 
  976      auto var = 
dynamic_cast<RooRealVar *
>(ufit()->floatParsFinal().find(fPOIName()));
 
  980         throw std::runtime_error(
"Cannot find POI");
 
  982   throw std::runtime_error(
"Unconditional fit unavailable");
 
  988   if (!fAsimov && nllVar) {
 
  989      if (!nllVar->fFuncVars)
 
  990         nllVar->reinitialize();
 
  992      auto theFit = (!
data.first && fGenFit) ? fGenFit : cfit_alt(readOnly);
 
  993      if (!theFit || allowedStatusCodes.find(theFit->status()) == allowedStatusCodes.end())
 
  995      *nllVar->fFuncVars = theFit->floatParsFinal();
 
  996      *nllVar->fFuncVars = theFit->constPars();
 
  997      auto asimov = nllVar->generate(
true);
 
  998      fAsimov = std::make_shared<xRooHypoPoint>(*
this);
 
 1000      fAsimov->fUfit.reset();
 
 1001      fAsimov->fNull_cfit.reset();
 
 1002      fAsimov->fAlt_cfit.reset();
 
 1003      fAsimov->data = asimov;
 
 1004      fAsimov->fGenFit = theFit;
 
 1005      fAsimov->isExpected = 
true;
 
 1014      return std::pair(1, 0);
 
 1015   auto first_poi = 
dynamic_cast<RooRealVar *
>(poi().first());
 
 1017      return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
 1019                                             first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1022                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1025                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1026   return std::pair(nom, std::max(std::abs(up - nom), std::abs(down - nom)));
 
 1032      return std::pair(1, 0);
 
 1033   auto first_poi = 
dynamic_cast<RooRealVar *
>(poi().first());
 
 1035      return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
 1038                                             first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1041                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1044                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1046   return std::pair(nom, std::max(std::abs(up - nom), std::abs(down - nom)));
 
 1051   if (fNullVal() == fAltVal())
 
 1052      return std::pair(1, 0); 
 
 1054      return std::pair(1, 0);
 
 1055   auto first_poi = 
dynamic_cast<RooRealVar *
>(poi().first());
 
 1057      return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
 1061                                   first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1064                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1067                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1069                                              first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1072                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1075                                   sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1077   auto nom = (nom1 == 0) ? 0 : nom1 / nom2;
 
 1078   auto up = (up1 == 0) ? 0 : up1 / up2;
 
 1079   auto down = (down1 == 0) ? 0 : down1 / down2;
 
 1081   return std::make_pair(nom, std::max(std::abs(up - nom), std::abs(down - nom)));
 
 1086   auto first_poi = 
dynamic_cast<RooRealVar *
>(poi().first());
 
 1087   if (!first_poi || (!std::isnan(nSigma) && std::isnan(sigma_mu().
first)))
 
 1088      return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
 1089   if (std::isnan(nSigma))
 
 1092                                        sigma_mu().
first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
 
 1094                                       sigma_mu().
first + sigma_mu().second, first_poi->getMin(
"physical"),
 
 1095                                       first_poi->getMax(
"physical"));
 
 1097                                         sigma_mu().
first - sigma_mu().second, first_poi->getMin(
"physical"),
 
 1098                                         first_poi->getMax(
"physical"));
 
 1099   return std::pair<double, double>(nom, std::max(std::abs(nom - up), std::abs(nom - down)));
 
 1104   if (std::isnan(nSigma))
 
 1107   size_t firstToy = 0;
 
 1108   while (firstToy < altToys.size() && std::isnan(std::get<1>(altToys[firstToy])))
 
 1110   if (firstToy >= altToys.size())
 
 1111      return std::make_pair(std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN());
 
 1114   return std::make_pair(
 
 1115      std::get<1>(altToys[targetIdx]),
 
 1116      (std::get<1>(altToys[std::min(
int(altToys.size()), targetIdx)]) - std::get<1>(altToys[std::max(0, targetIdx)])) /
 
 1122   if (!ufit(readOnly) || allowedStatusCodes.find(ufit(readOnly)->status()) == allowedStatusCodes.end())
 
 1123      return std::make_pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
 1126      return std::make_pair(0, 0);
 
 1127   if (!cfit_null(readOnly) || allowedStatusCodes.find(cfit_null(readOnly)->status()) == allowedStatusCodes.end())
 
 1128      return std::make_pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
 1130   return std::make_pair(2. * cFactor * (cfit_null(readOnly)->minNll() - ufit(readOnly)->minNll()),
 
 1131                         2. * cFactor * sqrt(pow(cfit_null(readOnly)->edm(), 2) + pow(ufit(readOnly)->edm(), 2)));
 
 1139   if (!nllVar || (readOnly && nllVar->get() && !nllVar->get()->getAttribute(
"readOnly")))
 
 1141   if (!nllVar->fFuncVars)
 
 1142      nllVar->reinitialize();
 
 1144   nllVar->setData(
data);
 
 1145   nllVar->fFuncVars->setAttribAll(
"Constant", 
false);
 
 1146   *nllVar->fFuncVars = *coords; 
 
 1147   if (nllVar->fFuncGlobs)
 
 1148      nllVar->fFuncGlobs->setAttribAll(
"Constant", 
true);
 
 1149   std::unique_ptr<RooAbsCollection>(nllVar->fFuncVars->selectCommon(poi()))
 
 1150      ->setAttribAll(
"Constant", 
false); 
 
 1153      nllVar->fFuncVars->assignValueOnly(fGenFit->constPars());
 
 1154      nllVar->fFuncVars->assignValueOnly(fGenFit->floatParsFinal());
 
 1156      nllVar->get()->SetName(
 
 1157         TString::Format(
"%s/%s_%s", nllVar->get()->GetName(), fGenFit->GetName(), (isExpected) ? 
"asimov" : 
"toys"));
 
 1158   } 
else if (!std::isnan(fAltVal())) {
 
 1160      nllVar->fFuncVars->setRealValue(fPOIName(), fAltVal());
 
 1162   return (fUfit = nllVar->minimize());
 
 1168   for (
auto &
c : coll) {
 
 1171      out += 
c->GetName();
 
 1186   if (!nllVar || (readOnly && nllVar->get() && !nllVar->get()->getAttribute(
"readOnly")))
 
 1188   if (!nllVar->fFuncVars)
 
 1189      nllVar->reinitialize();
 
 1191   nllVar->setData(
data);
 
 1194      *nllVar->fFuncVars = fUfit->floatParsFinal();
 
 1196   nllVar->fFuncVars->setAttribAll(
"Constant", 
false);
 
 1197   *nllVar->fFuncVars = *coords; 
 
 1198   if (nllVar->fFuncGlobs)
 
 1199      nllVar->fFuncGlobs->setAttribAll(
"Constant", 
true);
 
 1200   nllVar->fFuncVars->find(fPOIName())
 
 1201      ->setStringAttribute(
"altVal", (!std::isnan(fAltVal())) ? 
TString::Format(
"%g", fAltVal()) : 
nullptr);
 
 1203      nllVar->get()->SetName(
 
 1204         TString::Format(
"%s/%s_%s", nllVar->get()->GetName(), fGenFit->GetName(), (isExpected) ? 
"asimov" : 
"toys"));
 
 1205   nllVar->get()->setStringAttribute(
"fitresultTitle", 
collectionContents(poi()).c_str());
 
 1206   return (fNull_cfit = nllVar->minimize());
 
 1211   if (std::isnan(fAltVal()))
 
 1215   if (!nllVar || (readOnly && nllVar->get() && !nllVar->get()->getAttribute(
"readOnly")))
 
 1217   if (!nllVar->fFuncVars)
 
 1218      nllVar->reinitialize();
 
 1220   nllVar->setData(
data);
 
 1223      *nllVar->fFuncVars = fUfit->floatParsFinal();
 
 1225   nllVar->fFuncVars->setAttribAll(
"Constant", 
false);
 
 1226   *nllVar->fFuncVars = *coords; 
 
 1227   if (nllVar->fFuncGlobs)
 
 1228      nllVar->fFuncGlobs->setAttribAll(
"Constant", 
true);
 
 1229   *nllVar->fFuncVars = alt_poi();
 
 1231      nllVar->get()->SetName(
 
 1232         TString::Format(
"%s/%s_%s", nllVar->get()->GetName(), fGenFit->GetName(), (isExpected) ? 
"asimov" : 
"toys"));
 
 1233   nllVar->get()->setStringAttribute(
"fitresultTitle", 
collectionContents(alt_poi()).c_str());
 
 1234   return (fAlt_cfit = nllVar->minimize());
 
 1240   if (!asimov(readOnly)) {
 
 1241      return std::make_pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
 1244   auto out = asimov(readOnly)->pll(readOnly);
 
 1245   return std::make_pair(std::abs(fNullVal() - fAltVal()) / sqrt(out.first),
 
 1246                         out.second * 0.5 * std::abs(fNullVal() - fAltVal()) / (out.first * sqrt(out.first)));
 
 1251   auto _ts = ts_toys(nSigma);
 
 1252   if (std::isnan(_ts.first))
 
 1257   auto &_theToys = (alt) ? altToys : nullToys;
 
 1263   double result_err_up = 0;
 
 1264   double result_err_down = 0;
 
 1265   for (
auto &toy : _theToys) {
 
 1266      if (std::isnan(std::get<1>(toy)))
 
 1269         bool res = std::get<1>(toy) >= _ts.first;
 
 1270         if (std::get<2>(toy) != 1)
 
 1275            result += std::get<2>(toy);
 
 1276         if (std::get<1>(toy) >= _ts.first - _ts.second)
 
 1277            result_err_up += std::get<2>(toy);
 
 1278         if (std::get<1>(toy) >= _ts.first - _ts.second)
 
 1279            result_err_down += std::get<2>(toy);
 
 1284   result_err_down -= 
result;
 
 1285   double result_err = std::max(std::abs(result_err_up), std::abs(result_err_down));
 
 1288   result_err /= _theToys.size();
 
 1291   result /= (_theToys.size() - nans);
 
 1295   return std::make_pair(
result, result_err);
 
 1300   return pX_toys(
false, nSigma);
 
 1305   return pX_toys(
true, nSigma);
 
 1318   if (!nllVar->fFuncVars)
 
 1319      nllVar->reinitialize();
 
 1337   if (!nllVar->fFuncVars)
 
 1338      nllVar->reinitialize();
 
 1348   if ((alt && !cfit_alt()) || (!alt && !cfit_null())) {
 
 1349      throw std::runtime_error(
"Cannot add toys, invalid conditional fit");
 
 1351   auto &toys = (alt) ? altToys : nullToys;
 
 1353   std::vector<float> times(nToys);
 
 1360   for (
auto i = 0; i < nToys; i++) {
 
 1361      if (i == 0 && initialSeed != 0)
 
 1364      toys.push_back(std::make_tuple(seed, ((alt) ? generateAlt(seed) : generateNull(seed)).pll().first, 1.));
 
 1365      if (std::isnan(std::get<1>(toys.back())))
 
 1367      times[i] = s.
RealTime() - lastTime; 
 
 1371                   << 
TString::Format(
"Generated %d/%d %s hypothesis toys [%.2f toys/s]...", i + 1, nToys,
 
 1384                << 
TString::Format(
"Generated %d/%d %s hypothesis toys [%.2f toys/s overall]...Done!", nToys, nToys,
 
 1393   g->Set(times.size());
 
 1394   for (
size_t i = 0; i < times.size(); i++)
 
 1395      g->SetPoint(i, i, times[i]);
 
 1397   for (
auto &t : toys) {
 
 1398      if (std::isnan(std::get<1>(t)))
 
 1399         std::get<1>(t) = -std::numeric_limits<double>::infinity();
 
 1401   std::sort(toys.begin(), toys.end(),
 
 1402             [](
const decltype(nullToys)::value_type &
a, 
const decltype(nullToys)::value_type &
b) -> 
bool {
 
 1403                if (std::isnan(std::get<1>(a)))
 
 1405                if (std::isnan(std::get<1>(b)))
 
 1407                return std::get<1>(a) < std::get<1>(b);
 
 1409   for (
auto &t : toys) {
 
 1410      if (std::isinf(std::get<1>(t)))
 
 1411         std::get<1>(t) = std::numeric_limits<double>::quiet_NaN();
 
 1414      std::cout << 
"Warning: " << nans << 
" toys were bad" << std::endl;
 
 1419   addToys(
false, nToys, seed);
 
 1423   addToys(
true, nToys, seed);
 
 1436   out.
nllVar = std::make_shared<xRooNLLVar>(*
this);
 
 1445   auto _snap = std::unique_ptr<RooAbsCollection>(
fFuncVars->selectByAttrib(
"Constant", 
true))->snapshot();
 
 1446   _snap->find(poi->GetName())->setAttribute(
"poi", 
true);
 
 1447   if (std::isnan(alt_value))
 
 1448      _snap->find(poi->GetName())->setStringAttribute(
"altVal", 
nullptr);
 
 1450      _snap->find(poi->GetName())->setStringAttribute(
"altVal", 
TString::Format(
"%g", alt_value));
 
 1452      _snap->remove(*
fGlobs, 
true, 
true);
 
 1455   auto _type = pllType;
 
 1458      if (std::isnan(alt_value))
 
 1460      else if (
value >= alt_value)
 
 1477   std::unique_ptr<RooAbsCollection> _poi(
fFuncVars->selectByAttrib(
"poi", 
true));
 
 1478   if (_poi->empty()) {
 
 1479      throw std::runtime_error(
"No POI specified in model");
 
 1480   } 
else if (_poi->size() != 1) {
 
 1481      throw std::runtime_error(
"Multiple POI specified in model");
 
 1483   return hypoPoint(_poi->first()->GetName(), 
value, alt_value, pllType);
 
 1494   bool hasSame = sOpt.
Contains(
"same");
 
 1499   TH1 *hAxis = 
nullptr;
 
 1501   auto clearPad = []() {
 
 1503      if (
gPad->GetNumber() == 0) {
 
 1511   if (!hasSame || !pad) {
 
 1522            if (hAxis = 
dynamic_cast<TH1 *
>(o); hAxis)
 
 1529   double _min = std::numeric_limits<double>::quiet_NaN();
 
 1530   double _max = -std::numeric_limits<double>::quiet_NaN();
 
 1532   for (
auto &
p : nullToys) {
 
 1533      if (std::get<2>(
p) == 0)
 
 1535      if (std::isnan(std::get<1>(
p)))
 
 1537      _min = std::min(std::get<1>(
p), _min);
 
 1538      _max = std::max(std::get<1>(
p), _max);
 
 1540   for (
auto &
p : altToys) {
 
 1541      if (std::get<2>(
p) == 0)
 
 1543      if (std::isnan(std::get<1>(
p)))
 
 1545      _min = std::min(std::get<1>(
p), _min);
 
 1546      _max = std::max(std::get<1>(
p), _max);
 
 1550   if (!std::isnan(obs.first)) {
 
 1551      _min = std::min(obs.first - std::abs(obs.first) * 0.1, _min);
 
 1552      _max = std::max(obs.first + std::abs(obs.first) * 0.1, _max);
 
 1555   auto asi = (fAsimov && fAsimov->fUfit && fAsimov->fNull_cfit) ? fAsimov->pll().first
 
 1556                                                                 : std::numeric_limits<double>::quiet_NaN();
 
 1559      _min = std::min(asi - std::abs(asi), _min);
 
 1560      _max = std::max(asi + std::abs(asi), _max);
 
 1565   auto _poi = 
dynamic_cast<RooRealVar *
>(poi().first());
 
 1567   auto makeHist = [&](
bool isAlt) {
 
 1569      auto h = 
new TH1D((isAlt) ? 
"alt_toys" : 
"null_toys", 
"", 100, _min, _max + (_max - _min) * 0.01);
 
 1571      size_t nBadOrZero = 0;
 
 1572      for (
auto &
p : (isAlt) ? altToys : nullToys) {
 
 1573         double w = std::isnan(std::get<1>(
p)) ? 0 : std::get<2>(
p);
 
 1576         if (!std::isnan(std::get<1>(
p)))
 
 1577            h->Fill(std::get<1>(
p), 
w);
 
 1579      if (
h->GetEntries() > 0)
 
 1580         h->Scale(1. / 
h->Integral(0, 
h->GetNbinsX() + 1));
 
 1593      title += 
TString::Format(
"%s' = %g", fPOIName(), (isAlt) ? fAltVal() : fNullVal());
 
 1594      title += (std::string(
" , N_{toys}=") + ((isAlt) ? altToys.size() : nullToys.size()));
 
 1596         title += (std::string(
" (N_{bad/0}=") + nBadOrZero + 
')');
 
 1603      h->SetMarkerSize(0);
 
 1608   auto nullHist = makeHist(
false);
 
 1609   auto altHist = makeHist(
true);
 
 1616      axis->Reset(
"ICES");
 
 1617      axis->SetMinimum(1
e-7);
 
 1618      axis->SetMaximum(
h->GetMaximum());
 
 1620      axis->SetLineWidth(0);
 
 1623      l = 
new TLegend(0.4, 0.7, 1. - 
gPad->GetRightMargin(), 1. - 
gPad->GetTopMargin());
 
 1624      l->SetName(
"legend");
 
 1626      l->SetBorderSize(0);
 
 1630      for (
auto o : *
gPad->GetListOfPrimitives()) {
 
 1637   if (
h->GetEntries() > 0)
 
 1638      h->
Draw(
"histesame");
 
 1640      h->Draw(
"axissame"); 
 
 1642   if (
h->GetEntries() > 0)
 
 1643      h->Draw(
"histesame");
 
 1645      h->Draw(
"axissame"); 
 
 1648      l->AddEntry(nullHist);
 
 1649      l->AddEntry(altHist);
 
 1652   if (fAsimov && fAsimov->fUfit && fAsimov->fNull_cfit && !std::isnan(sigma_mu().first) && !std::isnan(fAltVal())) {
 
 1653      auto hh = (
TH1 *)nullHist->
Clone(
"null_asymp");
 
 1654      hh->SetLineStyle(2);
 
 1656      for (
int i = 1; i <= hh->GetNbinsX(); i++) {
 
 1659                                            _poi->getMin(
"physical"), _poi->getMax(
"physical")) -
 
 1661                                               sigma_mu().first, _poi->getMin(
"physical"), _poi->getMax(
"physical")));
 
 1664      hh = (
TH1 *)altHist->Clone(
"alt_asymp");
 
 1665      hh->SetLineStyle(2);
 
 1667      for (
int i = 1; i <= hh->GetNbinsX(); i++) {
 
 1670                                            _poi->getMin(
"physical"), _poi->getMax(
"physical")) -
 
 1672                                               sigma_mu().first, _poi->getMin(
"physical"), _poi->getMax(
"physical")));
 
 1685   auto pNull = pNull_toys();
 
 1686   auto pAlt = pAlt_toys();
 
 1688   auto pNullA = pNull_asymp();
 
 1689   auto pAltA = pAlt_asymp();
 
 1691   l->AddEntry(tl, label, 
"l");
 
 1693   if (!std::isnan(pNull.first) || !std::isnan(pAlt.first)) {
 
 1694      auto pCLs = pCLs_toys();
 
 1695      label += 
" p_{toy}=(";
 
 1696      label += (std::isnan(pNull.first)) ? 
"-" : 
TString::Format(
"%.4f #pm %.4f", pNull.first, pNull.second);
 
 1697      label += (std::isnan(pAlt.first)) ? 
",-" : 
TString::Format(
",%.4f #pm %.4f", pAlt.first, pAlt.second);
 
 1698      label += (std::isnan(pCLs.first)) ? 
",-)" : 
TString::Format(
",%.4f #pm %.4f", pCLs.first, pCLs.second);
 
 1700   if (label.Length() > 0)
 
 1701      l->AddEntry(
"", label, 
"");
 
 1703   if (!std::isnan(pNullA.first) || !std::isnan(pAltA.first)) {
 
 1704      auto pCLs = pCLs_asymp();
 
 1705      label += 
" p_{asymp}=(";
 
 1706      label += (std::isnan(pNullA.first)) ? 
"-" : 
TString::Format(
"%.4f #pm %.4f", pNullA.first, pNullA.second);
 
 1707      label += (std::isnan(pAltA.first)) ? 
",-" : 
TString::Format(
",%.4f #pm %.4f", pAltA.first, pAltA.second);
 
 1708      label += (std::isnan(pCLs.first)) ? 
",-)" : 
TString::Format(
",%.4f #pm %.4f", pCLs.first, pCLs.second);
 
 1710   if (label.Length() > 0)
 
 1711      l->AddEntry(
"", label, 
"");
 
 1718   auto v = 
dynamic_cast<RooRealVar *
>(poi().empty() ? nullptr : poi().first());
 
 1720      if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1727      if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1734      if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1741      if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1748      return "Test Statistic";
 
 1754   return (poi().
first())->GetName();
 
 1758   return dynamic_cast<RooAbsReal *
>(poi().first())->getVal();
 
 1762   return dynamic_cast<RooAbsReal *
>(alt_poi().first())->getVal();
 
 1771      hs.
AddPoints(parName, nPoints, low, high);
 
 1778   auto _poi = std::unique_ptr<RooAbsCollection>(
 
 1779      std::unique_ptr<RooAbsCollection>(
pdf()->getVariables())->selectByAttrib(
"poi", 
true));
 
 1781      throw std::runtime_error(
"You must specify a POI for the hypoSpace");
 
 1782   return hypoSpace(_poi->first()->GetName(), nPoints, low, high, alt_value, pllType);
 
 1790   if (strlen(parName)) {
 
 1791      auto poi = s.
pars()->find(parName);
 
 1793         throw std::runtime_error(
"parameter not found");
 
 1794      s.
pars()->setAttribAll(
"poi", 
false);
 
 1795      poi->setAttribute(
"poi", 
true);
 
 1796   } 
else if (std::unique_ptr<RooAbsCollection>(s.
pars()->selectByAttrib(
"poi", 
true))->empty()) {
 
 1797      throw std::runtime_error(
"You must specify a POI for the hypoSpace");
 
 1799   s.
fNlls[s.
fPdfs.begin()->second] = std::make_shared<xRooNLLVar>(*
this);
 
 1809   bool setReadonly = 
false;
 
 1810   if (nllVar && !nllVar->get()->getAttribute(
"readOnly")) {
 
 1812      nllVar->get()->setAttribute(
"readOnly");
 
 1815   auto ts_obs = ts_asymp();
 
 1819   if (!nullToys.empty()) {
 
 1821      std::vector<double> values;
 
 1822      std::vector<double> weights;
 
 1823      values.
reserve(nullToys.size());
 
 1824      weights.reserve(nullToys.size());
 
 1826      for (
auto &t : nullToys) {
 
 1827         if (std::isnan(std::get<1>(t))) {
 
 1830            values.push_back(std::get<1>(t));
 
 1831            weights.push_back(std::get<2>(t));
 
 1840#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00) 
 1850   if (!altToys.empty()) {
 
 1851      std::vector<double> values;
 
 1852      std::vector<double> weights;
 
 1853      values.
reserve(nullToys.size());
 
 1854      weights.reserve(nullToys.size());
 
 1856      for (
auto &t : nullToys) {
 
 1857         if (std::isnan(std::get<1>(t))) {
 
 1860            values.push_back(std::get<1>(t));
 
 1861            weights.push_back(std::get<2>(t));
 
 1870#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00) 
 1880      nllVar->get()->setAttribute(
"readOnly", 
false);
 
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
 
R__EXTERN TStyle * gStyle
 
R__EXTERN TSystem * gSystem
 
AutoRestorer(const RooAbsCollection &s, xRooNLLVar *nll=nullptr)
 
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > fOldData
 
std::unique_ptr< RooAbsCollection > fSnap
 
Generic interface for defining configuration options of a numerical algorithm.
 
void SetValue(const char *name, double val)
generic methods for retrieving options
 
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
 
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
 
const RefCountList_t & servers() const
List of all servers of this object.
 
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
 
A space to attach TBranches.
 
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
 
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
 
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
 
void setAttribAll(const Text_t *name, bool value=true)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
 
Storage_t::size_type size() const
 
RooAbsArg * first() const
 
void reserve(Storage_t::size_type count)
 
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
 
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
 
std::string contentsString() const
Return comma separated list of contained object names as STL string.
 
void setName(const char *name)
 
RooAbsData is the common abstract base class for binned and unbinned datasets.
 
virtual const RooArgSet * get() const
 
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
 
virtual void setVal(double value)=0
Set the current value of the object. Needs to be overridden by implementations.
 
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
 
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
 
bool setData(RooAbsData &data, bool cloneData=true) override
Change dataset that is used to given one.
 
RooArgList is a container object that can hold multiple RooAbsArg objects.
 
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
 
RooArgSet is a container object that can hold multiple RooAbsArg objects.
 
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
 
Int_t getInt(Int_t idx) const
 
TObject * Clone(const char *newName=nullptr) const override
Make a clone of an object using the Streamer facility.
 
RooConstraintSum calculates the sum of the -(log) likelihoods of a set of RooAbsPfs that represent co...
 
RooDataSet is a container class to hold unbinned data.
 
void add(const RooArgSet &row, double weight=1.0, double weightError=0.0) override
Add one ore more rows of data.
 
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
 
static Double_t k(const IncompatFunc &compatRegions, double pValue, double poiVal, double poiPrimeVal, double sigma_mu=0, double mu_low=-std::numeric_limits< double >::infinity(), double mu_high=std::numeric_limits< double >::infinity())
 
static Double_t PValue(const IncompatFunc &compatRegions, double k, double mu, double mu_prime, double sigma_mu=0, double mu_low=-std::numeric_limits< double >::infinity(), double mu_high=std::numeric_limits< double >::infinity())
 
static int CompatFactor(const IncompatFunc &func, double mu_hat)
 
static std::shared_ptr< const RooFitResult > minimize(RooAbsReal &nll, const std::shared_ptr< ROOT::Fit::FitConfig > &fitConfig=nullptr)
 
static std::shared_ptr< ROOT::Fit::FitConfig > createFitConfig()
 
static std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > generateFrom(RooAbsPdf &pdf, const std::shared_ptr< const RooFitResult > &fr, bool expected=false, int seed=0)
 
const RooFitResult * operator->() const
 
void Draw(Option_t *opt="")
 
xRooFitResult(const std::shared_ptr< xRooNode > &in)
 
void addToys(bool alt, int nToys, int initialSeed=0)
 
std::pair< double, double > getVal(const char *what)
 
RooStats::HypoTestResult result()
 
std::pair< double, double > pNull_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
 
std::pair< double, double > pAlt_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
 
void addNullToys(int nToys=1, int seed=0)
 
xRooFit::Asymptotics::PLLType fPllType
 
void addAltToys(int nToys=1, int seed=0)
 
std::pair< double, double > ts_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
 
std::shared_ptr< const RooAbsCollection > coords
 
std::shared_ptr< xRooHypoPoint > asimov(bool readOnly=false)
 
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > data
 
std::pair< double, double > pll(bool readOnly=false)
 
std::shared_ptr< const RooFitResult > ufit(bool readOnly=false)
 
std::shared_ptr< const RooFitResult > cfit_null(bool readOnly=false)
 
xRooHypoPoint generateNull(int seed=0)
 
std::pair< double, double > sigma_mu(bool readOnly=false)
 
std::shared_ptr< const RooFitResult > cfit_alt(bool readOnly=false)
 
std::pair< double, double > pX_toys(bool alt, double nSigma=std::numeric_limits< double >::quiet_NaN())
 
std::shared_ptr< const RooFitResult > fGenFit
 
void Draw(Option_t *opt="")
 
std::pair< double, double > pAlt_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
 
xRooHypoPoint generateAlt(int seed=0)
 
std::pair< double, double > ts_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
 
std::shared_ptr< xRooNLLVar > nllVar
 
std::pair< double, double > pNull_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
 
std::pair< double, double > pCLs_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
 
xRooFit::Asymptotics::PLLType fTestStatType
 
bool AddModel(const xRooNode &pdf, const char *validity="")
 
std::shared_ptr< RooArgSet > pars() const
 
std::set< std::pair< std::shared_ptr< RooArgList >, std::shared_ptr< xRooNode > > > fPdfs
 
int AddPoints(const char *parName, size_t nPoints, double low, double high)
 
std::map< std::shared_ptr< xRooNode >, std::shared_ptr< xRooNLLVar > > fNlls
 
void AddOption(const RooCmdArg &opt)
 
std::shared_ptr< RooAbsReal > func() const
 
RooAbsData * data() const
 
double binnedDataTerm() const
 
ROOT::Math::IOptions * fitConfigOptions()
 
std::shared_ptr< RooAbsCollection > fFuncGlobs
 
std::shared_ptr< RooAbsCollection > fFuncVars
 
Bool_t setData(const std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > &_data)
 
std::shared_ptr< RooAbsPdf > fPdf
 
RooConstraintSum * constraintTerm() const
 
std::shared_ptr< RooAbsCollection > fConstVars
 
std::shared_ptr< const RooAbsCollection > fGlobs
 
std::shared_ptr< RooAbsData > fData
 
double extendedTerm() const
 
RooNLLVar * nllTerm() const
 
xRooHypoSpace hypoSpace(const char *parName, int nPoints, double low, double high, double alt_value=std::numeric_limits< double >::quiet_NaN(), const xRooFit::Asymptotics::PLLType &pllType=xRooFit::Asymptotics::Unknown)
 
std::shared_ptr< RooAbsPdf > pdf() const
 
xRooNLLVar(RooAbsPdf &pdf, const std::pair< RooAbsData *, const RooAbsCollection * > &data, const RooLinkedList &nllOpts=RooLinkedList())
 
std::shared_ptr< RooLinkedList > fOpts
 
std::string fFuncCreationLog
 
void Print(Option_t *opt="")
 
void Draw(Option_t *opt="")
 
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > generate(bool expected=false, int seed=0)
 
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > getData() const
 
std::shared_ptr< ROOT::Fit::FitConfig > fitConfig()
 
std::shared_ptr< ROOT::Fit::FitConfig > fFitConfig
 
double getEntryVal(size_t entry)
 
std::shared_ptr< RooArgSet > pars(bool stripGlobalObs=true)
 
xRooHypoPoint hypoPoint(const char *parName, double value, double alt_value=std::numeric_limits< double >::quiet_NaN(), const xRooFit::Asymptotics::PLLType &pllType=xRooFit::Asymptotics::Unknown)
 
xRooFitResult minimize(const std::shared_ptr< ROOT::Fit::FitConfig > &=nullptr)
 
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
 
TObject * At(int index) const
Return object stored in sequential position given by index.
 
static RooMsgService & instance()
Return reference to singleton instance.
 
StreamConfig & getStream(Int_t id)
 
Class RooNLLVar implements a -log(likelihood) calculation from a dataset and a PDF.
 
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
 
RooRealVar represents a variable that can be changed from the outside.
 
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
 
HypoTestResult is a base class for results from hypothesis tests.
 
void SetAltDetailedOutput(RooDataSet *d)
 
double fNullPValue
p-value for the null hypothesis (small number means disfavoured)
 
double fAlternatePValueError
error of p-value for the alternate hypothesis (small number means disfavoured)
 
void SetNullDetailedOutput(RooDataSet *d)
 
RooDataSet * GetNullDetailedOutput(void) const
 
void SetBackgroundAsAlt(bool l=true)
 
void SetAltPValue(double pvalue)
 
void SetNullDistribution(SamplingDistribution *null)
 
void SetTestStatisticData(const double tsd)
 
void SetAltPValueError(double err)
 
double fNullPValueError
error of p-value for the null hypothesis (small number means disfavoured)
 
void SetAltDistribution(SamplingDistribution *alt)
 
RooDataSet * GetAltDetailedOutput(void) const
 
double fAlternatePValue
p-value for the alternate hypothesis (small number means disfavoured)
 
void SetNullPValue(double pvalue)
 
void SetNullPValueError(double err)
 
This class simply holds a sampling distribution of some test statistic.
 
RooStringVar is a RooAbsArg implementing string values.
 
Draw all kinds of Arrows.
 
virtual TArrow * DrawArrow(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Float_t arrowsize=0, Option_t *option="")
Draw this arrow with new coordinates.
 
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
 
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
 
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
 
static TCanvas * MakeDefCanvas()
Static function to build a default canvas.
 
Class to handle efficiency histograms.
 
void FillWeighted(Bool_t bPassed, Double_t weight, Double_t x, Double_t y=0, Double_t z=0)
This function is used for filling the two histograms with a weight.
 
Double_t GetEfficiencyErrorUp(Int_t bin) const
Returns the upper error on the efficiency in the given global bin.
 
void Fill(Bool_t bPassed, Double_t x, Double_t y=0, Double_t z=0)
This function is used for filling the two histograms.
 
A TGraph is an object made of two arrays X and Y with npoints each.
 
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
 
virtual void Sort(Bool_t(*greater)(const TGraph *, Int_t, Int_t)=&TGraph::CompareX, Bool_t ascending=kTRUE, Int_t low=0, Int_t high=-1111)
Sorts the points of this TGraph using in-place quicksort (see e.g.
 
void SetName(const char *name="") override
Set graph name.
 
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
 
virtual Double_t GetPointY(Int_t i) const
Get y value for point i.
 
void SetTitle(const char *title="") override
Change (i.e.
 
void SetNameTitle(const char *name="", const char *title="") override
Set graph name and title.
 
1-D histogram with a double per channel (see TH1 documentation)}
 
TH1 is the base class of all histogram classes in ROOT.
 
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
 
This class displays a legend box (TPaveText) containing several legend entries.
 
void Draw(Option_t *option="") override
Draw this legend with its current attributes.
 
Use the TLine constructor to create a simple line.
 
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
 
A TMultiGraph is a collection of TGraph (or derived) objects.
 
const char * GetName() const override
Returns name of object.
 
const char * GetTitle() const override
Returns title of object.
 
void Clear(Option_t *option="") override
Set name and title to empty strings ("").
 
virtual const char * GetName() const
Returns name of object.
 
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
 
virtual void Delete(Option_t *option="")
Delete this object.
 
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
 
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
 
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
 
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
 
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
 
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
 
void Continue()
Resume a stopped stopwatch.
 
Provides iteration through tokens of a given string.
 
Bool_t NextToken()
Get the next token, it is stored in this TString.
 
void ToLower()
Change string to lower-case.
 
Double_t Atof() const
Return floating-point value contained in string.
 
TString & ReplaceAll(const TString &s1, const TString &s2)
 
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
 
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
 
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
 
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
 
Float_t GetPadRightMargin() const
 
Float_t GetPadLeftMargin() const
 
Float_t GetPadBottomMargin() const
 
Float_t GetPadTopMargin() const
 
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
 
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
 
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
 
TVirtualPad is an abstract base class for the Pad and Canvas classes.
 
virtual TList * GetListOfPrimitives() const =0
 
virtual TObject * GetPrimitive(const char *name) const =0
 
RooCmdArg GlobalObservables(Args_t &&... argsOrArgSet)
 
double gaussian_cdf(double x, double sigma=1, double x0=0)
Alternative name for same function.
 
Double_t LnGamma(Double_t z)
Computation of ln[gamma(z)] for all z.
 
#define BEGIN_XROOFIT_NAMESPACE
 
#define END_XROOFIT_NAMESPACE
 
void removeTopic(RooFit::MsgTopic oldTopic)
 
std::string collectionContents(const RooAbsCollection &coll)