22#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
23#define protected public
56#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
58#define GETWS(a) a->_myws
59#define GETWSSETS(w) w->_namedSets
61#define GETWS(a) a->workspace()
62#define GETWSSETS(w) w->sets()
69#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
70#define protected public
98std::set<int> xRooNLLVar::xRooHypoPoint::allowedStatusCodes = {0};
109 fOldTitle =
fNll->get()->getStringAttribute(
"fitresultTitle");
134 std::unique_ptr<RooAbsCollection>
fSnap;
137 std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>>
fOldData;
146 std::make_pair(std::shared_ptr<RooAbsData>(
data.first, [](
RooAbsData *) {}),
153 const std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>> &
data,
175 if (strcmp(opts.
At(
i)->
GetName(),
"GlobalObservables") == 0) {
180 throw std::runtime_error(
"GlobalObservables mismatch");
182 }
else if (strcmp(opts.
At(
i)->
GetName(),
"Hesse") == 0) {
184 }
else if (strcmp(opts.
At(
i)->
GetName(),
"Strategy") == 0) {
186 }
else if (strcmp(opts.
At(
i)->
GetName(),
"StrategySequence") == 0) {
188 }
else if (strcmp(opts.
At(
i)->
GetName(),
"Tolerance") == 0) {
190 }
else if (strcmp(opts.
At(
i)->
GetName(),
"PrintLevel") == 0) {
193 if (strcmp(opts.
At(
i)->
GetName(),
"Optimize") == 0) {
204 auto _vars = std::unique_ptr<RooArgSet>(
fPdf->getVariables());
205 if (
auto extCon =
dynamic_cast<RooCmdArg *
>(
fOpts->find(
"ExternalConstraints"))) {
206 for (
auto con : *extCon->getSet(0)) {
207 _vars->add(*std::unique_ptr<RooArgSet>(con->getVariables()));
210 auto _funcGlobs = std::unique_ptr<RooArgSet>(
dynamic_cast<RooArgSet *
>(_vars->selectCommon(*
fGlobs)));
214 if (
auto flag =
dynamic_cast<RooCmdArg *
>(
fOpts->find(
"ReuseNLL"))) {
220 if (
auto range =
dynamic_cast<RooCmdArg *
>(
fOpts->find(
"RangeWithName"))) {
221 TString rangeName = range->getString(0);
228 std::vector<TString> chanPatterns;
230 bool hasRange(
false);
231 std::string noneCatRanges;
233 chanPatterns.emplace_back(pattern);
234 if (_cat.hasRange(chanPatterns.back())) {
237 if (!noneCatRanges.empty())
238 noneCatRanges +=
",";
239 noneCatRanges += chanPatterns.back();
246 if (noneCatRanges.empty()) {
247 fOpts->Remove(range);
250 range->setString(0, noneCatRanges.c_str());
254 std::make_shared<RooSimultaneous>(
TString::Format(
"%s_reduced", s->GetName()),
"Reduced model", _cat);
255 for (
auto &
c : _cat) {
256 auto _pdf = s->getPdf(
c.first.c_str());
259 _cat.setIndex(
c.second);
260 bool matchAny =
false;
261 for (
auto &p : chanPatterns) {
262 if (_cat.hasRange(p) && _cat.inRange(p)) {
268 newPdf->addPdf(*_pdf,
c.first.c_str());
303 (opts.find(
"GlobalObservables"))
304 ? dynamic_cast<
RooCmdArg *>(opts.find(
"GlobalObservables"))->getSet(0)->snapshot()
312 std::cout <<
"PDF: ";
316 std::cout <<
"<null>" << std::endl;
318 std::cout <<
"Data: ";
322 std::cout <<
"<null>" << std::endl;
324 std::cout <<
"NLL Options: " << std::endl;
325 for (
int i = 0;
i <
fOpts->GetSize();
i++) {
329 std::cout <<
" " <<
c->GetName() <<
" : ";
330 if (
c->getString(0)) {
331 std::cout <<
c->getString(0);
332 }
else if (
c->getSet(0) && !
c->getSet(0)->empty()) {
333 std::cout << (
c->getSet(0)->contentsString());
335 std::cout <<
c->getInt(0);
337 std::cout << std::endl;
340 std::cout <<
"Fit Config: " << std::endl;
341 std::cout <<
" UseParabErrors: " << (
fFitConfig->ParabErrors() ?
"True" :
"False")
342 <<
" [toggles HESSE algorithm]" << std::endl;
343 std::cout <<
" MinimizerOptions: " << std::endl;
352 if (std::shared_ptr<RooAbsReal>::get())
353 oldName = std::shared_ptr<RooAbsReal>::get()->GetName();
358 fPdf->treeNodeServerList(&s,
nullptr,
true,
false);
360 bool isBinned =
false;
361 bool hasBinned =
false;
364 isBinned =
a->getInt(0);
366 std::map<RooAbsArg *, bool> origValues;
369 if (
a->InheritsFrom(
"RooRealSumPdf")) {
372 bool setBinned =
false;
374 std::unique_ptr<RooArgSet> obs(
a->getObservables(
fData->get()));
375 if (obs->size() == 1) {
376 auto *var =
static_cast<RooRealVar *
>(obs->first());
377 std::unique_ptr<std::list<double>> boundaries{
dynamic_cast<RooAbsReal *
>(
a)->binBoundaries(
378 *var, -std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity())};
380 if (!std::shared_ptr<RooAbsReal>::get()) {
381 Info(
"xRooNLLVar",
"%s will be evaluated as a Binned PDF (%d bins)",
a->GetName(),
382 int(boundaries->size() - 1));
388 origValues[
a] =
a->getAttribute(
"BinnedLikelihood");
389 a->setAttribute(
"BinnedLikelihood", setBinned);
395 std::set<std::string> setNames;
398 setNames.insert(
a.first);
401 for (
auto &
a : setNames) {
405 std::set<std::string> attribs;
406 if (std::shared_ptr<RooAbsReal>::get())
407 attribs = std::shared_ptr<RooAbsReal>::get()->attributes();
408 this->reset(std::unique_ptr<RooAbsReal>{
fPdf->createNLL(*
fData, *
fOpts)}.release());
414 for (
auto &
a : attribs)
415 std::shared_ptr<RooAbsReal>::get()->setAttribute(
a.c_str());
421 std::shared_ptr<RooAbsReal>::get()->SetName(oldName);
422 if (!origValues.empty()) {
424 std::shared_ptr<RooAbsReal>::get()->getVal();
425 for (
auto &[o,
v] : origValues)
426 o->setAttribute(
"BinnedLikelihood",
v);
430 fFuncVars = std::unique_ptr<RooArgSet>{std::shared_ptr<RooAbsReal>::get()->getVariables()};
438std::pair<std::shared_ptr<RooAbsData>, std::shared_ptr<const RooAbsCollection>>
442 return std::pair(
nullptr,
nullptr);
443 auto fr = std::make_shared<RooFitResult>(
TUUID().AsString());
447 fr->setConstParList(
l);
450 std::unique_ptr<RooAbsCollection>(fr->constPars().selectCommon(*
fGlobs))->setAttribAll(
"global",
true);
482 throw std::runtime_error(
"xRooFitResult::cfit: Cannot create cfit without nll");
486 if (
auto res =
fCfits->find(alias); res !=
fCfits->end()) {
490 if (
auto res =
fCfits->find(poiValues); res !=
fCfits->end()) {
495 *
fNll->fFuncVars =
get()->floatParsFinal();
496 fNll->fFuncVars->assignValueOnly(
get()->constPars());
497 std::unique_ptr<RooAbsCollection>(
fNll->fFuncVars->selectCommon(
get()->floatParsFinal()))
498 ->setAttribAll(
"Constant",
false);
499 std::unique_ptr<RooAbsCollection>(
fNll->fFuncVars->selectCommon(
get()->constPars()))->setAttribAll(
"Constant",
true);
504 fCfits->insert(std::pair((alias) ? alias : poiValues, out));
511 throw std::runtime_error(
"xRooFitResult::ifit: par not found");
520 throw std::runtime_error(
"xRooFitResult::impact: poi not found");
521 auto _ifit = ifit(
np, up, prefit);
523 throw std::runtime_error(
"xRooFitResult::impact: null ifit");
524 if (_ifit->status() != 0)
525 fNode->Warning(
"impact",
"ifit status code is %d", _ifit->status());
526 return _ifit->floatParsFinal().getRealValue(poi) - poiHat->
getVal();
529 int iPoi =
get()->floatParsFinal().index(poi);
530 int iNp =
get()->floatParsFinal().index(
np);
532 throw std::runtime_error(
"xRooFitResult::impact: poi not found");
534 throw std::runtime_error(
"xRooFitResult::impact: np not found");
536 dynamic_cast<RooRealVar *
>((prefit ?
get()->floatParsInit() :
get()->floatParsFinal()).find(
np));
539 return std::numeric_limits<double>::quiet_NaN();
549 for (
auto p :
get()->floatParsFinal()) {
550 if (strcmp(p->GetName(),
poi) == 0) {
556 bool matches =
false;
559 if ((p->getStringAttribute(
"group") && s == p->getStringAttribute(
"group")) ||
568 npNames += p->GetName();
577 fNode->Warning(
"conditionalError",
"No parameters selected by: %s", nps);
578 return (up) ?
static_cast<RooRealVar *
>(poiVar)->getErrorHi() :
static_cast<RooRealVar *
>(poiVar)->getErrorLo();
583 return sqrt(
get()->conditionalCovarianceMatrix(vars)(idx, idx));
586 auto _cfit =
cfit(npNames.
Data(), nps);
588 auto _poi = _cfit->floatParsFinal().find(
poi);
590 return (up) ?
static_cast<RooRealVar *
>(_poi)->getErrorHi() :
static_cast<RooRealVar *
>(_poi)->getErrorLo();
598 throw std::runtime_error(
"xRooFitResult::ranknp: poi not found");
600 std::vector<std::pair<std::string, double>> ranks;
602 for (
auto par :
get()->floatParsFinal()) {
605 ranks.emplace_back(std::pair(par->GetName(),
impact(
poi, par->GetName(), up, prefit,
true)));
608 std::sort(ranks.begin(), ranks.end(), [](
auto &left,
auto &right) {
609 if (std::isnan(left.second) && !std::isnan(right.second))
611 if (!std::isnan(left.second) && std::isnan(right.second))
613 return fabs(left.second) > fabs(right.second);
617 for (
auto &[
n,
v] : ranks) {
618 if (
v >= approxThreshold) {
622 v = std::numeric_limits<double>::quiet_NaN();
628 std::sort(ranks.begin(), ranks.end(), [](
auto &left,
auto &right) {
629 if (std::isnan(left.second) && !std::isnan(right.second))
631 if (!std::isnan(left.second) && std::isnan(right.second))
633 return fabs(left.second) > fabs(right.second);
637 out.setName(
"rankings");
638 for (
auto &[
n,
v] : ranks) {
639 out.addClone(*
get()->floatParsFinal().find(
n.c_str()));
640 auto vv =
static_cast<RooRealVar *
>(out.at(out.size() - 1));
661 std::unique_ptr<RooAbsCollection>(out->constPars().selectCommon(*
fGlobs))->setAttribAll(
"global",
true);
663 return xRooFitResult(std::make_shared<xRooNode>(out,
fPdf), std::make_shared<xRooNLLVar>(*
this));
685 if (
size_t(
_data->numEntries()) <= entry)
688 *std::unique_ptr<RooAbsCollection>(_pdf->getObservables(
_data)) = *
_data->get(entry);
691 return -
_data->weight() * _pdf->getLogVal(
_data->get());
696 std::set<std::string> out;
698 auto binnedOpt =
dynamic_cast<RooCmdArg *
>(
fOpts->find(
"Binned"));
702 bool allChannels =
true;
703 for (
auto c : simPdf.
bins()) {
707 c->get<
RooAbsArg>()->treeNodeServerList(&nodes,
nullptr,
true,
false);
708 bool isBinned =
false;
709 for (
auto a : nodes) {
710 if (
a->InheritsFrom(
"RooRealSumPdf") &&
711 ((binnedOpt && binnedOpt->getInt(0)) || (!binnedOpt &&
a->getAttribute(
"BinnedLikelihood")))) {
713 out.insert(chanName(chanName.
Index(
"=") + 1, chanName.
Length()).
Data());
728 pdf()->treeNodeServerList(&nodes,
nullptr,
true,
false);
729 for (
auto a : nodes) {
730 if (
a->InheritsFrom(
"RooRealSumPdf") &&
731 ((binnedOpt && binnedOpt->getInt(0)) || (!binnedOpt &&
a->getAttribute(
"BinnedLikelihood")))) {
746 if (
size_t(
_data->numEntries()) <= entry)
748 auto _pdf =
pdf().get();
749 std::unique_ptr<RooAbsCollection> _robs(_pdf->getObservables(
_data->get()));
750 *_robs = *
_data->get(entry);
752 _pdf = s->getPdf(s->indexCat().getCurrentLabel());
755 for (
auto o : *_robs) {
758 a && _pdf->dependsOn(*
a)) {
759 std::unique_ptr<std::list<double>> bins(
760 _pdf->binBoundaries(*
a, -std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity()));
762 double lowEdge = -std::numeric_limits<double>::infinity();
763 for (
auto b : *bins) {
764 if (
b >
a->getVal()) {
765 volume *= (
b - lowEdge);
791 for (
auto c : cTerm->list()) {
792 if (std::string(
c->ClassName()) ==
"RooAbsPdf") {
801 gaus->getMean().GetName()));
806 }
else if (
auto pois =
dynamic_cast<RooPoisson *
>(
c)) {
820 std::unique_ptr<RooAbsCollection>(
pars()->selectByAttrib(
"Constant",
false))->size();
834 std::unique_ptr<RooAbsCollection> _floats(
pars()->selectByAttrib(
"Constant",
false));
836 _floats->remove(*std::unique_ptr<RooAbsCollection>(_constraintTerm->getVariables()));
846 val -= _constraintTerm->getVal();
869 return std::numeric_limits<double>::quiet_NaN();
883 double out =
_data->sumEntries();
884 for (
int i = 0;
i <
_data->numEntries();
i++) {
886 double w =
_data->weight();
887 out -=
w * std::log(
w);
888 if (_binnedChannels.count(
"*")) {
889 out += std::lgamma(
w + 1);
890 }
else if (_binnedChannels.empty()) {
894 if (_binnedChannels.count(
_data->get()->getCatLabel(cat->
GetName()))) {
895 out += std::lgamma(
w + 1);
900 throw std::runtime_error(
"Cannot determine category of RooSimultaneous pdf");
911 auto out = std::shared_ptr<RooArgSet>(
get()->getVariables());
912 if (stripGlobalObs &&
fGlobs) {
913 out->remove(*
fGlobs,
true,
true);
921 return Scan(*std::unique_ptr<RooAbsCollection>(
get()->getVariables()->selectByName(scanPars)), coords, profilePars);
928 if (scanPars.
size() > 2 || scanPars.
empty())
934 out->SetName(
get()->GetName());
938 std::unique_ptr<RooAbsCollection> funcVars(
get()->getVariables());
941 for (
auto &coord : coords) {
942 if (coord.size() != scanPars.
size()) {
943 throw std::runtime_error(
"Invalid coordinate");
945 for (
size_t i = 0;
i < coord.size();
i++) {
949 if (profilePars.
empty()) {
968 if (sOpt ==
"sensitivity") {
973 if (sOpt ==
"floating") {
975 auto floats = std::unique_ptr<RooAbsCollection>(_pars->selectByAttrib(
"Constant",
false));
982 gr->SetName(
"multigraph");
998 if (
auto a = _pars->find(s);
a)
1002 if (vars.
size() == 1) {
1010 bool normRange =
false;
1018 out->SetName(
get()->GetName());
1022 double low =
v->getVal();
1024 double step = (
v->getMax() -
v->getMin()) / 100;
1025 double init =
v->getVal();
1026 double initVal =
func()->getVal();
1028 auto currTime = std::chrono::steady_clock::now();
1029 while (out->GetN() < 100 && (low >
v->getMin() || high < v->getMax())) {
1030 if (out->GetN() == 0) {
1031 out->SetPoint(out->GetN(), low, 0);
1040 if (low >
v->getMin()) {
1042 auto _v =
func()->getVal();
1043 if (std::isnan(_v) || std::isinf(_v)) {
1044 if (bad->
GetN() == 0)
1048 out->SetPoint(out->GetN(), low, _v - initVal);
1052 if (high < v->getMax()) {
1054 auto _v =
func()->getVal();
1055 if (std::isnan(_v) || std::isinf(_v)) {
1056 if (bad->
GetN() == 0)
1060 out->SetPoint(out->GetN(), high, _v - initVal);
1067 if (std::chrono::steady_clock::now() - currTime > std::chrono::seconds(1)) {
1068 currTime = std::chrono::steady_clock::now();
1075 a.DrawArrow(init, 0, init, -0.1);
1077#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 30, 00)
1078 gPad->GetCanvas()->ResetUpdated();
1083 Error(
"Draw",
"Name a parameter to scan over: Draw(<name>) , choose from: %s",
1084 _pars->empty() ?
"" : _pars->contentsString().c_str());
1098 return setData(std::dynamic_pointer_cast<RooAbsData>(
data.fComp),
1099 std::shared_ptr<const RooAbsCollection>(
data.globs().argList().snapshot()));
1111 : std::shared_ptr<const RooAbsCollection>(
_data.first->getGlobalObservables(),
1118 throw std::runtime_error(
"Missing globs");
1122 std::unique_ptr<RooAbsCollection> _actualGlobs(
fPdf->getObservables(s));
1125 std::unique_ptr<RooAbsCollection> _actualGlobs2(
fPdf->getObservables(s2));
1126 if (!_actualGlobs->equals(*_actualGlobs2)) {
1128 rC.
add(*_actualGlobs2);
1132 lC.
add(*_actualGlobs);
1135 throw std::runtime_error(
TString::Format(
"globs mismatch: adding %s removing %s",
r.Data(),
l.Data()));
1140 if (!std::shared_ptr<RooAbsReal>::get()) {
1151 fFuncVars->setAttribAll(
"Constant",
false);
1153 std::shared_ptr<RooAbsData> __data =
fData;
1161 if (
_data.first->getGlobalObservables()) {
1173 }
catch (std::runtime_error &) {
1178 fFuncVars->setAttribAll(
"Constant",
false);
1180 std::shared_ptr<RooAbsData> __data =
fData;
1186 throw std::runtime_error(
"Unable to setData");
1193 }
else if (
auto f = std::unique_ptr<RooAbsCollection>(
fConstVars->selectByAttrib(
"Constant",
false)); !
f->empty()) {
1216 if (std::shared_ptr<RooAbsReal>::get()) {
1239 for (
auto s :
_func->servers()) {
1255 return fData->sumEntries() * log(1.0 * (s->servers().size() - 1));
1267 for (
int i = 0;
i <
fData->numEntries();
i++) {
1280 for (
auto s :
_func->servers()) {
1284 for (
auto s2 : s->servers()) {
1303 bool doCLs = sWhat.
Contains(
"pcls");
1304 bool doNull = sWhat.
Contains(
"pnull");
1305 bool doAlt = sWhat.
Contains(
"palt");
1306 double nSigma = (sWhat.
Contains(
"exp"))
1311 : std::numeric_limits<double>::quiet_NaN();
1313 bool toys = sWhat.
Contains(
"toys");
1317 bool readOnly = sWhat.
Contains(
"readonly");
1324 if (
getVal(sWhat +
" readonly").second != 0) {
1335 if (
altToys.size() < nToysAlt) {
1338 }
else if (doCLs && toys) {
1346 RestoreNll(std::shared_ptr<xRooNLLVar> &
v,
bool r) : rr(
r), var(
v)
1348 if (rr && var && var->get()) {
1349 _readOnly = var->get()->getAttribute(
"readOnly");
1350 var->get()->setAttribute(
"readOnly", rr);
1358 var->get()->setAttribute(
"readOnly", _readOnly);
1362 bool _readOnly =
false;
1364 std::shared_ptr<xRooNLLVar> &var;
1367 RestoreNll rest(
nllVar, readOnly);
1378 throw std::runtime_error(std::string(
"Unknown: ") +
what);
1385 out.add(*std::unique_ptr<RooAbsCollection>(
coords->selectByAttrib(
"poi",
true)));
1392 out.setName(
"alt_poi");
1393 out.addClone(*std::unique_ptr<RooAbsCollection>(
coords->selectByAttrib(
"poi",
true)));
1394 for (
auto a : out) {
1398 if (
auto s =
a->getStringAttribute(
"altVal"); s && strlen(s)) {
1401 v->setVal(std::numeric_limits<double>::quiet_NaN());
1417 if (me.asimov(
true))
1418 out += me.asimov(
true)->status() << 3;
1424 std::cout <<
"POI: " <<
const_cast<xRooHypoPoint *
>(
this)->
poi().contentsString()
1428 std::cout <<
" , pllType: " <<
fPllType << std::endl;
1430 std::cout <<
" - ufit: ";
1432 std::cout <<
fUfit->GetName() <<
" " <<
fUfit->minNll() <<
" (status=" <<
fUfit->status() <<
") ("
1437 std::cout <<
"Not calculated" << std::endl;
1439 std::cout <<
" - null cfit: ";
1443 std::cout <<
"Not calculated";
1446 std::cout << std::endl <<
" - alt cfit: ";
1451 std::cout <<
"Not calculated" << std::endl;
1453 std::cout <<
" sigma_mu: ";
1456 std::cout <<
"Not calculated";
1458 std::cout << const_cast<xRooHypoPoint *>(
this)->sigma_mu().first <<
" +/- "
1462 std::cout << std::endl;
1463 std::cout <<
" - asimov ufit: ";
1465 std::cout <<
fAsimov->fUfit->GetName() <<
" " <<
fAsimov->fUfit->minNll()
1466 <<
" (status=" <<
fAsimov->fUfit->status() <<
")";
1468 std::cout <<
"Not calculated";
1470 std::cout << std::endl <<
" - asimov null cfit: ";
1472 std::cout <<
fAsimov->fNull_cfit->GetName() <<
" " <<
fAsimov->fNull_cfit->minNll()
1473 <<
" (status=" <<
fAsimov->fNull_cfit->status() <<
")";
1475 std::cout <<
"Not calculated";
1478 std::cout << std::endl;
1480 std::cout << std::endl;
1483 std::cout <<
" - genFit: " <<
fGenFit->GetName() << std::endl;
1485 std::cout <<
" * null toys: " <<
nullToys.size();
1486 size_t firstToy = 0;
1487 while (firstToy <
nullToys.size() && std::isnan(std::get<1>(
nullToys[firstToy])))
1490 std::cout <<
" [ of which " << firstToy <<
" are bad]";
1491 std::cout <<
" , alt toys: " <<
altToys.size();
1493 while (firstToy <
altToys.size() && std::isnan(std::get<1>(
altToys[firstToy])))
1496 std::cout <<
" [ of which " << firstToy <<
" are bad]";
1497 std::cout << std::endl;
1512 throw std::runtime_error(
"Unconditional fit unavailable");
1539 if (toys->getGlobalObservables()) {
1540 coords = std::shared_ptr<RooAbsCollection>(toys->getGlobalObservables()->snapshot());
1542 for (
int i = 0;
i < toys->numEntries();
i++) {
1543 auto toy = toys->get(
i);
1545 std::make_tuple(
int(toy->getRealValue(
"seed")), toy->getRealValue(
"ts"), toys->weight()));
1550 for (
int i = 0;
i < toys->numEntries();
i++) {
1551 auto toy = toys->get(
i);
1553 std::make_tuple(
int(toy->getRealValue(
"seed")), toy->getRealValue(
"ts"), toys->weight()));
1572 fAsimov = std::make_shared<xRooHypoPoint>(*
this);
1574 fAsimov->hypoTestResult.reset();
1576 for (
auto p :
fAsimov->poi()) {
1579 v->deleteSharedProperties();
1589 std::make_pair(
nullptr,
nullptr);
1600 return std::pair<double, double>(1, 0);
1603 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1606 first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1609 _sigma_mu.first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1612 _sigma_mu.first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1613 return std::pair(nom, std::max(std::abs(up - nom), std::abs(down - nom)));
1619 return std::pair<double, double>(1, 0);
1622 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1625 first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1628 _sigma_mu.first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1631 _sigma_mu.first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1633 return std::pair(nom, std::max(std::abs(up - nom), std::abs(down - nom)));
1639 return std::pair<double, double>(1, 0);
1642 return std::pair<double, double>(1, 0);
1645 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1650 first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1653 _sigma_mu.first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1656 _sigma_mu.first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1658 first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1661 first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1664 first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1666 auto nom = (nom1 == 0) ? 0 : nom1 / nom2;
1667 auto up = (up1 == 0) ? 0 : up1 / up2;
1668 auto down = (down1 == 0) ? 0 : down1 / down2;
1670 return std::pair(nom, std::max(std::abs(up - nom), std::abs(down - nom)));
1675 if (std::isnan(nSigma))
1679 if (!first_poi || (!std::isnan(nSigma) && std::isnan(_sigma_mu.first)))
1680 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1682 _sigma_mu.first, first_poi->getMin(
"physical"), first_poi->getMax(
"physical"));
1684 _sigma_mu.first + _sigma_mu.second, first_poi->getMin(
"physical"),
1685 first_poi->getMax(
"physical"));
1687 _sigma_mu.first - _sigma_mu.second, first_poi->getMin(
"physical"),
1688 first_poi->getMax(
"physical"));
1689 return std::pair<double, double>(nom, std::max(std::abs(nom - up), std::abs(nom - down)));
1694 if (std::isnan(nSigma))
1697 size_t firstToy = 0;
1698 while (firstToy <
altToys.size() && std::isnan(std::get<1>(
altToys[firstToy])))
1700 if (firstToy >=
altToys.size())
1701 return std::pair(std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN());
1704 return std::pair(std::get<1>(
altToys[targetIdx]), (std::get<1>(
altToys[std::min(
int(
altToys.size()), targetIdx)]) -
1705 std::get<1>(
altToys[std::max(0, targetIdx)])) /
1711 auto _ufit =
ufit(readOnly);
1714 return std::pair<double, double>(
hypoTestResult->GetTestStatisticData(), 0);
1715 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1718 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1720 if (
auto _first_poi =
dynamic_cast<RooRealVar *
>(
poi().first());
1721 _first_poi && _first_poi->
getMin(
"physical") > _first_poi->getMin() &&
1726 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1733 return std::pair<double, double>(0, 0);
1735 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
1737 return std::pair<double, double>(2. * cFactor * (
cfit_null(readOnly)->minNll() - _ufit->minNll()),
1738 2. * cFactor * sqrt(pow(
cfit_null(readOnly)->edm(), 2) + pow(_ufit->edm(), 2)));
1748 for (
int i = 0;
i < fits->numEntries();
i++) {
1749 auto fit = fits->get(
i);
1750 if (fit->getCatIndex(
"type") !=
type)
1754 fits->getGlobalObservables()->getStringValue(
TString::Format(
"%s.name", fit->getCatLabel(
"type")));
1757 for (
auto file : *
gROOT->GetListOfFiles()) {
1758 if (
auto k =
static_cast<TDirectory *
>(file)->FindKeyAny(_name.c_str())) {
1761 k->GetMotherDir()->GetList()
1764 if (
auto cachedFit = (storedFr) ? storedFr->
fr.get() : k->ReadObject<
RooFitResult>(); cachedFit) {
1767 k->GetMotherDir()->Add(storedFr);
1770 return storedFr->
fr;
1774 auto rfit = std::make_shared<RooFitResult>(_name.c_str(),
TUUID(_name.c_str()).
GetTime().
AsString());
1775 rfit->setStatus(fit->getRealValue(
"status"));
1776 rfit->setMinNLL(fit->getRealValue(
"minNll"));
1777 rfit->setEDM(fit->getRealValue(
"edm"));
1778 rfit->setCovQual(fit->getRealValue(
"covQual"));
1780 std::unique_ptr<RooAbsCollection> par_hats(
1781 hypoTestResult->GetFitInfo()->getGlobalObservables()->selectByName(
coords->contentsString().c_str()));
1782 par_hats->setName(
"floatParsFinal");
1783 rfit->setFinalParList(*par_hats);
1790 rfit->setCovarianceMatrix(cov);
1802 return fUfit = rfit;
1804 if (!
nllVar || (readOnly &&
nllVar->get() && !
nllVar->get()->getAttribute(
"readOnly")))
1812 bool tmp =
nllVar->get()->getAttribute(
"readOnly");
1813 nllVar->get()->setAttribute(
"readOnly");
1814 auto out =
ufit(
true);
1815 nllVar->get()->setAttribute(
"readOnly", tmp);
1823 }
else if (!
nllVar->get()->getAttribute(
"readOnly")) {
1826 nllVar->fFuncVars->setAttribAll(
"Constant",
false);
1829 nllVar->fFuncGlobs->setAttribAll(
"Constant",
true);
1830 std::unique_ptr<RooAbsCollection>(
nllVar->fFuncVars->selectCommon(
poi()))
1831 ->setAttribAll(
"Constant",
false);
1835 nllVar->fFuncVars->assignValueOnly(
fGenFit->floatParsFinal());
1842 }
else if (!std::isnan(
fAltVal())) {
1844 for (
auto _poiCoord :
poi()) {
1845 auto _poi =
dynamic_cast<RooRealVar *
>(
nllVar->fFuncVars->find(_poiCoord->GetName()));
1847 _poi->setVal(_poi->getStringAttribute(
"initVal") ?
TString(_poi->getStringAttribute(
"initVal")).
Atof()
1858 for (
auto &
c : coll) {
1861 out +=
c->GetName();
1880 if (!
nllVar || (readOnly &&
nllVar->get() && !
nllVar->get()->getAttribute(
"readOnly")))
1888 bool tmp =
nllVar->get()->getAttribute(
"readOnly");
1889 nllVar->get()->setAttribute(
"readOnly");
1891 nllVar->get()->setAttribute(
"readOnly", tmp);
1899 }
else if (!
nllVar->get()->getAttribute(
"readOnly")) {
1906 nllVar->fFuncVars->setAttribAll(
"Constant",
false);
1909 nllVar->fFuncGlobs->setAttribAll(
"Constant",
true);
1926 auto _first_poi =
dynamic_cast<RooRealVar *
>(
poi().first());
1929 if (_first_poi->getMin(
"physical") <= _first_poi->getMin())
1936 if (!
nllVar || (readOnly &&
nllVar->get() && !
nllVar->get()->getAttribute(
"readOnly")))
1944 bool tmp =
nllVar->get()->getAttribute(
"readOnly");
1945 nllVar->get()->setAttribute(
"readOnly");
1947 nllVar->get()->setAttribute(
"readOnly", tmp);
1955 }
else if (!
nllVar->get()->getAttribute(
"readOnly")) {
1962 nllVar->fFuncVars->setAttribAll(
"Constant",
false);
1964 nllVar->fFuncVars->setRealValue(_first_poi->GetName(), _first_poi->getMin(
"physical"));
1966 nllVar->fFuncGlobs->setAttribAll(
"Constant",
true);
1977 nllVar->get()->setStringAttribute(
1992 if (!
nllVar || (readOnly &&
nllVar->get() && !
nllVar->get()->getAttribute(
"readOnly")))
2000 bool tmp =
nllVar->get()->getAttribute(
"readOnly");
2001 nllVar->get()->setAttribute(
"readOnly");
2003 nllVar->get()->setAttribute(
"readOnly", tmp);
2011 }
else if (!
nllVar->get()->getAttribute(
"readOnly")) {
2018 nllVar->fFuncVars->setAttribAll(
"Constant",
false);
2021 nllVar->fFuncGlobs->setAttribAll(
"Constant",
true);
2036 auto asi =
asimov(readOnly);
2039 return std::pair<double, double>(std::numeric_limits<double>::quiet_NaN(), 0);
2042 auto out = asi->pll(readOnly);
2043 return std::pair<double, double>(std::abs(
fNullVal() -
fAltVal()) / sqrt(out.first),
2045 (out.first * sqrt(out.first)));
2051 if (std::isnan(_ts.first))
2054 return std::pair<double, double>(1, 0);
2060 if (_theToys.empty()) {
2061 return std::pair(0.5, std::numeric_limits<double>::infinity());
2068 double result_err_up = 0;
2069 double result_err_down = 0;
2070 for (
auto &toy : _theToys) {
2071 if (std::isnan(std::get<1>(toy))) {
2074 bool res = std::get<1>(toy) >= _ts.first;
2075 if (std::get<2>(toy) != 1) {
2081 result += std::get<2>(toy);
2082 if (std::get<1>(toy) >= _ts.first - _ts.second)
2083 result_err_up += std::get<2>(toy);
2084 if (std::get<1>(toy) >= _ts.first - _ts.second)
2085 result_err_down += std::get<2>(toy);
2090 result_err_down -=
result;
2091 double result_err = std::max(std::abs(result_err_up), std::abs(result_err_down));
2094 result_err /= _theToys.size();
2097 result /= (_theToys.size() - nans);
2101 return std::pair<double, double>(
result, result_err);
2106 return pX_toys(
false, nSigma);
2111 if (!std::isnan(nSigma)) {
2133 out.fGenFit = _cfit;
2158 bool targetCLs,
double relErrThreshold,
size_t maxToys)
2161 throw std::runtime_error(
"Cannot add toys, invalid conditional fit");
2164 auto condition = [&]() {
2168 if (!std::isnan(obs.first)) {
2169 double diff = (
target < 0) ? obs.first : std::abs(obs.first -
target);
2170 double err = obs.second;
2171 if (err > 1
e-4 && diff <= relErrThreshold * obs.second) {
2179 alt = (pAlt.second * pNull.first > pNull.second * pAlt.first);
2180 if ((alt ? pAlt.second : pNull.second) < 1
e-4)
2189 if (!std::isnan(
target) && std::isnan(
ts_toys(target_nSigma).first)) {
2190 if (std::isnan(target_nSigma)) {
2191 throw std::runtime_error(
"Cannot target obs p-value because ts value unavailable");
2193 if (targetCLs &&
pCLs_toys(target_nSigma).second == 0) {
2199 Info(
"addToys",
"First generating 100 alt toys in order to determine expected ts value");
2200 addToys(
true, 100, initialSeed);
2202 if (std::isnan(
ts_toys(target_nSigma).first)) {
2203 throw std::runtime_error(
"Unable to determine expected ts value");
2213 g->SetNameTitle(
"toyTime",
"Time per toy;Toy;time [s]");
2222 size_t toysAdded(0);
2223 size_t altToysAdded(0);
2229 if (toys.size() >= maxToys) {
2234 if (!std::isnan(
target) && !condition()) {
2237 auto currVal = std::isnan(
target) ? std::pair(0., 0.)
2240 size_t nnToys = std::min(
size_t(nToys), (maxToys - toys.size()));
2242 for (
size_t i = 0;
i < nnToys;
i++) {
2247 toys.push_back(std::make_tuple(seed, toy.pll().first, 1.));
2249 (alt ? altToysAdded : toysAdded)++;
2250 if (std::isnan(std::get<1>(toys.back())))
2252 g->SetPoint(
g->GetN(),
g->GetN(), s.
RealTime() - lastTime);
2256 <<
TString::Format(
"Generated %d/%d %s hypothesis toys [%.2f toys/s]",
2257 int(alt ? altToysAdded : toysAdded),
int(nnToys), alt ?
"alt" :
"null",
2258 double(altToysAdded + toysAdded - lasti) / s.
RealTime());
2259 if (!std::isnan(
target)) {
2260 std::cout <<
" [current=" << currVal.first <<
"+/-" << currVal.second <<
" target=" <<
target
2261 <<
" nSigma=" << target_nSigma <<
"]";
2263 std::cout <<
"..." << std::flush;
2264 lasti = altToysAdded + toysAdded;
2279 for (
auto &t : toys) {
2280 if (std::isnan(std::get<1>(t)))
2281 std::get<1>(t) = -std::numeric_limits<double>::infinity();
2283 std::sort(toys.begin(), toys.end(),
2284 [](
const decltype(
nullToys)::value_type &
a,
const decltype(
nullToys)::value_type &
b) ->
bool {
2285 if (std::isnan(std::get<1>(a)))
2287 if (std::isnan(std::get<1>(b)))
2289 return std::get<1>(a) < std::get<1>(b);
2291 for (
auto &t : toys) {
2292 if (std::isinf(std::get<1>(t)))
2293 std::get<1>(t) = std::numeric_limits<double>::quiet_NaN();
2295 if (std::isnan(
target)) {
2302 }
while (condition());
2305 <<
"Finished Generating ";
2307 std::cout << toysAdded <<
" null ";
2310 std::cout << altToysAdded <<
" alt ";
2312 std::cout <<
"toys " <<
TString::Format(
"[%.2f toys/s overall]",
double(toysAdded + altToysAdded) / s2.
RealTime())
2317#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 30, 00)
2318 gPad->GetCanvas()->ResetUpdated();
2325 std::cout <<
"Warning: " << nans <<
" toys were bad" << std::endl;
2402 out.nllVar = std::make_shared<xRooNLLVar>(*
this);
2407 while (pattern.NextToken()) {
2410 double val = std::numeric_limits<double>::quiet_NaN();
2416 throw std::runtime_error(
"poiValues must contain value");
2421 throw std::runtime_error(
"Cannot find poi");
2422 if (!std::isnan(val))
2425 if (poiNames !=
"") {
2430 if (poiNames ==
"") {
2431 throw std::runtime_error(
"No poi");
2433 if (!std::isnan(alt_value)) {
2434 std::unique_ptr<RooAbsCollection> thePoi(
fFuncVars->selectByName(poiNames));
2435 for (
auto b : *thePoi) {
2436 if (!
static_cast<RooRealVar *
>(
b)->hasRange(
"physical")) {
2437 static_cast<RooRealVar *
>(
b)->setRange(
"physical", 0, std::numeric_limits<double>::infinity());
2441 auto _snap = std::unique_ptr<RooAbsCollection>(
fFuncVars->selectByAttrib(
"Constant",
true))->snapshot();
2442 _snap->setAttribAll(
"poi",
false);
2443 std::unique_ptr<RooAbsCollection> _poi(_snap->selectByName(poiNames));
2444 _poi->setAttribAll(
"poi",
true);
2445 if (std::isnan(alt_value)) {
2446 for (
auto a : *_poi)
2447 a->setStringAttribute(
"altVal",
nullptr);
2449 for (
auto a : *_poi)
2453 _snap->remove(*
fGlobs,
true,
true);
2454 out.coords.reset(_snap);
2456 auto _type = pllType;
2459 if (std::isnan(alt_value)) {
2461 }
else if (
dynamic_cast<RooRealVar *
>(_poi->first())->getVal() >= alt_value) {
2468 out.fPllType = _type;
2473xRooNLLVar::xRooHypoPoint
2479 std::unique_ptr<RooAbsCollection> _poi(
fFuncVars->selectByAttrib(
"poi",
true));
2480 if (_poi->empty()) {
2481 throw std::runtime_error(
"No POI specified in model");
2482 }
else if (_poi->size() != 1) {
2483 throw std::runtime_error(
"Multiple POI specified in model");
2485 return hypoPoint(_poi->first()->GetName(),
value, alt_value, pllType);
2502 bool hasSame = sOpt.
Contains(
"same");
2507 TH1 *hAxis =
nullptr;
2509 auto clearPad = []() {
2511 if (
gPad->GetNumber() == 0) {
2512 gPad->SetBottomMargin(
gStyle->GetPadBottomMargin());
2513 gPad->SetTopMargin(
gStyle->GetPadTopMargin());
2514 gPad->SetLeftMargin(
gStyle->GetPadLeftMargin());
2515 gPad->SetRightMargin(
gStyle->GetPadRightMargin());
2519 if (!hasSame || !pad) {
2530 if (hAxis =
dynamic_cast<TH1 *
>(o); hAxis)
2537 double _min = std::numeric_limits<double>::quiet_NaN();
2538 double _max = -std::numeric_limits<double>::quiet_NaN();
2541 if (std::get<2>(p) == 0)
2543 if (std::isnan(std::get<1>(p)))
2545 _min = std::min(std::get<1>(p), _min);
2546 _max = std::max(std::get<1>(p), _max);
2549 if (std::get<2>(p) == 0)
2551 if (std::isnan(std::get<1>(p)))
2553 _min = std::min(std::get<1>(p), _min);
2554 _max = std::max(std::get<1>(p), _max);
2558 if (!std::isnan(obs.first)) {
2559 _min = std::min(obs.first - std::abs(obs.first) * 0.1, _min);
2560 _max = std::max(obs.first + std::abs(obs.first) * 0.1, _max);
2569 : std::numeric_limits<double>::quiet_NaN();
2572 _min = std::min(asi - std::abs(asi), _min);
2573 _max = std::max(asi + std::abs(asi), _max);
2580 auto makeHist = [&](
bool isAlt) {
2582 auto h =
new TH1D((isAlt) ?
"alt_toys" :
"null_toys",
"", 100, _min, _max + (_max - _min) * 0.01);
2583 h->SetDirectory(
nullptr);
2584 size_t nBadOrZero = 0;
2586 double w = std::isnan(std::get<1>(p)) ? 0 : std::get<2>(p);
2589 if (!std::isnan(std::get<1>(p)))
2590 h->Fill(std::get<1>(p),
w);
2592 if (
h->GetEntries() > 0)
2593 h->Scale(1. /
h->Integral(0,
h->GetNbinsX() + 1));
2617 h->SetMarkerSize(0);
2622 auto nullHist = makeHist(
false);
2623 auto altHist = makeHist(
true);
2626 auto h = (nullHist->GetEntries()) ? nullHist : altHist;
2629 auto axis =
static_cast<TH1 *
>(
h->Clone(
".axis"));
2631 axis->SetStats(
false);
2632 axis->Reset(
"ICES");
2634 axis->SetLineWidth(0);
2636 axis->SetMinimum(1
e-7);
2637 axis->GetYaxis()->SetRangeUser(1
e-7, 10);
2638 axis->SetMaximum(
h->GetMaximum());
2640 l =
new TLegend(0.4, 0.7, 1. -
gPad->GetRightMargin(), 1. -
gPad->GetTopMargin());
2641 l->SetName(
"legend");
2643 l->SetBorderSize(0);
2647 for (
auto o : *
gPad->GetListOfPrimitives()) {
2654 if (
h->GetEntries() > 0) {
2657 h->Draw(
"axissame");
2660 if (
h->GetEntries() > 0) {
2663 h->Draw(
"axissame");
2667 l->AddEntry(nullHist);
2668 l->AddEntry(altHist);
2672 auto hh =
static_cast<TH1 *
>(nullHist->Clone(
"null_asymp"));
2674 hh->SetStats(
false);
2675 hh->SetLineStyle(2);
2677 for (
int i = 1;
i <= hh->GetNbinsX();
i++) {
2680 _poi->getMin(
"physical"), _poi->getMax(
"physical")) -
2682 sigma_mu().first, _poi->getMin(
"physical"), _poi->getMax(
"physical")));
2685 hh =
static_cast<TH1 *
>(altHist->Clone(
"alt_asymp"));
2687 hh->SetStats(
false);
2688 hh->SetLineStyle(2);
2690 for (
int i = 1;
i <= hh->GetNbinsX();
i++) {
2693 _poi->getMin(
"physical"), _poi->getMax(
"physical")) -
2695 sigma_mu().first, _poi->getMin(
"physical"), _poi->getMax(
"physical")));
2710 l->AddEntry(tl, label,
"l");
2712 if (!std::isnan(pNull.first) || !std::isnan(pAlt.first)) {
2714 label +=
" p_{toy}=(";
2715 label += (std::isnan(pNull.first)) ?
"-" :
TString::Format(
"%.4f #pm %.4f", pNull.first, pNull.second);
2716 label += (std::isnan(pAlt.first)) ?
",-" :
TString::Format(
",%.4f #pm %.4f", pAlt.first, pAlt.second);
2717 label += (std::isnan(pCLs.first)) ?
",-)" :
TString::Format(
",%.4f #pm %.4f)", pCLs.first, pCLs.second);
2719 if (label.Length() > 0)
2720 l->AddEntry(
"", label,
"");
2722 if (!std::isnan(pNullA.first) || !std::isnan(pAltA.first)) {
2724 label +=
" p_{asymp}=(";
2725 label += (std::isnan(pNullA.first)) ?
"-" :
TString::Format(
"%.4f #pm %.4f", pNullA.first, pNullA.second);
2726 label += (std::isnan(pAltA.first)) ?
",-" :
TString::Format(
",%.4f #pm %.4f", pAltA.first, pAltA.second);
2727 label += (std::isnan(pCLs.first)) ?
",-)" :
TString::Format(
",%.4f #pm %.4f)", pCLs.first, pCLs.second);
2729 if (label.Length() > 0)
2730 l->AddEntry(
"", label,
"");
2732 if (
auto ax =
dynamic_cast<TH1 *
>(
gPad->GetPrimitive(
".axis")))
2733 ax->GetYaxis()->SetRangeUser(1
e-7, 1);
2740 if (
v &&
v->hasRange(
"physical") &&
v->getMin(
"physical") != -std::numeric_limits<double>::infinity()) {
2750 if (
v &&
v->hasRange(
"physical") &&
v->getMin(
"physical") != -std::numeric_limits<double>::infinity()) {
2754 return (inWords) ?
TString::Format(
"-2log[L(%s,#hat{#hat{#theta}})/L(#hat{%s},#hat{#theta})]",
v->GetTitle(),
2760 if (
v &&
v->hasRange(
"physical") &&
v->getMin(
"physical") != -std::numeric_limits<double>::infinity()) {
2761 return (inWords) ?
TString::Format(
"Lower-Bound One-Sided Discovery PLR")
2770 if (
v &&
v->hasRange(
"physical") &&
v->getMin(
"physical") != -std::numeric_limits<double>::infinity()) {
2779 return "Test Statistic";
2785 return (
poi().empty()) ? nullptr : (
poi().first())->
GetName();
2790 return (first_poi ==
nullptr) ? std::numeric_limits<double>::quiet_NaN() : first_poi->getVal();
2795 auto first_poi =
dynamic_cast<RooAbsReal *
>(_alt_poi.first());
2796 return (first_poi ==
nullptr) ? std::numeric_limits<double>::quiet_NaN() : first_poi->getVal();
2804 int tsType = nPoints;
2805 double alt_val = std::numeric_limits<double>::quiet_NaN();
2812 auto out =
hypoSpace(parName, pllType, alt_val);
2818 for (
auto p : out.poi()) {
2820 dynamic_cast<RooRealVar *
>(p)->setRange(
"physical", 0, std::numeric_limits<double>::infinity());
2821 Info(
"xRooNLLVar::hypoSpace",
"Setting physical range of %s to [0,inf]", p->GetName());
2822 }
else if (
dynamic_cast<RooRealVar *
>(p)->hasRange(
"physical")) {
2823 dynamic_cast<RooRealVar *
>(p)->removeRange(
"physical");
2824 Info(
"xRooNLLVar::hypoSpace",
"Setting physical range of %s to [-inf,inf] (i.e. removed range)",
2839 if (
int(low + 0.5) > 0) {
2840 out.AddPoints(parName,
int(low + 0.5), high, alt_value);
2842 if (!std::isnan(high) && !std::isnan(alt_value) && !(std::isinf(high) && std::isinf(alt_value))) {
2843 for (
auto p : out.poi()) {
2844 dynamic_cast<RooRealVar *
>(p)->setRange(
"scan", high, alt_value);
2853 hs.
AddPoints(parName, nPoints, low, high);
2855 if (!std::isnan(low) && !std::isnan(high) && !(std::isinf(low) && std::isinf(high))) {
2856 for (
auto p : hs.
poi()) {
2857 dynamic_cast<RooRealVar *
>(p)->setRange(
"scan", low, high);
2867 auto _poi = std::unique_ptr<RooAbsCollection>(
2868 std::unique_ptr<RooAbsCollection>(
pdf()->getVariables())->selectByAttrib(
"poi",
true));
2870 throw std::runtime_error(
"You must specify a POI for the hypoSpace");
2871 return hypoSpace(_poi->first()->GetName(), nPoints, low, high, alt_value, pllType);
2880 if (strlen(parName)) {
2881 std::unique_ptr<RooAbsCollection> axes(s.
pars()->selectByName(parName));
2883 throw std::runtime_error(
"parameter not found");
2884 axes->setAttribAll(
"axis",
true);
2889 s.
fNlls[s.
fPdfs.begin()->second] = std::make_shared<xRooNLLVar>(*
this);
2892 for (
auto poi : s.
poi()) {
2893 poi->setStringAttribute(
"altVal", std::isnan(alt_value) ?
nullptr :
TString::Format(
"%f", alt_value));
2905 out.SetBackgroundAsAlt(
true);
2906 out.SetName(
TUUID().AsString());
2909 bool setReadonly =
false;
2910 if (
nllVar && !
nllVar->get()->getAttribute(
"readOnly")) {
2912 nllVar->get()->setAttribute(
"readOnly");
2917 out.SetTestStatisticData(ts_obs.first);
2924 "pllType",
"test statistic type",
2925 {{
"TwoSided", 0}, {
"OneSidedPositive", 1}, {
"OneSidedNegative", 2}, {
"Uncapped", 3}, {
"Unknown", 4}}));
2936 {
"asimov_cfit_null", 4},
2938 {
"cfit_lbound", 6}}));
2944 auto fitDS =
new RooDataSet(
"fits",
"fit summary data", fitDetails);
2945 fitDS->convertToTreeStore();
2947 for (
int i = 0;
i < 7;
i++) {
2948 std::shared_ptr<const RooFitResult> fit;
2950 case 0: fit =
ufit();
break;
2953 case 3: fit =
asimov() ?
asimov()->ufit(
true) :
nullptr;
break;
2954 case 4: fit =
asimov() ?
asimov()->cfit_null(
true) :
nullptr;
break;
2967 fitDS->add(fitDetails);
2970 fitDS->setGlobalObservables(fitMeta);
2972 out.SetFitInfo(fitDS);
2981 nullToyDS->setGlobalObservables(nullMeta);
2984 std::vector<double> values;
2985 std::vector<double> weights;
2990 values.push_back(std::get<1>(t));
2991 weights.push_back(std::get<2>(t));
2994 nullToyDS->add(nullDetails, std::get<2>(t));
2997#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
2999 out.fNullPValueError =
3003 out.SetNullPValueError(
3007#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
3015 out.SetNullDetailedOutput(nullToyDS);
3018 std::vector<double> values;
3019 std::vector<double> weights;
3020 values.reserve(
altToys.size());
3021 weights.reserve(
altToys.size());
3028 altToyDS->setGlobalObservables(altMeta);
3030 values.push_back(std::get<1>(t));
3031 weights.push_back(std::get<2>(t));
3034 altToyDS->add(altDetails, std::get<2>(t));
3037 out.SetAltDetailedOutput(altToyDS);
3038#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
3039 out.fAlternatePValue =
pAlt_toys().first;
3040 out.fAlternatePValueError =
3044 out.SetAltPValueError(
3049#if ROOT_VERSION_CODE < ROOT_VERSION(6, 27, 00)
3051 out.fAlternatePValueError =
pAlt_asymp().second;
3059 nllVar->get()->setAttribute(
"readOnly",
false);
3068 return "xValueWithError: nullptr\n";
3069 return Form(
"%f +/- %f",
v->first,
v->second);
3071std::string cling::printValue(
const std::map<std::string, xRooNLLVar::xValueWithError> *
m)
3075 std::string out =
"{\n";
3076 for (
auto [k,
v] : *
m) {
3077 out +=
"\"" + k +
"\" => " + printValue(&
v) +
"\n";
GOFOpMode operMode() const
RooAbsData * _data
Pointer to original input dataset.
RooAbsReal * _func
Pointer to original input function.
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.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
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 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 np
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 value
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 Atom_t Time_t type
TMatrixTSym< Double_t > TMatrixDSym
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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
static double 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 int CompatFactor(const IncompatFunc &func, double mu_hat)
static double 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())
std::shared_ptr< RooFitResult > fr
static std::shared_ptr< const RooFitResult > minimize(RooAbsReal &nll, const std::shared_ptr< ROOT::Fit::FitConfig > &fitConfig=nullptr, const std::shared_ptr< RooLinkedList > &nllOpts=nullptr)
static std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > generateFrom(RooAbsPdf &pdf, const RooFitResult &fr, bool expected=false, int seed=0)
static std::shared_ptr< ROOT::Fit::FitConfig > createFitConfig()
double impact(const char *poi, const char *np, bool up=true, bool prefit=false, bool approx=false)
std::shared_ptr< xRooNLLVar > fNll
const RooFitResult * operator->() const
void Draw(Option_t *opt="")
xRooFitResult ifit(const char *np, bool up, bool prefit=false)
double conditionalError(const char *poi, const char *nps, bool up=true, bool approx=false)
std::shared_ptr< xRooNLLVar > nll() const
RooArgList ranknp(const char *poi, bool up=true, bool prefit=false, double approxThreshold=std::numeric_limits< double >::infinity())
xRooFitResult(const std::shared_ptr< xRooNode > &in, const std::shared_ptr< xRooNLLVar > &nll=nullptr)
std::shared_ptr< xRooNode > fNode
xRooFitResult cfit(const char *poiValues, const char *alias=nullptr)
std::shared_ptr< std::map< std::string, xRooFitResult > > fCfits
xValueWithError pll(bool readOnly=false)
std::shared_ptr< RooStats::HypoTestResult > hypoTestResult
RooStats::HypoTestResult result()
std::shared_ptr< const RooFitResult > retrieveFit(int type)
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > fData
std::vector< std::tuple< int, double, double > > altToys
std::shared_ptr< const RooAbsCollection > coords
std::shared_ptr< const RooFitResult > fLbound_cfit
std::shared_ptr< const RooFitResult > cfit_lbound(bool readOnly=false)
std::shared_ptr< xRooNLLVar > nllVar
void Draw(Option_t *opt="") override
Default Draw method for all objects.
std::shared_ptr< const RooFitResult > fNull_cfit
TString tsTitle(bool inWords=false) const
xValueWithError ts_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
std::shared_ptr< const RooFitResult > fUfit
xRooHypoPoint(std::shared_ptr< RooStats::HypoTestResult > htr=nullptr, const RooAbsCollection *_coords=nullptr)
xRooFit::Asymptotics::PLLType fPllType
xValueWithError sigma_mu(bool readOnly=false)
xValueWithError pAlt_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
std::vector< std::tuple< int, double, double > > nullToys
std::shared_ptr< xRooHypoPoint > asimov(bool readOnly=false)
xValueWithError pAlt_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
std::shared_ptr< const RooFitResult > ufit(bool readOnly=false)
void Print(Option_t *opt="") const override
Print TNamed name and title.
std::shared_ptr< const RooFitResult > cfit_null(bool readOnly=false)
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > data()
xRooHypoPoint generateNull(int seed=0)
RooArgList alt_poi() const
xValueWithError pCLs_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
std::shared_ptr< const RooFitResult > cfit_alt(bool readOnly=false)
size_t addToys(bool alt, int nToys, int initialSeed=0, double target=std::numeric_limits< double >::quiet_NaN(), double target_nSigma=std::numeric_limits< double >::quiet_NaN(), bool targetCLs=false, double relErrThreshold=2., size_t maxToys=10000)
void addAltToys(int nToys=1, int seed=0, double target=std::numeric_limits< double >::quiet_NaN(), double target_nSigma=std::numeric_limits< double >::quiet_NaN())
std::shared_ptr< const RooFitResult > fAlt_cfit
void addCLsToys(int nToys=1, int seed=0, double target=std::numeric_limits< double >::quiet_NaN(), double target_nSigma=std::numeric_limits< double >::quiet_NaN())
xRooHypoPoint generateAlt(int seed=0)
xValueWithError pX_toys(bool alt, double nSigma=std::numeric_limits< double >::quiet_NaN())
std::shared_ptr< const RooFitResult > fGenFit
void addNullToys(int nToys=1, int seed=0, double target=std::numeric_limits< double >::quiet_NaN(), double target_nSigma=std::numeric_limits< double >::quiet_NaN())
static std::set< int > allowedStatusCodes
std::shared_ptr< xRooHypoPoint > fAsimov
xValueWithError pCLs_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
xValueWithError ts_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
xValueWithError getVal(const char *what)
xValueWithError pNull_asymp(double nSigma=std::numeric_limits< double >::quiet_NaN())
xValueWithError pNull_toys(double nSigma=std::numeric_limits< double >::quiet_NaN())
std::shared_ptr< RooArgSet > pars() const
xRooFit::Asymptotics::PLLType fTestStatType
bool AddModel(const xRooNode &pdf, const char *validity="")
std::map< std::shared_ptr< xRooNode >, std::shared_ptr< xRooNLLVar > > fNlls
int AddPoints(const char *parName, size_t nPoints, double low, double high)
std::set< std::pair< std::shared_ptr< RooArgList >, std::shared_ptr< xRooNode > > > fPdfs
std::shared_ptr< RooAbsCollection > fFuncGlobs
void AddOption(const RooCmdArg &opt)
std::shared_ptr< const RooAbsCollection > fGlobs
std::shared_ptr< RooLinkedList > fOpts
std::shared_ptr< RooAbsReal > func() const
RooAbsData * data() const
std::set< std::string > binnedChannels() const
double binnedDataTerm() const
ROOT::Math::IOptions * fitConfigOptions()
RooConstraintSum * constraintTerm() const
std::shared_ptr< ROOT::Fit::FitConfig > fFitConfig
double saturatedConstraintTerm() const
double extendedTerm() 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)
TObject * Scan(const RooArgList &scanPars, const std::vector< std::vector< double > > &coords, const RooArgList &profilePars=RooArgList())
std::shared_ptr< RooAbsCollection > fConstVars
xRooNLLVar(RooAbsPdf &pdf, const std::pair< RooAbsData *, const RooAbsCollection * > &data, const RooLinkedList &nllOpts=RooLinkedList())
std::shared_ptr< RooAbsPdf > pdf() const
double mainTermPgof() const
double saturatedMainTerm() const
void Print(Option_t *opt="")
std::string fFuncCreationLog
void Draw(Option_t *opt="")
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > generate(bool expected=false, int seed=0)
RooNLLVar * mainTerm() const
std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > getData() const
double getEntryVal(size_t entry) const
double saturatedVal() const
std::shared_ptr< RooAbsCollection > fFuncVars
double getEntryBinWidth(size_t entry) const
std::shared_ptr< ROOT::Fit::FitConfig > fitConfig()
std::shared_ptr< RooArgSet > pars(bool stripGlobalObs=true) const
std::shared_ptr< RooAbsData > fData
double mainTermNdof() const
std::shared_ptr< RooAbsPdf > fPdf
bool setData(const std::pair< std::shared_ptr< RooAbsData >, std::shared_ptr< const RooAbsCollection > > &_data)
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)
The xRooNode class is designed to wrap over a TObject and provide functionality to aid with interacti...
xRooNode bins() const
bins of a channel or sample, or channels of a multi-channel pdf
Generic interface for defining configuration options of a numerical algorithm.
void SetValue(const char *name, double val)
generic methods for retrieving options
virtual void SetNamedValue(const char *, const char *)
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
A space to attach TBranches.
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.
RooAbsCollection * snapshot(bool deepCopy=true) const
Take a snap shot of current collection contents.
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...
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
Storage_t::size_type size() const
RooAbsArg * first() const
bool setCatIndex(const char *name, Int_t newVal=0, bool verbose=false)
Set index value of a RooAbsCategoryLValue stored in set with given name to newVal.
bool setRealValue(const char *name, double newVal=0.0, bool verbose=false)
Set value of a RooAbsRealLValue 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.
const char * getCatLabel(const char *name, const char *defVal="", bool verbose=false) const
Get state name of a RooAbsCategory stored in set with given name.
std::string contentsString() const
Return comma separated list of contained object names as STL string.
Abstract base class for binned and unbinned datasets.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual bool setData(RooAbsData &, bool=true)
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.
RooArgSet * selectCommon(const RooAbsCollection &refColl) const
Use RooAbsCollection::selecCommon(), but return as RooArgSet.
Object to represent discrete states.
Named container for two doubles, two integers two object points and three string pointers that can be...
const RooArgSet * getSet(Int_t idx) const
Return RooArgSet stored in slot idx.
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.
const char * getString(Int_t idx) const
Return string stored in slot idx.
Calculates the sum of the -(log) likelihoods of a set of RooAbsPfs that represent constraint function...
Container class to hold unbinned data.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
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)
Implements a -log(likelihood) calculation from a dataset and a PDF.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
double getErrorLo() const
double getErrorHi() const
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
const RooAbsCategoryLValue & indexCat() const
HypoTestResult is a base class for results from hypothesis tests.
This class simply holds a sampling distribution of some test statistic.
A RooAbsArg implementing string values.
Draw all kinds of Arrows.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
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.
const char * AsString() const
Return the date & time as a string (ctime() format).
Describe directory structure in memory.
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.
Graphics object made of three arrays X, Y and Z with the same number of points each.
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Sets point number n.
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.
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.
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.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
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 TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
@ kCanDelete
if object in a list can be deleted
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 ].
Regular expression class.
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.
Int_t Atoi() const
Return integer value of string.
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
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
TDatime GetTime() const
Get time from UUID.
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 WeightVar(const char *name="weight", bool reinterpretAsWeight=false)
RooCmdArg GlobalObservables(Args_t &&... argsOrArgSet)
RooCmdArg GlobalObservablesSource(const char *sourceName)
double gaussian_pdf(double x, double sigma=1, double x0=0)
Probability density function of the normal (Gaussian) distribution.
double gaussian_cdf(double x, double sigma=1, double x0=0)
Alternative name for same function.
Double_t Prob(Double_t chi2, Int_t ndf)
Computation of the probability for a certain Chi-squared (chi2) and number of degrees of freedom (ndf...
Double_t Poisson(Double_t x, Double_t par)
Computes the Poisson distribution function for (x,par).
#define BEGIN_XROOFIT_NAMESPACE
#define END_XROOFIT_NAMESPACE
void removeTopic(RooFit::MsgTopic oldTopic)
std::string collectionContents(const RooAbsCollection &coll)