Revision 716fb731a3c8c9b583235feddac21006994d9626 authored by Kyle Cranmer on 03 August 2011, 22:09:36 UTC, committed by Kyle Cranmer on 03 August 2011, 22:09:36 UTC
git-svn-id: http://root.cern.ch/svn/root/branches/v5-30-00-patches@40446 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 0db9ccb
RooWorkspace.h
/*****************************************************************************
* Project: RooFit *
* Package: RooFitCore *
* File: $Id: RooWorkspace.h,v 1.3 2007/07/16 21:04:28 wouter Exp $
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#ifndef ROO_WORKSPACE
#define ROO_WORKSPACE
#include "RooPrintable.h"
#include "RooArgSet.h"
#include "RooLinkedList.h"
#include "RooCmdArg.h"
#include "RooExpensiveObjectCache.h"
#include "TUUID.h"
#include <map>
#include <list>
#include <string>
class TClass ;
class RooAbsPdf ;
class RooAbsData ;
class RooRealVar ;
class RooCategory ;
class RooAbsReal ;
class RooAbsCategory ;
class RooFactoryWSTool ;
class RooAbsStudy ;
#include "TNamed.h"
#include "TDirectoryFile.h"
class RooWorkspace : public TNamed {
public:
RooWorkspace() ;
RooWorkspace(const char* name, Bool_t doCINTExport) ;
RooWorkspace(const char* name, const char* title=0) ;
RooWorkspace(const RooWorkspace& other) ;
~RooWorkspace() ;
void exportToCint(const char* namespaceName=0) ;
Bool_t importClassCode(const char* pat="*", Bool_t doReplace=kFALSE) ;
Bool_t importClassCode(TClass* theClass, Bool_t doReplace=kFALSE) ;
// Import functions for dataset, functions, generic objects
Bool_t import(const RooAbsArg& arg, const RooCmdArg& arg1=RooCmdArg(),const RooCmdArg& arg2=RooCmdArg(),const RooCmdArg& arg3=RooCmdArg()) ;
Bool_t import(const RooArgSet& args, const RooCmdArg& arg1=RooCmdArg(),const RooCmdArg& arg2=RooCmdArg(),const RooCmdArg& arg3=RooCmdArg()) ;
Bool_t import(RooAbsData& data, const RooCmdArg& arg1=RooCmdArg(),const RooCmdArg& arg2=RooCmdArg(),const RooCmdArg& arg3=RooCmdArg()) ;
Bool_t import(const char *fileSpec, const RooCmdArg& arg1=RooCmdArg(),const RooCmdArg& arg2=RooCmdArg(),const RooCmdArg& arg3=RooCmdArg()) ;
Bool_t import(TObject& object, Bool_t replaceExisting=kFALSE) ;
Bool_t import(TObject& object, const char* aliasName, Bool_t replaceExisting=kFALSE) ;
// Transaction management interface for multi-step import operations
Bool_t startTransaction() ;
Bool_t cancelTransaction() ;
Bool_t commitTransaction() ;
// Named set management
Bool_t defineSet(const char* name, const RooArgSet& aset, Bool_t importMissing=kFALSE) ;
Bool_t defineSet(const char* name, const char* contentList) ;
Bool_t extendSet(const char* name, const char* newContents) ;
Bool_t renameSet(const char* name, const char* newName) ;
Bool_t removeSet(const char* name) ;
const RooArgSet* set(const char* name) ;
// Import, load and save parameter value snapshots
Bool_t saveSnapshot(const char* name, const char* paramNames) ;
Bool_t saveSnapshot(const char* name, const RooArgSet& params, Bool_t importValues=kFALSE) ;
Bool_t loadSnapshot(const char* name) ;
void merge(const RooWorkspace& /*other*/) {} ;
// Join p.d.f.s and datasets for simultaneous analysis
// RooAbsPdf* joinPdf(const char* jointPdfName, const char* indexName, const char* inputMapping) ;
// RooAbsData* joinData(const char* jointDataName, const char* indexName, const char* inputMapping) ;
// Accessor functions
RooAbsPdf* pdf(const char* name) const ;
RooAbsReal* function(const char* name) const ;
RooRealVar* var(const char* name) const ;
RooCategory* cat(const char* name) const ;
RooAbsCategory* catfunc(const char* name) const ;
RooAbsData* data(const char* name) const ;
RooAbsArg* arg(const char* name) const ;
RooAbsArg* fundArg(const char* name) const ;
RooArgSet argSet(const char* nameList) const ;
TIterator* componentIterator() const { return _allOwnedNodes.createIterator() ; }
const RooArgSet& components() const { return _allOwnedNodes ; }
TObject* genobj(const char* name) const ;
TObject* obj(const char* name) const ;
// Group accessors
RooArgSet allVars() const;
RooArgSet allCats() const ;
RooArgSet allFunctions() const ;
RooArgSet allCatFunctions() const ;
RooArgSet allPdfs() const ;
RooArgSet allResolutionModels() const ;
std::list<RooAbsData*> allData() const ;
std::list<TObject*> allGenericObjects() const ;
Bool_t makeDir() ;
Bool_t cd(const char* path = 0) ;
Bool_t writeToFile(const char* fileName, Bool_t recreate=kTRUE) ;
// Tools management
RooFactoryWSTool& factory() ;
RooAbsArg* factory(const char* expr) ;
// RooStudyManager modules
Bool_t addStudy(RooAbsStudy& study) ;
TIterator* studyIterator() { return _studyMods.MakeIterator() ; }
void clearStudies() ;
// Print function
void Print(Option_t* opts=0) const ;
static void autoImportClassCode(Bool_t flag) ;
static void addClassDeclImportDir(const char* dir) ;
static void addClassImplImportDir(const char* dir) ;
static void setClassFileExportDir(const char* dir=0) ;
const TUUID& uuid() const { return _uuid ; }
RooExpensiveObjectCache& expensiveObjectCache() { return _eocache ; }
class CodeRepo : public TObject {
public:
CodeRepo(RooWorkspace* wspace=0) : _wspace(wspace), _compiledOK(kTRUE) {} ;
virtual ~CodeRepo() {} ;
Bool_t autoImportClass(TClass* tc, Bool_t doReplace=kFALSE) ;
Bool_t compileClasses() ;
Bool_t compiledOK() const { return _compiledOK ; }
std::string listOfClassNames() const ;
class ClassRelInfo {
public:
TString _baseName;
TString _fileBase ;
} ;
class ClassFiles {
public:
ClassFiles() : _extracted(kFALSE) {}
TString _hext ;
TString _hfile ;
TString _cxxfile ;
Bool_t _extracted ;
} ;
protected:
RooWorkspace* _wspace ; // owning workspace
std::map<TString,ClassRelInfo> _c2fmap ; // List of contained classes
std::map<TString,ClassFiles> _fmap ; // List of contained files
Bool_t _compiledOK ; //! Flag indicating that classes compiled OK
ClassDef(CodeRepo,1) ; // Code repository for RooWorkspace
} ;
class WSDir : public TDirectoryFile {
public:
WSDir(const char* name, const char* title, RooWorkspace* wspace) :
TDirectoryFile(name,title,"RooWorkspace::WSDir",0),
_wspace(wspace)
{
}
virtual ~WSDir() { Clear("nodelete") ; } ;
#if ROOT_VERSION_CODE <= 332546
virtual void Add(TObject*) ;
virtual void Append(TObject*) ;
#else
virtual void Add(TObject*,Bool_t) ;
virtual void Append(TObject*,Bool_t) ;
#endif
protected:
friend class RooWorkspace ;
void InternalAppend(TObject* obj) ;
RooWorkspace* _wspace ; //! do not persist
ClassDef(WSDir,1) ; // TDirectory representation of RooWorkspace
} ;
private:
Bool_t isValidCPPID(const char* name) ;
void exportObj(TObject* obj) ;
void unExport() ;
friend class CodeRepo ;
static std::list<std::string> _classDeclDirList ;
static std::list<std::string> _classImplDirList ;
static std::string _classFileExportDir ;
TUUID _uuid ; // Unique workspace ID
static Bool_t _autoClass ; // Automatic import of non-distribution class code
CodeRepo _classes ; // Repository of embedded class code. This data member _must_ be first
RooArgSet _allOwnedNodes ; // List of owned pdfs and components
RooLinkedList _dataList ; // List of owned datasets
RooLinkedList _views ; // List of model views
RooLinkedList _snapshots ; // List of parameter snapshots
RooLinkedList _genObjects ; // List of generic objects
RooLinkedList _studyMods ; // List if StudyManager modules
std::map<std::string,RooArgSet> _namedSets ; // Map of named RooArgSets
WSDir* _dir ; //! Transient ROOT directory representation of workspace
RooExpensiveObjectCache _eocache ; // Cache for expensive objects
RooFactoryWSTool* _factory ; //! Factory tool associated with workspace
Bool_t _doExport ; //! Export contents of workspace to CINT?
std::string _exportNSName ; //! Name of CINT namespace to which contents are exported
Bool_t _openTrans ; //! Is there a transaction open?
RooArgSet _sandboxNodes ; //! Sandbox for incoming objects in a transaction
ClassDef(RooWorkspace,7) // Persistable project container for (composite) pdfs, functions, variables and datasets
} ;
#endif
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...