59xRooNLLVar::xRooHypoSpace::xRooHypoSpace(
const char *
name, 
const char *title)
 
   66   return pdf(toArgs(parValues));
 
   75   std::shared_ptr<xRooNode> out = 
nullptr;
 
   77   for (
auto &[_range, _pdf] : fPdfs) {
 
   80      bool collision = 
true;
 
   81      for (
auto &_lhs : *_range) {
 
   82         auto _rhs = rhs.
find(*_lhs);
 
   87               if (!(
v->getMin() <= 
v2->getMax() && 
v2->getMin() <= 
v->getMax())) {
 
   92               if (!(
v->getMin() <= 
c2->getVal() && 
c2->getVal() <= 
v->getMax())) {
 
   99               if (!(
c->getVal() <= 
v2->getMax() && 
v2->getMin() <= 
c->getVal())) {
 
  104               if (!(
c->getVal() == 
c2->getVal())) {
 
  113            throw std::runtime_error(
"Multiple pdf possibilities");
 
  131      auto _idx = s.
Index(
'=');
 
  140         _idx = _val.
Index(
',');
 
  159      throw std::runtime_error(
"Unknown parameter");
 
  162      _par->setVal((high + low) * 0.5);
 
  167   double step = (high - low) / nPoints;
 
  169      throw std::runtime_error(
"Invalid steps");
 
  171   for (
double v = low + step * 0.5; 
v <= high; 
v += step) {
 
  182   double factor = pow(10.0, digits - ceil(log10(std::abs(
value))));
 
  183   return std::round(
value * factor) / factor;
 
  187   const double multiplier = std::pow(10.0, decimal_places);
 
  188   return std::round(
value * multiplier) / multiplier;
 
  195   if (!std::isinf(out.second)) {
 
  196      auto tmp = out.second;
 
  198      int expo = (out.second == 0) ? 0 : (
int)std::floor(std::log10(std::abs(out.second)));
 
  201         out.first = (expo >= 0) ? round(out.first) : 
round_to_decimal(out.first, -expo);
 
  202      } 
else if (out.second != 0) {
 
  203         out.first = (expo >= 0) ? round(out.first) : 
round_to_decimal(out.first, -expo + 1);
 
  213      for (
auto p : poi()) {
 
  214         if (!
p->hasRange(
"physical")) {
 
  215            Info(
"limits", 
"No physical range set for %s, setting to [0,inf]", 
p->
GetName());
 
  216            dynamic_cast<RooRealVar *
>(
p)->setRange(
"physical", 0, std::numeric_limits<double>::infinity());
 
  218         if (!
p->getStringAttribute(
"altVal")) {
 
  219            Info(
"limits", 
"No altVal set for %s, setting to 0", 
p->
GetName());
 
  220            p->setStringAttribute(
"altVal", 
"0");
 
  223         double altVal = 
TString(
p->getStringAttribute(
"altVal")).
Atof();
 
  225         if (
v->getMin() >= altVal) {
 
  226            Info(
"limits", 
"range of POI does not straddle alt value, adjusting minimum to %g", altVal - 1
e-5);
 
  227            v->setMin(altVal - 1
e-5);
 
  229         if (
v->getMax() <= altVal) {
 
  230            Info(
"limits", 
"range of POI does not straddle alt value, adjusting minimum to %g", altVal + 1
e-5);
 
  231            v->setMax(altVal + 1
e-5);
 
  233         for (
auto &[
pdf, nll] : fNlls) {
 
  234            if (
auto _v = 
dynamic_cast<RooRealVar *
>(nll->pars()->find(*
p))) {
 
  235               _v->setRange(
v->getMin(), 
v->getMax());
 
  241   std::map<std::string, std::pair<double, double>> out;
 
  242   std::shared_ptr<TMemFile> memFile;
 
  244      memFile = std::make_shared<TMemFile>(
"memory", 
"RECREATE");
 
  246   for (
int nSigma : {0, 1, 2, -1, -2}) {
 
  247      auto lim = FindLimit(
TString::Format(
"%s exp%s%d", opt, nSigma > 0 ? 
"+" : 
"", nSigma), relUncert);
 
  249         lim.second = -lim.second; 
 
  255#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 26, 00) 
  257   for (
auto &[
pdf, nll] : fNlls) {
 
  258      auto _d = 
dynamic_cast<RooDataSet *
>(nll->data());
 
  259      if (!_d || !_d->weightVar() || !_d->weightVar()->getStringAttribute(
"fitResult")) {
 
  270         lim.second = -lim.second;
 
  279   fPars->assignValueOnly(toArgs(coords));
 
  284      throw std::runtime_error(
"no model at coordinates");
 
  286   if (std::unique_ptr<RooAbsCollection>(fPars->selectByAttrib(
"poi", 
true))->size() == 0) {
 
  287      throw std::runtime_error(
 
  288         "No pars designated as POI - set with pars()->find(<parName>)->setAttribute(\"poi\",true)");
 
  291   if (fNlls.find(_pdf) == fNlls.end()) {
 
  292      fNlls[_pdf] = std::make_shared<xRooNLLVar>(_pdf->nll(
"" , {}));
 
  298   out.
data = fNlls[_pdf]->getData();
 
  300   out.
coords.reset(fPars->snapshot()); 
 
  305      ->remove(*std::unique_ptr<RooAbsCollection>(out.
coords->selectByAttrib(
"Constant", 
false)), 
true, 
true);
 
  307   double alt_value = out.
fAltVal();
 
  309   auto _type = fTestStatType;
 
  312      if (std::isnan(alt_value))
 
  314      else if (
value >= alt_value)
 
  324   return emplace_back(out);
 
  331      throw std::runtime_error(
"Not a pdf");
 
  337   auto vpars = toArgs(validity);
 
  339   vpars.remove(
pars, 
true, 
true);
 
  342   if (
auto existing = 
pdf(
pars)) {
 
  343      throw std::runtime_error(std::string(
"Clashing model: ") + existing->GetName());
 
  346   auto myPars = std::shared_ptr<RooArgList>(
dynamic_cast<RooArgList *
>(
pars.snapshot()));
 
  349   pars.remove(*fPars, 
true, 
true);
 
  351   fPars->addClone(
pars);
 
  353   fPdfs.insert(std::make_pair(myPars, std::make_shared<xRooNode>(_pdf)));
 
  369      std::map<std::string, std::set<double>> values;
 
  370      for (
auto &par : *
pars()) {
 
  373         for (
auto p : *
this) {
 
  374            values[par->GetName()].insert(
 
  375               p.coords->getRealValue(par->GetName(), std::numeric_limits<double>::quiet_NaN()));
 
  382      for (
auto &[k, 
v] : values) {
 
  383         if (
v.size() > maxDiff || (
v.size() == maxDiff && !isPOI && 
pars()->find(k.c_str())->getAttribute(
"poi"))) {
 
  385            isPOI = 
pars()->find(k.c_str())->getAttribute(
"poi");
 
  386            maxDiff = std::max(maxDiff, 
v.size());
 
  390      if (bestVar.empty()) {
 
  394      out.
add(*
pars()->find(bestVar.c_str()));
 
  396      std::set<std::vector<double>> coords;
 
  397      for (
auto &
p : *
this) {
 
  398         std::vector<double> p_coords;
 
  400            p_coords.push_back(
p.coords->getRealValue(o->GetName(), std::numeric_limits<double>::quiet_NaN()));
 
  402         if (coords.find(p_coords) != coords.end()) {
 
  411   std::unique_ptr<RooAbsCollection> poi(out.
selectByAttrib(
"poi", 
true));
 
  422   out.
add(*std::unique_ptr<RooAbsCollection>(
pars()->selectByAttrib(
"poi", 
true)));
 
  446         Error(
"LoadFits", 
"Path not found %s", apath);
 
  456   std::map<std::set<std::tuple<std::string, double, std::string>>, std::set<std::set<std::string>>> cfits;
 
  457   std::set<std::string> allpois;
 
  462      std::cout << 
"Processing " << _dir->GetName() << std::endl;
 
  463      if (
auto keys = _dir->GetListOfKeys(); keys) {
 
  466         bool isNllDir = 
false;
 
  467         for (
auto &&k : *keys) {
 
  468            TKey *key = 
dynamic_cast<TKey *
>(k);
 
  469            if (strcmp(key->
GetClassName(), 
"RooLinkedList") == 0) {
 
  475         for (
auto &&k : *keys) {
 
  476            if (
auto subdir = _dir->GetDirectory(k->GetName()); subdir) {
 
  478                  LoadFits(subdir->GetPath());
 
  485            if (cl->InheritsFrom(
"RooFitResult")) {
 
  490                     std::unique_ptr<RooAbsCollection> snap(cachedFit->floatParsFinal().snapshot());
 
  491                     snap->remove(*fPars, 
true, 
true);
 
  492                     fPars->addClone(*snap);
 
  494                     for (
auto &
p : cachedFit->constPars()) {
 
  495                        if (
p->getAttribute(
"global"))
 
  501                        if (!fPars->contains(*
v))
 
  506                  std::set<std::string> floatPars;
 
  507                  for (
auto &
p : cachedFit->floatParsFinal())
 
  512                  std::set<std::tuple<std::string, double, std::string>> constPars;
 
  513                  for (
auto &
p : cachedFit->constPars()) {
 
  514                     if (
p->getAttribute(
"global"))
 
  521                        std::make_tuple(
v->GetName(), 
v->getVal(),
 
  522                                        v->getStringAttribute(
"altVal") ? 
v->getStringAttribute(
"altVal") : 
""));
 
  525                  for (
auto &&[key, 
value] : cfits) {
 
  526                     if (constPars == key)
 
  528                     if (std::includes(constPars.begin(), constPars.end(), key.begin(), key.end())) {
 
  532                        std::set<std::string> pois;
 
  533                        for (
auto &&par : constPars) {
 
  534                           if (key.find(par) == key.end()) {
 
  535                              pois.insert(std::get<0>(par));
 
  536                              allpois.insert(std::get<0>(par));
 
  540                           cfits[constPars].insert(pois);
 
  575   Info(
"xRooHypoSpace", 
"%s - Loaded %d fits", apath, nFits);
 
  577   if (allpois.size() == 1) {
 
  578      Info(
"xRooHypoSpace", 
"Detected POI: %s", allpois.begin()->c_str());
 
  580      auto nll = std::make_shared<xRooNLLVar>(
nullptr, 
nullptr);
 
  581      auto dummyNll = std::make_shared<RooRealVar>(apath, 
"Dummy NLL", std::numeric_limits<double>::quiet_NaN());
 
  582      nll->std::shared_ptr<
RooAbsReal>::operator=(dummyNll);
 
  586         for (
auto &&
p : *fPars) {
 
  591         for (
auto &
p : allpois) {
 
  592            fPars->find(
p.c_str())->setAttribute(
"poi", 
true);
 
  597      for (
auto &&[key, 
value] : cfits) {
 
  600            auto _coords = std::make_shared<RooArgSet>();
 
  601            for (
auto &k : key) {
 
  602               auto v = _coords->addClone(
RooRealVar(std::get<0>(k).c_str(), std::get<0>(k).c_str(), std::get<1>(k)));
 
  603               v->setAttribute(
"poi", allpois.find(std::get<0>(k)) != allpois.end());
 
  604               if (!std::get<2>(k).empty()) {
 
  605                  v->setStringAttribute(
"altVal", std::get<2>(k).c_str());
 
  630   } 
else if (nFits > 0) {
 
  631      std::cout << 
"possible POI: ";
 
  632      for (
auto p : allpois)
 
  633         std::cout << 
p << 
",";
 
  634      std::cout << std::endl;
 
  645   for (
size_t i = 0; i < 
size(); i++) {
 
  646      std::cout << i << 
") ";
 
  647      for (
auto a : _axes) {
 
  648         if (
a != _axes.first())
 
  650         std::cout << 
a->GetName() << 
"=" 
  651                   << at(i).coords->getRealValue(
a->GetName(), std::numeric_limits<double>::quiet_NaN());
 
  653      std::cout << 
" status=[ufit:";
 
  658         std::cout << ufit->
status();
 
  661      std::cout << 
",cfit_null:";
 
  662      auto cfit = 
const_cast<xRooHypoPoint &
>(at(i)).cfit_null(
true);
 
  666         std::cout << cfit->
status();
 
  669      std::cout << 
",cfit_alt:";
 
  670      auto afit = 
const_cast<xRooHypoPoint &
>(at(i)).cfit_alt(
true);
 
  674         std::cout << afit->
status();
 
  678      auto sigma_mu = 
const_cast<xRooHypoPoint &
>(at(i)).sigma_mu(
true);
 
  679      if (!std::isnan(sigma_mu.first)) {
 
  680         std::cout << 
" sigma_mu=" << sigma_mu.first;
 
  682            std::cout << 
" +/- " << sigma_mu.second;
 
  684      std::cout << std::endl;
 
  686   std::cout << 
"--------------------------" << std::endl;
 
  687   std::cout << 
"Number of bad fits: " << badFits << std::endl;
 
  703         : std::numeric_limits<double>::quiet_NaN();
 
  705      !std::isnan(nSigma) && nSigma && !(sOpt(sOpt.
Index(
"exp") + 3) == 
'+' || sOpt(sOpt.
Index(
"exp") + 3) == 
'-');
 
  708   if (_axes.size() != 1)
 
  711   auto out = std::make_shared<TGraphErrors>();
 
  712   out->SetName(GetName());
 
  713   const char *sCL = (doCLs) ? 
"CLs" : 
"null";
 
  719                         : (!nSigma ? 
"Expected" 
  721                                                      expBand || !nSigma ? 
"" : ((nSigma < 0) ? 
"-" : 
"+"), 
int(nSigma))
 
  723                      _axes.at(0)->GetTitle(), sCL);
 
  725   if (std::isnan(nSigma)) {
 
  727      out->SetMarkerStyle(20);
 
  729         out->SetNameTitle(
"obs_ts", 
TString::Format(
"Observed;%s;Test Statistic", _axes.at(0)->GetTitle()));
 
  731      out->SetNameTitle(
TString::Format(
"exp%d_p%s", 
int(nSigma), sCL), title);
 
  732      out->SetMarkerStyle(0);
 
  733      out->SetLineStyle(2 + 
int(nSigma));
 
  734      if (expBand && nSigma) {
 
  737         out->SetLineStyle(0);
 
  738         out->SetLineWidth(0);
 
  739         auto x = out->Clone(
"up");
 
  743         out->GetListOfFunctions()->Add(
x, 
"F");
 
  744         x = out->Clone(
"down");
 
  748         out->GetListOfFunctions()->Add(
x, 
"F");
 
  752                           TString::Format(
"Expected;%s;Test Statistic", _axes.at(0)->GetTitle()));
 
  755   auto badPoints = [&]() {
 
  756      auto badPoints2 = 
dynamic_cast<TGraph *
>(out->GetListOfFunctions()->FindObject(
"badPoints"));
 
  760         badPoints2->SetName(
"badPoints");
 
  761         badPoints2->SetMarkerStyle(5);
 
  762         badPoints2->SetMarkerColor(
kRed);
 
  763         badPoints2->SetMarkerSize(out->GetMarkerSize());
 
  764         out->GetListOfFunctions()->Add(badPoints2, 
"P");
 
  770   for (
auto &
p : *
this) {
 
  771      double _x = 
p.coords->getRealValue(_axes.at(0)->GetName(), std::numeric_limits<double>::quiet_NaN());
 
  772      auto pval = 
p.getVal(sOpt);
 
  773      auto idx = out->GetN() - nPointsDown;
 
  775      if (std::isnan(pval.first)) {
 
  776         badPoints()->SetPoint(badPoints()->GetN(), _x, 0);
 
  778         out->InsertPointBefore(idx, _x, pval.first);
 
  779         out->SetPointError(idx, 0, pval.second);
 
  782      if (expBand && nSigma) {
 
  785         pval = 
p.getVal(sOpt2);
 
  786         if (std::isnan(pval.first)) {
 
  787            badPoints()->SetPoint(badPoints()->GetN(), _x, 0);
 
  789            out->InsertPointBefore(idx + 1, _x, pval.first);
 
  790            out->SetPointError(idx + 1, 0, pval.second);
 
  792            if (out->GetPointY(idx) < pval.first)
 
  798   if (out->GetN() == 0)
 
  805      out->Sort(&
TGraph::CompareX, 
false, out->GetN() - nPointsDown, out->GetN() - 1); 
 
  808      auto up = 
dynamic_cast<TGraph *
>(out->GetListOfFunctions()->FindObject(
"up"));
 
  809      auto down = 
dynamic_cast<TGraph *
>(out->GetListOfFunctions()->FindObject(
"down"));
 
  811      for (
int i = 0; i < out->GetN(); i++) {
 
  812         if (i < out->GetN() - nPointsDown) {
 
  813            up->
SetPoint(up->GetN(), out->GetPointX(i), out->GetPointY(i) + out->GetErrorY(i) * (above ? 1. : -1.));
 
  814            down->SetPoint(down->GetN(), out->GetPointX(i), out->GetPointY(i) - out->GetErrorY(i) * (above ? 1. : -1.));
 
  816            up->SetPoint(up->GetN(), out->GetPointX(i), out->GetPointY(i) - out->GetErrorY(i) * (above ? 1. : -1.));
 
  817            down->SetPoint(down->GetN(), out->GetPointX(i), out->GetPointY(i) + out->GetErrorY(i) * (above ? 1. : -1.));
 
  828   auto gr = std::make_shared<TGraph>(pValues);
 
  831   std::set<double> existingX;
 
  832   while (i < gr->GetN()) {
 
  835      else if (existingX.find(
gr->
GetPointX(i)) != existingX.end()) {
 
  849      return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
  852   double alpha = log(
target);
 
  855   for (
int ii = 1; ii < 
gr->
GetN(); ii++) {
 
  866         return std::pair(lim, err);
 
  877         return std::pair(2. * 
gr->
GetPointX(
gr->
GetN() - 1) - 
x1, std::numeric_limits<double>::infinity());
 
  878      return std::pair((alpha - 
y1) / 
m + 
x1, std::numeric_limits<double>::infinity());
 
  885         return std::pair(2. * 
x1 - 
gr->
GetPointX(1), std::numeric_limits<double>::infinity());
 
  886      return std::pair((alpha - 
y1) / 
m + 
x1, std::numeric_limits<double>::infinity());
 
  892   std::shared_ptr<TGraphErrors> 
gr = BuildGraph(
TString(opt) + 
" readonly");
 
  895   for (
auto p : poi()) {
 
  896      for (
auto &[
pdf, nll] : fNlls) {
 
  897         if (
auto _v = 
dynamic_cast<RooRealVar *
>(nll->pars()->find(*
p))) {
 
  898            dynamic_cast<RooRealVar *
>(
p)->setRange(_v->getMin(), _v->getMax());
 
  904      auto v = (poi().empty()) ? 
nullptr : 
dynamic_cast<RooRealVar *
>(poi().first());
 
  906         return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
  907      double muMax = std::min(
v->getMax(), 
v->getMax(
"physical"));
 
  908      double muMin = std::max(
v->getMin(
"physical"), 
v->getMin());
 
  910         if (std::isnan(AddPoint(
TString::Format(
"%s=%g", 
v->GetName(), muMin)).getVal(opt).first)) {
 
  912            return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
  914         return FindLimit(opt, relUncert); 
 
  918             AddPoint(
TString::Format(
"%s=%g", 
v->GetName(), muMin + (muMax - muMin) / 50)).getVal(opt).first)) {
 
  920         return std::pair(std::numeric_limits<double>::quiet_NaN(), 0);
 
  922      return FindLimit(opt, relUncert);
 
  925   auto lim = GetLimit(*
gr);
 
  927   if (std::isnan(lim.first)) {
 
  931   if (std::abs(lim.second) <= relUncert * std::abs(lim.first))
 
  935   auto v = 
dynamic_cast<RooRealVar *
>(poi().first());
 
  936   double maxMu = std::min(
v->getMax(
"physical"), 
v->getMax());
 
  937   double minMu = std::max(
v->getMin(
"physical"), 
v->getMin());
 
  938   if (lim.second == std::numeric_limits<double>::infinity()) {
 
  940      nextPoint = lim.first;
 
  941      if (nextPoint > 
v->getMax(
"physical"))
 
  943      if (nextPoint > 
v->getMax(
"physical"))
 
  945   } 
else if (lim.second == -std::numeric_limits<double>::infinity()) {
 
  947      nextPoint = lim.first;
 
  948      if (nextPoint < v->getMin(
"physical"))
 
  949         nextPoint = 
gr->
GetPointX(0) - (maxMu - minMu) / 50;
 
  950      if (nextPoint < v->getMin(
"physical"))
 
  953      nextPoint = lim.first + lim.second * relUncert * 0.99;
 
  959   Info(
"FindLimit", 
"%s -- Testing new point @ %s=%g", opt, 
v->GetName(), nextPoint);
 
  960   if (std::isnan(AddPoint(
TString::Format(
"%s=%g", 
v->GetName(), nextPoint)).getVal(opt).first)) {
 
  964   return FindLimit(opt, relUncert);
 
  978   if (sOpt == 
"status") {
 
  980      if (_axes.size() <= 2) {
 
  995         badPoints->
SetName(
"bad_ufit");
 
 1001         badPoints2->
SetName(
"bad_cfit_null");
 
 1008                                       (_axes.size() == 1) ? 
"" : _axes.at(1)->GetTitle()));
 
 1009         for (
auto &
p : *
this) {
 
 1010            bool _readOnly = 
p.nllVar ? 
p.nllVar->get()->getAttribute(
"readOnly") : 
false;
 
 1012               p.nllVar->get()->setAttribute(
"readOnly", 
true);
 
 1013            double x = 
p.coords->getRealValue(_axes.at(0)->GetName());
 
 1014            double y = _axes.size() == 1 ? 
p.ts_asymp().first : 
p.coords->getRealValue(_axes.at(1)->GetName());
 
 1016            if (!std::isnan(
p.ts_asymp().first)) {
 
 1017               if (_axes.size() == 1)
 
 1020            } 
else if (
p.fUfit && (std::isnan(
p.fUfit->minNll()) ||
 
 1024            } 
else if (
p.fNull_cfit && (std::isnan(
p.fNull_cfit->minNll()) ||
 
 1029            if (!std::isnan(
p.ts_asymp(0).first)) {
 
 1031            } 
else if (
p.asimov() && 
p.asimov()->fUfit &&
 
 1032                       (std::isnan(
p.asimov()->fUfit->minNll()) ||
 
 1036            } 
else if (
p.asimov() && 
p.asimov()->fNull_cfit &&
 
 1037                       (std::isnan(
p.asimov()->fNull_cfit->minNll()) ||
 
 1042               p.nllVar->get()->setAttribute(
"readOnly", _readOnly);
 
 1045         if (_axes.size() == 1) {
 
 1047            for (
int i = 0; i < out->
GetN(); i++) {
 
 1051            auto fixPoints = [&](
TGraph *
g) {
 
 1052               for (
int i = 0; i < 
g->GetN(); i++) {
 
 1053                  if (std::isnan(
g->GetPointY(i)))
 
 1054                     g->SetPointY(i, std::isnan(tmp.
Eval(
g->GetPointX(i))) ? 0. : tmp.
Eval(
g->GetPointX(i)));
 
 1059            fixPoints(expAvail);
 
 1060            fixPoints(badPoints);
 
 1061            fixPoints(badPoints2);
 
 1066         auto leg = 
new TLegend(1. - 
gPad->GetRightMargin() - 0.3, 1. - 
gPad->GetTopMargin() - 0.3,
 
 1067                                1. - 
gPad->GetRightMargin() - 0.05, 1. - 
gPad->GetTopMargin() - 0.05);
 
 1068         leg->SetName(
"legend");
 
 1069         leg->AddEntry(out, 
"Uncomputed", 
"P");
 
 1071         if (tsAvail->
GetN()) {
 
 1073            leg->AddEntry(tsAvail, 
"Computed", 
"P");
 
 1077         if (expAvail->
GetN()) {
 
 1079            leg->AddEntry(expAvail, 
"Expected computed", 
"P");
 
 1083         if (badPoints->
GetN()) {
 
 1085            leg->AddEntry(badPoints, 
"Bad ufit", 
"P");
 
 1089         if (badPoints2->
GetN()) {
 
 1091            leg->AddEntry(badPoints2, 
"Bad null cfit", 
"P");
 
 1098         gPad->SetGrid(
true, _axes.size() > 1);
 
 1099         if (_axes.size() == 1)
 
 1100            gPad->SetLogy(
false);
 
 1110      auto exp2 = BuildGraph(sOpt + 
" exp2");
 
 1111      auto exp1 = BuildGraph(sOpt + 
" exp1");
 
 1112      auto exp = BuildGraph(sOpt + 
" exp");
 
 1113      auto obs = BuildGraph(sOpt);
 
 1118      auto g = 
dynamic_cast<TGraphErrors *
>(exp2->DrawClone(
"AF"));
 
 1120      g->GetHistogram()->SetName(
".axis");
 
 1121      g->GetHistogram()->SetTitle(
"");
 
 1129      l.
DrawLine(
g->GetHistogram()->GetXaxis()->GetXmin(), 0.05, 
g->GetHistogram()->GetXaxis()->GetXmax(), 0.05);
 
 1133      auto leg = 
new TLegend(1. - 
gPad->GetRightMargin() - 0.3, 1. - 
gPad->GetTopMargin() - 0.3,
 
 1134                             1. - 
gPad->GetRightMargin() - 0.05, 1. - 
gPad->GetTopMargin() - 0.05);
 
 1135      leg->SetName(
"legend");
 
 1136      leg->AddEntry(
g->GetListOfFunctions()->FindObject(
"down"), 
"", 
"F");
 
 1140      leg->AddEntry(
gPad->GetPrimitive(exp->GetName()), 
"", 
"LPE");
 
 1141      leg->AddEntry(
gPad->GetPrimitive(obs->GetName()), 
"", 
"LPE");
 
 1145      g->GetHistogram()->Draw(
"sameaxis"); 
 
 1148         gPad->SetGrid(0, 0);
 
 1163   if (!empty() && axes().
size() == 1) {
 
 1164      auto v = 
dynamic_cast<RooRealVar *
>(axes().first());
 
 1165      for (
auto &
p : *
this) {
 
 1167            pllType = 
p.fPllType;
 
 1171         if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1178         if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1185         if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1192         if (
v && 
v->hasRange(
"physical") && 
v->getMin(
"physical") != -std::numeric_limits<double>::infinity())
 
 1199         title += 
";Test Statistic";
 
 1204   *
dynamic_cast<TAttFill *
>(out) = *
this;
 
 1205   *
dynamic_cast<TAttLine *
>(out) = *
this;
 
 1211   auto basePad = 
gPad;
 
 1215   bool doFits = 
false;
 
 1221   auto mainPad = 
gPad;
 
 1228      gPad->SetBottomMargin(
gPad->GetBottomMargin() * 2.); 
 
 1232      mainPad = basePad->GetPad(1);
 
 1238   std::pair<double, double> minMax(std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity());
 
 1239   for (
auto &
p : *
this) {
 
 1240      if (
p.fPllType != pllType)
 
 1242      auto val = 
p.pll().first;
 
 1243      minMax.first = std::min(minMax.first, val);
 
 1244      minMax.second = std::max(minMax.second, val);
 
 1249   TGraph *badPoints = 
nullptr;
 
 1253   std::shared_ptr<const RooFitResult> ufr;
 
 1254   for (
auto &
p : *
this) {
 
 1255      if (
p.fPllType != pllType)
 
 1257      auto val = 
p.pll().first;
 
 1260      if (
auto fr = 
p.fNull_cfit;
 
 1266         pad->SetNumber(out->
GetN() + 1); 
 
 1273      if (std::isnan(val)) {
 
 1277            badPoints->
SetName(
"badPoints");
 
 1284         mainPad->Modified();
 
 1292            for (
int i = 0; i < badPoints->
GetN(); i++)
 
 1296         mainPad->Modified();
 
 1308   if (ufr && doFits) {
 
 1310      auto pad = 
new TPad(ufr->GetName(), 
"unconditional fit", 0, 0, 1., 1.);
 
 1318      pad = 
new TPad(
"selected", 
"selected", 0, 0, 1, 1);
 
 1321      basePad->GetPad(2)->GetPad(-1)->AppendPad();
 
 1332   gPad->GetCanvas()->
Connect(
"Highlighted(TVirtualPad*,TObject*,Int_t,Int_t)", 
"xRooNode::InteractiveObject",
 
 1343   auto _axes = axes();
 
 1349   for (
auto &
p : *
this) {
 
 1350      double _x = 
p.coords->getRealValue(_axes.at(0)->GetName(), std::numeric_limits<double>::quiet_NaN());
 
 1351      out->
Add(_x, 
p.result());
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
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 SetFillStyle
 
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
 
Option_t Option_t TPoint TPoint const char x1
 
Option_t Option_t SetFillColor
 
Option_t Option_t TPoint TPoint const char y1
 
R__EXTERN TSystem * gSystem
 
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
 
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
 
RooAbsCollection * selectByAttrib(const char *name, bool value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
 
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...
 
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
 
void sort(bool reverse=false)
Sort collection using std::sort and name comparison.
 
void setName(const char *name)
 
RooAbsArg * find(const char *name) const
Find object with given name in list.
 
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
 
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
 
RooArgList is a container object that can hold multiple RooAbsArg objects.
 
RooArgSet is a container object that can hold multiple RooAbsArg objects.
 
RooConstVar represent a constant real-valued object.
 
RooDataSet is a container class to hold unbinned data.
 
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
 
xRooFit::Asymptotics::PLLType fPllType
 
std::shared_ptr< const RooAbsCollection > coords
 
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > data
 
std::shared_ptr< xRooNLLVar > nllVar
 
static std::set< int > allowedStatusCodes
 
RooStats::HypoTestInverterResult * result()
 
bool AddModel(const xRooNode &pdf, const char *validity="")
 
static RooArgList toArgs(const char *str)
 
int AddPoints(const char *parName, size_t nPoints, double low, double high)
 
std::shared_ptr< TGraphErrors > BuildGraph(const char *opt)
 
static std::pair< double, double > GetLimit(const TGraph &pValues, double target=0.05)
 
void Print(Option_t *opt="") const override
Print TNamed name and title.
 
xRooHypoPoint & AddPoint(const char *coords="")
 
std::shared_ptr< xRooNode > pdf(const RooAbsCollection &parValues) const
 
void Draw(Option_t *opt="") override
Default Draw method for all objects.
 
void LoadFits(const char *apath)
 
std::pair< double, double > FindLimit(const char *opt, double relUncert=std::numeric_limits< double >::infinity())
 
std::map< std::string, std::pair< double, double > > limits(const char *opt="cls", double relUncert=0.1)
 
std::shared_ptr< RooAbsPdf > pdf() const
 
std::shared_ptr< RooArgSet > pars(bool stripGlobalObs=true)
 
void Draw(Option_t *opt="") override
Default Draw method for all objects.
 
RooArgList argList() const
 
static InteractiveObject * gIntObj
 
RooRealVar represents a variable that can be changed from the outside.
 
HypoTestInverterResult class holds the array of hypothesis test results and compute a confidence inte...
 
bool Add(const HypoTestInverterResult &otherResult)
merge with the content of another HypoTestInverterResult object
 
Fill Area Attributes class.
 
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
 
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
 
virtual Size_t GetMarkerSize() const
Return the marker size.
 
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
 
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
 
static TCanvas * MakeDefCanvas()
Static function to build a default canvas.
 
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
 
Describe directory structure in memory.
 
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
 
A TGraphErrors is a TGraph with error bars.
 
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
 
A TGraph is an object made of two arrays X and Y with npoints each.
 
virtual Double_t GetPointX(Int_t i) const
Get x value for point i.
 
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
 
static Bool_t CompareX(const TGraph *gr, Int_t left, Int_t right)
Return kTRUE if fX[left] > fX[right]. Can be used by Sort.
 
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.
 
TList * GetListOfFunctions() const
 
virtual Double_t Eval(Double_t x, TSpline *spline=nullptr, Option_t *option="") const
Interpolate points in this graph at x using a TSpline.
 
virtual Int_t RemovePoint()
Delete point close to the mouse position Returns index of removed point (or -1 if nothing was changed...
 
void SetName(const char *name="") override
Set graph name.
 
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
 
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
 
virtual Double_t GetPointY(Int_t i) const
Get y value for point i.
 
void SetTitle(const char *title="") override
Change (i.e.
 
virtual void SetPointY(Int_t i, Double_t y)
Set y value for point i.
 
virtual void SetEditable(Bool_t editable=kTRUE)
if editable=kFALSE, the graph cannot be modified with the mouse by default a TGraph is editable
 
@ kNoTitle
Don't draw the histogram title.
 
virtual void SetMaximum(Double_t maximum=-1111)
 
virtual void SetMinimum(Double_t minimum=-1111)
 
Book space in a file, create I/O buffers, to fill them, (un)compress them.
 
virtual const char * GetClassName() const
 
This class displays a legend box (TPaveText) containing several legend entries.
 
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.
 
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
 
void Add(TObject *obj) override
 
The TNamed class is the base class for all named ROOT classes.
 
const char * GetName() const override
Returns name of object.
 
virtual const char * GetName() const
Returns name of object.
 
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
 
The most important graphics class in the ROOT system.
 
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
 
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.
 
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
 
const char * Data() const
 
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
 
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
 
#define BEGIN_XROOFIT_NAMESPACE
 
#define END_XROOFIT_NAMESPACE
 
std::pair< double, double > matchPrecision(const std::pair< double, double > &in)
 
double round_to_decimal(double value, int decimal_places)
 
double round_to_digits(double value, int digits)