76 std::set<std::string> arguments;
78 for (
size_t i = 0; i <
expr.size(); ++i) {
96 arguments.insert(arg);
106template <
class RooArg_t>
112 if (!
p.has_child(
"expression")) {
115 TString formula(
p[
"expression"].val());
158 obs->GetName() +
"' as indicated by parent RooBinSamplingPdf '" +
name +
162 if (!
p.has_child(
"epsilon")) {
165 double epsilon(
p[
"epsilon"].val_double());
180 if (
p.has_child(
"extended") &&
p[
"extended"].val_bool()) {
199template <
class RooArg_t>
205 if (!
p.has_child(
"coefficients")) {
212 for (
const auto &coef :
p[
"coefficients"].children()) {
216 if (order == 0 && coef.val() ==
"1.0") {
218 }
else if (coefs.empty() && coef.val() ==
"0.0") {
252 if (
p.has_child(
"normalization")) {
259 domain =
p[
"domain"].val();
277 const std::string
muName =
p[
"mu"].val();
278 const std::string
sigmaName =
p[
"sigma"].val();
344 if (!
p.has_child(
"coefficients")) {
351 for (
const auto &coef :
p[
"coefficients"].children()) {
355 if (order == 0 && coef.val() ==
"1.0") {
357 }
else if (coefs.empty() && coef.val() ==
"0.0") {
375 bool has_cov =
p.has_child(
"covariances");
376 bool has_corr =
p.has_child(
"correlations") &&
p.has_child(
"standard_deviations");
384 int n =
p[
"covariances"].num_children();
387 for (
const auto &row :
p[
"covariances"].children()) {
389 for (
const auto &val : row.children()) {
390 covmat(i,
j) = val.val_double();
397 for (
const auto &
v :
p[
"standard_deviations"].children()) {
402 for (
const auto &row :
p[
"correlations"].children()) {
404 for (
const auto &val : row.children()) {
423 std::string
const &key()
const override;
427 elem[
"type"] << key();
437 std::string
const &key()
const override;
441 elem[
"type"] << key();
451 std::string
const &key()
const override;
455 elem[
"type"] << key();
464 std::string
const &key()
const override;
468 elem[
"type"] << key();
470 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
480 if (!
p.has_child(
"data")) {
483 std::unique_ptr<RooDataHist> dataHist =
492 std::string
const &key()
const override;
496 elem[
"type"] << key();
498 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
508 if (!
p.has_child(
"data")) {
511 std::unique_ptr<RooDataHist> dataHist =
520 std::string
const &key()
const override;
524 elem[
"type"] << key();
525 elem[
"pdf"] << pdf->
pdf().GetName();
534 std::string
const &key()
const override;
538 elem[
"type"] << key();
545template <
class RooArg_t>
548 std::string
const &key()
const override;
552 elem[
"type"] << key();
553 TString expression(pdf->expression());
560 for (
size_t idx = pdf->nParameters(); idx--;) {
561 const RooAbsArg *par = pdf->getParameter(idx);
562 expression.ReplaceAll((
"x[" + std::to_string(idx) +
"]").c_str(), par->
GetName());
563 expression.ReplaceAll((
"@" + std::to_string(idx)).c_str(), par->
GetName());
565 elem[
"expression"] << expression.Data();
569template <
class RooArg_t>
572 std::string
const &key()
const override;
575 auto *pdf =
static_cast<const RooArg_t *
>(func);
576 elem[
"type"] << key();
577 elem[
"x"] << pdf->x().GetName();
578 auto &coefs =
elem[
"coefficients"].set_seq();
582 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
583 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
585 for (
const auto &coef : pdf->coefList()) {
586 coefs.append_child() << coef->GetName();
594 std::string
const &key()
const override;
598 elem[
"type"] << key();
599 elem[
"x"] << pdf->x().GetName();
600 auto &coefs =
elem[
"coefficients"].set_seq();
604 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
605 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
607 for (
const auto &coef : pdf->coefList()) {
608 coefs.append_child() << coef->GetName();
616 std::string
const &key()
const override;
619 auto *pdf =
static_cast<const RooPoisson *
>(func);
620 elem[
"type"] << key();
621 elem[
"x"] << pdf->getX().GetName();
622 elem[
"mean"] << pdf->getMean().GetName();
623 elem[
"integer"] << !pdf->getNoRounding();
630 std::string
const &key()
const override;
635 elem[
"type"] << key();
636 elem[
"x"] << pdf->getX().GetName();
638 auto &m0 = pdf->getMedian();
639 auto &k = pdf->getShapeK();
641 if (pdf->useStandardParametrization()) {
642 elem[
"mu"] << m0.GetName();
643 elem[
"sigma"] << k.GetName();
645 elem[
"mu"] <<
tool->exportTransformed(&m0,
"_lognormal_log",
"log(%s)");
646 elem[
"sigma"] <<
tool->exportTransformed(&k,
"_lognormal_log",
"log(%s)");
655 std::string
const &key()
const override;
659 elem[
"type"] << key();
660 elem[
"x"] << pdf->variable().GetName();
661 auto &
c = pdf->coefficient();
662 if (pdf->negateCoefficient()) {
663 elem[
"c"] <<
c.GetName();
665 elem[
"c"] <<
tool->exportTransformed(&
c,
"_exponential_inverted",
"-%s");
674 std::string
const &key()
const override;
678 elem[
"type"] << key();
681 elem[
"covariances"].fill_mat(pdf->covarianceMatrix());
688 std::string
const &key()
const override;
692 elem[
"type"] << key();
694 TString formula(pdf->function().GetExpFormula());
695 formula.ReplaceAll(
"x", pdf->observables()[0].GetName());
696 formula.ReplaceAll(
"y", pdf->observables()[1].GetName());
697 formula.ReplaceAll(
"z", pdf->observables()[2].GetName());
698 for (
size_t i = 0; i < pdf->parameters().
size(); ++i) {
700 formula.ReplaceAll(
pname, pdf->parameters()[i].GetName());
702 elem[
"expression"] << formula.Data();
709 std::string
const &key()
const override;
713 std::string
name =
elem[
"name"].val();
714 for (
char&
c :
name ) {
715 if (
c ==
'[' ||
c ==
'|' ||
c==
',') {
721 elem[
"type"] << key();
722 elem[
"integrand"] << integral->integrand().GetName();
723 if (integral->intRange()) {
724 elem[
"domain"] << integral->intRange();
727 if (
RooArgSet const *funcNormSet = integral->funcNormSet()) {
734#define DEFINE_EXPORTER_KEY(class_name, name) \
735 std::string const &class_name::key() const \
737 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.
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)