Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

When using RooFit, statistical models can be conveniently handled and stored as a RooWorkspace.

However, for the sake of interoperability with other statistical frameworks, and also ease of manipulation, it may be useful to store statistical models in text form.

The RooJSONFactoryWSTool is a helper class to achieve exactly this, exporting to and importing from JSON.

In order to import a workspace from a JSON file, you can do

ws = ROOT.RooWorkspace("ws")
tool = ROOT.RooJSONFactoryWSTool(ws)
tool.importJSON("myjson.json")

Similarly, in order to export a workspace to a JSON file, you can do

tool = ROOT.RooJSONFactoryWSTool(ws)
tool.exportJSON("myjson.json")

Analogously, in C++, you can do

// ...
RooWorkspace ws("ws");
tool.importJSON("myjson.json");
When using RooFit, statistical models can be conveniently handled and stored as a RooWorkspace.
Persistable container for RooFit projects.

and

// ...
tool.exportJSON("myjson.json");

For more details, consult the tutorial rf515_hfJSON.

The RooJSONFactoryWSTool only knows about a limited set of classes for import and export. If import or export of a class you're interested in fails, you might need to add your own importer or exporter. Please consult the relevant section in the RooFit Developer Documentation to learn how to do that (Implement JSON I/O for a RooFit class with RooFit HS3).

You can always get a list of all the available importers and exporters by calling the following functions:

ROOT.RooFit.JSONIO.printImporters()
ROOT.RooFit.JSONIO.printExporters()

Definition at line 53 of file RooJSONFactoryWSTool.h.

Classes

struct  Config
 
class  DependencyMissingError
 

Public Member Functions

 RooJSONFactoryWSTool (RooWorkspace &ws)
 
 ~RooJSONFactoryWSTool ()
 
std::vector< RooFit::HS3::DistributionRef > const * channelConstraints (std::string const &dist) const
 The constraint terms that the document that is currently being imported adds to the HistFactory distribution dist, besides those that its modifiers name, or nullptr if there are none.
 
std::string const * constraintObservable (std::string const &pdfName) const
 
std::string exportAsArrayComponent (RooAbsPdf const &pdf, std::string const &arrayName)
 
bool exportJSON (std::ostream &os)
 Export the workspace as an HS3 document, and write it as JSON to the stream. Returns true; errors are exceptions.
 
bool exportJSON (std::string const &fileName)
 Export the workspace as an HS3 document, and write it to a JSON file. Returns true; errors are exceptions.
 
std::string exportJSONtoString ()
 Export the workspace as an HS3 document, and return it as a JSON string.
 
std::string const & exportRootName () const
 The name of the top-level object whose export is in progress (the root of the current export recursion).
 
std::string exportTransformed (const RooAbsReal *original, const std::string &suffix, const std::string &formula)
 
std::string getStringAttribute (const std::string &obj, const std::string &attrib)
 
bool hasAttribute (const std::string &obj, const std::string &attrib)
 
RooFit::HS3::Version hs3Version () const
 The HS3 version of the document that is currently being imported.
 
void importFunction (const RooFit::Detail::JSONNode &p, bool importAllDependants)
 Import the function or distribution p into the workspace, with the importers that are registered for its type.
 
void importFunction (const std::string &jsonString, bool importAllDependants)
 Import a function or distribution that is given as a JSON string, see the overload for a JSONNode.
 
bool importJSON (std::istream &is)
 Import an HS3 document that is read as JSON from the stream into the workspace. Returns true; errors are exceptions.
 
bool importJSON (std::string const &filename)
 Import the HS3 document of a JSON file into the workspace. Returns true; errors are exceptions.
 
void importJSONElement (const std::string &name, const std::string &jsonString)
 
bool importJSONfromString (const std::string &s)
 Import an HS3 document that is given as a JSON string into the workspace. Returns true; errors are exceptions.
 
void importVariableElement (const RooFit::Detail::JSONNode &elementNode)
 
bool isConstraintReadAsChannel (RooAbsPdf const &pdf) const
 Whether the constraint term pdf contributes to the likelihoods of the document that is currently being imported as a component of a combined distribution with data, by itself or as a component of an array distribution.
 
void queueExport (RooAbsArg const &arg)
 
void queueExportTemporary (RooAbsArg *arg)
 
void recordConstraintTerms (std::string const &pdfName, std::vector< std::string > const &terms)
 
template<class T >
T * request (const std::string &objname, const std::string &requestAuthor)
 The object objname from the workspace, imported from the document first if needed.
 
template<class T >
T * requestArg (const RooFit::Detail::JSONNode &node, const std::string &key)
 
template<class T >
RooArgList requestArgList (const RooFit::Detail::JSONNode &node, const std::string &seqName)
 
template<class T >
RooArgSet requestArgSet (const RooFit::Detail::JSONNode &node, const std::string &seqName)
 
template<class T , class Coll_t >
Coll_t requestCollection (const RooFit::Detail::JSONNode &node, const std::string &seqName)
 
void setAttribute (const std::string &obj, const std::string &attrib)
 
void setConstraintObservable (RooAbsPdf const &pdf, std::string const &observable)
 Record that observable is the observable of the constraint term pdf (the side that is not the constrained parameter).
 
void setStringAttribute (const std::string &obj, const std::string &attrib, const std::string &value)
 
template<class T >
T * tryRequest (const std::string &objname)
 Like request(), but returns nullptr if neither the workspace nor the document has the object.
 
RooWorkspace * workspace ()
 
template<class Obj_t , typename... Args_t>
Obj_t & wsEmplace (RooStringView name, Args_t &&...args)
 
template<class Obj_t >
Obj_t & wsImport (Obj_t const &obj)
 

Static Public Member Functions

static RooFit::Detail::JSONNode & appendNamedChild (RooFit::Detail::JSONNode &node, std::string const &name)
 
static RooWorkspace cleanWS (const RooWorkspace &ws, bool onlyModelConfig=false)
 
static Config & config ()
 
static void error (const char *s)
 Write an error to the RooFit message service, and throw it as a std::runtime_error.
 
static void error (const std::string &s)
 
static void exportArray (std::size_t n, double const *contents, RooFit::Detail::JSONNode &output)
 Write n numbers as an array, each as an integer if it has no fractional part.
 
static void exportHisto (RooArgSet const &vars, std::size_t n, double const *contents, RooFit::Detail::JSONNode &output)
 Write the axes and the n bin contents of a histogram over the variables vars, which are RooRealVars or RooCategories, in the order of the variables.
 
static void fillSeq (RooFit::Detail::JSONNode &node, RooAbsCollection const &coll, size_t nMax=-1)
 
static RooFit::Detail::JSONNode const * findNamedChild (RooFit::Detail::JSONNode const &node, std::string const &name)
 
static bool isValidName (const std::string &str)
 Whether a string is a valid name: a letter or an underscore, followed by letters, digits or underscores.
 
static std::string name (const RooFit::Detail::JSONNode &n)
 
static RooArgSet readAxes (const RooFit::Detail::JSONNode &node)
 Create the variables for the "axes" of topNode, which are owned by the returned set.
 
static std::unique_ptr< RooDataHist > readBinnedData (const RooFit::Detail::JSONNode &n, const std::string &namecomp, RooArgSet const &vars)
 Create a RooDataHist with the name name over the variables vars from the "contents" of n, and its "errors" if it has any.
 
static std::string sanitizeName (const std::string str)
 Replace some characters that are common in the names of RooFit objects, but that the HS3 standard doesn't allow in names, if config().allowSanitizeNames is set.
 
static RooWorkspace sanitizeWS (const RooWorkspace &ws)
 
static bool testValidName (const std::string &name, bool forceError)
 
static std::ostream & warning (const std::string &s)
 Write a warning to the RooFit message service, and return its stream.
 

Static Public Attributes

static constexpr bool useListsInsteadOfDicts = true
 Named objects are always stored in lists, as the HS3 standard requires. Kept for backwards compatibility.
 

Private Member Functions

void exportAllObjects (RooFit::Detail::JSONNode &n)
 
void exportArrayDists ()
 
void exportCombinedData (RooAbsData const &data)
 Export a data set with category observables as a "combined" data set.
 
bool exportConstraintData (std::string const &term, RooArgSet const *globalObservables, std::string const &dataName)
 
void exportData (RooAbsData const &data)
 
void exportModelConfig (RooStats::ModelConfig const &mc, const std::vector< RooAbsData * > &singleDataSets)
 
void exportObject (RooAbsArg const &func)
 
template<class T >
void exportObjects (T const &args)
 
void exportSimultaneous (RooSimultaneous const &simPdf)
 Export a RooSimultaneous as a "combined_dist".
 
void exportSingleModelConfig (RooStats::ModelConfig const &mc, std::string const &analysisName, std::string const *dataName)
 
void exportVariable (const RooAbsArg *v, RooFit::HS3::ParameterPoint &point)
 
void importAllNodes (RooFit::Detail::JSONNode &n)
 
void importDependants (const RooFit::Detail::JSONNode &n)
 
void importDistribution (RooFit::HS3::Distribution const &distribution)
 
void importVariable (RooFit::HS3::ParameterValue const &p)
 
void prepareCombinedObservableRenaming ()
 
void recordCategory (RooAbsCategory const &cat)
 
template<class T >
T * requestImpl (const std::string &objname)
 
template<>
RooRealVar * requestImpl (const std::string &objname)
 
template<>
RooAbsPdf * requestImpl (const std::string &objname)
 
template<>
RooAbsReal * requestImpl (const std::string &objname)
 
void warnIfFreeWithoutDomain (RooRealVar const &var)
 

Private Attributes

std::map< std::string, std::map< std::string, std::map< std::string, std::string > > > _combinedObservableRenames
 
std::unique_ptr< RooFit::HS3::ToolExportState > _export
 
std::unique_ptr< RooFit::HS3::ToolImportState > _import
 
std::vector< std::string > _importStack
 
std::map< std::string, std::map< std::string, RooAbsPdf const * > > _renamedComponents
 
std::vector< std::unique_ptr< RooAbsArg > > _renamedObjects
 
std::vector< RooAbsArg const * > _serversToDelete
 
std::vector< RooAbsArg const * > _serversToExport
 
RooWorkspace & _workspace
 

Friends

void RooFit::HS3::setExportedObject (RooJSONFactoryWSTool &tool, RooFit::HS3::HistFactoryDist dist, std::vector< RooFit::HS3::DistributionRef > channelConstraints)
 

#include <RooFitHS3/RooJSONFactoryWSTool.h>

Constructor & Destructor Documentation

◆ RooJSONFactoryWSTool()

RooJSONFactoryWSTool::RooJSONFactoryWSTool ( RooWorkspace & ws)

Definition at line 1825 of file RooJSONFactoryWSTool.cxx.

◆ ~RooJSONFactoryWSTool()

RooJSONFactoryWSTool::~RooJSONFactoryWSTool ( )
default

Member Function Documentation

◆ appendNamedChild()

JSONNode & RooJSONFactoryWSTool::appendNamedChild ( RooFit::Detail::JSONNode & node,
std::string const & name )
static

Definition at line 1873 of file RooJSONFactoryWSTool.cxx.

◆ channelConstraints()

std::vector< HS3::DistributionRef > const * RooJSONFactoryWSTool::channelConstraints ( std::string const & dist) const

The constraint terms that the document that is currently being imported adds to the HistFactory distribution dist, besides those that its modifiers name, or nullptr if there are none.

Definition at line 1840 of file RooJSONFactoryWSTool.cxx.

◆ cleanWS()

RooWorkspace RooJSONFactoryWSTool::cleanWS ( const RooWorkspace & ws,
bool onlyModelConfig = false )
static

Definition at line 3776 of file RooJSONFactoryWSTool.cxx.

◆ config()

RooJSONFactoryWSTool::Config & RooJSONFactoryWSTool::config ( )
static

Definition at line 3823 of file RooJSONFactoryWSTool.cxx.

◆ constraintObservable()

std::string const * RooJSONFactoryWSTool::constraintObservable ( std::string const & pdfName) const

Definition at line 2271 of file RooJSONFactoryWSTool.cxx.

◆ error() [1/2]

void RooJSONFactoryWSTool::error ( const char * s)
static

Write an error to the RooFit message service, and throw it as a std::runtime_error.

Definition at line 3741 of file RooJSONFactoryWSTool.cxx.

◆ error() [2/2]

static void RooJSONFactoryWSTool::error ( const std::string & s)
inlinestatic

Definition at line 192 of file RooJSONFactoryWSTool.h.

◆ exportAllObjects()

void RooJSONFactoryWSTool::exportAllObjects ( RooFit::Detail::JSONNode & n)
private

Definition at line 3257 of file RooJSONFactoryWSTool.cxx.

◆ exportArray()

void RooJSONFactoryWSTool::exportArray ( std::size_t n,
double const * contents,
RooFit::Detail::JSONNode & output )
static

Write n numbers as an array, each as an integer if it has no fractional part.

RooFit doesn't use this function itself, but exporters outside of ROOT do.

Definition at line 2520 of file RooJSONFactoryWSTool.cxx.

◆ exportArrayDists()

void RooJSONFactoryWSTool::exportArrayDists ( )
private

Definition at line 2243 of file RooJSONFactoryWSTool.cxx.

◆ exportAsArrayComponent()

std::string RooJSONFactoryWSTool::exportAsArrayComponent ( RooAbsPdf const & pdf,
std::string const & arrayName )

Definition at line 2214 of file RooJSONFactoryWSTool.cxx.

◆ exportCombinedData()

void RooJSONFactoryWSTool::exportCombinedData ( RooAbsData const & data)
private

Export a data set with category observables as a "combined" data set.

The categories are the columns, sorted by name, and are declared as categorical axes of the default domain. There is one sub-data set per key, i.e. per combination of states, written like any other data set and named after the data set and the labels of the key. A key is written also without entries: RooFit treats a channel without entries as present and empty. If the workspace has a RooSimultaneous with the same columns, each sub-data set only carries the observables of the corresponding component, and keys without entries for which it has no component are left out; otherwise, every sub-data set carries all observables.

Definition at line 2616 of file RooJSONFactoryWSTool.cxx.

◆ exportConstraintData()

bool RooJSONFactoryWSTool::exportConstraintData ( std::string const & term,
RooArgSet const * globalObservables,
std::string const & dataName )
private

Definition at line 2291 of file RooJSONFactoryWSTool.cxx.

◆ exportData()

void RooJSONFactoryWSTool::exportData ( RooAbsData const & data)
private

Definition at line 2679 of file RooJSONFactoryWSTool.cxx.

◆ exportHisto()

void RooJSONFactoryWSTool::exportHisto ( RooArgSet const & vars,
std::size_t n,
double const * contents,
RooFit::Detail::JSONNode & output )
static

Write the axes and the n bin contents of a histogram over the variables vars, which are RooRealVars or RooCategories, in the order of the variables.

Definition at line 2513 of file RooJSONFactoryWSTool.cxx.

◆ exportJSON() [1/2]

bool RooJSONFactoryWSTool::exportJSON ( std::ostream & os)

Export the workspace as an HS3 document, and write it as JSON to the stream. Returns true; errors are exceptions.

Definition at line 3457 of file RooJSONFactoryWSTool.cxx.

◆ exportJSON() [2/2]

bool RooJSONFactoryWSTool::exportJSON ( std::string const & fileName)

Export the workspace as an HS3 document, and write it to a JSON file. Returns true; errors are exceptions.

Definition at line 3467 of file RooJSONFactoryWSTool.cxx.

◆ exportJSONtoString()

std::string RooJSONFactoryWSTool::exportJSONtoString ( )

Export the workspace as an HS3 document, and return it as a JSON string.

Definition at line 3449 of file RooJSONFactoryWSTool.cxx.

◆ exportModelConfig()

void RooJSONFactoryWSTool::exportModelConfig ( RooStats::ModelConfig const & mc,
const std::vector< RooAbsData * > & singleDataSets )
private

Definition at line 2870 of file RooJSONFactoryWSTool.cxx.

◆ exportObject()

void RooJSONFactoryWSTool::exportObject ( RooAbsArg const & func)
private

Definition at line 2098 of file RooJSONFactoryWSTool.cxx.

◆ exportObjects()

template<class T >
void RooJSONFactoryWSTool::exportObjects ( T const & args)
inlineprivate

Definition at line 277 of file RooJSONFactoryWSTool.h.

◆ exportRootName()

std::string const & RooJSONFactoryWSTool::exportRootName ( ) const

The name of the top-level object whose export is in progress (the root of the current export recursion).

Definition at line 2209 of file RooJSONFactoryWSTool.cxx.

◆ exportSimultaneous()

void RooJSONFactoryWSTool::exportSimultaneous ( RooSimultaneous const & simPdf)
private

Export a RooSimultaneous as a "combined_dist".

The components are selected by a key with one label per column. The columns are the index category of the RooSimultaneous or, for a RooSuperCategory index, its input categories, sorted by name. They are declared as categorical axes of the default domain. States without a pdf are not written: HS3 does not require a component for every key.

Definition at line 2358 of file RooJSONFactoryWSTool.cxx.

◆ exportSingleModelConfig()

void RooJSONFactoryWSTool::exportSingleModelConfig ( RooStats::ModelConfig const & mc,
std::string const & analysisName,
std::string const * dataName )
private

Definition at line 2998 of file RooJSONFactoryWSTool.cxx.

◆ exportTransformed()

std::string RooJSONFactoryWSTool::exportTransformed ( const RooAbsReal * original,
const std::string & suffix,
const std::string & formula )

Definition at line 2005 of file RooJSONFactoryWSTool.cxx.

◆ exportVariable()

void RooJSONFactoryWSTool::exportVariable ( const RooAbsArg * v,
RooFit::HS3::ParameterPoint & point )
private

Definition at line 1975 of file RooJSONFactoryWSTool.cxx.

◆ fillSeq()

void RooJSONFactoryWSTool::fillSeq ( RooFit::Detail::JSONNode & node,
RooAbsCollection const & coll,
size_t nMax = -1 )
static

Definition at line 1857 of file RooJSONFactoryWSTool.cxx.

◆ findNamedChild()

JSONNode const * RooJSONFactoryWSTool::findNamedChild ( RooFit::Detail::JSONNode const & node,
std::string const & name )
static

Definition at line 1880 of file RooJSONFactoryWSTool.cxx.

◆ getStringAttribute()

std::string RooJSONFactoryWSTool::getStringAttribute ( const std::string & obj,
const std::string & attrib )

Definition at line 3491 of file RooJSONFactoryWSTool.cxx.

◆ hasAttribute()

bool RooJSONFactoryWSTool::hasAttribute ( const std::string & obj,
const std::string & attrib )

Definition at line 3475 of file RooJSONFactoryWSTool.cxx.

◆ hs3Version()

HS3::Version RooJSONFactoryWSTool::hs3Version ( ) const

The HS3 version of the document that is currently being imported.

Outside of an import it is 0.0.0, like a version that can't be parsed.

Definition at line 1852 of file RooJSONFactoryWSTool.cxx.

◆ importAllNodes()

void RooJSONFactoryWSTool::importAllNodes ( RooFit::Detail::JSONNode & n)
private

Definition at line 3509 of file RooJSONFactoryWSTool.cxx.

◆ importDependants()

void RooJSONFactoryWSTool::importDependants ( const RooFit::Detail::JSONNode & n)
private

Definition at line 2858 of file RooJSONFactoryWSTool.cxx.

◆ importDistribution()

void RooJSONFactoryWSTool::importDistribution ( RooFit::HS3::Distribution const & distribution)
private

Definition at line 2483 of file RooJSONFactoryWSTool.cxx.

◆ importFunction() [1/2]

void RooJSONFactoryWSTool::importFunction ( const RooFit::Detail::JSONNode & p,
bool importAllDependants )

Import the function or distribution p into the workspace, with the importers that are registered for its type.

If importAllDependants is false, p is a fragment of a document, whose own "functions" and "distributions" are imported first.

Definition at line 2422 of file RooJSONFactoryWSTool.cxx.

◆ importFunction() [2/2]

void RooJSONFactoryWSTool::importFunction ( const std::string & jsonString,
bool importAllDependants )

Import a function or distribution that is given as a JSON string, see the overload for a JSONNode.

Definition at line 2506 of file RooJSONFactoryWSTool.cxx.

◆ importJSON() [1/2]

bool RooJSONFactoryWSTool::importJSON ( std::istream & is)

Import an HS3 document that is read as JSON from the stream into the workspace. Returns true; errors are exceptions.

Definition at line 3651 of file RooJSONFactoryWSTool.cxx.

◆ importJSON() [2/2]

bool RooJSONFactoryWSTool::importJSON ( std::string const & filename)

Import the HS3 document of a JSON file into the workspace. Returns true; errors are exceptions.

Definition at line 3659 of file RooJSONFactoryWSTool.cxx.

◆ importJSONElement()

void RooJSONFactoryWSTool::importJSONElement ( const std::string & name,
const std::string & jsonString )

Definition at line 3667 of file RooJSONFactoryWSTool.cxx.

◆ importJSONfromString()

bool RooJSONFactoryWSTool::importJSONfromString ( const std::string & s)

Import an HS3 document that is given as a JSON string into the workspace. Returns true; errors are exceptions.

Definition at line 3442 of file RooJSONFactoryWSTool.cxx.

◆ importVariable()

void RooJSONFactoryWSTool::importVariable ( RooFit::HS3::ParameterValue const & p)
private

Definition at line 2821 of file RooJSONFactoryWSTool.cxx.

◆ importVariableElement()

void RooJSONFactoryWSTool::importVariableElement ( const RooFit::Detail::JSONNode & elementNode)

Definition at line 3702 of file RooJSONFactoryWSTool.cxx.

◆ isConstraintReadAsChannel()

bool RooJSONFactoryWSTool::isConstraintReadAsChannel ( RooAbsPdf const & pdf) const

Whether the constraint term pdf contributes to the likelihoods of the document that is currently being imported as a component of a combined distribution with data, by itself or as a component of an array distribution.

It is then a measurement of its own, and must not be multiplied into the distributions that name it as a constraint as well.

Definition at line 1827 of file RooJSONFactoryWSTool.cxx.

◆ isValidName()

bool RooJSONFactoryWSTool::isValidName ( const std::string & str)
static

Whether a string is a valid name: a letter or an underscore, followed by letters, digits or underscores.

Only characters from the ASCII character set are allowed.

Definition at line 1894 of file RooJSONFactoryWSTool.cxx.

◆ name()

std::string RooJSONFactoryWSTool::name ( const RooFit::Detail::JSONNode & n)
static

Definition at line 1916 of file RooJSONFactoryWSTool.cxx.

◆ prepareCombinedObservableRenaming()

void RooJSONFactoryWSTool::prepareCombinedObservableRenaming ( )
private

Definition at line 2529 of file RooJSONFactoryWSTool.cxx.

◆ queueExport()

void RooJSONFactoryWSTool::queueExport ( RooAbsArg const & arg)
inline

Definition at line 234 of file RooJSONFactoryWSTool.h.

◆ queueExportTemporary()

void RooJSONFactoryWSTool::queueExportTemporary ( RooAbsArg * arg)
inline

Definition at line 235 of file RooJSONFactoryWSTool.h.

◆ readAxes()

RooArgSet RooJSONFactoryWSTool::readAxes ( const RooFit::Detail::JSONNode & node)
static

Create the variables for the "axes" of topNode, which are owned by the returned set.

Definition at line 2786 of file RooJSONFactoryWSTool.cxx.

◆ readBinnedData()

std::unique_ptr< RooDataHist > RooJSONFactoryWSTool::readBinnedData ( const RooFit::Detail::JSONNode & n,
const std::string & namecomp,
RooArgSet const & vars )
static

Create a RooDataHist with the name name over the variables vars from the "contents" of n, and its "errors" if it has any.

Definition at line 2797 of file RooJSONFactoryWSTool.cxx.

◆ recordCategory()

void RooJSONFactoryWSTool::recordCategory ( RooAbsCategory const & cat)
private

Definition at line 2408 of file RooJSONFactoryWSTool.cxx.

◆ recordConstraintTerms()

void RooJSONFactoryWSTool::recordConstraintTerms ( std::string const & pdfName,
std::vector< std::string > const & terms )

Definition at line 2280 of file RooJSONFactoryWSTool.cxx.

◆ request()

template<class T >
T * RooJSONFactoryWSTool::request ( const std::string & objname,
const std::string & requestAuthor )
inline

The object objname from the workspace, imported from the document first if needed.

Throws a DependencyMissingError if neither has it.

Definition at line 121 of file RooJSONFactoryWSTool.h.

◆ requestArg()

template<class T >
T * RooJSONFactoryWSTool::requestArg ( const RooFit::Detail::JSONNode & node,
const std::string & key )
inline

Definition at line 137 of file RooJSONFactoryWSTool.h.

◆ requestArgList()

template<class T >
RooArgList RooJSONFactoryWSTool::requestArgList ( const RooFit::Detail::JSONNode & node,
const std::string & seqName )
inline

Definition at line 171 of file RooJSONFactoryWSTool.h.

◆ requestArgSet()

template<class T >
RooArgSet RooJSONFactoryWSTool::requestArgSet ( const RooFit::Detail::JSONNode & node,
const std::string & seqName )
inline

Definition at line 165 of file RooJSONFactoryWSTool.h.

◆ requestCollection()

template<class T , class Coll_t >
Coll_t RooJSONFactoryWSTool::requestCollection ( const RooFit::Detail::JSONNode & node,
const std::string & seqName )
inline

Definition at line 147 of file RooJSONFactoryWSTool.h.

◆ requestImpl() [1/4]

template<class T >
T * RooJSONFactoryWSTool::requestImpl ( const std::string & objname)
private

◆ requestImpl() [2/4]

template<>
RooRealVar * RooJSONFactoryWSTool::requestImpl ( const std::string & objname)
private

Definition at line 1924 of file RooJSONFactoryWSTool.cxx.

◆ requestImpl() [3/4]

template<>
RooAbsPdf * RooJSONFactoryWSTool::requestImpl ( const std::string & objname)
private

Definition at line 1936 of file RooJSONFactoryWSTool.cxx.

◆ requestImpl() [4/4]

template<>
RooAbsReal * RooJSONFactoryWSTool::requestImpl ( const std::string & objname)
private

Definition at line 1955 of file RooJSONFactoryWSTool.cxx.

◆ sanitizeName()

std::string RooJSONFactoryWSTool::sanitizeName ( const std::string str)
static

Replace some characters that are common in the names of RooFit objects, but that the HS3 standard doesn't allow in names, if config().allowSanitizeNames is set.

Definition at line 3749 of file RooJSONFactoryWSTool.cxx.

◆ sanitizeWS()

RooWorkspace RooJSONFactoryWSTool::sanitizeWS ( const RooWorkspace & ws)
static

Definition at line 3830 of file RooJSONFactoryWSTool.cxx.

◆ setAttribute()

void RooJSONFactoryWSTool::setAttribute ( const std::string & obj,
const std::string & attrib )

Definition at line 3486 of file RooJSONFactoryWSTool.cxx.

◆ setConstraintObservable()

void RooJSONFactoryWSTool::setConstraintObservable ( RooAbsPdf const & pdf,
std::string const & observable )

Record that observable is the observable of the constraint term pdf (the side that is not the constrained parameter).

A Gaussian whose mean it is gets written with x and mean swapped, so that the observable is x.

Definition at line 2266 of file RooJSONFactoryWSTool.cxx.

◆ setStringAttribute()

void RooJSONFactoryWSTool::setStringAttribute ( const std::string & obj,
const std::string & attrib,
const std::string & value )

Definition at line 3502 of file RooJSONFactoryWSTool.cxx.

◆ testValidName()

bool RooJSONFactoryWSTool::testValidName ( const std::string & name,
bool forceError )
static

Definition at line 1900 of file RooJSONFactoryWSTool.cxx.

◆ tryRequest()

template<class T >
T * RooJSONFactoryWSTool::tryRequest ( const std::string & objname)
inline

Like request(), but returns nullptr if neither the workspace nor the document has the object.

Definition at line 131 of file RooJSONFactoryWSTool.h.

◆ warnIfFreeWithoutDomain()

void RooJSONFactoryWSTool::warnIfFreeWithoutDomain ( RooRealVar const & var)
private

Definition at line 2848 of file RooJSONFactoryWSTool.cxx.

◆ warning()

std::ostream & RooJSONFactoryWSTool::warning ( const std::string & s)
static

Write a warning to the RooFit message service, and return its stream.

Definition at line 3735 of file RooJSONFactoryWSTool.cxx.

◆ workspace()

RooWorkspace * RooJSONFactoryWSTool::workspace ( )
inline

Definition at line 176 of file RooJSONFactoryWSTool.h.

◆ wsEmplace()

template<class Obj_t , typename... Args_t>
Obj_t & RooJSONFactoryWSTool::wsEmplace ( RooStringView name,
Args_t &&... args )
inline

Definition at line 186 of file RooJSONFactoryWSTool.h.

◆ wsImport()

template<class Obj_t >
Obj_t & RooJSONFactoryWSTool::wsImport ( Obj_t const & obj)
inline

Definition at line 179 of file RooJSONFactoryWSTool.h.

Friends And Related Symbol Documentation

◆ RooFit::HS3::setExportedObject

Member Data Documentation

◆ _combinedObservableRenames

std::map<std::string, std::map<std::string, std::map<std::string, std::string> > > RooJSONFactoryWSTool::_combinedObservableRenames
private

Definition at line 326 of file RooJSONFactoryWSTool.h.

◆ _export

std::unique_ptr<RooFit::HS3::ToolExportState> RooJSONFactoryWSTool::_export
private

Definition at line 320 of file RooJSONFactoryWSTool.h.

◆ _import

std::unique_ptr<RooFit::HS3::ToolImportState> RooJSONFactoryWSTool::_import
private

Definition at line 319 of file RooJSONFactoryWSTool.h.

◆ _importStack

std::vector<std::string> RooJSONFactoryWSTool::_importStack
private

Definition at line 332 of file RooJSONFactoryWSTool.h.

◆ _renamedComponents

std::map<std::string, std::map<std::string, RooAbsPdf const *> > RooJSONFactoryWSTool::_renamedComponents
private

Definition at line 327 of file RooJSONFactoryWSTool.h.

◆ _renamedObjects

std::vector<std::unique_ptr<RooAbsArg> > RooJSONFactoryWSTool::_renamedObjects
private

Definition at line 328 of file RooJSONFactoryWSTool.h.

◆ _serversToDelete

std::vector<RooAbsArg const *> RooJSONFactoryWSTool::_serversToDelete
private

Definition at line 322 of file RooJSONFactoryWSTool.h.

◆ _serversToExport

std::vector<RooAbsArg const *> RooJSONFactoryWSTool::_serversToExport
private

Definition at line 321 of file RooJSONFactoryWSTool.h.

◆ _workspace

RooWorkspace& RooJSONFactoryWSTool::_workspace
private

Definition at line 316 of file RooJSONFactoryWSTool.h.

◆ useListsInsteadOfDicts

constexpr bool RooJSONFactoryWSTool::useListsInsteadOfDicts = true
staticconstexpr

Named objects are always stored in lists, as the HS3 standard requires. Kept for backwards compatibility.

Definition at line 56 of file RooJSONFactoryWSTool.h.

Libraries for RooJSONFactoryWSTool:

The documentation for this class was generated from the following files: