75 std::vector<std::string> arguments;
77 for (
size_t i = 0; i <
expr.size(); ++i) {
90 arguments.push_back(arg);
100template <
class RooArg_t>
106 if (!
p.has_child(
"expression")) {
109 TString formula(
p[
"expression"].val());
152 obs->GetName() +
"' as indicated by parent RooBinSamplingPdf '" +
name +
156 if (!
p.has_child(
"epsilon")) {
159 double epsilon(
p[
"epsilon"].val_double());
174 if (
p.has_child(
"extended") &&
p[
"extended"].val_bool()) {
199 if (!
p.has_child(
"coefficients")) {
206 for (
const auto &coef :
p[
"coefficients"].children()) {
210 if (order == 0 && coef.val() ==
"1.0") {
212 }
else if (coefs.empty() && coef.val() ==
"0.0") {
246 if (
p.has_child(
"normalization")) {
253 domain =
p[
"domain"].val();
271 const std::string
muName =
p[
"mu"].val();
272 const std::string
sigmaName =
p[
"sigma"].val();
338 if (!
p.has_child(
"coefficients")) {
345 for (
const auto &coef :
p[
"coefficients"].children()) {
349 if (order == 0 && coef.val() ==
"1.0") {
351 }
else if (coefs.empty() && coef.val() ==
"0.0") {
369 bool has_cov =
p.has_child(
"covariances");
370 bool has_corr =
p.has_child(
"correlations") &&
p.has_child(
"standard_deviations");
378 int n =
p[
"covariances"].num_children();
381 for (
const auto &row :
p[
"covariances"].children()) {
383 for (
const auto &val : row.children()) {
384 covmat(i,
j) = val.val_double();
391 for (
const auto &
v :
p[
"standard_deviations"].children()) {
396 for (
const auto &row :
p[
"correlations"].children()) {
398 for (
const auto &val : row.children()) {
417 std::string
const &key()
const override;
421 elem[
"type"] << key();
431 std::string
const &key()
const override;
435 elem[
"type"] << key();
445 std::string
const &key()
const override;
449 elem[
"type"] << key();
458 std::string
const &key()
const override;
462 elem[
"type"] << key();
464 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
474 if (!
p.has_child(
"data")) {
477 std::unique_ptr<RooDataHist> dataHist =
486 std::string
const &key()
const override;
490 elem[
"type"] << key();
492 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
502 if (!
p.has_child(
"data")) {
505 std::unique_ptr<RooDataHist> dataHist =
514 std::string
const &key()
const override;
518 elem[
"type"] << key();
519 elem[
"pdf"] << pdf->
pdf().GetName();
528 std::string
const &key()
const override;
532 elem[
"type"] << key();
539template <
class RooArg_t>
542 std::string
const &key()
const override;
546 elem[
"type"] << key();
547 TString expression(pdf->expression());
550 for (
size_t i = 0; i < pdf->nParameters(); ++i) {
557 expression.ReplaceAll((
"x[" + std::to_string(idx) +
"]").c_str(), par->GetName());
566 std::size_t idx = it->second;
567 expression.ReplaceAll((
"@" + std::to_string(idx)).c_str(), par->
GetName());
569 elem[
"expression"] << expression.Data();
576 std::string
const &key()
const override;
580 elem[
"type"] << key();
581 elem[
"x"] << pdf->x().GetName();
582 auto &coefs =
elem[
"coefficients"].set_seq();
586 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
587 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
589 for (
const auto &coef : pdf->coefList()) {
590 coefs.append_child() << coef->GetName();
598 std::string
const &key()
const override;
602 elem[
"type"] << key();
603 elem[
"x"] << pdf->x().GetName();
604 auto &coefs =
elem[
"coefficients"].set_seq();
608 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
609 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
611 for (
const auto &coef : pdf->coefList()) {
612 coefs.append_child() << coef->GetName();
620 std::string
const &key()
const override;
623 auto *pdf =
static_cast<const RooPoisson *
>(func);
624 elem[
"type"] << key();
625 elem[
"x"] << pdf->getX().GetName();
626 elem[
"mean"] << pdf->getMean().GetName();
627 elem[
"integer"] << !pdf->getNoRounding();
634 std::string
const &key()
const override;
639 elem[
"type"] << key();
640 elem[
"x"] << pdf->getX().GetName();
642 auto &m0 = pdf->getMedian();
643 auto &k = pdf->getShapeK();
645 if (pdf->useStandardParametrization()) {
646 elem[
"mu"] << m0.GetName();
647 elem[
"sigma"] << k.GetName();
649 elem[
"mu"] <<
tool->exportTransformed(&m0,
"_lognormal_log",
"log(%s)");
650 elem[
"sigma"] <<
tool->exportTransformed(&k,
"_lognormal_log",
"log(%s)");
659 std::string
const &key()
const override;
663 elem[
"type"] << key();
664 elem[
"x"] << pdf->variable().GetName();
665 auto &
c = pdf->coefficient();
666 if (pdf->negateCoefficient()) {
667 elem[
"c"] <<
c.GetName();
669 elem[
"c"] <<
tool->exportTransformed(&
c,
"_exponential_inverted",
"-%s");
678 std::string
const &key()
const override;
682 elem[
"type"] << key();
685 elem[
"covariances"].fill_mat(pdf->covarianceMatrix());
692 std::string
const &key()
const override;
696 elem[
"type"] << key();
698 TString formula(pdf->function().GetExpFormula());
699 formula.ReplaceAll(
"x", pdf->observables()[0].GetName());
700 formula.ReplaceAll(
"y", pdf->observables()[1].GetName());
701 formula.ReplaceAll(
"z", pdf->observables()[2].GetName());
702 for (
size_t i = 0; i < pdf->parameters().
size(); ++i) {
704 formula.ReplaceAll(pname, pdf->parameters()[i].GetName());
706 elem[
"expression"] << formula.Data();
713 std::string
const &key()
const override;
717 elem[
"type"] << key();
718 elem[
"integrand"] << integral->integrand().GetName();
719 if (integral->intRange()) {
720 elem[
"domain"] << integral->intRange();
723 if (
RooArgSet const *funcNormSet = integral->funcNormSet()) {
730#define DEFINE_EXPORTER_KEY(class_name, name) \
731 std::string const &class_name::key() const \
733 const static std::string keystring = name; \
#define DEFINE_EXPORTER_KEY(class_name, name)
bool endsWith(std::string_view str, std::string_view suffix)
std::string removeSuffix(std::string_view str, std::string_view suffix)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
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.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value and implements functionality common to al...
Efficient implementation of a sum of PDFs of the form.
const RooArgList & coefList() const
ExtendMode extendMode() const override
Returns ability of PDF to provide extended likelihood terms.
const RooArgList & pdfList() const
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
The RooBinSamplingPdf is supposed to be used as an adapter between a continuous PDF and a binned dist...
const RooAbsPdf & pdf() const
const RooAbsReal & observable() const
Returns the bin width (or volume) given a RooHistFunc.
bool divideByBinWidth() const
const RooHistFunc & histFunc() const
Container class to hold N-dimensional binned data.
A real-valued function sampled from a multidimensional histogram.
A propability density function sampled from a multidimensional histogram.
RooLegacyExpPoly implements a polynomial PDF of the form.
Multivariate Gaussian p.d.f.
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
RooPolynomial implements a polynomial p.d.f of the form.
Performs hybrid numerical/analytical integrals of RooAbsReal objects.
const RooArgList & coefList() const
const RooArgList & funcList() const
Implements a PDF constructed from a sum of functions:
const RooArgList & funcList() const
ExtendMode extendMode() const override
Returns ability of PDF to provide extended likelihood terms.
const RooArgList & coefList() const
Variable that can be changed from the outside.
Use TF1, TF2, TF3 functions as RooFit objects.
const char * GetName() const override
Returns name of object.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
#define STATIC_EXECUTE(MY_FUNC)