89bool isCacheSet(std::string
const& setName) {
91 return setName.rfind(
"CACHE_", 0) == 0;
190 TNamed(other), _uuid(other._uuid), _classes(other._classes,this)
199 for(
auto * snap : static_range_cast<RooArgSet*>(other.
_snapshots)) {
200 auto snapClone =
static_cast<RooArgSet*
>(snap->snapshot());
201 snapClone->
setName(snap->GetName()) ;
206 for (map<string,RooArgSet>::const_iterator iter3 = other.
_namedSets.begin() ; iter3 != other.
_namedSets.end() ; ++iter3) {
230 if(newname && std::string(newname) !=
GetName()) {
270 std::vector<std::string> tokens =
ROOT::Split(fileSpec,
":");
273 if (tokens.size() != 3) {
274 std::ostringstream stream;
275 for (
const auto& token : tokens) {
276 stream <<
"\n\t" << token;
278 coutE(InputArguments) <<
"RooWorkspace(" <<
GetName() <<
") ERROR in file specification, expecting 'filename:wsname:objname', but '" << fileSpec <<
"' given."
279 <<
"\nTokens read are:" << stream.str() << endl;
283 const std::string&
filename = tokens[0];
284 const std::string& wsname = tokens[1];
285 const std::string& objname = tokens[2];
290 coutE(InputArguments) <<
"RooWorkspace(" <<
GetName() <<
") ERROR opening file " <<
filename << endl ;
297 coutE(InputArguments) <<
"RooWorkspace(" <<
GetName() <<
") ERROR: No object named " << wsname <<
" in file " <<
filename
298 <<
" or object is not a RooWorkspace" << endl ;
305 bool ret =
import(*warg,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) ;
310 bool ret =
import(*wdata,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) ;
314 coutE(InputArguments) <<
"RooWorkspace(" <<
GetName() <<
") ERROR: No RooAbsArg or RooAbsData object named " << objname
315 <<
" in workspace " << wsname <<
" in file " <<
filename << endl ;
331 ret |=
import(*oneArg,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) ;
383 pc.
defineString(
"conflictSuffix",
"RenameConflictNodes",0) ;
384 pc.
defineInt(
"renameConflictOrig",
"RenameConflictNodes",0,0) ;
386 pc.
defineString(
"allVarsSuffix",
"RenameAllVariables",0) ;
387 pc.
defineString(
"allVarsExcept",
"RenameAllVariables",1) ;
391 pc.
defineInt(
"useExistingNodes",
"RecycleConflictNodes",0,0) ;
393 pc.
defineInt(
"noRecursion",
"NoRecursion",0,0) ;
394 pc.
defineMutex(
"RenameConflictNodes",
"RenameAllNodes") ;
395 pc.
defineMutex(
"RenameConflictNodes",
"RecycleConflictNodes") ;
396 pc.
defineMutex(
"RenameAllNodes",
"RecycleConflictNodes") ;
397 pc.
defineMutex(
"RenameVariable",
"RenameAllVariables") ;
406 const char* suffixC = pc.
getString(
"conflictSuffix") ;
407 const char* suffixA = pc.
getString(
"allSuffix") ;
408 const char* suffixV = pc.
getString(
"allVarsSuffix") ;
409 const char* exceptVars = pc.
getString(
"allVarsExcept") ;
410 const char* varChangeIn = pc.
getString(
"varChangeIn") ;
411 const char* varChangeOut = pc.
getString(
"varChangeOut") ;
412 bool renameConflictOrig = pc.
getInt(
"renameConflictOrig") ;
413 Int_t useExistingNodes = pc.
getInt(
"useExistingNodes") ;
419 if (suffixC && strlen(suffixC)==0) suffixC = 0 ;
420 if (suffixA && strlen(suffixA)==0) suffixA = 0 ;
422 bool conflictOnly = suffixA ? false : true ;
423 const char* suffix = suffixA ? suffixA : suffixC ;
426 std::map<string,string> varMap ;
427 if (strlen(varChangeIn)>0) {
430 const std::vector<std::string> tokIn =
ROOT::Split(varChangeIn,
", ",
true);
431 const std::vector<std::string> tokOut =
ROOT::Split(varChangeOut,
", ",
true);
432 for (
unsigned int i=0; i < tokIn.size(); ++i) {
433 varMap.insert(std::make_pair(tokIn[i], tokOut[i]));
436 assert(tokIn.size() == tokOut.size());
441 std::set<string> exceptVarNames ;
442 if (exceptVars && strlen(exceptVars)) {
443 const std::vector<std::string> toks =
ROOT::Split(exceptVars,
", ",
true);
444 exceptVarNames.insert(toks.begin(), toks.end());
447 if (suffixV != 0 && strlen(suffixV)>0) {
449 for (
const auto v : *vars) {
450 if (exceptVarNames.find(
v->GetName())==exceptVarNames.end()) {
451 varMap[
v->GetName()] =
Form(
"%s_%s",
v->GetName(),suffixV) ;
462 bool factoryMatch = (tagIn && tagWs && !strcmp(tagIn,tagWs)) ;
464 ((
RooAbsArg&)inArg).setAttribute(
"RooWorkspace::Recycle") ;
467 if (!suffix && wsarg && !useExistingNodes && !(inArg.
isFundamental() && varMap[inArg.
GetName()]!=
"")) {
470 coutE(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") ERROR importing object named " << inArg.
GetName()
471 <<
": another instance with same name already in the workspace and no conflict resolution protocol specified" << endl ;
475 coutI(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") Object " << inArg.
GetName() <<
" is already in workspace!" << endl ;
481 coutI(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") Recycling existing object " << inArg.
GetName() <<
" created with identical factory specification" << endl ;
490 branchSet.
add(inArg) ;
495 for (
const auto branch : branchSet) {
497 if (wsbranch && wsbranch!=branch && !branch->
getAttribute(
"RooWorkspace::Recycle") && !useExistingNodes) {
498 conflictNodes.
add(*branch) ;
503 if (!conflictNodes.
empty() && !suffix && !useExistingNodes) {
504 coutE(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") ERROR object named " << inArg.
GetName() <<
": component(s) "
505 << conflictNodes <<
" already in the workspace and no conflict resolution protocol specified" << endl ;
518 conflictNodes.
add(branchSet) ;
522 string topName2 = cloneTop->
GetName() ;
523 if (!renameConflictOrig) {
525 for (
const auto cnode : conflictNodes) {
527 string origName = cnode2->
GetName() ;
530 string tag =
Form(
"ORIGNAME:%s",origName.c_str()) ;
533 string tag2 =
Form(
"%s",origName.c_str()) ;
538 if (cnode2==cloneTop) {
543 coutI(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName()
544 <<
") Resolving name conflict in workspace by changing name of imported node "
545 << origName <<
" to " << cnode2->
GetName() << endl ;
551 for (
const auto cnode : conflictNodes) {
553 string origName = cnode->GetName() ;
562 wsnode->
SetName(
Form(
"%s_%s",cnode->GetName(),suffix)) ;
563 wsnode->
SetTitle(
Form(
"%s (%s)",cnode->GetTitle(),suffix)) ;
566 for (
unsigned int n=1;
true; ++
n) {
567 string newname =
Form(
"%s_%s_%d",cnode->GetName(),suffix,
n) ;
569 wsnode->
SetName(newname.c_str()) ;
570 wsnode->
SetTitle(
Form(
"%s (%s %d)",cnode->GetTitle(),suffix,
n)) ;
576 coutI(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName()
577 <<
") Resolving name conflict in workspace by changing name of original node "
578 << origName <<
" to " << wsnode->
GetName() << endl ;
581 coutW(ObjectHandling) <<
"RooWorkspce::import(" <<
GetName() <<
") Internal error: expected to find existing node "
582 << origName <<
" to be renamed, but didn't find it..." << endl ;
589 if (strlen(varChangeIn)>0 || (suffixV && strlen(suffixV)>0)) {
592 for (
const auto cnode : cloneSet) {
594 if (varMap.find(cnode->GetName())!=varMap.end()) {
595 string origName = cnode->GetName() ;
596 cnode->SetName(varMap[cnode->GetName()].c_str()) ;
597 string tag =
Form(
"ORIGNAME:%s",origName.c_str()) ;
598 cnode->setAttribute(tag.c_str()) ;
599 if (!cnode->getStringAttribute(
"origName")) {
600 string tag2 =
Form(
"%s",origName.c_str()) ;
601 cnode->setStringAttribute(
"origName",tag2.c_str()) ;
605 coutI(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") Changing name of variable "
606 << origName <<
" to " << cnode->GetName() <<
" on request" << endl ;
609 if (cnode==cloneTop) {
610 topName2 = cnode->GetName() ;
626 for (
const auto branch2 : branchSet2) {
628 conflictNodes2.
add(*branch2) ;
633 if (!conflictNodes2.
empty()) {
634 coutE(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") ERROR object named " << inArg.
GetName() <<
": component(s) "
635 << conflictNodes2 <<
" cause naming conflict after conflict resolution protocol was executed" << endl ;
640 for (
const auto node : cloneSet2) {
641 if (node->importWorkspaceHook(*
this)) {
642 coutE(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") ERROR object named " << node->
GetName()
643 <<
" has an error in importing in one or more of its auxiliary objects, aborting" << endl ;
650 for (
const auto node : cloneSet2) {
653 coutW(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") WARNING: problems import class code of object "
654 << node->
ClassName() <<
"::" << node->GetName() <<
", reading of workspace will require external definition of class" << endl ;
660 node->setExpensiveObjectCache(
_eocache) ;
668 if (!silence && useExistingNodes) {
669 coutI(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") using existing copy of " << node->
ClassName()
670 <<
"::" << node->GetName() <<
" for import of " << cloneTop2->
ClassName() <<
"::"
671 << cloneTop2->
GetName() << endl ;
676 nodesToBeDeleted.
addOwned(std::unique_ptr<RooAbsArg>{node});
683 coutI(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") importing " << node->ClassName() <<
"::"
684 << node->GetName() << endl ;
698 if (!recycledNodes.
empty()) {
699 for (
const auto node : cloneSet2) {
700 node->redirectServers(recycledNodes) ;
745 pc.
defineInt(
"embedded",
"Embedded",0,0) ;
755 const char* dsetName = pc.
getString(
"dsetName") ;
756 const char* varChangeIn = pc.
getString(
"varChangeIn") ;
757 const char* varChangeOut = pc.
getString(
"varChangeOut") ;
758 bool embedded = pc.
getInt(
"embedded") ;
762 coutI(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") importing dataset " << inData.
GetName() << endl ;
765 if (dsetName && strlen(dsetName)==0) {
776 if (dsetName && dataList.
FindObject(dsetName)) {
777 coutE(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") ERROR dataset with name " << dsetName <<
" already exists in workspace, import aborted" << endl ;
781 coutE(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") ERROR dataset with name " << inData.
GetName() <<
" already exists in workspace, import aborted" << endl ;
789 coutI(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") changing name of dataset from " << inData.
GetName() <<
" to " << dsetName << endl ;
797 if (strlen(varChangeIn)>0) {
799 const std::vector<std::string> tokIn =
ROOT::Split(varChangeIn,
",");
800 const std::vector<std::string> tokOut =
ROOT::Split(varChangeOut,
",");
801 for (
unsigned int i=0; i < tokIn.size(); ++i) {
803 coutI(ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") changing name of dataset observable " << tokIn[i] <<
" to " << tokOut[i] << endl ;
811 if (!
arg(carg->GetName())) {
817 dataList.
Add(clone) ;
844 coutW(InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName() <<
") WARNING redefining previously defined named set " <<
name << endl ;
852 if (!
arg(sarg->GetName())) {
856 coutE(InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName() <<
") ERROR set constituent \"" << sarg->
GetName()
857 <<
"\" is not in workspace and importMissing option is disabled" << endl ;
861 wsargs.
add(*
arg(sarg->GetName())) ;
882 coutW(InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName()
883 <<
") WARNING redefining previously defined named set " <<
name << endl;
902 coutW(InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName() <<
") WARNING redefining previously defined named set " <<
name << endl ;
908 for (
const std::string& token :
ROOT::Split(contentList,
",")) {
910 if (!
arg(token.c_str())) {
911 coutE(InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName() <<
") ERROR proposed set constituent \"" << token
912 <<
"\" is not in workspace" << endl ;
915 wsargs.
add(*
arg(token.c_str())) ;
937 for (
const std::string& token :
ROOT::Split(newContents,
",")) {
939 if (!
arg(token.c_str())) {
940 coutE(InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName() <<
") ERROR proposed set constituent \"" << token
941 <<
"\" is not in workspace" << endl ;
944 wsargs.
add(*
arg(token.c_str())) ;
961 std::map<string,RooArgSet>::iterator i =
_namedSets.
find(
static_cast<const char*
>(
name));
962 return (i!=
_namedSets.end()) ? &(i->second) :
nullptr;
975 coutE(InputArguments) <<
"RooWorkspace::renameSet(" <<
GetName() <<
") ERROR a set with name " <<
name
976 <<
" does not exist" << endl ;
982 coutE(InputArguments) <<
"RooWorkspace::renameSet(" <<
GetName() <<
") ERROR a set with name " << newName
983 <<
" already exists" << endl ;
1006 coutE(InputArguments) <<
"RooWorkspace::removeSet(" <<
GetName() <<
") ERROR a set with name " <<
name
1007 <<
" does not exist" << endl ;
1113 TString className = carg->ClassName() ;
1115 coutW(ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") WARNING: problems import class code of object "
1116 << carg->ClassName() <<
"::" << carg->GetName() <<
", reading of workspace will require external definition of class" << endl ;
1156 snapshot->assign(params) ;
1160 coutI(ObjectHandling) <<
"RooWorkspace::saveSnaphot(" <<
GetName() <<
") replacing previous snapshot with name " <<
name << endl ;
1180 coutE(ObjectHandling) <<
"RooWorkspace::loadSnapshot(" <<
GetName() <<
") no snapshot with name " <<
name <<
" is available" << endl ;
1186 actualParams.
assign(*snap) ;
1268 for (
const std::string& token :
ROOT::Split(nameList,
",")) {
1273 coutE(InputArguments) <<
" RooWorkspace::argSet(" <<
GetName() <<
") no RooAbsArg named \"" << token <<
"\" in workspace" << endl ;
1436 std::list<RooAbsData*> ret ;
1437 for(
auto * dat : static_range_cast<RooAbsData*>(
_dataList)) {
1438 ret.push_back(dat) ;
1449 std::list<RooAbsData*> ret ;
1451 ret.push_back(dat) ;
1463 std::list<TObject*> ret ;
1470 ret.push_back(gobj) ;
1502 if (mapEntry && strlen(mapEntry)>0) {
1512 if (implfile.empty() || declfile.empty()) {
1513 oocoutE(
_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo(" <<
_wspace->
GetName() <<
") ERROR: cannot retrieve code file names for class "
1514 << tc->
GetName() <<
" through ROOT TClass interface, unable to import code" << endl ;
1530 << tc->
GetName() <<
" : it cannot be persisted because it doesn't have a default constructor. Please fix " << endl ;
1537 std::string declpath;
1538 std::string implpath;
1561 if (declpath.empty()) {
1563 << tc->
GetName() <<
" because header file " << declfile <<
" is not found in current directory nor in $ROOTSYS" ;
1577 ooccoutW(
_wspace,ObjectHandling) <<
". To fix this problem, add the required directory to the search "
1578 <<
"path using RooWorkspace::addClassDeclImportDir(const char* dir)" << endl ;
1606 if (implpath.empty()) {
1608 << tc->
GetName() <<
" because implementation file " << implfile <<
" is not found in current directory nor in $ROOTSYS" ;
1622 ooccoutW(
_wspace,ObjectHandling) <<
". To fix this problem add the required directory to the search "
1623 <<
"path using RooWorkspace::addClassImplImportDir(const char* dir)" << endl;
1641 const std::string declfilename = !declpath.empty() ?
gSystem->
BaseName(declpath.c_str())
1645 int dotpos2 = strrchr(declfilename.c_str(),
'.') - declfilename.c_str() ;
1646 string declfilebase = declfilename.substr(0,dotpos2) ;
1647 string declfileext = declfilename.substr(dotpos2+1) ;
1649 list<string> extraHeaders ;
1652 if (
_fmap.find(declfilebase) ==
_fmap.end()) {
1655 std::fstream fdecl(!declpath.empty() ? declpath.c_str() : declfile.c_str());
1660 <<
") ERROR opening declaration file " << declfile << endl ;
1665 <<
") importing code of class " << tc->
GetName()
1666 <<
" from " << (!implpath.empty() ? implpath.c_str() : implfile.c_str())
1667 <<
" and " << (!declpath.empty() ? declpath.c_str() : declfile.c_str()) << endl ;
1672 while(fdecl.getline(buf,1023)) {
1675 bool processedInclude = false ;
1676 char* extincfile = 0 ;
1679 if (strstr(buf,
"#include")) {
1682 strlcpy(tmp, buf, 64000);
1683 bool stdinclude = strchr(buf,
'<');
1684 strtok(tmp,
" <\"");
1685 char *incfile = strtok(0,
" <>\"");
1690 hpath +=
"/include/";
1694 <<
") scheduling include file " << incfile <<
" for import" << endl;
1695 extraHeaders.push_back(incfile);
1696 extincfile = incfile;
1697 processedInclude =
true;
1702 if (processedInclude) {
1703 decl +=
"// external include file below retrieved from workspace code storage\n" ;
1704 decl +=
Form(
"#include \"%s\"\n",extincfile) ;
1712 fstream fimpl(!implpath.empty() ? implpath.c_str() : implfile.c_str()) ;
1717 <<
") ERROR opening implementation file " << implfile << endl ;
1724 while(fimpl.getline(buf,1023)) {
1728 bool foundSelfInclude=false ;
1729 bool processedInclude = false ;
1730 char* extincfile = 0 ;
1733 if (strstr(buf,
"#include")) {
1736 strlcpy(tmp, buf, 64000);
1737 bool stdinclude = strchr(buf,
'<');
1738 strtok(tmp,
" <\"");
1739 char *incfile = strtok(0,
" <>\"");
1741 if (strstr(incfile, declfilename.c_str())) {
1742 foundSelfInclude =
true;
1745 if (!stdinclude && !foundSelfInclude) {
1748 hpath +=
"/include/";
1753 <<
") scheduling include file " << incfile <<
" for import" << endl;
1754 extraHeaders.push_back(incfile);
1755 extincfile = incfile;
1756 processedInclude =
true;
1763 if (foundSelfInclude) {
1766 impl +=
"// class declaration include file below retrieved from workspace code storage\n" ;
1767 impl +=
Form(
"#include \"%s.%s\"\n",declfilebase.c_str(),declfileext.c_str()) ;
1768 }
else if (processedInclude) {
1769 impl +=
"// external include file below retrieved from workspace code storage\n" ;
1770 impl +=
Form(
"#include \"%s\"\n",extincfile) ;
1778 _fmap[declfilebase]._hfile = decl ;
1779 _fmap[declfilebase]._cxxfile = impl ;
1780 _fmap[declfilebase]._hext = declfileext ;
1783 for (list<string>::iterator ehiter = extraHeaders.begin() ; ehiter != extraHeaders.end() ; ++ehiter ) {
1787 eh.
_hname = ehiter->c_str() ;
1788 fstream fehdr(ehiter->c_str()) ;
1791 while(fehdr.getline(buf2,1023)) {
1794 if (strstr(buf2,
"#include")) {
1797 strlcpy(tmp, buf2, 64000);
1798 bool stdinclude = strchr(buf,
'<');
1799 strtok(tmp,
" <\"");
1800 char *incfile = strtok(0,
" <>\"");
1805 hpath +=
"/include/";
1809 <<
") scheduling recursive include file " << incfile <<
" for import"
1811 extraHeaders.push_back(incfile);
1819 eh.
_hfile = ehimpl.c_str();
1821 _ehmap[ehiter->c_str()] = eh;
1829 <<
") code of class " << tc->
GetName()
1830 <<
" was already imported from " << (!implpath.empty() ? implpath : implfile.c_str())
1831 <<
" and " << (!declpath.empty() ? declpath.c_str() : declfile.c_str()) << std::endl;
1844 std::list<TClass*> bases ;
1845 for(
auto * base : static_range_cast<TBaseClass*>(*bl)) {
1846 if (baseNameList.
Length()>0) {
1847 baseNameList +=
"," ;
1849 baseNameList += base->GetClassPointer()->GetName() ;
1850 bases.push_back(base->GetClassPointer()) ;
1859 for(
TClass* bclass : bases) {
1879 if (
_dir)
return true ;
1906 if (oldObj && !replaceExisting) {
1907 coutE(InputArguments) <<
"RooWorkspace::import(" <<
GetName() <<
") generic object with name "
1908 <<
object.
GetName() <<
" is already in workspace and replaceExisting flag is set to false" << endl ;
1914 object.IsA()->SetDirectoryAutoAdd(0);
1924 object.IsA()->SetDirectoryAutoAdd(func);
1946 if (oldObj && !replaceExisting) {
1947 coutE(InputArguments) <<
"RooWorkspace::import(" <<
GetName() <<
") generic object with name "
1948 << aliasName <<
" is already in workspace and replaceExisting flag is set to false" << endl ;
1955 wrapper->setOwning(
true) ;
1956 wrapper->SetName(aliasName) ;
1957 wrapper->SetTitle(aliasName) ;
2001 if (ret)
return ret ;
2005 if (ret)
return ret ;
2022 if (!gobj)
return nullptr;
2047 TFile f(fileName,recreate?
"RECREATE":
"UPDATE") ;
2062 cxcoutD(ObjectHandling) <<
"INFO: Creating RooFactoryWSTool associated with this workspace" << endl ;
2063 _factory = make_unique<RooFactoryWSTool>(*
this);
2087 bool treeMode(
false) ;
2088 bool verbose(
false);
2089 if (
TString(opts).Contains(
"t")) {
2092 if (
TString(opts).Contains(
"v")) {
2096 cout << endl <<
"RooWorkspace(" <<
GetName() <<
") " <<
GetTitle() <<
" contents" << endl << endl ;
2116 if (!parg->hasClients()) {
2125 if (!parg->hasClients()) {
2126 funcSet.
add(*parg) ;
2133 if (!parg->hasClients()) {
2134 catfuncSet.
add(*parg) ;
2142 convResoSet.
add(*parg) ;
2144 resoSet.
add(*parg) ;
2157 funcSet.
add(*parg) ;
2162 catfuncSet.
add(*parg) ;
2180 if (!varSet.
empty()) {
2182 cout <<
"variables" << endl ;
2183 cout <<
"---------" << endl ;
2184 cout << varSet << endl ;
2188 if (!pdfSet.
empty()) {
2189 cout <<
"p.d.f.s" << endl ;
2190 cout <<
"-------" << endl ;
2194 parg->printComponentTree() ;
2203 if (!resoSet.
empty()) {
2204 cout <<
"analytical resolution models" << endl ;
2205 cout <<
"----------------------------" << endl ;
2214 if (!funcSet.
empty()) {
2215 cout <<
"functions" << endl ;
2216 cout <<
"--------" << endl ;
2220 parg->printComponentTree() ;
2228 if (!catfuncSet.
empty()) {
2229 cout <<
"category functions" << endl ;
2230 cout <<
"------------------" << endl ;
2234 parg->printComponentTree() ;
2243 cout <<
"datasets" << endl ;
2244 cout <<
"--------" << endl ;
2245 for(
auto * data2 : static_range_cast<RooAbsData*>(
_dataList)) {
2246 std::cout << data2->ClassName() <<
"::" << data2->GetName() << *data2->get() << std::endl;
2248 std::cout << std::endl ;
2252 cout <<
"embedded datasets (in pdfs and functions)" << endl ;
2253 cout <<
"-----------------------------------------" << endl ;
2255 cout << data2->ClassName() <<
"::" << data2->GetName() << *data2->get() << endl ;
2261 cout <<
"parameter snapshots" << endl ;
2262 cout <<
"-------------------" << endl ;
2263 for(
auto * snap : static_range_cast<RooArgSet*>(
_snapshots)) {
2264 cout << snap->GetName() <<
" = (" ;
2267 if (
first) {
first=false ; }
else { cout <<
"," ; }
2268 cout <<
a->GetName() <<
"=" ;
2269 a->printValue(cout) ;
2270 if (
a->isConstant()) {
2274 cout <<
")" << endl ;
2281 cout <<
"named sets" << endl ;
2282 cout <<
"----------" << endl ;
2283 for (map<string,RooArgSet>::const_iterator it =
_namedSets.begin() ; it !=
_namedSets.end() ; ++it) {
2284 if (verbose || !isCacheSet(it->first)) {
2285 cout << it->first <<
":" << it->second << endl;
2294 cout <<
"generic objects" << endl ;
2295 cout <<
"---------------" << endl ;
2298 cout << ((
RooTObjWrap*)gobj)->obj()->ClassName() <<
"::" << gobj->GetName() << endl ;
2300 cout << gobj->ClassName() <<
"::" << gobj->GetName() << endl ;
2308 cout <<
"study modules" << endl ;
2309 cout <<
"-------------" << endl ;
2311 cout << smobj->ClassName() <<
"::" << smobj->GetName() << endl ;
2318 cout <<
"embedded class code" << endl ;
2319 cout <<
"-------------------" << endl ;
2325 cout <<
"embedded precalculated expensive components" << endl ;
2326 cout <<
"-------------------------------------------" << endl ;
2358 _fmap[
name]._hext.Streamer(R__b) ;
2359 _fmap[
name]._hfile.Streamer(R__b) ;
2360 _fmap[
name]._cxxfile.Streamer(R__b) ;
2369 _c2fmap[
name]._baseName.Streamer(R__b) ;
2370 _c2fmap[
name]._fileBase.Streamer(R__b) ;
2380 _ehmap[
name]._hname.Streamer(R__b) ;
2381 _ehmap[
name]._hfile.Streamer(R__b) ;
2388 _compiledOK = !compileClasses() ;
2396 UInt_t count = _fmap.size() ;
2398 map<TString,ClassFiles>::iterator iter = _fmap.begin() ;
2399 while(iter!=_fmap.end()) {
2400 TString key_copy(iter->first) ;
2402 iter->second._hext.Streamer(R__b) ;
2403 iter->second._hfile.Streamer(R__b);
2404 iter->second._cxxfile.Streamer(R__b);
2410 count = _c2fmap.size() ;
2412 map<TString,ClassRelInfo>::iterator iter2 = _c2fmap.begin() ;
2413 while(iter2!=_c2fmap.end()) {
2414 TString key_copy(iter2->first) ;
2416 iter2->second._baseName.Streamer(R__b) ;
2417 iter2->second._fileBase.Streamer(R__b);
2422 count = _ehmap.size() ;
2424 map<TString,ExtraHeader>::iterator iter3 = _ehmap.begin() ;
2425 while(iter3!=_ehmap.end()) {
2426 TString key_copy(iter3->first) ;
2428 iter3->second._hname.Streamer(R__b) ;
2429 iter3->second._hfile.Streamer(R__b);
2455 node->ioStreamerPass2() ;
2462 node->setExpensiveObjectCache(
_eocache) ;
2463 node->setWorkspace(*
this);
2467 cout <<
"RooWorkspace::Streamer(" <<
GetName() <<
") " << node->
ClassName() <<
"::" << node->GetName()
2477 map<RooAbsArg*,vector<RooAbsArg *> > extClients, extValueClients, extShapeClients ;
2482 std::vector<RooAbsArg *> clientsTmp{tmparg->_clientList.begin(), tmparg->_clientList.end()};
2483 for (
auto client : clientsTmp) {
2486 const auto refCount = tmparg->_clientList.refCount(client);
2487 auto& bufferVec = extClients[tmparg];
2489 bufferVec.insert(bufferVec.end(), refCount, client);
2490 tmparg->_clientList.Remove(client,
true);
2495 clientsTmp.assign(tmparg->_clientListValue.begin(), tmparg->_clientListValue.end());
2496 for (
auto vclient : clientsTmp) {
2498 cxcoutD(ObjectHandling) <<
"RooWorkspace::Streamer(" <<
GetName() <<
") element " << tmparg->GetName()
2499 <<
" has external value client link to " << vclient <<
" (" << vclient->GetName() <<
") with ref count " << tmparg->_clientListValue.refCount(vclient) << endl ;
2501 const auto refCount = tmparg->_clientListValue.refCount(vclient);
2502 auto& bufferVec = extValueClients[tmparg];
2504 bufferVec.insert(bufferVec.end(), refCount, vclient);
2505 tmparg->_clientListValue.Remove(vclient,
true);
2510 clientsTmp.assign(tmparg->_clientListShape.begin(), tmparg->_clientListShape.end());
2511 for (
auto sclient : clientsTmp) {
2513 cxcoutD(ObjectHandling) <<
"RooWorkspace::Streamer(" <<
GetName() <<
") element " << tmparg->GetName()
2514 <<
" has external shape client link to " << sclient <<
" (" << sclient->GetName() <<
") with ref count " << tmparg->_clientListShape.refCount(sclient) << endl ;
2516 const auto refCount = tmparg->_clientListShape.refCount(sclient);
2517 auto& bufferVec = extShapeClients[tmparg];
2519 bufferVec.insert(bufferVec.end(), refCount, sclient);
2520 tmparg->_clientListShape.Remove(sclient,
true);
2531 for (
auto &iterx : extClients) {
2532 for (
auto client : iterx.second) {
2533 iterx.first->_clientList.Add(client);
2537 for (
auto &iterx : extValueClients) {
2538 for (
auto client : iterx.second) {
2539 iterx.first->_clientListValue.Add(client);
2543 for (
auto &iterx : extShapeClients) {
2544 for (
auto client : iterx.second) {
2545 iterx.first->_clientListShape.Add(client);
2561 map<TString,ClassRelInfo>::const_iterator iter = _c2fmap.begin() ;
2562 while(iter!=_c2fmap.end()) {
2566 ret += iter->first ;
2579 static const UInt_t crctab[256] = { 0x00000000,
2580 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
2581 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6,
2582 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,
2583 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac,
2584 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f,
2585 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a,
2586 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
2587 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58,
2588 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033,
2589 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe,
2590 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,
2591 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4,
2592 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
2593 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5,
2594 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,
2595 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07,
2596 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c,
2597 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1,
2598 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
2599 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b,
2600 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698,
2601 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d,
2602 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,
2603 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f,
2604 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
2605 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80,
2606 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,
2607 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a,
2608 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629,
2609 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c,
2610 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
2611 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e,
2612 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65,
2613 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8,
2614 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,
2615 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2,
2616 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
2617 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74,
2618 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,
2619 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21,
2620 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a,
2621 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087,
2622 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
2623 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d,
2624 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce,
2625 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb,
2626 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,
2627 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09,
2628 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
2629 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf,
2630 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
2634 while (sz--) crc = (crc << 8) ^
UInt_t(*
data++) ^ crctab[crc >> 24];
2642 unsigned long sz = strlen(
data);
2643 switch (strlen(
data)) {
2655 return crc32(
data + 4, sz - 4, (
data[0] << 24) | (
data[1] << 16) |
2673 bool haveDir=false ;
2678 bool writeExtraHeaders(
false) ;
2681 map<TString,ClassRelInfo>::iterator iter = _c2fmap.begin() ;
2682 while(iter!=_c2fmap.end()) {
2684 oocxcoutD(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() now processing class " << iter->first.Data() << endl ;
2688 oocoutI(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Embedded class "
2689 << iter->first <<
" already in ROOT class table, skipping" << endl ;
2699 oocoutI(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() reusing code export directory " << dirName.c_str()
2700 <<
" to extract coded embedded in workspace" << endl ;
2703 oocoutI(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() creating code export directory " << dirName.c_str()
2704 <<
" to extract coded embedded in workspace" << endl ;
2706 oocoutE(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() ERROR creating code export directory " << dirName.c_str()
2707 <<
" to extract coded embedded in workspace" << endl ;
2716 if (!writeExtraHeaders) {
2717 writeExtraHeaders = true ;
2719 map<TString,ExtraHeader>::iterator eiter = _ehmap.begin() ;
2720 while(eiter!=_ehmap.end()) {
2723 bool needEHWrite=true ;
2724 string fdname =
Form(
"%s/%s",dirName.c_str(),eiter->second._hname.Data()) ;
2725 ifstream ifdecl(fdname.c_str()) ;
2729 while (ifdecl.getline(buf, 64000)) {
2734 UInt_t crcWS = crc32(eiter->second._hfile.Data());
2735 needEHWrite = (crcFile != crcWS);
2740 oocoutI(_wspace, ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Extracting extra header file "
2746 ofstream fdecl(fdname.c_str());
2748 oocoutE(_wspace, ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() ERROR opening file " << fdname
2749 <<
" for writing" << endl;
2752 fdecl << eiter->second._hfile.Data();
2761 ClassFiles& cfinfo = _fmap[iter->second._fileBase] ;
2763 oocxcoutD(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() now processing file with base " << iter->second._fileBase << endl ;
2767 oocxcoutD(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() file with base name " << iter->second._fileBase
2768 <<
" has already been extracted, skipping to next class" << endl ;
2773 bool needDeclWrite=true ;
2774 string fdname =
Form(
"%s/%s.%s",dirName.c_str(),iter->second._fileBase.Data(),cfinfo.
_hext.
Data()) ;
2775 ifstream ifdecl(fdname.c_str()) ;
2779 while (ifdecl.getline(buf, 64000)) {
2785 needDeclWrite = (crcFile!=crcWS) ;
2789 if (needDeclWrite) {
2790 oocoutI(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Extracting declaration code of class " << iter->first <<
", file " << fdname << endl ;
2791 ofstream fdecl(fdname.c_str()) ;
2793 oocoutE(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() ERROR opening file "
2794 << fdname <<
" for writing" << endl ;
2802 bool needImplWrite=true ;
2803 string finame =
Form(
"%s/%s.cxx",dirName.c_str(),iter->second._fileBase.Data()) ;
2804 ifstream ifimpl(finame.c_str()) ;
2808 while (ifimpl.getline(buf, 64000)) {
2814 needImplWrite = (crcFile!=crcWS) ;
2818 if (needImplWrite) {
2819 oocoutI(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Extracting implementation code of class " << iter->first <<
", file " << finame << endl ;
2820 ofstream fimpl(finame.c_str()) ;
2822 oocoutE(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() ERROR opening file"
2823 << finame <<
" for writing" << endl ;
2832 oocxcoutD(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() marking code unit " << iter->second._fileBase <<
" as extracted" << endl ;
2835 oocoutI(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Compiling code unit " << iter->second._fileBase.Data() <<
" to define class " << iter->first << endl ;
2839 oocoutE(_wspace,ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() ERROR compiling class " << iter->first.Data() <<
", to fix this you can do the following: " << endl
2840 <<
" 1) Fix extracted source code files in directory " << dirName.c_str() <<
"/" << endl
2841 <<
" 2) In clean ROOT session compiled fixed classes by hand using '.x " << dirName.c_str() <<
"/ClassName.cxx+'" << endl
2842 <<
" 3) Reopen file with RooWorkspace with broken source code in UPDATE mode. Access RooWorkspace to force loading of class" << endl
2843 <<
" Broken instances in workspace will _not_ be compiled, instead precompiled fixed instances will be used." << endl
2844 <<
" 4) Reimport fixed code in workspace using 'RooWorkspace::importClassCode(\"*\",true)' method, Write() updated workspace to file and close file" << endl
2845 <<
" 5) Reopen file in clean ROOT session to confirm that problems are fixed" << endl ;
2872 coutE(ObjectHandling) <<
"RooWorkspace::WSDir::Add(" <<
GetName() <<
") ERROR: Directory is read-only representation of a RooWorkspace, use RooWorkspace::import() to add objects" << endl ;
2874 InternalAppend(
obj) ;
2885 coutE(ObjectHandling) <<
"RooWorkspace::WSDir::Add(" <<
GetName() <<
") ERROR: Directory is read-only representation of a RooWorkspace, use RooWorkspace::import() to add objects" << endl ;
2887 InternalAppend(
obj) ;
2899 if (removedObj ==
_dir)
_dir =
nullptr;
2910 std::vector<std::string> invalidSets;
2913 auto const& setName =
c.first;
2914 auto&
set =
c.second;
2915 std::size_t oldSize =
set.
size();
2920 if(
set.
size() < oldSize && isCacheSet(setName)) {
2921 invalidSets.emplace_back(setName);
2926 for(std::string
const& setName : invalidSets) {
R__EXTERN TClassTable * gClassTable
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
static void ioStreamerPass2Finalize()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
void SetName(const char *name) override
Set the name of the TNamed.
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
void branchNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=nullptr, bool recurseNonDerived=false) const
Fill supplied list with all branch nodes of the arg tree starting with ourself as top node.
virtual bool isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
A space to attach TBranches.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
const char * GetName() const override
Returns name of object.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void RecursiveRemove(TObject *obj) override
If one of the TObject we have a referenced to is deleted, remove the reference.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
Storage_t::size_type size() const
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
void sort(bool reverse=false)
Sort collection using std::sort and name comparison.
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
void useHashMapForFind(bool flag) const
void setName(const char *name)
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
virtual bool changeObservableName(const char *from, const char *to)
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
const char * sealNotice() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooAbsStudy is an abstract base class for RooStudyManager modules.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
bool containsInstance(const RooAbsArg &var) const override
Check if this exact instance is in this collection.
RooCategory is an object to represent discrete states.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
void defineMutex(const char *head, Args_t &&... tail)
Define arguments where any pair is mutually exclusive.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
bool defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
bool defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
bool ok(bool verbose) const
Return true of parsing was successful.
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false)
Return string property registered with name 'name'.
RooExpensiveObjectCache is a singleton class that serves as repository for objects that are expensive...
void importCacheObjects(RooExpensiveObjectCache &other, const char *ownerName, bool verbose=false)
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
void RecursiveRemove(TObject *obj) override
If one of the TObject we have a referenced to is deleted, remove the reference.
bool Replace(const TObject *oldArg, const TObject *newArg)
Replace object 'oldArg' in collection with new object 'newArg'.
Int_t getHashTableSize() const
void Delete(Option_t *o=nullptr) override
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
TObject * find(const char *name) const
Return pointer to object with given name in collection.
virtual void Add(TObject *arg)
void setHashTableSize(Int_t size)
Change the threshold for hash-table use to given size.
TObject * FindObject(const char *name) const override
Return pointer to obejct with given name.
virtual bool Remove(TObject *arg)
Remove object from collection.
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
RooFit::MsgLevel globalKillBelow() const
static bool setAddDirectoryStatus(bool flag)
Configure whether new instances of RooPlot will add themselves to gDirectory.
RooRealVar represents a variable that can be changed from the outside.
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
The RooStringView is a wrapper around a C-syle string that can also be constructed from a std::string...
RooInt is a minimal implementation of a TNamed holding a TObject.
An interface to set and retrieve a workspace.
virtual void ReplaceWS(RooWorkspace *ws)=0
Set the workspace irrespective of what the previous workspace is.
std::map< TString, ExtraHeader > _ehmap
void Streamer(TBuffer &) override
Custom streamer for the workspace.
std::string listOfClassNames() const
Return STL string with last of class names contained in the code repository.
bool autoImportClass(TClass *tc, bool doReplace=false)
Import code of class 'tc' into the repository.
bool compileClasses()
For all classes in the workspace for which no class definition is found in the ROOT class table extra...
std::map< TString, ClassRelInfo > _c2fmap
std::map< TString, ClassFiles > _fmap
void InternalAppend(TObject *obj)
Internal access to TDirectory append method.
void Add(TObject *, bool) override
Overload TDirectory interface method to prohibit insertion of objects in read-only directory workspac...
TClass * IsA() const override
void Append(TObject *, bool) override
Overload TDirectory interface method to prohibit insertion of objects in read-only directory workspac...
The RooWorkspace is a persistable container for RooFit projects.
RooExpensiveObjectCache _eocache
Cache for expensive objects.
TObject * obj(RooStringView name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
RooLinkedList _genObjects
List of generic objects.
static std::list< std::string > _classDeclDirList
const RooArgSet * getSnapshot(const char *name) const
Return the RooArgSet containing a snapshot of variables contained in the workspace.
static void addClassDeclImportDir(const char *dir)
Add dir to search path for class declaration (header) files.
void Print(Option_t *opts=nullptr) const override
Print contents of the workspace.
RooLinkedList _dataList
List of owned datasets.
RooAbsCategory * catfunc(RooStringView name) const
Retrieve discrete function (RooAbsCategory) with given name. A null pointer is returned if not found.
WSDir * _dir
! Transient ROOT directory representation of workspace
static void addClassImplImportDir(const char *dir)
Add dir to search path for class implementation (.cxx) files.
RooAbsPdf * pdf(RooStringView name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
std::map< std::string, RooArgSet > _namedSets
Map of named RooArgSets.
RooAbsData * embeddedData(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
RooCategory * cat(RooStringView name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found.
void clearStudies()
Remove all RooStudyManager modules.
bool renameSet(const char *name, const char *newName)
Rename set to a new name.
std::unique_ptr< RooFactoryWSTool > _factory
! Factory tool associated with workspace
RooArgSet allVars() const
Return set with all variable objects.
RooArgSet argSet(RooStringView nameList) const
Return set of RooAbsArgs matching to given list of names.
bool writeToFile(const char *fileName, bool recreate=true)
Save this current workspace into given file.
const RooArgSet * set(RooStringView name)
Return pointer to previously defined named set with given nmame If no such set is found a null pointe...
bool cd(const char *path=nullptr)
bool import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
RooArgSet allCats() const
Return set with all category objects.
void RecursiveRemove(TObject *obj) override
If one of the TObject we have a referenced to is deleted, remove the reference.
RooAbsArg * fundArg(RooStringView name) const
Return fundamental (i.e.
RooLinkedList _views
List of model views.
~RooWorkspace() override
Workspace destructor.
bool cancelTransaction()
Cancel an ongoing import transaction.
bool startTransaction()
Open an import transaction operations.
TObject * Clone(const char *newname="") const override
TObject::Clone() needs to be overridden.
RooArgSet allResolutionModels() const
Return set with all resolution model objects.
RooLinkedList _snapshots
List of parameter snapshots.
bool saveSnapshot(RooStringView, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of given parameters.
RooArgSet allPdfs() const
Return set with all probability density function objects.
void Streamer(TBuffer &) override
Stream an object of class RooWorkspace.
TObject * genobj(RooStringView name) const
Return generic object with given name.
std::list< RooAbsData * > allData() const
Return list of all dataset in the workspace.
RooLinkedList _studyMods
List if StudyManager modules.
std::list< TObject * > allGenericObjects() const
Return list of all generic objects in the workspace.
static void setClassFileExportDir(const char *dir=nullptr)
Specify the name of the directory in which embedded source code is unpacked and compiled.
bool importClassCode(const char *pat="*", bool doReplace=false)
Inport code of all classes in the workspace that have a class name that matches pattern 'pat' and whi...
bool makeDir()
Create transient TDirectory representation of this workspace.
RooArgSet allCatFunctions() const
Return set with all category function objects.
static std::string _classFileExportDir
static std::list< std::string > _classImplDirList
RooAbsReal * function(RooStringView name) const
Retrieve function (RooAbsReal) with given name. Note that all RooAbsPdfs are also RooAbsReals....
RooAbsArg * arg(RooStringView name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
RooWorkspace()
Default constructor.
bool removeSet(const char *name)
Remove a named set from the workspace.
RooArgSet allFunctions() const
Return set with all function objects.
RooFactoryWSTool & factory()
Return instance to factory tool.
bool extendSet(const char *name, const char *newContents)
Define a named set in the work space through a comma separated list of names of objects already in th...
RooExpensiveObjectCache & expensiveObjectCache()
RooArgSet _sandboxNodes
! Sandbox for incoming objects in a transaction
bool defineSetInternal(const char *name, const RooArgSet &aset)
bool _openTrans
! Is there a transaction open?
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
bool addStudy(RooAbsStudy &study)
Insert RooStudyManager module.
static void autoImportClassCode(bool flag)
If flag is true, source code of classes not the ROOT distribution is automatically imported if on obj...
RooLinkedList _embeddedDataList
List of owned datasets that are embedded in pdfs.
RooArgSet _allOwnedNodes
List of owned pdfs and components.
RooAbsData * data(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
std::list< RooAbsData * > allEmbeddedData() const
Return list of all dataset in the workspace.
bool loadSnapshot(const char *name)
Load the values and attributes of the parameters in the snapshot saved with the given name.
bool defineSet(const char *name, const RooArgSet &aset, bool importMissing=false)
Define a named RooArgSet with given constituents.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
TClass instances represent classes, structs and namespaces in the ROOT type system.
const char * GetImplFileName() const
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Long_t Property() const override
Returns the properties of the TClass as a bit field stored as a Long_t value.
Bool_t HasDefaultConstructor(Bool_t testio=kFALSE) const
Return true if we have access to a constructor usable for I/O.
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Bool_t cd() override
Change current directory to "this" directory.
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
The TNamed class is the base class for all named ROOT classes.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual TClass * IsA() const
Regular expression class.
const char * Data() const
virtual void Streamer(TBuffer &)
Stream a string object.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
virtual int MakeDirectory(const char *name)
Make a directory.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual int CompileMacro(const char *filename, Option_t *opt="", const char *library_name="", const char *build_dir="", UInt_t dirmode=0)
This method compiles and loads a shared library containing the code from the file "filename".
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
void(* DirAutoAdd_t)(void *, TDirectory *)
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.