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();
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());
554 for (
size_t idx = pdf->nParameters(); idx--;) {
555 const RooAbsArg *par = pdf->getParameter(idx);
556 expression.ReplaceAll((
"x[" + std::to_string(idx) +
"]").c_str(), par->
GetName());
557 expression.ReplaceAll((
"@" + std::to_string(idx)).c_str(), par->
GetName());
559 elem[
"expression"] << expression.Data();
566 std::string
const &key()
const override;
570 elem[
"type"] << key();
571 elem[
"x"] << pdf->x().GetName();
572 auto &coefs =
elem[
"coefficients"].set_seq();
576 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
577 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
579 for (
const auto &coef : pdf->coefList()) {
580 coefs.append_child() << coef->GetName();
588 std::string
const &key()
const override;
592 elem[
"type"] << key();
593 elem[
"x"] << pdf->x().GetName();
594 auto &coefs =
elem[
"coefficients"].set_seq();
598 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
599 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
601 for (
const auto &coef : pdf->coefList()) {
602 coefs.append_child() << coef->GetName();
610 std::string
const &key()
const override;
613 auto *pdf =
static_cast<const RooPoisson *
>(func);
614 elem[
"type"] << key();
615 elem[
"x"] << pdf->getX().GetName();
616 elem[
"mean"] << pdf->getMean().GetName();
617 elem[
"integer"] << !pdf->getNoRounding();
624 std::string
const &key()
const override;
629 elem[
"type"] << key();
630 elem[
"x"] << pdf->getX().GetName();
632 auto &m0 = pdf->getMedian();
633 auto &k = pdf->getShapeK();
635 if (pdf->useStandardParametrization()) {
636 elem[
"mu"] << m0.GetName();
637 elem[
"sigma"] << k.GetName();
639 elem[
"mu"] <<
tool->exportTransformed(&m0,
"_lognormal_log",
"log(%s)");
640 elem[
"sigma"] <<
tool->exportTransformed(&k,
"_lognormal_log",
"log(%s)");
649 std::string
const &key()
const override;
653 elem[
"type"] << key();
654 elem[
"x"] << pdf->variable().GetName();
655 auto &
c = pdf->coefficient();
656 if (pdf->negateCoefficient()) {
657 elem[
"c"] <<
c.GetName();
659 elem[
"c"] <<
tool->exportTransformed(&
c,
"_exponential_inverted",
"-%s");
668 std::string
const &key()
const override;
672 elem[
"type"] << key();
675 elem[
"covariances"].fill_mat(pdf->covarianceMatrix());
682 std::string
const &key()
const override;
686 elem[
"type"] << key();
688 TString formula(pdf->function().GetExpFormula());
689 formula.ReplaceAll(
"x", pdf->observables()[0].GetName());
690 formula.ReplaceAll(
"y", pdf->observables()[1].GetName());
691 formula.ReplaceAll(
"z", pdf->observables()[2].GetName());
692 for (
size_t i = 0; i < pdf->parameters().
size(); ++i) {
694 formula.ReplaceAll(
pname, pdf->parameters()[i].GetName());
696 elem[
"expression"] << formula.Data();
703 std::string
const &key()
const override;
707 elem[
"type"] << key();
708 elem[
"integrand"] << integral->integrand().GetName();
709 if (integral->intRange()) {
710 elem[
"domain"] << integral->intRange();
713 if (
RooArgSet const *funcNormSet = integral->funcNormSet()) {
720#define DEFINE_EXPORTER_KEY(class_name, name) \
721 std::string const &class_name::key() const \
723 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)