17#ifndef RooFit_ModelConfig_h
18#define RooFit_ModelConfig_h
59 if (strcmp(
name,
"") == 0) {
225 std::stringstream ss;
226 ss <<
"pdf " <<
name <<
" does not exist in workspace";
227 const std::string errorMsg = ss.str();
228 coutE(ObjectHandling) << errorMsg << std::endl;
229 throw std::runtime_error(errorMsg);
242 std::stringstream ss;
243 ss <<
"pdf " <<
name <<
" does not exist in workspace";
244 const std::string errorMsg = ss.str();
245 coutE(ObjectHandling) << errorMsg << std::endl;
246 throw std::runtime_error(errorMsg);
259 std::stringstream ss;
260 ss <<
"dataset " <<
name <<
" does not exist in workspace";
261 const std::string errorMsg = ss.str();
262 coutE(ObjectHandling) << errorMsg << std::endl;
263 throw std::runtime_error(errorMsg);
321 template <
typename... CmdArgs_t>
327 template <
typename... CmdArgs_t>
328 std::unique_ptr<RooFitResult>
fitTo(
RooAbsData &data, CmdArgs_t
const &...cmdArgs)
const
const char Option_t
Option string (const char).
#define ClassDefOverride(name, id)
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Container class to hold unbinned data.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
< A class that holds configuration information for a model using a workspace as a store
void SetConstraintParameters(const RooArgSet &set)
Specify the constraint parameters.
void SetSnapshot(const RooArgSet &set)
Set parameter values for a particular hypothesis if using a common PDF by saving a snapshot in the wo...
std::string fSnapshotName
name for RooArgSet that specifies a particular hypothesis
std::string fExtConstraintsName
name for RooArgSet specifying external constraints
ModelConfig(const char *name, const char *title, RooWorkspace *ws=nullptr)
void SetGlobalObservables(const char *argList)
Specify the global observables through a comma-separated list of arguments already in the workspace.
void ImportPdfInWS(const RooAbsPdf &pdf)
internal function to import Pdf in WS
std::string fNuisParamsName
name for RooArgSet specifying nuisance parameters
void SetNuisanceParameters(const char *argList)
Specify the nuisance parameters using a comma-separated list of arguments already in the workspace.
void SetParametersOfInterest(const RooArgSet &set)
Specify parameters of interest.
void SetExternalConstraints(const RooArgSet &set)
Specify the external constraints.
RooAbsData * GetProtoData() const
get Proto data set (return nullptr if not existing)
void DefineSetInWS(const char *name, const RooArgSet &set)
helper functions to define a set in the WS
void GuessObsAndNuisance(const RooDataSet &data, bool printModelConfig=true)
std::string fPriorPdfName
name for RooAbsPdf specifying a prior on the parameters
std::string fDataName
name of data set in workspace
RooWorkspace * GetWorkspace() const
alias for GetWS()
void SetProtoData(RooAbsData &data)
Set the proto DataSet, add to the workspace if not already there.
const RooArgSet * GetConditionalObservables() const
get RooArgSet for conditional observables (return nullptr if not existing)
std::string fConditionalObsName
name for RooArgSet specifying conditional observables
void SetParameters(const RooArgSet &set)
Specify parameters of the PDF.
void SetConditionalObservables(const char *argList)
Specify the conditional observables through a comma-separated list of arguments already in the worksp...
ModelConfig(const char *name, RooWorkspace *ws=nullptr)
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return nullptr if not existing)
void SetConditionalObservables(const RooArgSet &set)
Specify the conditional observables.
ModelConfig * Clone(const char *name="") const override
clone
void SetObservables(const RooArgSet &set)
Specify the observables.
RooWorkspace * fRefWS
! WS reference used in the file
void ReplaceWS(RooWorkspace *ws) override
Remove the existing reference to a workspace and replace it with this new one.
void SetPdf(const char *name)
Specify the name of the PDF in the workspace to be used.
void SetPriorPdf(const RooAbsPdf &pdf)
Set the Prior Pdf, add to the workspace if not already there.
void SetParametersOfInterest(const char *argList)
Specify parameters of interest using a comma-separated list of arguments already in the workspace.
void SetWorkspace(RooWorkspace &ws)
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
std::string fPdfName
name of PDF in workspace
std::string fObservablesName
name for RooArgSet specifying observable parameters.
void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the workspace if not already there.
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return nullptr if not existing)
void SetExternalConstraints(const char *argList)
Specify the external constraints through a comma-separated list of arguments already in the workspace...
std::unique_ptr< RooAbsReal > createNLLImpl(RooAbsData &data, const RooLinkedList &cmdList) const
std::unique_ptr< RooFitResult > fitTo(RooAbsData &data, CmdArgs_t const &...cmdArgs) const
Wrapper around RooAbsPdf::fitTo(), where the pdf and some configuration options are retrieved from th...
void LoadSnapshot() const
load the snapshot from ws if it exists
void SetConstraintParameters(const char *argList)
Specify the constraint parameters through a comma-separated list of arguments already in the workspac...
std::string fConstrParamsName
name for RooArgSet specifying constrained parameters
void Print(Option_t *option="") const override
overload the print method
std::string fGlobalObsName
name for RooArgSet specifying global observables
std::unique_ptr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &...cmdArgs) const
Wrapper around RooAbsPdf::createNLL(), where the pdf and some configuration options are retrieved fro...
void ImportDataInWS(RooAbsData &data)
internal function to import data in WS
void SetWS(RooWorkspace &ws) override
Set a workspace that owns all the necessary components for the analysis.
bool SetHasOnlyParameters(const RooArgSet &set, const char *errorMsgPrefix=nullptr)
helper function to check that content of a given set is exclusively parameters
std::string fPOIName
name for RooArgSet specifying parameters of interest
std::unique_ptr< RooFitResult > fitToImpl(RooAbsData &data, const RooLinkedList &cmdList) const
void SetProtoData(const char *name)
Specify the name of the dataset in the workspace to be used.
const RooArgSet * GetObservables() const
get RooArgSet for observables (return nullptr if not existing)
ModelConfig(RooWorkspace *ws=nullptr)
void SetObservables(const char *argList)
specify the observables through a comma-separated list of arguments already in the workspace.
const RooArgSet * GetSnapshot() const
get RooArgSet for parameters for a particular hypothesis (return nullptr if not existing)
const RooArgSet * GetConstraintParameters() const
get RooArgSet containing the constraint parameters (return nullptr if not existing)
const RooArgSet * GetExternalConstraints() const
get RooArgSet for global observables (return nullptr if not existing)
RooWorkspace * GetWS() const override
Get workspace.
void GuessObsAndNuisance(const RooArgSet &obsSet, bool printModelConfig=true)
Makes sensible guesses of observables, parameters of interest and nuisance parameters if one or multi...
std::string fProtoDataName
name for RooArgSet specifying dataset that should be used as proto-data
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
void SetNuisanceParameters(const RooArgSet &set)
Specify the nuisance parameters (parameters that are not POI).
void SetPriorPdf(const char *name)
Specify the name of the PDF in the workspace to be used.
void SetParameters(const char *argList)
Specify parameters using a list of comma-separated list of arguments already in the workspace.
RooAbsPdf * GetPriorPdf() const
get parameters prior pdf (return nullptr if not existing)
void SetGlobalObservables(const RooArgSet &set)
Specify the global observables.
An interface to set and retrieve a workspace.
Persistable container for RooFit projects.
RooAbsPdf * pdf(RooStringView name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
const RooArgSet * set(RooStringView name)
Return pointer to previously defined named set with given nmame If no such set is found a null pointe...
RooAbsData * data(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
const char * GetName() const override
Returns name of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
std::unique_ptr< RooLinkedList > createCmdList(RooCmdArg const *arg1, Args &&...args)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
RooStats::ModelConfig ModelConfig
Namespace for the RooStats classes.