85 std::set<std::string> arguments;
87 for (
size_t i = 0; i <
expr.size(); ++i) {
105 arguments.insert(arg);
115template <
class RooArg_t>
121 if (!
p.has_child(
"expression")) {
124 TString formula(
p[
"expression"].val());
182 obs->GetName() +
"' as indicated by parent RooBinSamplingPdf '" +
name +
186 if (!
p.has_child(
"epsilon")) {
189 double epsilon(
p[
"epsilon"].val_double());
204 if (
p.has_child(
"extended") &&
p[
"extended"].val_bool()) {
223template <
class RooArg_t>
229 if (!
p.has_child(
"coefficients")) {
236 for (
const auto &coef :
p[
"coefficients"].children()) {
240 if (order == 0 && coef.val() ==
"1.0") {
242 }
else if (coefs.empty() && coef.val() ==
"0.0") {
314 if (
p.has_child(
"normalization")) {
321 domain =
p[
"domain"].val();
337 Int_t order =
p[
"order"].val_int();
338 double eps =
p[
"eps"].val_double();
339 if (
p.has_child(
"normalization")) {
356 Int_t order =
p[
"ipOrder"].val_int();
359 if (
p.has_child(
"conv_func")) {
376 if (
p.has_child(
"range")) {
395 const std::string
muName =
p[
"mu"].val();
396 const std::string
sigmaName =
p[
"sigma"].val();
462 if (!
p.has_child(
"coefficients")) {
469 for (
const auto &coef :
p[
"coefficients"].children()) {
473 if (order == 0 && coef.val() ==
"1.0") {
475 }
else if (coefs.empty() && coef.val() ==
"0.0") {
493 bool has_cov =
p.has_child(
"covariances");
494 bool has_corr =
p.has_child(
"correlations") &&
p.has_child(
"standard_deviations");
502 int n =
p[
"covariances"].num_children();
505 for (
const auto &row :
p[
"covariances"].children()) {
507 for (
const auto &val : row.children()) {
508 covmat(i,
j) = val.val_double();
515 for (
const auto &
v :
p[
"standard_deviations"].children()) {
520 for (
const auto &row :
p[
"correlations"].children()) {
522 for (
const auto &val : row.children()) {
538template <
class RooArg_t>
541 std::string
const &key()
const override;
545 elem[
"type"] << key();
546 std::string
name =
elem[
"name"].val();
554 elem[
"extended"] << (pdf->extendMode() != RooArg_t::CanNotBeExtended);
561 std::string
const &key()
const override;
565 elem[
"type"] << key();
566 std::string
name =
elem[
"name"].val();
581 std::string
const &key()
const override;
585 elem[
"type"] << key();
586 std::string
name =
elem[
"name"].val();
600 std::string
const &key()
const override;
604 elem[
"type"] << key();
606 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
616 if (!
p.has_child(
"data")) {
619 std::unique_ptr<RooDataHist> dataHist =
628 std::string
const &key()
const override;
632 elem[
"type"] << key();
634 tool->exportHisto(*
dh.get(),
dh.numEntries(),
dh.weightArray(),
elem[
"data"].set_map());
644 if (!
p.has_child(
"data")) {
647 std::unique_ptr<RooDataHist> dataHist =
656 std::string
const &key()
const override;
660 elem[
"type"] << key();
661 elem[
"pdf"] << pdf->
pdf().GetName();
670 std::string
const &key()
const override;
674 elem[
"type"] << key();
681template <
class RooArg_t>
684 std::string
const &key()
const override;
688 elem[
"type"] << key();
689 TString expression(pdf->expression());
696 for (
size_t idx = pdf->nParameters(); idx--;) {
697 const RooAbsArg *par = pdf->getParameter(idx);
698 expression.ReplaceAll((
"x[" + std::to_string(idx) +
"]").c_str(), par->
GetName());
699 expression.ReplaceAll((
"@" + std::to_string(idx)).c_str(), par->
GetName());
701 elem[
"expression"] << expression.Data();
705template <
class RooArg_t>
708 std::string
const &key()
const override;
711 auto *pdf =
static_cast<const RooArg_t *
>(func);
712 elem[
"type"] << key();
713 elem[
"x"] << pdf->x().GetName();
714 auto &coefs =
elem[
"coefficients"].set_seq();
718 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
719 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
721 for (
const auto &coef : pdf->coefList()) {
722 coefs.append_child() << coef->GetName();
730 std::string
const &key()
const override;
734 elem[
"type"] << key();
735 elem[
"x"] << pdf->x().GetName();
736 auto &coefs =
elem[
"coefficients"].set_seq();
740 for (
int i = 0; i < pdf->lowestOrder(); ++i) {
741 coefs.append_child() << (i == 0 ?
"1.0" :
"0.0");
743 for (
const auto &coef : pdf->coefList()) {
744 coefs.append_child() << coef->GetName();
752 std::string
const &key()
const override;
755 auto *pdf =
static_cast<const RooPoisson *
>(func);
756 elem[
"type"] << key();
757 elem[
"x"] << pdf->getX().GetName();
758 elem[
"mean"] << pdf->getMean().GetName();
759 elem[
"integer"] << !pdf->getNoRounding();
766 std::string
const &key()
const override;
769 auto *pdf =
static_cast<const RooDecay *
>(func);
770 elem[
"type"] << key();
771 elem[
"t"] << pdf->getT().GetName();
772 elem[
"tau"] << pdf->getTau().GetName();
773 elem[
"resolutionModel"] << pdf->getModel().GetName();
774 elem[
"decayType"] << pdf->getDecayType();
782 std::string
const &key()
const override;
786 elem[
"type"] << key();
787 std::string
name =
elem[
"name"].val();
790 elem[
"x"] << pdf->convVar().GetName();
798 std::string
const &key()
const override;
802 elem[
"type"] << key();
803 std::string
name =
elem[
"name"].val();
806 elem[
"x"] << pdf->convVar().GetName();
807 elem[
"mean"] << pdf->getMean().GetName();
808 elem[
"sigma"] << pdf->getSigma().GetName();
815 std::string
const &key()
const override;
820 elem[
"type"] << key();
821 elem[
"x"] << pdf->getX().GetName();
823 auto &m0 = pdf->getMedian();
824 auto &k = pdf->getShapeK();
826 if (pdf->useStandardParametrization()) {
827 elem[
"mu"] << m0.GetName();
828 elem[
"sigma"] << k.GetName();
830 elem[
"mu"] <<
tool->exportTransformed(&m0,
"_lognormal_log",
"log(%s)");
831 elem[
"sigma"] <<
tool->exportTransformed(&k,
"_lognormal_log",
"log(%s)");
840 std::string
const &key()
const override;
844 elem[
"type"] << key();
845 elem[
"x"] << pdf->variable().GetName();
846 auto &
c = pdf->coefficient();
847 if (pdf->negateCoefficient()) {
848 elem[
"c"] <<
c.GetName();
850 elem[
"c"] <<
tool->exportTransformed(&
c,
"_exponential_inverted",
"-%s");
859 std::string
const &key()
const override;
863 elem[
"type"] << key();
866 elem[
"covariances"].fill_mat(pdf->covarianceMatrix());
873 std::string
const &key()
const override;
877 elem[
"type"] << key();
879 TString formula(pdf->function().GetExpFormula());
880 formula.ReplaceAll(
"x", pdf->observables()[0].GetName());
881 formula.ReplaceAll(
"y", pdf->observables()[1].GetName());
882 formula.ReplaceAll(
"z", pdf->observables()[2].GetName());
883 for (
size_t i = 0; i < pdf->parameters().
size(); ++i) {
885 formula.ReplaceAll(
pname, pdf->parameters()[i].GetName());
887 elem[
"expression"] << formula.Data();
894 std::string
const &key()
const override;
898 elem[
"type"] << key();
899 elem[
"x"] << pdf->getX().GetName();
900 elem[
"function"] << pdf->getFunc().GetName();
901 if (!pdf->getNset().empty()) {
904 elem[
"order"] << pdf->order();
905 elem[
"eps"] << pdf->eps();
912 std::string
const &key()
const override;
916 std::string
name =
elem[
"name"].val();
920 elem[
"type"] << key();
921 std::string integrand = integral->integrand().GetName();
923 elem[
"integrand"] << integrand;
924 if (integral->intRange()) {
925 elem[
"domain"] << integral->intRange();
928 if (
RooArgSet const *funcNormSet = integral->funcNormSet()) {
937 std::string
const &key()
const override;
941 elem[
"type"] << key();
942 if (
auto convFunc = pdf->getPdfConvVar()) {
945 elem[
"conv_var"] << pdf->getConvVar().GetName();
946 elem[
"pdf1"] << pdf->getPdf1().GetName();
947 elem[
"pdf2"] << pdf->getPdf2().GetName();
948 elem[
"ipOrder"] << pdf->getInterpolationOrder();
955 std::string
const &key()
const override;
959 elem[
"type"] << key();
960 if (
auto rangeName = pdf->getRangeName()) {
963 elem[
"pdf"] << pdf->pdf().GetName();
964 elem[
"norm"] << pdf->getN().GetName();
969#define DEFINE_EXPORTER_KEY(class_name, name) \
970 std::string const &class_name::key() const \
972 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...
RooAddModel is an efficient implementation of a sum of PDFs of the form.
Efficient implementation of a sum of PDFs of the form.
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.
Single or double sided decay function that can be analytically convolved with any RooResolutionModel ...
Represents the first, second, or third order derivative of any RooAbsReal as calculated (numerically)...
RooExtendPdf is a wrapper around an existing PDF that adds a parameteric extended likelihood term to ...
PDF for the numerical (FFT) convolution of two PDFs.
Class RooGaussModel implements a RooResolutionModel that models a Gaussian distribution.
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.
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
Use TF1, TF2, TF3 functions as RooFit objects.
Implements a RooResolution model that corresponds to a delta function.
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)