46void addUnique(std::vector<std::string> &names, std::string
const &
name)
48 if (std::find(names.begin(), names.end(),
name) == names.end()) {
49 names.push_back(
name);
59void addNames(
JSONNode const &node, std::set<std::string> &out)
65 }
else if (isName(node)) {
66 out.insert(node.
val());
72std::vector<std::string> namesIn(
JSONNode const &node,
const char *key,
const char *field =
nullptr)
74 std::vector<std::string> out;
76 for (
JSONNode const &entry : list->children()) {
77 JSONNode const *
name = field ? entry.find(field) : &entry;
79 out.push_back(
name->val());
88std::vector<std::string> namedConstraints(HistFactoryDist
const &dist)
90 std::vector<std::string> out;
91 auto add =
overloaded{[&](ConstraintPdf
const &constraint) {
92 if (!constraint.legacyName) {
93 out.push_back(constraint.pdf.name);
96 [&](GammaConstraintPdfs
const &constraints) {
97 for (
auto const &pdf : constraints.pdfs) {
99 out.push_back(pdf->name);
103 [](
auto const &) {}};
104 for (Sample
const &sample :
dist.samples) {
106 std::visit(
overloaded{[](CustomModifier
const &) {}, [&](
auto const &
m) { std::visit(add,
m.constraint); }},
115std::vector<std::string> namedConstraints(
JSONNode const &dist)
117 std::vector<std::string> out;
119 for (
JSONNode const &sample : samples->children()) {
120 if (
JSONNode const *modifiers = sample.
find(
"modifiers")) {
122 for (std::string
const &constraint : namesIn(
modifier,
"constraints")) {
123 out.push_back(constraint);
133std::vector<std::string> componentsOf(
CombinedDist const &dist)
135 std::vector<std::string> out;
136 for (
auto const &component :
dist.components) {
137 out.push_back(component.ref.name);
143JSONNode const *genericNode(Distribution
const &dist,
const char *
type =
nullptr)
145 auto const *
generic = std::get_if<GenericObject>(&
dist.body);
146 return generic && (!
type ||
generic->type ==
type) ? generic->node : nullptr;
153 explicit Distributions(HS3Document
const &doc) :
_doc{doc}
155 for (Distribution
const &dist : doc.distributions) {
161 template <
class Body_t>
162 Body_t
const *
find(std::string
const &
name)
const
165 return found !=
_byName.end() ? std::get_if<Body_t>(&found->second->body) : nullptr;
172 return found !=
_byName.end() ? genericNode(*found->second,
type) : nullptr;
179 void addVariates(std::string
const &
name, std::set<std::string> &out, std::set<std::string> &visited)
const
181 if (!visited.insert(
name).second) {
184 if (
auto const *histFactory = find<HistFactoryDist>(
name)) {
185 for (BinnedAxis
const &axis : histFactory->axes) {
186 out.insert(axis.name);
189 auto addVariatesOf = [&](std::vector<std::string>
const &parts) {
190 for (std::string
const &part : parts) {
191 addVariates(part, out, visited);
194 if (
auto const *combined = find<CombinedDist>(
name)) {
195 addVariatesOf(componentsOf(*combined));
197 auto const *
generic = find<GenericObject>(
name);
198 if (!generic || !generic->node) {
201 JSONNode const &node = *
generic->node;
202 if (generic->type ==
"product_dist") {
203 addVariatesOf(namesIn(node,
"factors"));
204 }
else if (generic->type ==
"mixture_dist") {
205 addVariatesOf(namesIn(node,
"summands"));
206 }
else if (generic->type ==
"array_dist") {
207 if (
JSONNode const *components = node.
find(
"components")) {
208 for (
JSONNode const &component : components->children()) {
209 if (
JSONNode const *
x = component.find(
"x")) {
218 for (std::string
const &axis : namesIn(node,
"axes",
"name")) {
227 std::vector<std::string> likelihoodTerms(Likelihood
const &likelihood)
const
229 std::vector<std::string> terms;
230 auto add = [&](std::string
const &
name) {
232 if (
auto const *combined = find<CombinedDist>(
name)) {
233 for (std::string
const &component : componentsOf(*combined)) {
234 addUnique(terms, component);
236 }
else if (!
_byName.count(
name) && legacy !=
_doc.rooFit.combinedDistributions.end()) {
238 addUnique(terms, component.name);
241 addUnique(terms,
name);
244 for (LikelihoodTerm
const &term : likelihood.terms) {
245 add(term.distribution.name);
251 for (std::size_t i = 0; i < terms.size(); ++i) {
252 std::vector<std::string> constraints;
253 if (
auto const *histFactory = find<HistFactoryDist>(terms[i])) {
254 constraints = namedConstraints(*histFactory);
255 }
else if (
JSONNode const *generic = nodeOf(terms[i],
"histfactory_dist")) {
256 constraints = namedConstraints(*generic);
258 for (std::string
const &constraint : constraints) {
259 addUnique(terms, constraint);
267 std::map<std::string, Distribution const *>
_byName;
271using PartVariates = std::vector<std::pair<std::string, std::set<std::string>>>;
275void addShared(PartVariates
const &parts, std::string
const &
what, std::string
const &context,
276 std::vector<std::string> &messages)
278 std::map<std::string, std::vector<std::string>> partsOfVariate;
279 std::vector<std::string> order;
280 for (
auto const &[part, variates] : parts) {
281 for (std::string
const &variate : variates) {
282 auto &list = partsOfVariate[variate];
284 order.push_back(variate);
286 addUnique(list, part);
289 for (std::string
const &variate : order) {
290 auto const &list = partsOfVariate[variate];
291 if (list.size() < 2) {
295 for (std::size_t i = 0; i < list.size(); ++i) {
296 names += (i == 0 ?
"'" : (i + 1 == list.size() ?
"' and '" :
"', '")) + list[i];
298 messages.push_back(
"the variate '" + variate +
"' is shared by the " +
what +
" " + names +
"' of " + context);
303PartVariates componentAxes(HS3Document
const &doc,
CombinedData const &combined)
306 for (
auto const &component : combined.components) {
307 std::set<std::string> axes;
308 if (Data
const *found =
findByName(doc.data, component.ref.name)) {
310 [&](PointData
const &
data) {
311 for (ContinuousAxis
const &axis :
data.axes) {
312 axes.insert(axis.name);
315 [&](
auto const &
data) {
316 for (
auto const &axis :
data.axes) {
317 axes.insert(
nameOf(axis));
322 parts.emplace_back(component.ref.name, axes);
329int numDataEntries(HS3Document
const &doc, std::string
const &
name)
332 return data ?
static_cast<int>(
data->numEntries()) : 1;
339 Distributions distributions{doc};
340 std::set<std::string> variates;
341 std::set<std::string> visited;
343 distributions.addVariates(term.distribution.name, variates, visited);
344 if (
auto const *combined = distributions.find<
CombinedDist>(term.distribution.name)) {
345 variates.insert(combined->columns.begin(), combined->columns.end());
353 std::set<std::string> variates;
354 std::set<std::string> visited;
355 Distributions{doc}.addVariates(distribution, variates, visited);
361 std::map<std::string, std::set<std::string>> out;
363 if (
auto const *combined = std::get_if<CombinedData>(&
data.body)) {
364 std::map<std::string, int> counts;
365 for (
auto const &[component, axes] : componentAxes(doc, *combined)) {
366 for (std::string
const &axis : axes) {
367 if (++counts[axis] == 2) {
368 out[
data.name].insert(axis);
379 std::map<std::string, std::set<std::string>> out;
383 Distributions distributions{doc};
384 std::set<std::string> variates;
385 std::set<std::string> visited;
387 distributions.addVariates(dist.name, variates, visited);
390 for (std::string
const &column : columns) {
391 if (!variates.count(column)) {
392 out[dataset].insert(column);
401 Distributions distributions{doc};
402 std::vector<std::string> messages;
404 std::map<std::string, int> contributions;
406 std::map<std::string, std::set<std::string>> withoutData;
407 std::set<std::string> named;
409 std::set<std::string> expanding;
411 std::function<void(std::string
const &,
int, std::string
const &)> contribute =
412 [&](std::string
const &
name,
int entries, std::string
const &combined) {
413 contributions[
name] += entries;
415 withoutData[
name].insert(combined);
418 for (std::string
const &constraint : namedConstraints(*histFactory)) {
419 named.insert(constraint);
421 }
else if (
JSONNode const *generic = distributions.nodeOf(
name,
"histfactory_dist")) {
422 for (std::string
const &constraint : namedConstraints(*generic)) {
423 named.insert(constraint);
425 }
else if (
JSONNode const *product = distributions.nodeOf(
name,
"product_dist");
426 product && expanding.insert(
name).second) {
427 for (std::string
const &factor : namesIn(*product,
"factors")) {
428 contribute(factor, entries, combined);
430 expanding.erase(
name);
435 auto contributeCombined = [&](std::string
const &distName,
CombinedDist const &dist,
Data const *
data) {
436 auto const *combinedData =
data ? std::get_if<CombinedData>(&
data->body) :
nullptr;
437 for (
auto const &component : dist.components) {
440 auto const *dataComponent = combinedData->find(component.key);
441 entries = dataComponent ? numDataEntries(doc, dataComponent->ref.name) : 0;
442 if (!dataComponent && warnings) {
443 warnings->push_back(
"the component '" + component.ref.name +
"' of the combined distribution '" +
444 distName +
"' has no component in the data set '" +
data->name +
445 "' that the likelihood '" + likelihood.name +
446 "' pairs it with, so it does not contribute to the likelihood");
449 contribute(component.ref.name, entries, distName);
454 auto const *dataRef = std::get_if<DataRef>(&term.data);
456 std::string
const &
name = term.distribution.name;
458 ++contributions[
name];
459 contributeCombined(
name, *combined,
data);
461 contribute(
name,
data ? numDataEntries(doc,
data->name) : 1,
"");
465 contribute(aux.name, 1,
"");
467 for (std::string
const &constraint : named) {
468 const int n = contributions[constraint];
469 auto const ®ions = withoutData[constraint];
470 std::string inRegions;
471 for (std::string
const ®ion : regions) {
472 inRegions += (inRegions.empty() ?
"'" :
", '") + region +
"'";
475 messages.push_back(
"the constraint '" + constraint +
476 "' named by a modifier of a HistFactory channel contributes " + std::to_string(
n) +
477 " times to the likelihood '" + likelihood.name +
478 "', but it must contribute exactly once" +
479 (
n == 0 && !regions.empty() ?
" (it is a component of the combined distribution " +
480 inRegions +
" without data, which is no observation)"
482 }
else if (!regions.empty() && warnings) {
483 warnings->push_back(
"the constraint '" + constraint +
"' is a term of the likelihood '" + likelihood.name +
484 "' and also a component of the combined distribution " + inRegions +
485 " without data. It contributes once, as the term");
494 Distributions distributions{doc};
495 std::set<std::string> out;
498 auto const *dataRef = std::get_if<DataRef>(&term.data);
499 auto const *combinedData = dataRef ? find<CombinedData>(doc.
data, dataRef->name) :
nullptr;
500 auto const *dist = distributions.find<
CombinedDist>(term.distribution.name);
501 if (!dist || !combinedData) {
504 for (
auto const &component : dist->components) {
505 auto const *dataComponent = combinedData->
find(component.key);
506 if (dataComponent && numDataEntries(doc, dataComponent->ref.name) > 0) {
507 out.insert(component.ref.name);
517 Distributions distributions{doc};
518 std::vector<std::string> messages;
519 auto withVariates = [&](std::vector<std::string>
const &names) {
521 for (std::string
const &
name : names) {
522 std::set<std::string> visited;
523 distributions.addVariates(
name, parts.emplace_back(
name, std::set<std::string>{}).second, visited);
527 std::set<std::string> inLikelihoods;
530 inLikelihoods.insert(term.distribution.name);
533 inLikelihoods.insert(aux.name);
535 addShared(withVariates(distributions.likelihoodTerms(likelihood)),
"terms",
536 "the likelihood '" + likelihood.name +
"'", messages);
539 auto const *combined = std::get_if<CombinedDist>(&dist.body);
540 if (combined && !inLikelihoods.count(dist.name)) {
541 addShared(withVariates(componentsOf(*combined)),
"components",
"the combined_dist '" + dist.name +
"'",
546 std::map<std::string, std::set<std::string>>
const bookkeeping =
bookkeepingColumns(doc);
548 auto const *combined = std::get_if<CombinedData>(&
data.body);
552 PartVariates parts = componentAxes(doc, *combined);
553 if (
auto found = bookkeeping.find(
data.name); found != bookkeeping.end()) {
554 for (
auto &part : parts) {
555 for (std::string
const &column : found->second) {
556 part.second.erase(column);
560 addShared(parts,
"components",
"the combined data set '" +
data.name +
"'", messages);
570 std::map<std::string, std::map<std::string, std::string>> dropped;
571 std::set<std::string> labels;
576 std::vector<Data> copies;
577 auto hasEntries = [&](std::string
const &
name) {
580 return data &&
data->numEntries() > 0;
582 std::set<std::string> dataOfComponents;
584 std::set<std::string> termsToRemove;
586 auto const *combinedDist = find<CombinedDist>(doc.
distributions, term.distribution.name);
587 auto const *dataRef = std::get_if<DataRef>(&term.data);
588 auto *combined = dataRef ? find<CombinedData>(doc.
data, dataRef->name) :
nullptr;
589 if (!combinedDist || !combined) {
592 for (
auto const &component : combinedDist->components) {
593 if (component.key.size() != 1) {
596 std::string
const &label = component.key.front();
597 std::string
const &dist = component.ref.name;
599 std::find_if(likelihood.terms.begin(), likelihood.terms.end(), [&](
LikelihoodTerm const &other) {
600 return other.distribution.name == dist && std::holds_alternative<DataRef>(other.data);
602 if (ownTerm == likelihood.terms.end()) {
605 auto dataComponent = std::find_if(combined->components.begin(), combined->components.end(),
606 [&](
auto const &
c) { return c.key == component.key; });
607 if (dataComponent != combined->components.end() && hasEntries(dataComponent->ref.name)) {
610 out.
warnings.push_back(
"the distribution '" + dist +
"' is a component of '" + term.distribution.name +
611 "' without data and a term of the likelihood '" + likelihood.name +
612 "' with data. It is read as " +
613 (asChannels ?
"the component, with the data of the term." :
"the term only."));
615 DataRef termData = std::get<DataRef>(ownTerm->data);
616 if (!dataOfComponents.insert(termData.
name).second) {
618 const std::string copyName = dataRef->name +
"_" + label;
620 copies.push_back(*original);
621 copies.back().name = copyName;
622 termData.
name = copyName;
625 if (dataComponent != combined->components.end()) {
626 dataComponent->ref = termData;
628 combined->components.push_back({{label}, termData});
630 termsToRemove.insert(dist);
632 dropped[term.distribution.name][dist] = label;
633 labels.insert(label);
637 likelihood.terms.erase(
638 std::remove_if(likelihood.terms.begin(), likelihood.terms.end(),
639 [&](
LikelihoodTerm const &term) { return termsToRemove.count(term.distribution.name) > 0; }),
640 likelihood.terms.end());
642 doc.
data.insert(doc.
data.end(), copies.begin(), copies.end());
648 auto const *combinedDist = find<CombinedDist>(doc.
distributions, item.first);
649 for (
auto const &ref : item.second) {
650 std::string label = ref.name;
652 for (
auto const &component : combinedDist->components) {
653 if (component.ref.name == ref.name && component.key.size() == 1) {
654 label = component.key.front();
658 dropped[item.first][ref.name] = label;
659 labels.insert(label);
662 auto isLabel = [&](std::vector<std::string>
const &key) {
return key.size() == 1 && labels.count(key.front()); };
664 std::vector<LikelihoodTerm> added;
666 auto found = dropped.find(term.distribution.name);
667 if (found == dropped.end()) {
670 auto const *dataRef = std::get_if<DataRef>(&term.data);
671 auto const *combined = dataRef ? find<CombinedData>(doc.
data, dataRef->name) :
nullptr;
672 for (
auto const &item : found->second) {
673 std::string
const &dist = item.first;
674 std::string
const &label = item.second;
675 if (std::any_of(likelihood.terms.begin(), likelihood.terms.end(),
676 [&](
auto const &other) { return other.distribution.name == dist; })) {
679 if (
auto const *component = combined ? combined->find({label}) :
nullptr) {
680 added.push_back({{dist}, component->ref});
681 }
else if (std::none_of(likelihood.auxDistributions.begin(), likelihood.auxDistributions.end(),
682 [&](
auto const &ref) { return ref.name == dist; })) {
684 likelihood.auxDistributions.push_back({dist});
688 likelihood.terms.insert(likelihood.terms.end(), added.begin(), added.end());
691 if (
auto *combined = std::get_if<CombinedData>(&
data.body)) {
692 auto &components = combined->components;
693 for (
auto const &component : components) {
695 if (isLabel(component.key) && hasEntries(component.ref.name)) {
696 out.
data.insert(component.ref.name);
699 components.erase(std::remove_if(components.begin(), components.end(),
700 [&](
auto const &component) { return isLabel(component.key); }),
705 for (
auto &axis : domain.axes) {
706 if (
auto *categorical = std::get_if<CategoricalAxis>(&axis)) {
707 auto &categories = categorical->categories;
708 categories.erase(std::remove_if(categories.begin(), categories.end(),
709 [&](std::string
const &label) { return labels.count(label) > 0; }),
714 for (
auto const &droppedFrom : dropped) {
715 std::map<std::string, std::string>
const &components = droppedFrom.second;
716 for (
auto const &item : components) {
717 out.
terms.insert(item.first);
719 if (
auto *combinedDist = find<CombinedDist>(doc.
distributions, droppedFrom.first)) {
720 auto &all = combinedDist->components;
721 all.erase(std::remove_if(all.begin(), all.end(),
722 [&](
auto const &component) { return components.count(component.ref.name) > 0; }),
732 std::vector<std::string> errors;
733 auto soleVariateOf = [&](std::string
const &distribution, std::string
const &
what) {
734 std::set<std::string>
const variates =
variatesOf(doc, distribution);
735 if (variates.size() == 1) {
736 return *variates.begin();
738 errors.push_back(
"the variate of the distribution '" + distribution +
"', which " +
what +
739 " is paired with, can't be determined, since it doesn't have a single variate");
740 return std::string{};
742 std::vector<Data> inlineData;
743 std::map<std::string, std::string> variateOfPointData;
746 std::string
const &distribution = term.distribution.name;
747 if (
auto const *
value = std::get_if<double>(&term.data)) {
752 term.data = std::monostate{};
755 std::string
name = distribution +
"_data";
757 name = distribution +
"_data_" + std::to_string(k);
761 point.
axes.push_back(
762 {soleVariateOf(distribution,
"the number in the \"data\" of the likelihood '" + likelihood.name +
"'"),
763 std::nullopt, std::nullopt});
764 inlineData.push_back({
name, std::move(point)});
768 auto const *ref = std::get_if<DataRef>(&term.data);
769 auto const *point = ref ? find<PointData>(doc.
data, ref->name) :
nullptr;
773 if (!point->axes.empty()) {
775 std::set<std::string>
const variates =
variatesOf(doc, distribution);
776 if (variates.size() == 1 && point->axes.front().name != *variates.begin()) {
777 errors.push_back(
"the axis '" + point->axes.front().name +
"' of the point data set '" + ref->name +
778 "' is not the variate '" + *variates.begin() +
"' of the distribution '" +
779 distribution +
"' it is paired with");
783 std::string
const variate = soleVariateOf(distribution,
"the point data set '" + ref->name +
"'");
784 auto inserted = variateOfPointData.emplace(ref->name, variate);
785 if (!inserted.second && inserted.first->second != variate) {
786 errors.push_back(
"the point data set '" + ref->name +
787 "' without axes is paired with distributions of different variates, '" +
788 inserted.first->second +
"' and '" + variate +
"'");
792 for (
auto const &[
name, variate] : variateOfPointData) {
793 find<PointData>(doc.
data,
name)->axes.push_back({variate, std::nullopt, std::nullopt});
795 doc.
data.insert(doc.
data.end(), std::make_move_iterator(inlineData.begin()),
796 std::make_move_iterator(inlineData.end()));
802 std::map<std::string, std::set<std::string>> removed;
806 Distributions distributions{doc};
808 std::map<std::string, std::set<std::string>> removable;
810 std::vector<std::string>
const terms = distributions.likelihoodTerms(likelihood);
811 for (std::string
const &term : terms) {
812 JSONNode const *product = distributions.nodeOf(term,
"product_dist");
816 std::set<std::string> factorsThatAreTerms;
817 for (std::string
const &factor : namesIn(*product,
"factors")) {
818 if (factor != term && std::find(terms.begin(), terms.end(), factor) != terms.end()) {
819 factorsThatAreTerms.insert(factor);
822 auto found = removable.find(term);
823 if (found == removable.end()) {
824 removable[term] = factorsThatAreTerms;
826 std::set<std::string> both;
827 std::set_intersection(found->second.begin(), found->second.end(), factorsThatAreTerms.begin(),
828 factorsThatAreTerms.end(), std::inserter(both, both.begin()));
829 found->second = both;
835 if (
JSONNode const *node = genericNode(dist)) {
836 for (
const char *key : {
"factors",
"summands"}) {
837 for (std::string
const &part : namesIn(*node, key)) {
838 removable.erase(part);
844 auto found = removable.find(dist[
"name"].val());
845 if (found == removable.end() || found->second.empty()) {
848 std::vector<std::string> keep;
849 for (
JSONNode const &factor : dist[
"factors"].children()) {
850 if (!found->second.count(factor.val())) {
851 keep.push_back(factor.val());
855 dist[
"factors"].clear();
856 dist[
"factors"].fill_seq(keep);
857 removed.insert(*found);
std::map< std::string, Distribution const * > _byName
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 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 modifier
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
bool is_container() const
JSONNode const * find(std::string const &key) const
The component at the end of a path of keys, or nullptr if a component on the path doesn't exist.
bool has_child(std::string const &) const
An HS3 document. It is move-only, because generic objects refer to the JSON tree of the document.
std::vector< HS3::Data > data
std::vector< HS3::Likelihood > likelihoods
HS3::RooFitInternal rooFit
std::vector< HS3::Domain > domains
std::vector< HS3::Distribution > distributions
A document that passed validate().
double dist(Rotation3D const &r1, Rotation3D const &r2)
Types that represent an HS3 document.
AuxiliaryConstraints readAuxiliaryChannelsAsConstraints(ValidatedHS3Document &doc, bool asChannels)
RooFit writes an array of constraints with the data set of its observed values as a component of the ...
std::vector< std::string > unlistedConstraints(HS3Document const &doc, std::vector< std::string > *warnings=nullptr)
In HS3 0.3 (HS3 PR #154, decision on HS3 #156), the "constraints" of a HistFactory modifier add no te...
auto findByName(Objects_t &objects, std::string const &name) -> decltype(&*objects.begin())
The object with the name name among the objects of a section, e.g. findByName(doc....
std::map< std::string, std::set< std::string > > writeLikelihoodTermsOnce(HS3Document const &doc, Detail::JSONNode &root)
Writes each term of the likelihoods once: a factor of a product that is a term of the likelihood as w...
std::variant< NormFactor, NormSys, HistoSys, ShapeSys, StatError, CustomModifier > Modifier
std::string const & nameOf(std::variant< Ts... > const &v)
The name of the alternative that a variant holds, e.g. of an axis or of a modifier.
Combined< DataRef > CombinedData
std::set< std::string > variatesOf(HS3Document const &doc, Likelihood const &likelihood)
The variates of the "distributions" of a likelihood, which it pairs with data, with the columns of it...
std::map< std::string, std::set< std::string > > sharedAxes(HS3Document const &doc)
The axes that several components of a combined data set have, by combined data set.
std::set< std::string > componentsWithData(HS3Document const &doc)
The distributions that are components of a combined distribution of a likelihood, with a component of...
Ref< struct DistributionTag > DistributionRef
std::map< std::string, std::set< std::string > > bookkeepingColumns(HS3Document const &doc)
The bookkeeping columns by combined data set: the declared ones (RooFitInternal::bookkeepingColumns),...
auto find(Objects_t &objects, std::string const &name) -> decltype(std::get_if< Body_t >(&objects.begin() ->body))
The body of the object name if it is a Body_t, e.g. find<CombinedData>(doc.data, "obsData"),...
std::vector< std::string > sharedVariates(HS3Document const &doc)
Describes each variate that is shared although it must be distinct: by the terms of a likelihood,...
std::vector< std::string > resolvePointData(ValidatedHS3Document &doc)
A number given in-line in the "data" of a likelihood, or a point data set without axes,...
overloaded(Ts...) -> overloaded< Ts... >
Combined< DistributionRef > CombinedDist
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
What readAuxiliaryChannelsAsConstraints() changed.
std::set< std::string > data
Their data sets, which hold the observed values of global observables.
std::set< std::string > terms
The components that are no longer components of their combined distribution.
std::vector< std::string > warnings
Data sets or distributions that are selected by a key (HS3 #119). The columns are categorical axes of...
CombinedComponent< Ref_t > const * find(std::vector< std::string > const &key) const
The component for a key, or nullptr.
The data of a likelihood term: a data set, a number given in-line, or none (std::monostate) in a pure...
std::vector< LikelihoodTerm > terms
std::vector< ContinuousAxis > axes
std::map< std::string, std::vector< DistributionRef > > auxiliaryChannels
The components of a combined distribution that are auxiliary measurements (constraint terms paired wi...
std::map< std::string, std::vector< std::string > > bookkeepingColumns
Axes that the components of a combined data set share, but that are no variate of any distribution,...