Warning, file /include/root/RooWorkspace.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_WORKSPACE
0017 #define ROO_WORKSPACE
0018
0019 #include "RooPrintable.h"
0020 #include "RooArgSet.h"
0021 #include "RooLinkedList.h"
0022 #include "RooCmdArg.h"
0023 #include "RooExpensiveObjectCache.h"
0024 #include "TUUID.h"
0025 #include <map>
0026 #include <list>
0027 #include <memory>
0028 #include <string>
0029
0030 class TClass ;
0031 class RooAbsPdf ;
0032 class RooAbsData ;
0033 class RooRealVar ;
0034 class RooCategory ;
0035 class RooAbsReal ;
0036 class RooAbsCategory ;
0037 class RooFactoryWSTool ;
0038 class RooAbsStudy ;
0039
0040 #include "TNamed.h"
0041 #include "TDirectoryFile.h"
0042
0043 class RooWorkspace : public TNamed {
0044 public:
0045
0046 RooWorkspace() ;
0047 RooWorkspace(const char* name, bool doCINTExport)
0048 R__SUGGEST_ALTERNATIVE("The \"doCINTExport\" argument has no effect anymore since ROOT 6."
0049 "Consider using RooWorkspace(const char* name, const char* title=nullptr).");
0050 RooWorkspace(const char* name, const char* title=nullptr) ;
0051 RooWorkspace(const RooWorkspace& other) ;
0052 ~RooWorkspace() override ;
0053
0054 TObject *Clone(const char *newname="") const override;
0055
0056 bool importClassCode(const char* pat="*", bool doReplace=false) ;
0057 bool importClassCode(TClass* theClass, bool doReplace=false) ;
0058
0059
0060 bool import(const RooAbsArg& arg,
0061 const RooCmdArg& arg1={},const RooCmdArg& arg2={},const RooCmdArg& arg3={},
0062 const RooCmdArg& arg4={},const RooCmdArg& arg5={},const RooCmdArg& arg6={},
0063 const RooCmdArg& arg7={},const RooCmdArg& arg8={},const RooCmdArg& arg9={}) ;
0064 bool import(const RooArgSet& args,
0065 const RooCmdArg& arg1={},const RooCmdArg& arg2={},const RooCmdArg& arg3={},
0066 const RooCmdArg& arg4={},const RooCmdArg& arg5={},const RooCmdArg& arg6={},
0067 const RooCmdArg& arg7={},const RooCmdArg& arg8={},const RooCmdArg& arg9={}) ;
0068 bool import(RooAbsData const& data,
0069 const RooCmdArg& arg1={},const RooCmdArg& arg2={},const RooCmdArg& arg3={},
0070 const RooCmdArg& arg4={},const RooCmdArg& arg5={},const RooCmdArg& arg6={},
0071 const RooCmdArg& arg7={},const RooCmdArg& arg8={},const RooCmdArg& arg9={}) ;
0072 bool import(const char *fileSpec,
0073 const RooCmdArg& arg1={},const RooCmdArg& arg2={},const RooCmdArg& arg3={},
0074 const RooCmdArg& arg4={},const RooCmdArg& arg5={},const RooCmdArg& arg6={},
0075 const RooCmdArg& arg7={},const RooCmdArg& arg8={},const RooCmdArg& arg9={}) ;
0076 bool import(TObject const& object, bool replaceExisting=false) ;
0077 bool import(TObject const& object, const char* aliasName, bool replaceExisting=false) ;
0078
0079
0080 bool startTransaction() ;
0081 bool cancelTransaction() ;
0082 bool commitTransaction() ;
0083
0084
0085 bool defineSet(const char* name, const RooArgSet& aset, bool importMissing=false) ;
0086 bool defineSet(const char* name, const char* contentList) ;
0087 bool extendSet(const char* name, const char* newContents) ;
0088 bool renameSet(const char* name, const char* newName) ;
0089 bool removeSet(const char* name) ;
0090 const RooArgSet* set(RooStringView name) ;
0091 inline const std::map<std::string,RooArgSet>& sets() const { return _namedSets; }
0092
0093
0094 bool saveSnapshot(RooStringView, const char* paramNames) ;
0095 bool saveSnapshot(RooStringView, const RooArgSet& params, bool importValues=false) ;
0096 bool loadSnapshot(const char* name) ;
0097 const RooArgSet* getSnapshot(const char* name) const ;
0098
0099
0100 RooLinkedList const& getSnapshots() const { return _snapshots; }
0101
0102
0103 RooAbsPdf* pdf(RooStringView name) const ;
0104 RooAbsReal* function(RooStringView name) const ;
0105 RooRealVar* var(RooStringView name) const ;
0106 RooCategory* cat(RooStringView name) const ;
0107 RooAbsCategory* catfunc(RooStringView name) const ;
0108 RooAbsData* data(RooStringView name) const ;
0109 RooAbsData* embeddedData(RooStringView name) const ;
0110 RooAbsArg* arg(RooStringView name) const ;
0111 RooAbsArg* fundArg(RooStringView name) const ;
0112 RooArgSet argSet(RooStringView nameList) const ;
0113 const RooArgSet& components() const { return _allOwnedNodes ; }
0114 TObject* genobj(RooStringView name) const ;
0115 TObject* obj(RooStringView name) const ;
0116
0117
0118 RooArgSet allVars() const;
0119 RooArgSet allCats() const ;
0120 RooArgSet allFunctions() const ;
0121 RooArgSet allCatFunctions() const ;
0122 RooArgSet allPdfs() const ;
0123 RooArgSet allResolutionModels() const ;
0124 std::list<RooAbsData*> allData() const ;
0125 std::list<RooAbsData*> allEmbeddedData() const ;
0126 std::list<TObject*> allGenericObjects() const ;
0127
0128 bool makeDir() ;
0129 bool cd(const char* path = nullptr) ;
0130
0131 bool writeToFile(const char* fileName, bool recreate=true) ;
0132
0133
0134
0135
0136
0137
0138 void useFindsWithHashLookup(bool flag) {
0139 _allOwnedNodes.useHashMapForFind(flag);
0140 }
0141
0142 void RecursiveRemove(TObject *obj) override;
0143
0144
0145 RooFactoryWSTool& factory() ;
0146 RooAbsArg* factory(RooStringView expr) ;
0147
0148
0149 bool addStudy(RooAbsStudy& study) ;
0150 TIterator* studyIterator() { return _studyMods.MakeIterator() ; }
0151 void clearStudies() ;
0152
0153
0154 void Print(Option_t* opts=nullptr) const override ;
0155
0156 static void autoImportClassCode(bool flag) ;
0157
0158 static void addClassDeclImportDir(const char* dir) ;
0159 static void addClassImplImportDir(const char* dir) ;
0160 static void setClassFileExportDir(const char* dir=nullptr) ;
0161
0162 const TUUID& uuid() const { return _uuid ; }
0163
0164 RooExpensiveObjectCache& expensiveObjectCache() { return _eocache ; }
0165
0166 class CodeRepo : public TObject {
0167 public:
0168 CodeRepo(RooWorkspace* wspace=nullptr) : _wspace(wspace), _compiledOK(true) {} ;
0169
0170 CodeRepo(const CodeRepo& other, RooWorkspace* wspace=nullptr) : TObject(other) ,
0171 _wspace(wspace?wspace:other._wspace),
0172 _c2fmap(other._c2fmap),
0173 _fmap(other._fmap),
0174 _ehmap(other._ehmap),
0175 _compiledOK(other._compiledOK) {} ;
0176
0177 bool autoImportClass(TClass* tc, bool doReplace=false) ;
0178 bool compileClasses() ;
0179
0180 bool compiledOK() const { return _compiledOK ; }
0181
0182 std::string listOfClassNames() const ;
0183
0184
0185
0186 class ClassRelInfo {
0187 public:
0188 TString _baseName;
0189 TString _fileBase ;
0190 } ;
0191
0192 class ClassFiles {
0193 public:
0194 ClassFiles() : _extracted(false) {}
0195 TString _hext ;
0196 TString _hfile ;
0197 TString _cxxfile ;
0198 bool _extracted ;
0199 } ;
0200
0201
0202 class ExtraHeader {
0203 public:
0204 TString _hname ;
0205 TString _hfile ;
0206 } ;
0207
0208 protected:
0209 RooWorkspace* _wspace ;
0210 std::map<TString,ClassRelInfo> _c2fmap ;
0211 std::map<TString,ClassFiles> _fmap ;
0212 std::map<TString,ExtraHeader> _ehmap ;
0213 bool _compiledOK ;
0214
0215 ClassDefOverride(CodeRepo,2) ;
0216 } ;
0217
0218
0219 class WSDir : public TDirectoryFile {
0220 public:
0221 WSDir(const char* name, const char* title, RooWorkspace* wspace) :
0222 TDirectoryFile(name,title,"RooWorkspace::WSDir",nullptr),
0223 _wspace(wspace)
0224 {
0225 }
0226
0227 ~WSDir() override { Clear("nodelete") ; }
0228
0229
0230 void Add(TObject*,bool) override ;
0231 void Append(TObject*,bool) override ;
0232
0233 protected:
0234 friend class RooWorkspace ;
0235 void InternalAppend(TObject* obj) ;
0236 RooWorkspace* _wspace ;
0237
0238 ClassDefOverride(WSDir,1) ;
0239 } ;
0240
0241
0242 private:
0243 friend class RooAbsArg;
0244 friend class RooAbsPdf;
0245 friend class RooConstraintSum;
0246 bool defineSetInternal(const char *name, const RooArgSet &aset);
0247
0248 friend class CodeRepo;
0249 static std::list<std::string> _classDeclDirList;
0250 static std::list<std::string> _classImplDirList;
0251 static std::string _classFileExportDir;
0252
0253 TUUID _uuid;
0254
0255 static bool _autoClass;
0256
0257 CodeRepo _classes;
0258
0259 RooArgSet _allOwnedNodes;
0260 RooLinkedList _dataList;
0261 RooLinkedList _embeddedDataList;
0262 RooLinkedList _views;
0263 RooLinkedList _snapshots;
0264 RooLinkedList _genObjects;
0265 RooLinkedList _studyMods;
0266 std::map<std::string, RooArgSet> _namedSets;
0267
0268 WSDir *_dir = nullptr;
0269
0270 RooExpensiveObjectCache _eocache;
0271
0272 std::unique_ptr<RooFactoryWSTool> _factory;
0273
0274 bool _doExport;
0275 std::string _exportNSName;
0276
0277 bool _openTrans = false;
0278 RooArgSet _sandboxNodes;
0279
0280 ClassDefOverride(RooWorkspace, 8)
0281 } ;
0282
0283 #endif