121 std::vector<std::string> out;
124 out.push_back(
elem.val());
142 return data.components.size() == pdf->
indexCat().size();
155bool isNumber(
const std::string &str)
163 for (
size_t i = 0; i < str.size(); ++i) {
166 if (std::isdigit(
c)) {
204 if (!
p.has_child(
"name")) {
207 if (
auto n =
p.find(
"value"))
208 v.setVal(
n->val_double());
210 if (
auto n =
p.find(
"nbins"))
211 v.setBins(
n->val_int());
212 if (
auto n =
p.find(
"relErr"))
213 v.setError(
v.getVal() *
n->val_double());
214 if (
auto n =
p.find(
"err"))
215 v.setError(
n->val_double());
216 if (
auto n =
p.find(
"const")) {
217 v.setConstant(
n->val_bool());
219 v.setConstant(
false);
231 return &((*out)[
"parameters"]);
239 if (
auto node =
p.find(
"namespaces")) {
240 for (
const auto &ns : node->
children()) {
278 if (
auto seq = node.
find(
"dict")) {
279 for (
const auto &
attr :
seq->children()) {
283 if (
auto seq = node.
find(
"tags")) {
284 for (
const auto &
attr :
seq->children()) {
293 out.
add(*args,
true);
326 if (observables.
empty()) {
338 std::vector<RooAbsData *>
const &
data,
JSONNode &rootnode)
355 if (!var || !var->hasError()) {
390 "RooFitHS3: skipping parameter_stepwidths entry for unknown or non-real variable '" +
name +
"'.");
394 var->setError(
stepWidthNode.find(
"step_width")->val_double());
401 std::stringstream expression;
402 std::string classname(
ex.tclass->GetName());
403 size_t colon = classname.find_last_of(
':');
404 expression << (
colon < classname.size() ? classname.substr(
colon + 1) : classname);
407 for (
auto k :
ex.arguments) {
408 expression << (first ?
"::" +
name +
"(" :
",");
410 if (k ==
"true" || k ==
"false") {
411 expression << (k ==
"true" ?
"1" :
"0");
412 }
else if (!
p.has_child(k)) {
414 errMsg <<
"node '" <<
name <<
"' is missing key '" << k <<
"'";
416 }
else if (
p[k].is_seq()) {
426 expression <<
p[k].val();
430 return expression.str();
456template <
typename...
Keys_t>
459 return node.
find(
"misc",
"ROOT_internal", keys...);
510 if (it.first ==
"factory_tag" || it.first ==
"PROD_TERM_TYPE")
513 (*node)[
"dict"].set_map()[it.first] << it.second;
519 if (
attr ==
"SnapShot_ExtRefClone" ||
attr ==
"RooRealConstant_Factory_Object")
522 (*node)[
"tags"].set_seq().append_child() <<
attr;
542 for (
const auto &
p : node[
"axes"].
children()) {
548 errMsg <<
"The observable \"" <<
name <<
"\" could not be found in the workspace!";
571 std::string
const &
type =
p[
"type"].val();
572 if (
type ==
"binned") {
575 }
else if (
type ==
"unbinned") {
578 getObservables(workspace,
p, varlist);
581 auto &coords =
p[
"entries"];
582 if (!coords.is_seq()) {
586 if (
p.has_child(
"weights")) {
587 auto &weights =
p[
"weights"];
588 if (coords.num_children() != weights.num_children()) {
591 for (
auto const &weight : weights.children()) {
596 for (
auto const &point : coords.children()) {
597 if (!point.is_seq()) {
599 errMsg <<
"coordinate point '" << i <<
"' is not a list!";
602 if (point.num_children() != varlist.
size()) {
606 for (
auto const &
pointj : point.children()) {
621 std::stringstream
ss;
622 ss <<
"RooJSONFactoryWSTool() failed to create dataset " <<
name << std::endl;
644 const std::vector<std::unique_ptr<RooAbsData>> &datasets)
657 mc->SetWS(workspace);
661 throw std::runtime_error(
"likelihood node not found!");
663 if (!
nllNode->has_child(
"distributions")) {
664 throw std::runtime_error(
"likelihood node has no distributions attached!");
666 if (!
nllNode->has_child(
"data")) {
667 throw std::runtime_error(
"likelihood node has no data attached!");
671 for (
auto &
nameNode : (*nllNode)[
"aux_distributions"].children()) {
677 for (
auto &
nameNode : (*nllNode)[
"data"].children()) {
679 for (
const auto &
d : datasets) {
682 observables.
add(*
d->get(),
true);
685 if (
nameNode.val() !=
"0" && !found)
686 throw std::runtime_error(
"dataset '" +
nameNode.val() +
"' cannot be found!");
704 std::map<std::string, RooAbsPdf *>
pdfMap;
728 mc->SetParametersOfInterest(
readArgSet(
"parameters_of_interest"));
729 mc->SetObservables(observables);
740 for (
auto &domain :
analysisNode[
"domains"].children()) {
744 for (
auto &var : (*thisDomain)[
"axes"].children()) {
753 for (
const auto &
p : pars) {
754 if (
mc->GetParametersOfInterest()->find(*
p))
763 mc->SetGlobalObservables(globs);
764 mc->SetNuisanceParameters(
nps);
767 if (
auto found =
mcAuxNode->find(
"combined_data_name")) {
792 std::vector<int> indices;
794 for (
auto &
n :
info[
"indices"].children()) {
795 indices.push_back(
n.val_int());
799 std::map<std::string, RooAbsPdf *>
pdfMap;
826 std::vector<int> indices;
827 for (
auto &
n :
info[
"indices"].children()) {
828 indices.push_back(
n.val_int());
830 if (indices.size() != labels.size()) {
835 std::map<std::string, std::unique_ptr<RooAbsData>>
dsMap;
842 std::unique_ptr<RooAbsData> &
component = *std::find_if(
843 datasets.begin(), datasets.end(), [&](
auto &
d) { return d && d->GetName() == componentName; });
853 datasets.emplace_back(std::move(
combined));
860 std::sort(
coll.
begin(),
coll.
end(), [](
auto &
l,
auto &
r) { return strcmp(l->GetName(), r->GetName()) < 0; });
885 error(
"unable to stream collection " + std::string(
coll.GetName()) +
" to " + node.
key());
928 if (str.empty() || !(std::isalpha(str[0]) || str[0] ==
'_')) {
935 if (!(std::isalnum(
c) ||
c ==
'_')) {
947 std::stringstream
ss;
948 ss <<
"RooJSONFactoryWSTool() name '" <<
name <<
"' is not valid!" << std::endl
949 <<
"Sanitize names by setting RooJSONFactoryWSTool::config().allowSanitizeNames = true." << std::endl;
976 if (
const auto &node = vars->find(
objname)) {
1046 var[
"value"] <<
cv->getVal();
1047 var[
"const"] <<
true;
1049 var[
"value"] <<
rrv->getVal();
1051 var[
"const"] <<
rrv->isConstant();
1053 var[
"min"] <<
rrv->getMin();
1054 var[
"max"] <<
rrv->getMax();
1057 var[
"nbins"] <<
rrv->getBins();
1083 const std::string &formula)
1121 for (
auto const &
item :
simPdf->indexCat()) {
1127 child[
"index_cat"] <<
simPdf->indexCat().GetName();
1129 child[
"distributions"].set_seq();
1130 for (
auto const &
item :
simPdf->indexCat()) {
1131 child[
"distributions"].append_child() <<
simPdf->getPdf(
item.first.c_str())->GetName();
1143 auto &
collectionNode = (*_rootnodeOutput)[
dynamic_cast<RooAbsPdf const *
>(&func) ?
"distributions" :
"functions"];
1152 auto it = exporters.find(cl);
1153 if (it != exporters.end()) {
1154 for (
auto &exp : it->second) {
1157 if (!exp->exportObject(
this, &func,
elem)) {
1167 if (exp->autoExportDependants()) {
1180 const auto &dict = exportKeys.find(cl);
1181 if (dict == exportKeys.end()) {
1182 std::cerr <<
"unable to export class '" << cl->
GetName() <<
"' - no export keys available!\n"
1183 <<
"there are several possible reasons for this:\n"
1184 <<
" 1. " << cl->
GetName() <<
" is a custom class that you or some package you are using added.\n"
1186 <<
" is a ROOT class that nobody ever bothered to write a serialization definition for.\n"
1187 <<
" 3. something is wrong with your setup, e.g. you might have called "
1188 "RooFit::JSONIO::clearExportKeys() and/or never successfully read a file defining these "
1189 "keys with RooFit::JSONIO::loadExportKeys(filename)\n"
1190 <<
"either way, please make sure that:\n"
1191 <<
" 3: you are reading a file with export keys - call RooFit::JSONIO::printExportKeys() to "
1192 "see what is available\n"
1193 <<
" 2 & 1: you might need to write a serialization definition yourself. check "
1194 "https://root.cern/doc/master/group__roofit__dev__docs__hs3.html to "
1195 "see how to do this!\n";
1199 elem[
"type"] << dict->second.type;
1203 for (
size_t i = 0; i <
nprox; ++i) {
1209 std::string
pname(
p->name());
1210 if (
pname[0] ==
'!')
1213 auto k = dict->second.proxies.find(
pname);
1214 if (k == dict->second.proxies.end()) {
1215 std::cerr <<
"failed to find key matching proxy '" <<
pname <<
"' for type '" << dict->second.type
1216 <<
"', encountered in '" << func.
GetName() <<
"', skipping" << std::endl;
1221 if (k->second.empty())
1231 elem[k->second] <<
r->absArg()->GetName();
1239 std::cerr <<
"unable to locate server of " << func.
GetName() << std::endl;
1277 std::stringstream
ss;
1278 ss <<
"RooJSONFactoryWSTool() function node " +
name +
" is not a map!";
1283 if (!prefix.empty())
1285 if (!
p.has_child(
"type")) {
1286 std::stringstream
ss;
1287 ss <<
"RooJSONFactoryWSTool() no type given for function '" <<
name <<
"', skipping." << std::endl;
1300 auto it = importers.find(
functype);
1302 if (it != importers.end()) {
1303 for (
auto &
imp : it->second) {
1305 ok =
imp->importArg(
this,
p);
1306 }
catch (
const std::exception &
e) {
1307 std::stringstream
ss;
1308 const auto *ptr =
imp.get();
1309 ss <<
"RooJSONFactoryWSTool() failed. The importer " <<
typeid(*ptr).name()
1310 <<
" emitted and error: " <<
e.what() << std::endl;
1320 std::string expression = ::generate(
expr->second,
p,
this);
1322 std::stringstream
ss;
1323 ss <<
"RooJSONFactoryWSTool() failed to create " <<
expr->second.tclass->GetName() <<
" '" <<
name
1324 <<
"', skipping. expression was\n"
1325 << expression << std::endl;
1329 std::stringstream
ss;
1330 ss <<
"RooJSONFactoryWSTool() no handling for type '" <<
functype <<
"' implemented, skipping."
1332 <<
"there are several possible reasons for this:\n"
1333 <<
" 1. " <<
functype <<
" is a custom type that is not available in RooFit.\n"
1335 <<
" is a ROOT class that nobody ever bothered to write a deserialization definition for.\n"
1336 <<
" 3. something is wrong with your setup, e.g. you might have called "
1337 "RooFit::JSONIO::clearFactoryExpressions() and/or never successfully read a file defining "
1338 "these expressions with RooFit::JSONIO::loadFactoryExpressions(filename)\n"
1339 <<
"either way, please make sure that:\n"
1340 <<
" 3: you are reading a file with factory expressions - call "
1341 "RooFit::JSONIO::printFactoryExpressions() "
1342 "to see what is available\n"
1343 <<
" 2 & 1: you might need to write a deserialization definition yourself. check "
1344 "https://root.cern/doc/master/group__roofit__dev__docs__hs3.html to see "
1353 std::stringstream err;
1354 err <<
"something went wrong importing function '" <<
name <<
"'.";
1388 if (binning.isUniform()) {
1393 auto &edges =
obsNode[
"edges"].set_seq();
1394 edges.append_child() << binning.binLow(0);
1395 for (
int i = 0; i < binning.numBins(); ++i) {
1396 edges.append_child() << binning.binHigh(i);
1438 for (std::size_t i = 0; i <
n; ++i) {
1439 double w = contents[i];
1465 if (!std::isalpha(
in[0])) {
1470 oocoutW(
nullptr, IO) <<
"RooFitHS3: changed '" <<
in <<
"' to '" << out <<
"' to become a valid name";
1479 auto &labels = node[
"labels"].
set_seq();
1480 auto &indices = node[
"indices"].
set_seq();
1482 for (
auto const &
item : cat) {
1484 indices.append_child() <<
item.second;
1506 " has several category observables!");
1571 " has several category observables!");
1589 if (
auto weightVar = variables.find(
"weightVar")) {
1590 variables.remove(*weightVar);
1595 output[
"type"] <<
"binned";
1608 if (
data.isWeighted() && variables.size() == 1) {
1610 auto &
x =
static_cast<RooRealVar const &
>(*variables[0]);
1611 std::vector<double> contents;
1613 for (; i <
data.numEntries(); ++i) {
1615 if (
x.getBin() != i)
1617 contents.push_back(
data.weight());
1619 if (i ==
x.getBins())
1622 output[
"type"] <<
"binned";
1631 output[
"type"] <<
"unbinned";
1637 auto &coords =
output[
"entries"].set_seq();
1640 for (
int i = 0; i <
data.numEntries(); ++i) {
1642 coords.append_child().fill_seq(variables, [](
auto x) {
return static_cast<RooRealVar *
>(
x)->getVal(); });
1644 if (
data.isWeighted()) {
1646 if (
data.weight() != 1.)
1669 if (node.has_child(
"edges")) {
1670 std::vector<double> edges;
1671 for (
auto const &
bound : node[
"edges"].children()) {
1672 edges.push_back(
bound.val_double());
1674 auto obs = std::make_unique<RooRealVar>(node[
"name"].val().c_str(), node[
"name"].val().c_str(), edges[0],
1675 edges[edges.size() - 1]);
1676 RooBinning bins(obs->getMin(), obs->getMax());
1677 for (
auto b : edges) {
1680 obs->setBinning(bins);
1683 auto obs = std::make_unique<RooRealVar>(node[
"name"].val().c_str(), node[
"name"].val().c_str(),
1684 node[
"min"].val_double(), node[
"max"].val_double());
1685 obs->setBins(node[
"nbins"].val_int());
1704std::unique_ptr<RooDataHist>
1707 if (!
n.has_child(
"contents"))
1710 JSONNode const &contents =
n[
"contents"];
1716 if (
n.has_child(
"errors")) {
1724 std::stringstream
errMsg;
1725 errMsg <<
"inconsistent bin numbers: contents=" << contents.
num_children() <<
", bins=" << bins.size();
1728 auto dh = std::make_unique<RooDataHist>(
name,
name, vars);
1737 for (
auto const &err :
errors->children()) {
1766 std::stringstream
ss;
1767 ss <<
"RooJSONFactoryWSTool() node '" <<
name <<
"' is not a map, skipping.";
1768 oocoutE(
nullptr, InputArguments) <<
ss.str() << std::endl;
1771 if (
config().importNoDomainParametersAsRooConstVars && !
_domains->hasVariable(
name.c_str())) {
1772 if (!
p.has_child(
"value")) {
1794 for (
const auto &
p :
varsNode->children()) {
1798 if (
auto seq =
n.find(
"functions")) {
1799 for (
const auto &
p :
seq->children()) {
1803 if (
auto seq =
n.find(
"distributions")) {
1804 for (
const auto &
p :
seq->children()) {
1814 auto pdf =
mc.GetPdf();
1817 for (std::size_t i = 0; i < std::max(
combDataSets.size(), std::size_t(1)); ++i) {
1833 std::map<std::string, std::string>
mapping;
1849 auto pdf =
mc.GetPdf();
1858 nllNode[
"distributions"].set_seq();
1864 for (
auto const &
item :
simPdf->indexCat()) {
1866 nllNode[
"distributions"].append_child() <<
simPdf->getPdf(
item.first)->GetName();
1871 nllNode[
"distributions"].append_child() << it.first;
1872 nllNode[
"data"].append_child() << it.second;
1876 nllNode[
"distributions"].append_child() << pdf->GetName();
1877 nllNode[
"data"].append_child() << 0;
1880 if (
mc.GetExternalConstraints()) {
1883 for (
const auto &
constr : *
mc.GetExternalConstraints()) {
1889 if (!args || !args->size())
1892 std::vector<std::string> names;
1893 names.reserve(args->size());
1895 names.push_back(arg->GetName());
1896 std::sort(names.begin(), names.end());
1900 writeList(
"parameters_of_interest",
mc.GetParametersOfInterest());
1905 if (!args || args->empty())
1937 _domains = std::make_unique<RooFit::JSONIO::Detail::Domains>();
1942 std::vector<RooAbsPdf *>
allpdfs;
1944 if (!arg->hasClients()) {
1945 if (
auto *pdf =
dynamic_cast<RooAbsPdf *
>(arg)) {
1955 std::vector<RooAbsReal *>
allfuncs;
1957 if (!arg->hasClients()) {
1958 if (
auto *func =
dynamic_cast<RooAbsReal *
>(arg)) {
1972 std::vector<RooAbsData *>
alldata;
1979 std::vector<RooJSONFactoryWSTool::CombinedData>
combData;
1982 if (!
data.components.empty())
1983 combData.push_back(
data);
2008 for (
const auto &pdf :
allpdfs) {
2009 if (pdf->dependsOn(*arg)) {
2020 if (
name !=
"default_values") {
2039 std::stringstream
ss(s);
2051 std::stringstream
ss(s);
2062 std::stringstream
ss;
2074 std::stringstream
ss;
2086 std::unique_ptr<JSONTree> tree = JSONTree::create();
2089 auto &metadata =
n[
"metadata"].set_map();
2128 std::ofstream out(
filename.c_str());
2157 std::ofstream out(
filename.c_str());
2169 for (
auto &
a :
seq->children()) {
2180 auto &
tags = (*node)[
"tags"];
2190 if (
auto dict =
attrNode->find(
"dict")) {
2191 if (
auto *
a = dict->find(
attrib)) {
2199 const std::string &
value)
2202 auto &dict = (*node)[
"dict"];
2220 auto metadata =
n.find(
"metadata");
2221 if (!metadata || !metadata->find(
"hs3_version")) {
2222 std::stringstream
ss;
2223 ss <<
"The HS3 version is missing in the JSON!\n"
2224 <<
"Please include the HS3 version in the metadata field, e.g.:\n"
2225 <<
" \"metadata\" :\n"
2236 _domains = std::make_unique<RooFit::JSONIO::Detail::Domains>();
2237 if (
auto domains =
n.find(
"domains")) {
2250 if (
auto seq =
n.find(
"functions")) {
2251 if (
seq->is_seq()) {
2253 for (
const auto &
p :
seq->children()) {
2258 if (
auto seq =
n.find(
"distributions")) {
2259 if (
seq->is_seq()) {
2261 for (
const auto &
p :
seq->children()) {
2275 for (
const auto &var :
snsh[
"parameters"].children()) {
2301 std::vector<std::unique_ptr<RooAbsData>> datasets;
2303 for (
const auto &
p :
dataNode->children()) {
2318 for (
auto const &
d : datasets) {
2321 for (
auto const &obs : *
d->get()) {
2344 std::unique_ptr<JSONTree> tree = JSONTree::create(is);
2345 JSONNode const &rootnode = tree->rootnode();
2347 if (this->
workspace()->getSnapshot(
"default_values")) {
2378 std::unique_ptr<JSONTree> tree = JSONTree::create(is);
2379 JSONNode const &rootnode = tree->rootnode();
2407 if (
n.find(
"poi")) {
2410 std::string poi =
n.find(
"poi")->val();
2411 std::string
pdname =
n.find(
"pdfName")->val();
2422 bool isVariable =
true;
2425 if (
n.find(
"type")) {
2448 _domains = std::make_unique<RooFit::JSONIO::Detail::Domains>();
2449 if (
auto domains =
n.find(
"domains"))
2463 const auto &var =
snsh[
"parameters"].child(0);
2502 throw std::runtime_error(s);
2515 for (
char c : str) {
2520 case '(':
result +=
'_';
break;
2525 case '.':
result +=
"_dot_";
break;
2526 case '@':
result +=
"at";
break;
2527 case '-':
result +=
"minus";
break;
2528 case '/':
result +=
"_div_";
break;
2552 for (
auto *pdf : ws.
allPdfs()) {
2553 if (!pdf->hasClients()) {
2559 if (!func->hasClients()) {
2601 for (
auto *obj : list) {
2617 for (
auto *obj : *
data->get()) {
2621 for (
auto *
data :
tmpWS.allEmbeddedData()) {
2624 for (
auto *obj : *
data->get()) {
2632 std::cerr <<
"Warning: found snapshot that is not a RooArgSet, skipping\n";
2642 for (
auto *arg : *
snsh) {
2650 for (
auto *obj :
tmpWS.allGenericObjects()) {
2655 std::cerr <<
"Warning: object " << obj->GetName() <<
" is not TNamed, cannot rename.\n";
2666 for (
auto *obs :
mc->GetObservables()->get()) {
2671 for (
auto *poi :
mc->GetParametersOfInterest()->get()) {
2676 for (
auto *
nuis :
mc->GetNuisanceParameters()->get()) {
2681 for (
auto *
glob :
mc->GetGlobalObservables()->get()) {
2688 std::string
wsName = std::string{ws.
GetName()} +
"_sanitized";
std::unique_ptr< RooFit::Detail::JSONTree > varJSONString(const JSONNode &treeRoot)
double toDouble(const char *s)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t 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 filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void 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 child
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 attr
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
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
TClass * IsA() const override
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
RooFit::OwningPtr< 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...
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
const std::set< std::string > & attributes() const
const RefCountList_t & servers() const
List of all servers of this object.
const std::map< std::string, std::string > & stringAttributes() const
Int_t numProxies() const
Return the number of registered proxies.
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
A space to attach TBranches.
Abstract container object that can hold multiple RooAbsArg objects.
bool equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically-named contents.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
std::unique_ptr< RooArgSet > getAllConstraints(const RooArgSet &observables, RooArgSet &constrainedParams, bool stripDisconnected=true) const
This helper function finds and collects all constraints terms of all component p.d....
Abstract interface for proxy classes.
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
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...
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.
Abstract interface for RooAbsArg proxy classes.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Implements a RooAbsBinning in terms of an array of boundary values, posing no constraints on the choi...
bool addBoundary(double boundary)
Add bin boundary at given value.
Object to represent discrete states.
Represents a constant real-valued object.
Container class to hold N-dimensional binned data.
virtual JSONNode & set_map()=0
virtual JSONNode & append_child()=0
virtual children_view children()
virtual size_t num_children() const =0
virtual JSONNode & set_seq()=0
virtual bool is_seq() const =0
virtual bool is_map() const =0
virtual std::string key() const =0
JSONNode const * find(std::string const &key) const
static std::unique_ptr< JSONTree > create()
void readVariable(const RooRealVar &)
void writeJSON(RooFit::Detail::JSONNode &) const
static RooMsgService & instance()
Return reference to singleton instance.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
const RooAbsBinning & getBinning(const char *name=nullptr, bool verbose=true, bool createOnTheFly=false, bool shared=true) const override
Return binning definition with name.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
const RooAbsCategoryLValue & indexCat() const
< A class that holds configuration information for a model using a workspace as a store
Persistable container for RooFit projects.
TObject * obj(RooStringView name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
const RooArgSet * getSnapshot(const char *name) const
Return the RooArgSet containing a snapshot of variables contained in the workspace.
RooAbsPdf * pdf(RooStringView name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooArgSet argSet(RooStringView nameList) const
Return set of RooAbsArgs matching to given list of names.
RooArgSet allResolutionModels() const
Return set with all resolution model objects.
bool saveSnapshot(RooStringView, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of given parameters.
RooArgSet allPdfs() const
Return set with all probability density function objects.
std::list< RooAbsData * > allData() const
Return list of all dataset in the workspace.
RooLinkedList const & getSnapshots() const
std::list< TObject * > allGenericObjects() const
Return list of all generic objects in the workspace.
RooAbsReal * function(RooStringView name) const
Retrieve function (RooAbsReal) with given name. Note that all RooAbsPdfs are also RooAbsReals....
RooAbsArg * arg(RooStringView name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
const RooArgSet & components() const
RooArgSet allFunctions() const
Return set with all function objects.
RooFactoryWSTool & factory()
Return instance to factory tool.
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
bool loadSnapshot(const char *name)
Load the values and attributes of the parameters in the snapshot saved with the given name.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={})
Import a RooAbsArg object, e.g.
TClass instances represent classes, structs and namespaces in the ROOT type system.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
RooCmdArg RecycleConflictNodes(bool flag=true)
RooConstVar & RooConst(double val)
RooCmdArg Silence(bool flag=true)
RooCmdArg Index(RooCategory &icat)
RooCmdArg WeightVar(const char *name="weight", bool reinterpretAsWeight=false)
RooCmdArg Import(const char *state, TH1 &histo)
std::string makeValidVarName(std::string const &in)
ImportExpressionMap & importExpressions()
ExportKeysMap & exportKeys()