61std::vector<std::string> extract_arguments(
const std::string &expression)
 
   63   std::vector<std::string> arguments;
 
   64   size_t startidx = expression.size();
 
   65   for (
size_t i = 0; i < expression.size(); ++i) {
 
   66      if (startidx >= expression.size()) {
 
   67         if (isalpha(expression[i])) {
 
   71         if (!isdigit(expression[i]) && !isalpha(expression[i]) && expression[i] != 
'_') {
 
   72            if (expression[i] == 
' ')
 
   74            if (expression[i] == 
'(') {
 
   75               startidx = expression.size();
 
   78            std::string arg(expression.substr(startidx, i - startidx));
 
   79            startidx = expression.size();
 
   80            arguments.push_back(arg);
 
   84   if (startidx < expression.size())
 
   85      arguments.push_back(expression.substr(startidx));
 
   89template <
class RooArg_t>
 
   95      if (!
p.has_child(
"expression")) {
 
   98      TString formula(
p[
"expression"].val());
 
  100      for (
const auto &
d : extract_arguments(formula.Data())) {
 
  103      tool->
wsImport(RooArg_t{
name.c_str(), formula, dependents});
 
  142                                     obs->GetName() + 
"' as indicated by parent RooBinSamplingPdf '" + 
name +
 
  146      if (!
p.has_child(
"epsilon")) {
 
  149      double epsilon(
p[
"epsilon"].val_double());
 
  163      bool extended = 
false;
 
  164      if (
p.has_child(
"extended") && 
p[
"extended"].val_bool()) {
 
  189      if (!
p.has_child(
"coefficients")) {
 
  196      for (
const auto &coef : 
p[
"coefficients"].children()) {
 
  200         if (order == 0 && coef.val() == 
"1.0") {
 
  202         } 
else if (coefs.empty() && coef.val() == 
"0.0") {
 
  220      bool has_cov = 
p.has_child(
"covariances");
 
  221      bool has_corr = 
p.has_child(
"correlations") && 
p.has_child(
"standard_deviations");
 
  222      if (!has_cov && !has_corr) {
 
  229         int n = 
p[
"covariances"].num_children();
 
  232         for (
const auto &row : 
p[
"covariances"].children()) {
 
  234            for (
const auto &val : row.children()) {
 
  235               covmat(i, j) = val.val_double();
 
  241         std::vector<double> variances;
 
  242         for (
const auto &
v : 
p[
"standard_deviations"].children()) {
 
  243            variances.push_back(
v.val_double());
 
  245         covmat.
ResizeTo(variances.size(), variances.size());
 
  247         for (
const auto &row : 
p[
"correlations"].children()) {
 
  249            for (
const auto &val : row.children()) {
 
  250               covmat(i, j) = val.val_double() * variances[i] * variances[j];
 
  268   std::string 
const &
key() 
const override;
 
  272      elem[
"type"] << 
key();
 
  282   std::string 
const &
key() 
const override;
 
  286      elem[
"type"] << 
key();
 
  295   std::string 
const &
key() 
const override;
 
  299      elem[
"type"] << 
key();
 
  311      if (!
p.has_child(
"data")) {
 
  322   std::string 
const &
key() 
const override;
 
  326      elem[
"type"] << 
key();
 
  338      if (!
p.has_child(
"data")) {
 
  349   std::string 
const &
key() 
const override;
 
  353      elem[
"type"] << 
key();
 
  356      elem[
"epsilon"] << pdf->
epsilon();
 
  363   std::string 
const &
key() 
const override;
 
  367      elem[
"type"] << 
key();
 
  374template <
class RooArg_t>
 
  377   std::string 
const &
key() 
const override;
 
  380      const RooArg_t *pdf = 
static_cast<const RooArg_t *
>(func);
 
  381      elem[
"type"] << 
key();
 
  382      TString expression(pdf->expression());
 
  383      for (
size_t i = 0; i < pdf->nParameters(); ++i) {
 
  385         std::stringstream ss;
 
  386         ss << 
"x[" << i << 
"]";
 
  387         expression.ReplaceAll(ss.str().c_str(), par->
GetName());
 
  389      elem[
"expression"] << expression.Data();
 
  396   std::string 
const &
key() 
const override;
 
  400      elem[
"type"] << 
key();
 
  401      elem[
"x"] << pdf->x().GetName();
 
  402      auto &coefs = elem[
"coefficients"].
set_seq();
 
  406      for (
int i = 0; i < pdf->lowestOrder(); ++i) {
 
  409      for (
const auto &coef : pdf->coefList()) {
 
  418   std::string 
const &
key() 
const override;
 
  422      elem[
"type"] << 
key();
 
  425      elem[
"covariances"].
fill_mat(pdf->covarianceMatrix());
 
  432   std::string 
const &
key() 
const override;
 
  436      elem[
"type"] << 
key();
 
  438      TString formula(pdf->function().GetExpFormula());
 
  439      formula.ReplaceAll(
"x", pdf->observables()[0].GetName());
 
  440      formula.ReplaceAll(
"y", pdf->observables()[1].GetName());
 
  441      formula.ReplaceAll(
"z", pdf->observables()[2].GetName());
 
  442      for (
size_t i = 0; i < pdf->parameters().
size(); ++i) {
 
  444         formula.ReplaceAll(pname, pdf->parameters()[i].GetName());
 
  446      elem[
"expression"] << formula.Data();
 
  451#define DEFINE_EXPORTER_KEY(class_name, name)    \ 
  452   std::string const &class_name::key() const    \ 
  454      const static std::string keystring = name; \ 
  479   registerImporter<RooFormulaArgFactory<RooGenericPdf>>(
"generic_dist", 
false);
 
  480   registerImporter<RooFormulaArgFactory<RooFormulaVar>>(
"generic_function", 
false);
 
  481   registerImporter<RooBinSamplingPdfFactory>(
"binsampling_dist", 
false);
 
  482   registerImporter<RooAddPdfFactory>(
"mixture_dist", 
false);
 
  483   registerImporter<RooHistFuncFactory>(
"histogram", 
false);
 
  484   registerImporter<RooHistPdfFactory>(
"histogram_dist", 
false);
 
  485   registerImporter<RooBinWidthFunctionFactory>(
"binwidth", 
false);
 
  486   registerImporter<RooRealSumPdfFactory>(
"weighted_sum_dist", 
false);
 
  487   registerImporter<RooRealSumFuncFactory>(
"weighted_sum", 
false);
 
  488   registerImporter<RooPolynomialFactory>(
"polynomial_dist", 
false);
 
  489   registerImporter<RooMultiVarGaussianFactory>(
"multinormal_dist", 
false);
 
#define DEFINE_EXPORTER_KEY(class_name, name)
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
 
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
 
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.
 
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
 
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
 
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
 
RooArgList 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
 
RooBinWidthFunction is a class that returns the bin width (or volume) given a RooHistFunc.
 
bool divideByBinWidth() const
 
const RooHistFunc & histFunc() const
 
The RooDataHist is a container class to hold N-dimensional binned data.
 
double const * weightArray() const
 
const RooArgSet * get() const override
Get bin centre of current bin.
 
virtual JSONNode & append_child()=0
 
virtual JSONNode & set_seq()=0
 
void fill_mat(Matrix const &mat)
 
virtual std::string const & key() const =0
 
virtual bool exportObject(RooJSONFactoryWSTool *, const RooAbsArg *, RooFit::Detail::JSONNode &) const
 
virtual bool importArg(RooJSONFactoryWSTool *tool, const RooFit::Detail::JSONNode &node) const
 
RooHistFunc implements a real-valued function sampled from a multidimensional histogram.
 
RooDataHist & dataHist()
Return RooDataHist that is represented.
 
RooHistPdf implements a probablity density function sampled from a multidimensional histogram.
 
Multivariate Gaussian p.d.f.
 
RooPolynomial implements a polynomial p.d.f of the form.
 
const RooArgList & coefList() const
 
const RooArgList & funcList() const
 
The class RooRealSumPdf 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
 
RooRealVar represents a variable that can be changed from the outside.
 
Use TF1, TF2, TF3 functions as RooFit objects.
 
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
 
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)