75 std::set<std::string> arguments;
77 for (
size_t i = 0; i <
expr.size(); ++i) {
95 arguments.insert(arg);
105template <
class RooArg_t>
111 if (!
p.has_child(
"expression")) {
114 TString formula(
p[
"expression"].val());
157 obs->GetName() +
"' as indicated by parent RooBinSamplingPdf '" +
name +
161 if (!
p.has_child(
"epsilon")) {
164 double epsilon(
p[
"epsilon"].val_double());
179 if (
p.has_child(
"extended") &&
p[
"extended"].val_bool()) {
204 if (!
p.has_child(
"coefficients")) {
211 for (
const auto &coef :
p[
"coefficients"].children()) {
215 if (order == 0 && coef.val() ==
"1.0") {
217 }
else if (coefs.empty() && coef.val() ==
"0.0") {
251 if (
p.has_child(
"normalization")) {
258 domain =
p[
"domain"].val();
276 const std::string
muName =
p[
"mu"].val();
277 const std::string
sigmaName =
p[
"sigma"].val();
343 if (!
p.has_child(
"coefficients")) {
350 for (
const auto &coef :
p[
"coefficients"].children()) {
354 if (order == 0 && coef.val() ==
"1.0") {
356 }
else if (coefs.empty() && coef.val() ==
"0.0") {
374 bool has_cov =
p.has_child(
"covariances");
375 bool has_corr =
p.has_child(
"correlations") &&
p.has_child(
"standard_deviations");
383 int n =
p[
"covariances"].num_children();
386 for (
const auto &row :
p[
"covariances"].children()) {
388 for (
const auto &val : row.children()) {
389 covmat(i,
j) = val.val_double();
396 for (
const auto &
v :
p[
"standard_deviations"].children()) {
401 for (
const auto &row :
p[
"correlations"].children()) {
403 for (
const auto &val : row.children()) {
422 std::string
const &key()
const override;
426 elem[
"type"] << key();
436 std::string
const &key()
const override;
440 elem[
"type"] << key();
450 std::string
const &key()
const override;
454 elem[
"type"] << key();
463 std::string
const &key()
const override;
467 elem[
"type"] << key();
469 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
479 if (!
p.has_child(
"data")) {
482 std::unique_ptr<RooDataHist> dataHist =
491 std::string
const &key()
const override;
495 elem[
"type"] << key();
497 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
507 if (!
p.has_child(
"data")) {
510 std::unique_ptr<RooDataHist> dataHist =
519 std::string
const &key()
const override;
523 elem[
"type"] << key();
524 elem[
"pdf"] << pdf->
pdf().GetName();
533 std::string
const &key()
const override;
537 elem[
"type"] << key();
544template <
class RooArg_t>
547 std::string
const &key()
const override;
551 elem[
"type"] << key();
552 TString expression(pdf->expression());
559 for (
size_t idx = pdf->nParameters(); idx--;) {
560 const RooAbsArg *par = pdf->getParameter(idx);
561 expression.ReplaceAll((
"x[" + std::to_string(idx) +
"]").c_str(), par->
GetName());
562 expression.ReplaceAll((
"@" + std::to_string(idx)).c_str(), par->
GetName());
564 elem[
"expression"] << expression.Data();
571 std::string
const &key()
const override;
575 elem[
"type"] << key();
576 elem[
"x"] << pdf->x().GetName();
577 auto &coefs =
elem[
"coefficients"].set_seq();
581 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
582 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
584 for (
const auto &coef : pdf->coefList()) {
585 coefs.append_child() << coef->GetName();
593 std::string
const &key()
const override;
597 elem[
"type"] << key();
598 elem[
"x"] << pdf->x().GetName();
599 auto &coefs =
elem[
"coefficients"].set_seq();
603 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
604 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
606 for (
const auto &coef : pdf->coefList()) {
607 coefs.append_child() << coef->GetName();
615 std::string
const &key()
const override;
618 auto *pdf =
static_cast<const RooPoisson *
>(func);
619 elem[
"type"] << key();
620 elem[
"x"] << pdf->getX().GetName();
621 elem[
"mean"] << pdf->getMean().GetName();
622 elem[
"integer"] << !pdf->getNoRounding();
629 std::string
const &key()
const override;
634 elem[
"type"] << key();
635 elem[
"x"] << pdf->getX().GetName();
637 auto &m0 = pdf->getMedian();
638 auto &k = pdf->getShapeK();
640 if (pdf->useStandardParametrization()) {
641 elem[
"mu"] << m0.GetName();
642 elem[
"sigma"] << k.GetName();
644 elem[
"mu"] <<
tool->exportTransformed(&m0,
"_lognormal_log",
"log(%s)");
645 elem[
"sigma"] <<
tool->exportTransformed(&k,
"_lognormal_log",
"log(%s)");
654 std::string
const &key()
const override;
658 elem[
"type"] << key();
659 elem[
"x"] << pdf->variable().GetName();
660 auto &
c = pdf->coefficient();
661 if (pdf->negateCoefficient()) {
662 elem[
"c"] <<
c.GetName();
664 elem[
"c"] <<
tool->exportTransformed(&
c,
"_exponential_inverted",
"-%s");
673 std::string
const &key()
const override;
677 elem[
"type"] << key();
680 elem[
"covariances"].fill_mat(pdf->covarianceMatrix());
687 std::string
const &key()
const override;
691 elem[
"type"] << key();
693 TString formula(pdf->function().GetExpFormula());
694 formula.ReplaceAll(
"x", pdf->observables()[0].GetName());
695 formula.ReplaceAll(
"y", pdf->observables()[1].GetName());
696 formula.ReplaceAll(
"z", pdf->observables()[2].GetName());
697 for (
size_t i = 0; i < pdf->parameters().
size(); ++i) {
699 formula.ReplaceAll(
pname, pdf->parameters()[i].GetName());
701 elem[
"expression"] << formula.Data();
708 std::string
const &key()
const override;
712 elem[
"type"] << key();
713 elem[
"integrand"] << integral->integrand().GetName();
714 if (integral->intRange()) {
715 elem[
"domain"] << integral->intRange();
718 if (
RooArgSet const *funcNormSet = integral->funcNormSet()) {
725#define DEFINE_EXPORTER_KEY(class_name, name) \
726 std::string const &class_name::key() const \
728 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 probability 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)