197bool interpretExtendedCmdArg(
RooAbsPdf const& pdf,
int extendedCmdArg) {
199 if (extendedCmdArg == 2) {
203 <<
"p.d.f. provides expected number of events, including extended term in likelihood." << std::endl;
207 return extendedCmdArg;
210inline double getLog(
double prob,
RooAbsReal const *caller)
215 <<
") WARNING: top-level pdf has a large value: " << prob << std::endl;
219 caller->
logEvalError(
"getLogVal() top-level p.d.f evaluates to a negative number");
224 caller->
logEvalError(
"getLogVal() top-level p.d.f evaluates to zero");
226 return -std::numeric_limits<double>::infinity();
230 caller->
logEvalError(
"getLogVal() top-level p.d.f evaluates to NaN");
241 const char* rangeName,
bool splitRange)
249 if(!rangeName || splitRange)
return;
254 std::string fitrangeValue;
256 for (
auto const &subrange : subranges) {
257 if (subrange.empty())
259 std::string fitrangeValueSubrange = std::string(
"fit_") + baseName;
260 if (subranges.size() > 1) {
261 fitrangeValueSubrange +=
"_" + subrange;
263 fitrangeValue += fitrangeValueSubrange +
",";
266 if(arg->isCategory())
continue;
267 auto& observable =
static_cast<RooRealVar&
>(*arg);
269 observable.
setRange(fitrangeValueSubrange.c_str(), observable.getMin(subrange.c_str()),
270 observable.getMax(subrange.c_str()));
273 pdf.
setStringAttribute(
"fitrange", fitrangeValue.substr(0, fitrangeValue.size() - 1).c_str());
321 double plotMin,
double plotMax) :
322 RooAbsReal(
name,title,plotMin,plotMax), _normMgr(this,10), _selectComp(true)
335 _normMgr(other._normMgr,this), _selectComp(other._selectComp), _normRange(other._normRange)
357 if (normVal < 0. || (normVal == 0. && rawVal != 0)) {
359 const std::string msg =
"p.d.f normalization integral is zero or negative: " + std::to_string(normVal);
366 logEvalError(
Form(
"p.d.f value is less than zero (%f), trying to recover", rawVal));
377 return (rawVal == 0. && normVal == 0.) ? 0. : rawVal / normVal;
407 bool nintChanged(
false) ;
439 cxcoutD(
Eval) <<
"RooAbsPdf::analyticalIntegralWN(" <<
GetName() <<
") code = " << code <<
" normset = " << (normSet?*normSet:
RooArgSet()) << endl ;
442 if (code==0)
return getVal(normSet) ;
471 if(!error)
return error ;
494 if (!nset)
return 1 ;
502 coutW(
Eval) <<
"RooAbsPdf::getNorm(" <<
GetName() <<
":: WARNING normalization is zero, nset = " ; nset->
Print(
"1") ;
522 return cache->
_norm ;
579 ((
RooAbsPdf*)
this)->setProxyNormSet(nset) ;
588 <<
") recreating normalization integral " << endl ;
597 auto ntitle = std::string(
GetTitle()) +
" Unit Normalization";
598 auto nname = std::string(
GetName()) +
"_UnitNorm";
609 if (cacheParamsStr && strlen(cacheParamsStr)) {
611 std::unique_ptr<RooArgSet> intParams{normInt->
getVariables()} ;
615 if (!cacheParams.
empty()) {
617 <<
"-dim value cache for integral over " << depList <<
" as a function of " << cacheParams <<
" in range " << (nr?nr:
"<default>") << endl ;
626 normInt= cachedIntegral ;
668 for(
auto * pdf : dynamic_range_cast<RooAbsPdf*>(branchList)) {
669 if (pdf) pdf->setTraceCounter(
value,
false) ;
684 return getLog(
getVal(nset),
this);
694bool checkInfNaNNeg(
const T& inputs) {
700 for (
double val : inputs) {
701 inf |= !std::isfinite(val);
706 return inf || nan || neg;
717 for (
unsigned int i=0; i<outputs.
size(); ++i) {
718 const double value = outputs[i];
722 }
else if (!std::isfinite(outputs[i])){
725 }
else if (outputs[i] < 0.) {
726 logEvalError(
Form(
"p.d.f value of (%s) is less than zero (%f) for entry %zu",
740 auto pdfValues =
getValues(evalData, normSet);
750 for (std::size_t i = 0; i < pdfValues.
size(); ++i) {
751 output[i] = getLog(pdfValues[i],
this);
820 logEvalError(
"extendedTerm #expected events is <0 return a NaN");
832 logEvalError(
"extendedTerm #expected events is a NaN") ;
836 double extra = doOffset
837 ? (expected - sumEntries) - sumEntries * (
std::log(expected) -
std::log(sumEntries))
838 : expected - sumEntries *
std::log(expected);
840 if(sumEntriesW2 != 0.0) {
841 extra *= sumEntriesW2 / sumEntries;
872 double sumW =
data.sumEntries();
875 sumW2 =
data.sumEntriesW2();
968 auto baseName = std::string(
"nll_") +
GetName() +
"_" +
data.GetName();
976 pc.defineString(
"rangeName",
"RangeWithName",0,
"",
true) ;
977 pc.defineString(
"addCoefRange",
"SumCoefRange",0,
"") ;
978 pc.defineString(
"globstag",
"GlobalObservablesTag",0,
"") ;
979 pc.defineString(
"globssource",
"GlobalObservablesSource",0,
"data") ;
980 pc.defineDouble(
"rangeLo",
"Range",0,-999.) ;
981 pc.defineDouble(
"rangeHi",
"Range",1,-999.) ;
982 pc.defineInt(
"splitRange",
"SplitRange",0,0) ;
983 pc.defineInt(
"ext",
"Extended",0,2) ;
984 pc.defineInt(
"numcpu",
"NumCPU",0,1) ;
985 pc.defineInt(
"interleave",
"NumCPU",1,0) ;
986 pc.defineInt(
"verbose",
"Verbose",0,0) ;
987 pc.defineInt(
"optConst",
"Optimize",0,0) ;
988 pc.defineInt(
"cloneData",
"CloneData", 0, 2);
989 pc.defineSet(
"projDepSet",
"ProjectedObservables",0,0) ;
990 pc.defineSet(
"cPars",
"Constrain",0,0) ;
991 pc.defineSet(
"glObs",
"GlobalObservables",0,0) ;
992 pc.defineInt(
"doOffset",
"OffsetLikelihood",0,0) ;
993 pc.defineSet(
"extCons",
"ExternalConstraints",0,0) ;
994 pc.defineInt(
"BatchMode",
"BatchMode", 0, defaultBatchModeInt);
995 pc.defineDouble(
"IntegrateBins",
"IntegrateBins", 0, -1.);
996 pc.defineMutex(
"Range",
"RangeWithName") ;
997 pc.defineMutex(
"GlobalObservables",
"GlobalObservablesTag") ;
998 pc.defineInt(
"ModularL",
"ModularL", 0, 0);
1001 pc.defineMutex(
"ModularL",
"NumCPU");
1004 pc.defineMutex(
"ModularL",
"OffsetLikelihood");
1007 pc.process(cmdList) ;
1012 if (
pc.getInt(
"ModularL")) {
1013 int lut[3] = {2, 1, 0};
1021 if (
auto tmp =
pc.getSet(
"cPars"))
1024 if (
auto tmp =
pc.getSet(
"extCons"))
1025 extConsSet.
add(*tmp);
1027 if (
auto tmp =
pc.getSet(
"glObs"))
1030 const std::string rangeName =
pc.getString(
"globstag",
"",
false);
1041 const char* rangeName =
pc.getString(
"rangeName",0,
true) ;
1042 const char* addCoefRangeName =
pc.getString(
"addCoefRange",0,
true) ;
1043 const bool ext = interpretExtendedCmdArg(*
this,
pc.getInt(
"ext")) ;
1044 Int_t numcpu =
pc.getInt(
"numcpu") ;
1045 Int_t numcpu_strategy =
pc.getInt(
"interleave");
1047 if (numcpu_strategy==3 && !this->
InheritsFrom(
"RooSimultaneous") ) {
1048 coutW(
Minimization) <<
"Cannot use a NumCpu Strategy = 3 when the pdf is not a RooSimultaneous, "
1049 "falling back to default strategy = 0" << endl;
1050 numcpu_strategy = 0;
1054 Int_t splitRange =
pc.getInt(
"splitRange") ;
1056 Int_t optConst =
pc.getInt(
"optConst") ;
1057 Int_t cloneData =
pc.getInt(
"cloneData") ;
1061 coutE(
Minimization) <<
"The Offset(\"bin\") option doesn't suppot fits to RooDataSet yet, only to RooDataHist."
1062 " Falling back to no offsetting." << endl;
1068 cloneData = optConst ;
1071 if (
pc.hasProcessed(
"Range")) {
1072 double rangeLo =
pc.getDouble(
"rangeLo") ;
1073 double rangeHi =
pc.getDouble(
"rangeHi") ;
1078 for (
auto arg : obs) {
1080 if (rrv) rrv->
setRange(
"fit",rangeLo,rangeHi) ;
1088 resetFitrangeAttributes(*
this,
data, baseName, rangeName, splitRange);
1091 auto tmp =
pc.getSet(
"projDepSet");
1093 projDeps.
add(*tmp) ;
1096 const std::string globalObservablesSource =
pc.getString(
"globssource",
"data",
false);
1097 if(globalObservablesSource !=
"data" && globalObservablesSource !=
"model") {
1098 std::string errMsg =
"RooAbsPdf::fitTo: GlobalObservablesSource can only be \"data\" or \"model\"!";
1100 throw std::invalid_argument(errMsg);
1102 const bool takeGlobalObservablesFromData = globalObservablesSource ==
"data";
1107 auto createConstr = [&](
RooAbsPdf const& pdf,
bool removeConstraintsFromPdf=
false) -> std::unique_ptr<RooAbsReal> {
1109 baseName +
"_constr",
1113 pc.getSet(
"extCons"),
1115 pc.getString(
"globstag",0,
true),
1116 takeGlobalObservablesFromData,
1117 removeConstraintsFromPdf
1133 normSet->remove(projDeps,
true,
true);
1147 if (addCoefRangeName) {
1149 <<
") fixing interpretation of coefficients of any component to range "
1150 << addCoefRangeName <<
"\n";
1151 pdfClone->fixAddCoefRange(addCoefRangeName,
false);
1154 std::unique_ptr<RooAbsReal> compiledConstr;
1155 if(std::unique_ptr<RooAbsReal> constr = createConstr(*
this)) {
1157 compiledConstr->addOwnedComponents(std::move(constr));
1162 std::move(compiledConstr),
1163 rangeName ? rangeName :
"",
1166 pc.getDouble(
"IntegrateBins"),
1169 takeGlobalObservablesFromData).release();
1174 std::unique_ptr<RooAbsReal> nll ;
1185 cfg.
rangeName = rangeName ? rangeName :
"";
1186 auto nllVar = std::make_unique<RooNLLVar>(baseName.c_str(),
"-log(likelihood)",*
this,
data,projDeps, ext, cfg);
1189 nll = std::move(nllVar);
1193 if (std::unique_ptr<RooAbsReal> constraintTerm = createConstr(*
this)) {
1205 constraintTerm->setData(
data,
false);
1211 auto orignll = std::move(nll) ;
1212 nll = std::make_unique<RooAddition>(
Form(
"%s_with_constr",baseName.c_str()),
"nllWithCons",
RooArgSet(*orignll,*constraintTerm)) ;
1213 nll->addOwnedComponents(std::move(orignll),std::move(constraintTerm)) ;
1221 nll->enableOffsetting(
true) ;
1224 return nll.release() ;
1242 std::unique_ptr<RooFitResult> rw(minimizer.
save());
1246 <<
"RooAbsPdf::fitTo(" << this->
GetName()
1247 <<
") Calculating covariance matrix according to the asymptotically correct approach. If you find this "
1248 "method useful please consider citing https://arxiv.org/abs/1911.01303."
1252 auto nFloatPars = rw->floatParsFinal().getSize();
1254 for (
int k = 0; k < nFloatPars; k++) {
1255 for (
int l = 0;
l < nFloatPars;
l++) {
1262 std::vector<std::unique_ptr<RooDerivative>> derivatives;
1263 const RooArgList &floated = rw->floatParsFinal();
1264 std::unique_ptr<RooArgSet> floatingparams{
1266 for (
const auto paramresult : floated) {
1267 auto paraminternal =
static_cast<RooRealVar *
>(floatingparams->find(*paramresult));
1269 derivatives.emplace_back(this->
derivative(*paraminternal, obs, 1));
1273 for (
int j = 0; j <
data.numEntries(); j++) {
1277 std::vector<double> diffs(floated.
getSize(), 0.0);
1278 for (
int k = 0; k < floated.
getSize(); k++) {
1279 const auto paramresult =
static_cast<RooRealVar *
>(floated.
at(k));
1280 auto paraminternal =
static_cast<RooRealVar *
>(floatingparams->find(*paramresult));
1282 double diff = derivatives[k]->
getVal();
1284 *paraminternal = paramresult->getVal();
1288 double prob =
getVal(&obs);
1289 for (
int k = 0; k < floated.
getSize(); k++) {
1290 for (
int l = 0;
l < floated.
getSize();
l++) {
1291 num(k,
l) +=
data.weightSquared() * diffs[k] * diffs[
l] / (prob * prob);
1303 return rw->covQual();
1322 std::unique_ptr<RooFitResult> rw{minimizer.
save()};
1325 <<
") Calculating sum-of-weights-squared correction matrix for covariance matrix"
1328 std::unique_ptr<RooFitResult> rw2{minimizer.
save()};
1337 <<
") ERROR: Cannot apply sum-of-weights correction to covariance matrix: correction "
1338 "matrix calculated with weight-squared is singular"
1347 for (
int i = 0; i < matC.
GetNrows(); ++i) {
1348 for (
int j = 0; j < i; ++j) {
1349 matC(j, i) = matC(i, j);
1357 return std::min(rw->covQual(), rw2->covQual());
1376 bool weightedData =
data.isNonPoissonWeighted();
1380 coutW(
InputArguments) <<
"RooAbsPdf::fitTo(" <<
GetName() <<
") WARNING: a likelihood fit is requested of what appears to be weighted data.\n"
1381 <<
" While the estimated values of the parameters will always be calculated taking the weights into account,\n"
1382 <<
" there are multiple ways to estimate the errors of the parameters. You are advised to make an \n"
1383 <<
" explicit choice for the error calculation:\n"
1384 <<
" - Either provide SumW2Error(true), to calculate a sum-of-weights-corrected HESSE error matrix\n"
1385 <<
" (error will be proportional to the number of events in MC).\n"
1386 <<
" - Or provide SumW2Error(false), to return errors from original HESSE error matrix\n"
1387 <<
" (which will be proportional to the sum of the weights, i.e., a dataset with <sum of weights> events).\n"
1388 <<
" - Or provide AsymptoticError(true), to use the asymptotically correct expression\n"
1389 <<
" (for details see https://arxiv.org/abs/1911.01303)."
1394 coutE(
InputArguments) <<
"RooAbsPdf::fitTo(" <<
GetName() <<
"): sum-of-weights and asymptotic error correction do not work with MINOS errors. Not fitting." << endl;
1398 coutW(
InputArguments) <<
"RooAbsPdf::fitTo(" <<
GetName() <<
") WARNING: asymptotic correction does not apply to MINOS errors" << endl ;
1403 coutE(
InputArguments) <<
"RooAbsPdf::fitTo(" <<
GetName() <<
") ERROR: Cannot compute both asymptotically correct and SumW2 errors." << endl ;
1416 m.setMinimizerType(cfg.
minType.c_str());
1419 m.setPrintEvalErrors(cfg.
numee);
1428 if (cfg.
hesse)
m.hesse();
1430 int corrCovQual = -1;
1432 if (
m.getNPar()>0) {
1440 std::unique_ptr<RooFitResult> ret;
1442 auto name = std::string(
"fitresult_") +
GetName() +
"_" +
data.GetName();
1443 auto title = std::string(
"Result of fit of p.d.f. ") +
GetName() +
" to dataset " +
data.GetName();
1444 ret.reset(
m.save(
name.c_str(),title.c_str()));
1617 std::string nllCmdListString =
"ProjectedObservables,Extended,Range,"
1618 "RangeWithName,SumCoefRange,NumCPU,SplitRange,Constrained,Constrain,ExternalConstraints,"
1619 "CloneData,GlobalObservables,GlobalObservablesSource,GlobalObservablesTag,"
1620 "BatchMode,IntegrateBins,ModularL";
1623 nllCmdListString +=
",OffsetLikelihood";
1625 RooLinkedList nllCmdList =
pc.filterCmdList(fitCmdList, nllCmdListString.c_str());
1631 pc.defineDouble(
"prefit",
"Prefit",0,0);
1632 pc.defineDouble(
"RecoverFromUndefinedRegions",
"RecoverFromUndefinedRegions",0,minimizerDefaults.
recoverFromNaN);
1633 pc.defineInt(
"optConst",
"Optimize",0,minimizerDefaults.
optConst) ;
1634 pc.defineInt(
"verbose",
"Verbose",0,minimizerDefaults.
verbose) ;
1635 pc.defineInt(
"doSave",
"Save",0,minimizerDefaults.
doSave) ;
1636 pc.defineInt(
"doTimer",
"Timer",0,minimizerDefaults.
doTimer) ;
1637 pc.defineInt(
"printLevel",
"PrintLevel",0,minimizerDefaults.
printLevel) ;
1638 pc.defineInt(
"strat",
"Strategy",0,minimizerDefaults.
strat) ;
1639 pc.defineInt(
"initHesse",
"InitialHesse",0,minimizerDefaults.
initHesse) ;
1640 pc.defineInt(
"hesse",
"Hesse",0,minimizerDefaults.
hesse) ;
1641 pc.defineInt(
"minos",
"Minos",0,minimizerDefaults.
minos) ;
1642 pc.defineInt(
"numee",
"PrintEvalErrors",0,minimizerDefaults.
numee) ;
1643 pc.defineInt(
"doEEWall",
"EvalErrorWall",0,minimizerDefaults.
doEEWall) ;
1644 pc.defineInt(
"doWarn",
"Warnings",0,minimizerDefaults.
doWarn) ;
1645 pc.defineInt(
"doSumW2",
"SumW2Error",0,minimizerDefaults.
doSumW2) ;
1646 pc.defineInt(
"doAsymptoticError",
"AsymptoticError",0,minimizerDefaults.
doAsymptotic) ;
1647 pc.defineInt(
"maxCalls",
"MaxCalls",0,minimizerDefaults.
maxCalls);
1648 pc.defineInt(
"doOffset",
"OffsetLikelihood",0,0) ;
1649 pc.defineInt(
"parallelize",
"Parallelize", 0, 0);
1650 pc.defineInt(
"enableParallelGradient",
"ParallelGradientOptions", 0, 0);
1651 pc.defineInt(
"enableParallelDescent",
"ParallelDescentOptions", 0, 0);
1652 pc.defineInt(
"timingAnalysis",
"TimingAnalysis", 0, 0);
1653 pc.defineString(
"mintype",
"Minimizer",0,minimizerDefaults.
minType.c_str()) ;
1654 pc.defineString(
"minalg",
"Minimizer",1,minimizerDefaults.
minAlg.c_str()) ;
1655 pc.defineSet(
"minosSet",
"Minos",0,minimizerDefaults.
minosSet) ;
1656 pc.defineMutex(
"Range",
"RangeWithName") ;
1659 pc.process(fitCmdList) ;
1665 if (
pc.getInt(
"timingAnalysis") && !this->InheritsFrom(
"RooSimultaneous") ) {
1666 coutW(
Minimization) <<
"The timingAnalysis feature was built for minimization with RooSimulteneous "
1667 "and is not implemented for other PDF's. Please create a RooSimultenous to "
1668 "enable this feature." << endl;
1672 double prefit =
pc.getDouble(
"prefit");
1673 Int_t optConst =
pc.getInt(
"optConst") ;
1680 conf.
defineInt(
"BatchMode",
"BatchMode",0,0);
1683 if (conf.
getInt(
"BatchMode") != 0) {
1689 size_t nEvents =
static_cast<size_t>(prefit*
data.numEntries());
1690 if (prefit > 0.5 || nEvents < 100) {
1692 <<
"With the current PrefitDataFraction=" << prefit
1693 <<
", the number of events would be " << nEvents<<
" out of "
1694 <<
data.numEntries() <<
". Skipping prefit..." << endl;
1697 size_t step =
data.numEntries()/nEvents;
1701 if (
data.isWeighted()) tinyVars.
add(weight);
1706 for (
int i=0; i<
data.numEntries(); i+=step)
1712 pc.filterCmdList(tinyCmdList,
"Prefit,Hesse,Minos,Verbose,Save,Timer");
1716 tinyCmdList.
Add(&hesse_option);
1717 tinyCmdList.
Add(&print_option);
1719 fitTo(tiny,tinyCmdList);
1724 if (
pc.getInt(
"parallelize") != 0 ||
pc.getInt(
"enableParallelGradient") ||
pc.getInt(
"enableParallelDescent")) {
1727 nllCmdList.
Add(&modularL_option);
1730 std::unique_ptr<RooAbsReal> nll{
createNLL(
data,nllCmdList)};
1739 cfg.
strat =
pc.getInt(
"strat");
1741 cfg.
hesse =
pc.getInt(
"hesse");
1742 cfg.
minos =
pc.getInt(
"minos");
1743 cfg.
numee =
pc.getInt(
"numee");
1750 cfg.
minType =
pc.getString(
"mintype",
"");
1751 cfg.
minAlg =
pc.getString(
"minalg",
"minuit");
1772 RooLinkedList chi2CmdList =
pc.filterCmdList(fitCmdList,
"Range,RangeWithName,NumCPU,Optimize,ProjectedObservables,AddCoefRange,SplitRange,DataError,Extended,IntegrateBins") ;
1800 pc.defineString(
"rangeName",
"RangeWithName",0,
"",
true) ;
1801 pc.allowUndefined(
true) ;
1802 pc.process(cmdList) ;
1806 const char* rangeName =
pc.getString(
"rangeName",0,
true) ;
1816 if (!rangeName || strchr(rangeName,
',')==0) {
1819 chi2 =
new RooChi2Var(baseName.c_str(),baseName.c_str(),*
this,
data,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1825 string rcmd =
"RangeWithName" ;
1826 if (arg1.
GetName()==rcmd) rarg = &arg1 ;
1827 if (arg2.
GetName()==rcmd) rarg = &arg2 ;
1828 if (arg3.
GetName()==rcmd) rarg = &arg3 ;
1829 if (arg4.
GetName()==rcmd) rarg = &arg4 ;
1830 if (arg5.
GetName()==rcmd) rarg = &arg5 ;
1831 if (arg6.
GetName()==rcmd) rarg = &arg6 ;
1832 if (arg7.
GetName()==rcmd) rarg = &arg7 ;
1833 if (arg8.
GetName()==rcmd) rarg = &arg8 ;
1837 for (std::string& token :
ROOT::Split(rangeName,
",")) {
1841 &arg1==rarg?subRangeCmd:arg1,&arg2==rarg?subRangeCmd:arg2,
1842 &arg3==rarg?subRangeCmd:arg3,&arg4==rarg?subRangeCmd:arg4,
1843 &arg5==rarg?subRangeCmd:arg5,&arg6==rarg?subRangeCmd:arg6,
1844 &arg7==rarg?subRangeCmd:arg7,&arg8==rarg?subRangeCmd:arg8) ;
1845 chi2List.
add(*chi2Comp) ;
1847 chi2 =
new RooAddition(baseName.c_str(),
"chi^2",chi2List,
true) ;
1866 pc.defineInt(
"integrate",
"Integrate",0,0) ;
1867 pc.defineObject(
"yvar",
"YVar",0,0) ;
1870 pc.process(cmdList) ;
1876 bool integrate =
pc.getInt(
"integrate") ;
1916 os <<
indent <<
"--- RooAbsPdf ---" << endl;
1919 os <<
indent <<
" Normalization integral: " << endl ;
1920 auto moreIndent = std::string(
indent.Data()) +
" " ;
1950 bool verbose,
bool autoBinned,
const char* binnedTag)
const
1952 if (prototype || (auxProto && auxProto->
getSize()>0)) {
2028 pc.defineObject(
"proto",
"PrototypeData",0,0) ;
2029 pc.defineString(
"dsetName",
"Name",0,
"") ;
2030 pc.defineInt(
"randProto",
"PrototypeData",0,0) ;
2031 pc.defineInt(
"resampleProto",
"PrototypeData",1,0) ;
2032 pc.defineInt(
"verbose",
"Verbose",0,0) ;
2033 pc.defineInt(
"extended",
"Extended",0,0) ;
2034 pc.defineInt(
"nEvents",
"NumEvents",0,0) ;
2035 pc.defineInt(
"autoBinned",
"AutoBinned",0,1) ;
2036 pc.defineInt(
"expectedData",
"ExpectedData",0,0) ;
2037 pc.defineDouble(
"nEventsD",
"NumEventsD",0,-1.) ;
2038 pc.defineString(
"binnedTag",
"GenBinned",0,
"") ;
2039 pc.defineMutex(
"GenBinned",
"ProtoData") ;
2040 pc.defineMutex(
"Extended",
"NumEvents");
2043 pc.process(arg1,arg2,arg3,arg4,arg5,arg6) ;
2050 const char* dsetName =
pc.getString(
"dsetName") ;
2052 bool randProto =
pc.getInt(
"randProto") ;
2053 bool resampleProto =
pc.getInt(
"resampleProto") ;
2054 bool extended =
pc.getInt(
"extended") ;
2055 bool autoBinned =
pc.getInt(
"autoBinned") ;
2056 const char* binnedTag =
pc.getString(
"binnedTag") ;
2057 Int_t nEventsI =
pc.getInt(
"nEvents") ;
2058 double nEventsD =
pc.getInt(
"nEventsD") ;
2060 bool expectedData =
pc.getInt(
"expectedData") ;
2062 double nEvents = (nEventsD>0) ? nEventsD :
double(nEventsI);
2071 }
else if (nEvents==0) {
2072 cxcoutI(
Generation) <<
"No number of events specified , number of events generated is "
2076 if (extended && protoData && !randProto) {
2077 cxcoutI(
Generation) <<
"WARNING Using generator option Extended() (Poisson distribution of #events) together "
2078 <<
"with a prototype dataset implies incomplete sampling or oversampling of proto data. "
2079 <<
"Set randomize flag in ProtoData() option to randomize prototype dataset order and thus "
2080 <<
"to randomize the set of over/undersampled prototype events for each generation cycle." << endl ;
2093 if (dsetName && strlen(dsetName)>0) {
2094 data->SetName(dsetName) ;
2120 pc.defineObject(
"proto",
"PrototypeData",0,0) ;
2121 pc.defineString(
"dsetName",
"Name",0,
"") ;
2122 pc.defineInt(
"randProto",
"PrototypeData",0,0) ;
2123 pc.defineInt(
"resampleProto",
"PrototypeData",1,0) ;
2124 pc.defineInt(
"verbose",
"Verbose",0,0) ;
2125 pc.defineInt(
"extended",
"Extended",0,0) ;
2126 pc.defineInt(
"nEvents",
"NumEvents",0,0) ;
2127 pc.defineInt(
"autoBinned",
"AutoBinned",0,1) ;
2128 pc.defineString(
"binnedTag",
"GenBinned",0,
"") ;
2129 pc.defineMutex(
"GenBinned",
"ProtoData") ;
2133 pc.process(arg1,arg2,arg3,arg4,arg5,arg6) ;
2140 const char* dsetName =
pc.getString(
"dsetName") ;
2141 Int_t nEvents =
pc.getInt(
"nEvents") ;
2143 bool randProto =
pc.getInt(
"randProto") ;
2144 bool resampleProto =
pc.getInt(
"resampleProto") ;
2145 bool extended =
pc.getInt(
"extended") ;
2146 bool autoBinned =
pc.getInt(
"autoBinned") ;
2147 const char* binnedTag =
pc.getString(
"binnedTag") ;
2151 return new GenSpec(cx,whatVars,protoData,nEvents,extended,randProto,resampleProto,dsetName) ;
2201 return new RooDataSet(
"emptyData",
"emptyData",whatVars) ;
2205 std::unique_ptr<RooAbsGenContext> context{
autoGenContext(whatVars,0,0,
verbose,autoBinned,binnedTag)};
2211 if(0 != context && context->isValid()) {
2212 generated= context->generate(nEvents,
false, extended);
2227 double nEvents,
bool ,
bool randProtoOrder,
bool resampleProto,
2228 bool skipInit,
bool extended)
const
2230 if (nEvents==0 && (prototype==0 || prototype->
numEntries()==0)) {
2231 return new RooDataSet(
"emptyData",
"emptyData",whatVars) ;
2237 if (resampleProto) {
2238 randProtoOrder=true ;
2241 if (randProtoOrder && prototype && prototype->
numEntries()!=nEvents) {
2242 coutI(
Generation) <<
"RooAbsPdf::generate (Re)randomizing event order in prototype dataset (Nevt=" << nEvents <<
")" << endl ;
2249 generated= context.
generate(nEvents,skipInit,extended);
2252 coutE(
Generation) <<
"RooAbsPdf::generate(" <<
GetName() <<
") do not have a valid generator context" << endl;
2283 Int_t nEvents,
bool verbose,
bool randProtoOrder,
bool resampleProto)
const
2285 std::unique_ptr<RooAbsGenContext> context{
genContext(whatVars,&prototype,0,
verbose)};
2290 coutE(
Generation) <<
"RooAbsPdf::generate(" <<
GetName() <<
") ERROR creating generator context" << endl ;
2306 if (!resampleProto) {
2308 std::iota(lut, lut + nProto, 0);
2314 for (
int i = nProto-1; i > 0; --i) {
2379 if(server == &arg)
continue;
2380 if(server->dependsOn(arg)) {
2419 pc.defineString(
"dsetName",
"Name",0,
"") ;
2420 pc.defineInt(
"verbose",
"Verbose",0,0) ;
2421 pc.defineInt(
"extended",
"Extended",0,0) ;
2422 pc.defineInt(
"nEvents",
"NumEvents",0,0) ;
2423 pc.defineDouble(
"nEventsD",
"NumEventsD",0,-1.) ;
2424 pc.defineInt(
"expectedData",
"ExpectedData",0,0) ;
2427 pc.process(arg1,arg2,arg3,arg4,arg5,arg6) ;
2433 double nEvents =
pc.getDouble(
"nEventsD") ;
2435 nEvents =
pc.getInt(
"nEvents") ;
2438 bool extended =
pc.getInt(
"extended") ;
2439 bool expectedData =
pc.getInt(
"expectedData") ;
2440 const char* dsetName =
pc.getString(
"dsetName") ;
2445 cxcoutI(
Generation) <<
" Extended mode active, number of events generated (" << nEvents <<
") is Poisson fluctuation on "
2446 <<
GetName() <<
"::expectedEvents() = " << nEvents << endl ;
2451 }
else if (nEvents==0) {
2452 cxcoutI(
Generation) <<
"No number of events specified , number of events generated is "
2460 if (dsetName && strlen(dsetName)>0) {
2461 data->SetName(dsetName) ;
2503 coutE(
InputArguments) <<
"RooAbsPdf::generateBinned(" <<
GetName() <<
") ERROR: No event count provided and p.d.f does not provide expected number of events" << endl ;
2509 if (expectedData || extended) {
2521 double histMax(-1) ;
2522 Int_t histOutSum(0) ;
2528 double w=hist->
weight()*nEvents ;
2531 }
else if (extended) {
2541 if (hist->
weight()>histMax) {
2542 histMax = hist->
weight() ;
2545 histOutSum += histOut[i] ;
2550 if (!expectedData && !extended) {
2556 Int_t wgt = (histOutSum>nEvents) ? -1 : 1 ;
2559 std::size_t counter = 0;
2560 bool havePrintedInfo =
false;
2561 while(nEvtExtra>0) {
2564 hist->
get(ibinRand) ;
2567 if (ranY<hist->weight()) {
2569 histOut[ibinRand]++ ;
2572 if (histOut[ibinRand]>0) {
2573 histOut[ibinRand]-- ;
2581 if ((counter++ > 10*nEvents || nEvents > 1.E7) && !havePrintedInfo) {
2582 havePrintedInfo =
true;
2583 coutP(
Generation) <<
"RooAbsPdf::generateBinned(" <<
GetName() <<
") Performing costly accept/reject sampling. If this takes too long, use "
2584 <<
"extended mode to speed up the process." << std::endl;
2591 hist->
set(histOut[i],
sqrt(1.0*histOut[i])) ;
2594 }
else if (expectedData) {
2617 return generate(whatVars,nEvents) ;
2621void removeRangeOverlap(std::vector<std::pair<double, double>>& ranges) {
2623 std::sort(ranges.begin(), ranges.end());
2625 for (
auto it = ranges.begin(); it != ranges.end(); ++it) {
2626 double& startL = it->first;
2627 double& endL = it->second;
2629 for (
auto innerIt = it+1; innerIt != ranges.end(); ++innerIt) {
2630 const double startR = innerIt->first;
2631 const double endR = innerIt->second;
2633 if (startL <= startR && startR <= endL) {
2635 endL = std::max(endL, endR);
2636 *innerIt = make_pair(0., 0.);
2641 auto newEnd = std::remove_if(ranges.begin(), ranges.end(),
2642 [](
const std::pair<double,double>&
input){
2643 return input.first == input.second;
2645 ranges.erase(newEnd, ranges.end());
2758 std::unique_ptr<RooCmdArg> plotRange;
2759 std::unique_ptr<RooCmdArg> normRange2;
2763 cmdList.
Add(plotRange.get());
2768 cmdList.
Add(normRange2.get());
2771 if (plotRange || normRange2) {
2772 coutI(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") p.d.f was fitted in a subrange and no explicit "
2773 << (plotRange?
"Range()":
"") << ((plotRange&&normRange2)?
" and ":
"")
2774 << (normRange2?
"NormRange()":
"") <<
" was specified. Plotting / normalising in fit range. To override, do one of the following"
2775 <<
"\n\t- Clear the automatic fit range attribute: <pdf>.removeStringAttribute(\"fitrange\");"
2776 <<
"\n\t- Explicitly specify the plotting range: Range(\"<rangeName>\")."
2777 <<
"\n\t- Explicitly specify where to compute the normalisation: NormRange(\"<rangeName>\")."
2778 <<
"\n\tThe default (full) range can be denoted with Range(\"\") / NormRange(\"\")."<< endl ;
2786 pc.defineDouble(
"scaleFactor",
"Normalization",0,1.0) ;
2787 pc.defineInt(
"scaleType",
"Normalization",0,
Relative) ;
2788 pc.defineSet(
"compSet",
"SelectCompSet",0) ;
2789 pc.defineString(
"compSpec",
"SelectCompSpec",0) ;
2790 pc.defineObject(
"asymCat",
"Asymmetry",0) ;
2791 pc.defineDouble(
"rangeLo",
"Range",0,-999.) ;
2792 pc.defineDouble(
"rangeHi",
"Range",1,-999.) ;
2793 pc.defineString(
"rangeName",
"RangeWithName",0,
"") ;
2794 pc.defineString(
"normRangeName",
"NormRange",0,
"") ;
2795 pc.defineInt(
"rangeAdjustNorm",
"Range",0,0) ;
2796 pc.defineInt(
"rangeWNAdjustNorm",
"RangeWithName",0,0) ;
2797 pc.defineMutex(
"SelectCompSet",
"SelectCompSpec") ;
2798 pc.defineMutex(
"Range",
"RangeWithName") ;
2799 pc.allowUndefined() ;
2802 pc.process(cmdList) ;
2809 double scaleFactor =
pc.getDouble(
"scaleFactor") ;
2811 const char* compSpec =
pc.getString(
"compSpec") ;
2813 bool haveCompSel = ( (compSpec && strlen(compSpec)>0) || compSet) ;
2816 std::string nameSuffix ;
2817 if (compSpec && strlen(compSpec)>0) {
2818 nameSuffix.append(
"_Comp[") ;
2819 nameSuffix.append(compSpec) ;
2820 nameSuffix.append(
"]") ;
2821 }
else if (compSet) {
2822 nameSuffix.append(
"_Comp[") ;
2824 nameSuffix.append(
"]") ;
2832 RooCmdArg cnsuffix(
"CurveNameSuffix",0,0,0,0,nameSuffix.c_str(),0,0,0) ;
2833 cmdList.
Add(&cnsuffix);
2838 double nExpected(1) ;
2842 <<
"): ERROR the 'Expected' scale option can only be used on extendable PDFs" << endl ;
2853 bool hasCustomRange(
false), adjustNorm(
false) ;
2855 std::vector<pair<double,double> > rangeLim;
2858 if (
pc.hasProcessed(
"Range")) {
2860 double rangeLo =
pc.getDouble(
"rangeLo") ;
2861 double rangeHi =
pc.getDouble(
"rangeHi") ;
2862 rangeLim.push_back(make_pair(rangeLo,rangeHi)) ;
2863 adjustNorm =
pc.getInt(
"rangeAdjustNorm") ;
2864 hasCustomRange = true ;
2867 << rangeLo <<
"," << rangeHi <<
"]" ;
2868 if (!
pc.hasProcessed(
"NormRange")) {
2869 ccoutI(
Plotting) <<
", curve is normalized to data in " << (adjustNorm?
"given":
"full") <<
" range" << endl ;
2874 nameSuffix.append(
Form(
"_Range[%f_%f]",rangeLo,rangeHi)) ;
2876 }
else if (
pc.hasProcessed(
"RangeWithName")) {
2878 for (
const std::string& rangeNameToken :
ROOT::Split(
pc.getString(
"rangeName",
"",
false),
",")) {
2879 const char* thisRangeName = rangeNameToken.empty() ? nullptr : rangeNameToken.c_str();
2881 coutE(
Plotting) <<
"Range '" << rangeNameToken <<
"' not defined for variable '"
2887 adjustNorm =
pc.getInt(
"rangeWNAdjustNorm") ;
2888 hasCustomRange = true ;
2890 coutI(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") only plotting range '" <<
pc.getString(
"rangeName",
"",
false) <<
"'" ;
2891 if (!
pc.hasProcessed(
"NormRange")) {
2892 ccoutI(
Plotting) <<
", curve is normalized to data in " << (adjustNorm?
"given":
"full") <<
" range" << endl ;
2897 nameSuffix.append(
Form(
"_Range[%s]",
pc.getString(
"rangeName"))) ;
2900 if (
pc.hasProcessed(
"NormRange")) {
2902 for (
const auto& rangeNameToken :
ROOT::Split(
pc.getString(
"normRangeName",
"",
false),
",")) {
2903 const char* thisRangeName = rangeNameToken.empty() ? nullptr : rangeNameToken.c_str();
2905 coutE(
Plotting) <<
"Range '" << rangeNameToken <<
"' not defined for variable '"
2912 hasCustomRange = true ;
2913 coutI(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") p.d.f. curve is normalized using explicit choice of ranges '" <<
pc.getString(
"normRangeName",
"",
false) <<
"'" << endl ;
2915 nameSuffix.append(
Form(
"_NormRange[%s]",
pc.getString(
"rangeName"))) ;
2919 if (hasCustomRange && adjustNorm) {
2921 const std::size_t oldSize = rangeLim.size();
2922 removeRangeOverlap(rangeLim);
2924 if (oldSize != rangeLim.size() && !
pc.hasProcessed(
"NormRange")) {
2928 coutE(
Plotting) <<
"Requested plot/integration ranges overlap. For correct plotting, new ranges "
2929 "will be defined." << std::endl;
2932 std::string rangesNoOverlap;
2933 for (
auto it = rangeLim.begin(); it != rangeLim.end(); ++it) {
2934 std::stringstream rangeName;
2935 rangeName <<
"Remove_overlap_range_" << it - rangeLim.begin();
2936 plotVar->setRange(rangeName.str().c_str(), it->first, it->second);
2937 if (!rangesNoOverlap.empty())
2938 rangesNoOverlap +=
",";
2939 rangesNoOverlap += rangeName.str();
2944 rangeArg->
setString(0, rangesNoOverlap.c_str());
2946 plotRange = std::make_unique<RooCmdArg>(
RooFit::Range(rangesNoOverlap.c_str()));
2947 cmdList.
Add(plotRange.get());
2951 double rangeNevt(0) ;
2952 for (
const auto& riter : rangeLim) {
2957 scaleFactor *= rangeNevt/nExpected ;
2963 scaleFactor *= nExpected ;
2965 scaleFactor /= nExpected ;
2984 for (
const auto arg : branchNodeSet) {
2986 branchNodeSet.
remove(*arg) ;
2991 std::unique_ptr<RooArgSet> dirSelNodes;
2997 if (dirSelNodes->getSize()>0) {
2998 coutI(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") directly selected PDF components: " << *dirSelNodes << endl ;
3004 coutE(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") ERROR: component selection set " << *compSet <<
" does not match any components of p.d.f." << endl ;
3006 coutE(
Plotting) <<
"RooAbsPdf::plotOn(" <<
GetName() <<
") ERROR: component selection expression '" << compSpec <<
"' does not select any components of p.d.f." << endl ;
3013 RooCmdArg cnsuffix(
"CurveNameSuffix",0,0,0,0,nameSuffix.c_str(),0,0,0) ;
3014 cmdList.
Add(&cnsuffix);
3045 double nExpected(1) ;
3049 <<
"): ERROR the 'Expected' scale option can only be used on extendable PDFs" << endl ;
3117 pc.defineString(
"label",
"Label",0,
"") ;
3118 pc.defineDouble(
"xmin",
"Layout",0,0.65) ;
3119 pc.defineDouble(
"xmax",
"Layout",1,0.9) ;
3120 pc.defineInt(
"ymaxi",
"Layout",0,
Int_t(0.9*10000)) ;
3121 pc.defineInt(
"showc",
"ShowConstants",0,0) ;
3122 pc.defineSet(
"params",
"Parameters",0,0) ;
3123 pc.defineString(
"formatStr",
"Format",0,
"NELU") ;
3124 pc.defineInt(
"sigDigit",
"Format",0,2) ;
3125 pc.defineInt(
"dummy",
"FormatArgs",0,0) ;
3126 pc.defineMutex(
"Format",
"FormatArgs") ;
3129 pc.process(cmdList) ;
3134 const char* label =
pc.getString(
"label") ;
3135 double xmin =
pc.getDouble(
"xmin") ;
3136 double xmax =
pc.getDouble(
"xmax") ;
3137 double ymax =
pc.getInt(
"ymaxi") / 10000. ;
3138 Int_t showc =
pc.getInt(
"showc") ;
3141 const char* formatStr =
pc.getString(
"formatStr") ;
3142 Int_t sigDigit =
pc.getInt(
"sigDigit") ;
3148 if (
pc.hasProcessed(
"FormatArgs")) {
3156 std::unique_ptr<RooArgSet> selParams{
static_cast<RooArgSet*
>(pdfParams->selectCommon(*params))} ;
3157 if (
pc.hasProcessed(
"FormatArgs")) {
3203 bool showLabel= (label != 0 && strlen(label) > 0);
3208 for (
const auto param : params) {
3210 if(showConstants || !var->isConstant())
ymin-= dy;
3213 std::string labelString = label;
3214 unsigned int numLines = std::count(labelString.begin(), labelString.end(),
'\n') + 1;
3215 if (showLabel)
ymin -= numLines * dy;
3221 box->SetFillColor(0);
3222 box->SetBorderSize(0);
3223 box->SetTextAlign(12);
3224 box->SetTextSize(0.04F);
3225 box->SetFillStyle(0);
3227 for (
const auto param : params) {
3228 auto var =
static_cast<const RooRealVar*
>(param);
3229 if(var->isConstant() && !showConstants)
continue;
3231 std::unique_ptr<TString> formatted{options ? var->
format(sigDigits, options) : var->format(*formatCmd)};
3232 box->AddText(formatted->Data());
3293 pdfOwner->
_norm = 0 ;
3309 name.append(
"_Proj[") ;
3312 for(
auto const& arg : iset) {
3318 name.append(arg->GetName()) ;
3368 pc.defineSet(
"supNormSet",
"SupNormSet",0,0) ;
3369 pc.defineInt(
"numScanBins",
"ScanParameters",0,1000) ;
3370 pc.defineInt(
"intOrder",
"ScanParameters",1,2) ;
3371 pc.defineInt(
"doScanNum",
"ScanNumCdf",0,1) ;
3372 pc.defineInt(
"doScanAll",
"ScanAllCdf",0,0) ;
3373 pc.defineInt(
"doScanNon",
"ScanNoCdf",0,0) ;
3374 pc.defineMutex(
"ScanNumCdf",
"ScanAllCdf",
"ScanNoCdf") ;
3377 pc.process(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
3383 const RooArgSet* snset =
pc.getSet(
"supNormSet",0);
3388 Int_t numScanBins =
pc.getInt(
"numScanBins") ;
3389 Int_t intOrder =
pc.getInt(
"intOrder") ;
3390 Int_t doScanNum =
pc.getInt(
"doScanNum") ;
3391 Int_t doScanAll =
pc.getInt(
"doScanAll") ;
3392 Int_t doScanNon =
pc.getInt(
"doScanNon") ;
3403 Int_t isNum= (tmp->numIntRealVars().getSize()>0) ;
3406 coutI(
NumIntegration) <<
"RooAbsPdf::createCdf(" <<
GetName() <<
") integration over observable(s) " << iset <<
" involves numeric integration," << endl
3407 <<
" constructing cdf though numeric integration of sampled pdf in " << numScanBins <<
" bins and applying order "
3408 << intOrder <<
" interpolation on integrated histogram." << endl
3409 <<
" To override this choice of technique use argument ScanNone(), to change scan parameters use ScanParameters(nbins,order) argument" << endl ;
3421 ivar->
setBins(numScanBins,
"numcdf") ;
3435 bool stripDisconnected,
bool removeConstraintsFromPdf)
const
3440 for (
const auto arg : *comps) {
3441 auto pdf =
dynamic_cast<const RooAbsPdf*
>(arg) ;
3442 if (pdf && !ret->
find(pdf->GetName())) {
3443 std::unique_ptr<RooArgSet> compRet(
3444 pdf->getConstraints(observables,constrainedParams,stripDisconnected,removeConstraintsFromPdf));
3446 ret->
add(*compRet,
false) ;
3499 if (config)
return config ;
3531 delete _genContext ;
3538 bool extended,
bool randProto,
bool resampleProto,
TString dsetName,
bool init) :
3539 _genContext(context), _whatVars(whatVars), _protoData(protoData), _nGen(nGen), _extended(extended),
3540 _randProto(randProto), _resampleProto(resampleProto), _dsetName(dsetName), _init(
init)
3547void sterilizeClientCaches(
RooAbsArg & arg) {
3549 for(std::size_t iClient = 0; iClient <
clients.
size(); ++iClient) {
3551 const std::size_t oldClientsSize =
clients.
size();
3554 for(
int iCache = 0; iCache < client->
numCaches(); ++iCache) {
3556 cacheMgr->sterilize();
3566 throw std::runtime_error(
"After a clients caches were cleared, the client was gone! This should not happen.");
3587 sterilizeClientCaches(*
this);
3607 sterilizeClientCaches(*
this);
3621 bool nameChange,
bool isRecursiveStep)
3639std::unique_ptr<RooAbsArg>
3645 std::unique_ptr<RooAbsPdf> pdfClone(
static_cast<RooAbsPdf *
>(this->
Clone()));
3648 auto newArg = std::make_unique<RooNormalizedPdf>(*pdfClone, normSet);
3653 server->setAttribute(
"_COMPILED");
3655 newArg->setAttribute(
"_COMPILED");
3656 newArg->addOwnedComponents(std::move(pdfClone));
header file containing the templated implementation of matrix inversion routines for use with ROOT's ...
std::unique_ptr< RooAbsReal > createConstraintTerm(std::string const &name, RooAbsPdf const &pdf, RooAbsData const &data, RooArgSet const *constrainedParameters, RooArgSet const *externalConstraints, RooArgSet const *globalObservables, const char *globalObservablesTag, bool takeGlobalObservablesFromData, bool removeConstraintsFromPdf)
Create the parameter constraint sum to add to the negative log-likelihood.
static void indent(ostringstream &buf, int indent_level)
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 input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
class to compute the Cholesky decomposition of a matrix
bool Invert(M &m) const
place the inverse into m
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
void clearValueAndShapeDirty() const
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=nullptr, bool valueOnly=false) const
Test whether we depend on (ie, are served by) any object in the specified collection.
void setOperMode(OperMode mode, bool recurseADirty=true)
Set the operation mode of this node.
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
RooArgSet * getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
virtual std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const
const RefCountList_t & servers() const
List of all servers of this object.
void removeStringAttribute(const Text_t *key)
Delete a string attribute with a given key.
RooArgSet * getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
RooAbsCache * getCache(Int_t index) const
Return registered cache object by index.
const RefCountList_t & clients() const
List of all clients of this object.
bool isValueDirty() const
virtual void applyWeightSquared(bool flag)
Disables or enables the usage of squared weights.
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
void setProxyNormSet(const RooArgSet *nset)
Forward a change in the cached normalization argset to all the registered proxies.
void branchNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=nullptr, bool recurseNonDerived=false) const
Fill supplied list with all branch nodes of the arg tree starting with ourself as top node.
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
RefCountList_t _serverList
RooArgSet * getComponents() const
Create a RooArgSet with all components (branch nodes) of the expression tree headed by this object.
RooArgSet * getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Int_t numCaches() const
Return number of registered caches.
RooAbsArg * findServer(const char *name) const
Return server of this with name name. Returns nullptr if not found.
OperMode operMode() const
Query the operation mode of this node.
RooAbsArg * _owner
! Pointer to owning RooAbsArg
void setInterpolationOrder(Int_t order)
Set interpolation order of RooHistFunct representing cache histogram.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
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.
Int_t getSize() const
Return the number of elements in the collection.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
RooAbsArg * first() const
RooAbsCollection * selectByName(const char *nameList, bool verbose=false) const
Create a subset of the current collection, consisting only of those elements with names matching the ...
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
std::string contentsString() const
Return comma separated list of contained object names as STL string.
RooAbsArg * find(const char *name) const
Find object with given name in list.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
virtual void setExpectedData(bool)
virtual RooDataSet * generate(double nEvents=0, bool skipInit=false, bool extendedMode=false)
Generate the specified number of events with nEvents>0 and and return a dataset containing the genera...
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
Normalization set with for above integral.
~CacheElem() override
Destructor of normalization cache element.
RooAbsGenContext * _genContext
GenSpec * prepareMultiGen(const RooArgSet &whatVars, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none())
Prepare GenSpec configuration object for efficient generation of multiple datasets from identical spe...
virtual bool syncNormalization(const RooArgSet *dset, bool adjustProxies=true) const
Verify that the normalization integral cached with this PDF is valid for given set of normalization o...
int calcSumW2CorrectedCovariance(RooMinimizer &minimizer, RooAbsReal &nll) const
Apply correction to errors and covariance matrix.
double getNorm(const RooArgSet &nset) const
Get normalisation term needed to normalise the raw values returned by getVal().
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
RooObjCacheManager _normMgr
std::unique_ptr< RooNumGenConfig > _specGeneratorConfig
! MC generator configuration specific for this object
double getValV(const RooArgSet *set=nullptr) const override
Return current value, normalized by integrating over the observables in nset.
RooAbsReal * createChi2(RooDataHist &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) override
Create a from a histogram and this function.
bool _selectComp
Component selection flag for RooAbsPdf::plotCompOn.
virtual void generateEvent(Int_t code)
Interface for generation of an event using the algorithm corresponding to the specified code.
void logBatchComputationErrors(RooSpan< const double > &outputs, std::size_t begin) const
Scan through outputs and fix+log all nans and negative values.
RooSpan< const double > getLogProbabilities(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
Compute the log-likelihoods for all events in the requested batch.
void setGeneratorConfig()
Remove the specialized numeric MC generator configuration associated with this object.
virtual void resetErrorCounters(Int_t resetValue=10)
Reset error counter to given value, limiting the number of future error messages for this pdf to 'res...
static int verboseEval()
Return global level of verbosity for p.d.f. evaluations.
bool isActiveNormSet(RooArgSet const *normSet) const
Checks if normSet is the currently active normalization set of this PDF, meaning is exactly the same ...
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
virtual RooAbsGenContext * binnedGenContext(const RooArgSet &vars, bool verbose=false) const
Return a binned generator context.
RooAbsReal * createScanCdf(const RooArgSet &iset, const RooArgSet &nset, Int_t numScanBins, Int_t intOrder)
TString _normRange
Normalization range.
virtual bool isDirectGenSafe(const RooAbsArg &arg) const
Check if given observable can be safely generated using the pdfs internal generator mechanism (if tha...
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList={})
Construct representation of -log(L) of PDF with given dataset.
Int_t * randomizeProtoOrder(Int_t nProto, Int_t nGen, bool resample=false) const
Return lookup table with randomized order for nProto prototype events.
virtual RooFitResult * fitTo(RooAbsData &data, const RooLinkedList &cmdList={})
Fit PDF to given dataset.
void setNormRange(const char *rangeName)
~RooAbsPdf() override
Destructor.
RooArgSet const * _normSet
Normalization integral (owned by _normMgr)
RooFitResult * chi2FitTo(RooDataHist &data, const RooLinkedList &cmdList) override
Calls RooAbsPdf::createChi2(RooDataSet& data, const RooLinkedList& cmdList) and returns fit result.
RooNumGenConfig * specialGeneratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
virtual RooPlot * paramOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Add a box with parameter values (and errors) to the specified frame.
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
virtual bool selfNormalized() const
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print multi line detailed information of this RooAbsPdf.
virtual RooDataHist * generateBinned(const RooArgSet &whatVars, double nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none()) const
As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,...
Int_t _traceCount
Number of traces remaining to print.
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
int calcAsymptoticCorrectedCovariance(RooMinimizer &minimizer, RooAbsData const &data)
Use the asymptotically correct approach to estimate errors in the presence of weights.
void setTraceCounter(Int_t value, bool allNodes=false)
Reset trace counter to given value, limiting the number of future trace messages for this pdf to 'val...
Int_t _errorCount
Number of errors remaining to print.
RooAbsReal * createCdf(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Create a cumulative distribution function of this p.d.f in terms of the observables listed in iset.
Int_t _negCount
Number of negative probablities remaining to print.
std::unique_ptr< RooFitResult > minimizeNLL(RooAbsReal &nll, RooAbsData const &data, MinimizerConfig const &cfg)
Minimizes a given NLL variable by finding the optimal parameters with the RooMinimzer.
virtual const RooAbsReal * getNormObj(const RooArgSet *set, const RooArgSet *iset, const TNamed *rangeName=nullptr) const
Return pointer to RooAbsReal object that implements calculation of integral over observables iset in ...
void setActiveNormSet(RooArgSet const *normSet) const
Setter for the _normSet member, which should never be set directly.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Analytical integral with normalization (see RooAbsReal::analyticalIntegralWN() for further informatio...
void setNormRangeOverride(const char *rangeName)
virtual RooDataSet * generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents)
Special generator interface for generation of 'global observables' – for RooStats tools.
double normalizeWithNaNPacking(double rawVal, double normVal) const
virtual RooAbsGenContext * autoGenContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false, bool autoBinned=true, const char *binnedTag="") const
RooArgSet * getAllConstraints(const RooArgSet &observables, RooArgSet &constrainedParams, bool stripDisconnected=true, bool removeConstraintsFromPdf=false) const
This helper function finds and collects all constraints terms of all component p.d....
const RooNumGenConfig * getGeneratorConfig() const
Return the numeric MC generator configuration used for this object.
virtual void initGenerator(Int_t code)
Interface for one-time initialization to setup the generator for the specified code.
virtual ExtendMode extendMode() const
Returns ability of PDF to provide extended likelihood terms.
RooAbsPdf()
Default constructor.
bool traceEvalPdf(double value) const
Check that passed value is positive and not 'not-a-number'.
static RooNumGenConfig * defaultGeneratorConfig()
Returns the default numeric MC generator configuration for all RooAbsReals.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
The cache manager.
void printValue(std::ostream &os) const override
Print value of p.d.f, also print normalization integral that was last used, if any.
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false) const
Interface function to create a generator context from a p.d.f.
static TString _normRangeOverride
static Int_t _verboseEval
double extendedTerm(double sumEntries, double expected, double sumEntriesW2=0.0, bool doOffset=false) const
virtual Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK=true) const
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
virtual RooAbsPdf * createProjection(const RooArgSet &iset)
Return a p.d.f that represent a projection of this p.d.f integrated over given observables.
virtual double getLogVal(const RooArgSet *set=nullptr) const
Return the log of the current value with given normalization An error message is printed if the argum...
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none(), const RooCmdArg &arg9=RooCmdArg::none(), const RooCmdArg &arg10=RooCmdArg::none()) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
bool hasRange(const char *name) const override
Check if variable has a binning with given name.
std::pair< double, double > getRange(const char *name=nullptr) const
Get low and high bound of the variable.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooDataHist * fillDataHist(RooDataHist *hist, const RooArgSet *nset, double scaleFactor, bool correctForBinVolume=false, bool showProgress=false) const
Fill a RooDataHist with values sampled from this function at the bin centers.
void plotOnCompSelect(RooArgSet *selNodes) const
Helper function for plotting of composite p.d.fs.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsReal * createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create an object that represents the integral of the function over one or more observables std::liste...
bool plotSanityChecks(RooPlot *frame) const
Utility function for plotOn(), perform general sanity check on frame to ensure safe plotting operatio...
RooDerivative * derivative(RooRealVar &obs, Int_t order=1, double eps=0.001)
Return function representing first, second or third order derivative of this function.
RooAbsReal * createIntRI(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Utility function for createRunningIntegral.
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
RooFitResult * chi2FitDriver(RooAbsReal &fcn, RooLinkedList &cmdList)
Internal driver function for chi2 fits.
virtual RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
A buffer for reading values from trees.
double _value
Cache for current value of object.
virtual double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
TString integralNameSuffix(const RooArgSet &iset, const RooArgSet *nset=nullptr, const char *rangeName=nullptr, bool omitEmpty=false) const
Construct std::string with unique suffix name to give to integral object that encodes integrated obse...
virtual double evaluate() const =0
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
void logEvalError(const char *message, const char *serverValueString=nullptr) const
Log evaluation error message.
const RooNumIntConfig * getIntegratorConfig() const
Return the numeric integration configuration used for this object.
virtual bool isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
virtual double offset() const
RooAddition calculates the sum of a set of RooAbsReal terms, or when constructed with two sets,...
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.
RooBinnedGenContext is an efficient implementation of the generator context specific for binned pdfs.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
RooCachedReal is an implementation of RooAbsCachedReal that can cache any external RooAbsReal input f...
void setCacheSource(bool flag)
RooChi2Var implements a simple calculation from a binned dataset and a PDF.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
void setInt(Int_t idx, Int_t value)
Int_t getInt(Int_t idx) const
void setString(Int_t idx, const char *value)
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
static void stripCmdList(RooLinkedList &cmdList, const char *cmdsToPurge)
Utility function that strips command names listed (comma separated) in cmdsToPurge from cmdList.
bool defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
void allowUndefined(bool flag=true)
If flag is true the processing of unrecognized RooCmdArgs is not considered an error.
The RooDataHist is a container class to hold N-dimensional binned data.
double weight(std::size_t i) const
Return weight of i-th bin.
void set(std::size_t binNumber, double weight, double wgtErr)
Set bin content of bin that was last loaded with get(std::size_t).
const RooArgSet * get() const override
Get bin centre of current bin.
double sumEntries() const override
Sum the weights of all bins.
RooDataSet is a container class to hold unbinned data.
void add(const RooArgSet &row, double weight=1.0, double weightError=0.0) override
Add one ore more rows of data.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
void compileServers(RooAbsArg &arg, RooArgSet const &normSet)
RooAbsReal that wraps RooAbsL likelihoods for use in RooFit outside of the RooMinimizer context.
Class RooGenContext implement a universal generator context for all RooAbsPdf classes that do not hav...
Switches the message service to a different level while the instance is alive.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
virtual void Add(TObject *arg)
TObject * FindObject(const char *name) const override
Return pointer to obejct with given name.
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
int hesse()
Execute HESSE.
RooFitResult * save(const char *name=nullptr, const char *title=nullptr)
Save and return a RooFitResult snapshot of current minimizer status.
void applyCovarianceMatrix(TMatrixDSym const &V)
Apply results of given external covariance matrix.
static const char * str(const TNamed *ptr)
Return C++ string corresponding to given TNamed pointer.
Class RooNumCdf is an implementation of RooNumRunningInt specialized to calculate cumulative distribu...
RooNumGenConfig holds the configuration parameters of the various numeric integrators used by RooReal...
static RooNumGenConfig & defaultConfig()
Return reference to instance of default numeric integrator configuration object.
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
void sterilize() override
Clear the cache payload but retain slot mapping w.r.t to normalization and integration sets.
A RooPlot is a plot frame and a container for graphics objects within that frame.
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
double getFitRangeNEvt() const
Return the number of events in the fit range.
const RooArgSet * getNormVars() const
RooAbsRealLValue * getPlotVar() const
void updateNormVars(const RooArgSet &vars)
Install the given set of observables are reference normalization variables for this frame.
double getFitRangeBinW() const
Return the bin width that is being used to normalise the PDF.
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
Class RooProjectedPdf is a RooAbsPdf implementation that represent a projection of a given input p....
static UInt_t integer(UInt_t max, TRandom *generator=randomGenerator())
Return an integer uniformly distributed from [0,n-1].
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
RooRealVar represents a variable that can be changed from the outside.
TString * format(const RooCmdArg &formatArg) const
Format contents of RooRealVar for pretty printing on RooPlot parameter boxes.
void setRange(const char *name, double min, double max)
Set a fit or plotting range.
void setBins(Int_t nBins, const char *name=nullptr)
Create a uniform binning under name 'name' for this variable.
Container_t::const_iterator begin() const
Iterator over contained objects.
Container_t::const_iterator end() const
End of contained objects.
std::size_t size() const
Number of contained objects (neglecting the ref count).
A simple container to hold a batch of data values.
constexpr std::span< T >::pointer data() const
constexpr std::span< T >::size_type size() const noexcept
RooXYChi2Var implements a simple chi^2 calculation from an unbinned dataset with values x,...
TMatrixTSym< Element > & Similarity(const TMatrixT< Element > &n)
Calculate B * (*this) * B^T , final matrix will be (nrowsb x nrowsb) This is a similarity transform w...
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 * ClassName() const
Returns name of class to which the object belongs.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
A Pave (see TPave) with text, lines or/and boxes inside.
virtual Int_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
void ToLower()
Change string to lower-case.
void Clear()
Clear string without changing its capacity.
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
RooCmdArg SupNormSet(const RooArgSet &nset)
RooCmdArg WeightVar(const char *name, bool reinterpretAsWeight=false)
RooCmdArg Hesse(bool flag=true)
RooCmdArg ModularL(bool flag=false)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg BatchMode(std::string const &batchMode="cpu")
RooCmdArg NormRange(const char *rangeNameList)
RooCmdArg Range(const char *rangeName, bool adjustNorm=true)
RooCmdArg Normalization(double scaleFactor)
RVec< PromoteType< T > > abs(const RVec< T > &v)
RVec< PromoteType< T > > round(const RVec< T > &v)
RVec< PromoteType< T > > log(const RVec< T > &v)
void swap(RDirectoryEntry &e1, RDirectoryEntry &e2) noexcept
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
void init()
Inspect hardware capabilities, and load the optimal library for RooFit computations.
std::unique_ptr< RooAbsReal > createNLL(std::unique_ptr< RooAbsPdf > &&pdf, RooAbsData &data, std::unique_ptr< RooAbsReal > &&constraints, std::string const &rangeName, RooArgSet const &projDeps, bool isExtended, double integrateOverBinsPrecision, RooFit::BatchModeOption batchMode, RooFit::OffsetMode offset, bool takeGlobalObservablesFromData)
std::unique_ptr< T > compileForNormSet(T const &arg, RooArgSet const &normSet)
std::string & defaultBatchMode()
Get a handle on the default BatchMode option that is used when creating likelihoods.
std::unique_ptr< RooAbsL > buildLikelihood(RooAbsPdf *pdf, RooAbsData *data, RooAbsL::Extended extended=RooAbsL::Extended::Auto, ConstrainedParameters constrained_parameters={}, ExternalConstraints external_constraints={}, GlobalObservables global_observables={}, std::string global_observables_tag={})
OffsetMode
For setting the offset mode with the Offset() command argument to RooAbsPdf::fitTo()
BatchModeOption
For setting the batch mode flag with the BatchMode() command argument to RooAbsPdf::fitTo()
std::unique_ptr< T > cloneTreeWithSameParameters(T const &arg, RooArgSet const *observables=nullptr)
Clone RooAbsArg object and reattach to original parameters.
RooArgSet selectFromArgSet(RooArgSet const &, std::string const &names)
Construct a RooArgSet of objects in a RooArgSet whose names match to those in the names string.
std::string getColonSeparatedNameString(RooArgSet const &argSet)
Create a string with all sorted names of RooArgSet elements separated by colons.
static constexpr double pc
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754.
Configuration struct for RooAbsPdf::minimizeNLL with all the default.
bool enableParallelGradient
bool enableParallelDescent
const RooArgSet * minosSet
std::string rangeName
Stores the configuration parameters for RooAbsTestStatistic.
std::string addCoefRangeName
bool takeGlobalObservablesFromData
double integrateOverBinsPrecision
RooFit::MPSplit interleave
This struct enables passing computation data around between elements of a computation graph.
std::vector< double > logProbabilities
Possibility to register log probabilities.
Optional parameter used in buildLikelihood(), see documentation there.
Optional parameter used in buildLikelihood(), see documentation there.
Optional parameter used in buildLikelihood(), see documentation there.
Config argument to RooMinimizer ctor.
bool enableParallelDescent
bool enableParallelGradient
static double packFloatIntoNaN(float payload)
Pack float into mantissa of a NaN.