69 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,19,02)
104 _classDeclDirList.push_back(dir) ;
114 _classImplDirList.push_back(dir) ;
126 _classFileExportDir =
dir ;
128 _classFileExportDir =
".wscode.%s.%s" ;
158 TNamed(name,title?title:name), _classes(this), _dir(0), _factory(0), _doExport(
kFALSE), _openTrans(
kFALSE)
164 TNamed(name,name), _classes(this), _dir(0), _factory(0), _doExport(
kFALSE), _openTrans(
kFALSE)
177 TNamed(other), _uuid(other._uuid), _classes(other._classes,this), _dir(0), _factory(0), _doExport(
kFALSE), _openTrans(
kFALSE)
185 while((data2=iter->
Next())) {
201 for (map<string,RooArgSet>::const_iterator iter3 = other.
_namedSets.begin() ; iter3 != other.
_namedSets.end() ; ++iter3) {
211 while((gobj=iter4->
Next())) {
254 strlcpy(buf,fileSpec,10240) ;
256 char* wsname = strtok(0,
":") ;
257 char* objname = strtok(0,
":") ;
260 if (!filename||!wsname||!objname) {
261 coutE(
InputArguments) <<
"RooWorkspace(" <<
GetName() <<
") ERROR in file specification, expecting for 'filename:wsname:objname'" << endl ;
276 <<
" or object is not a RooWorkspace" << endl ;
283 Bool_t ret =
import(*warg,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) ;
289 Bool_t ret =
import(*wdata,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) ;
295 <<
" in workspace " << wsname <<
" in file " << filename << endl ;
313 ret |=
import(*oneArg,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) ;
363 pc.
defineString(
"conflictSuffix",
"RenameConflictNodes",0) ;
364 pc.
defineInt(
"renameConflictOrig",
"RenameConflictNodes",0,0) ;
366 pc.
defineString(
"allVarsSuffix",
"RenameAllVariables",0) ;
367 pc.
defineString(
"allVarsExcept",
"RenameAllVariables",1) ;
371 pc.
defineInt(
"useExistingNodes",
"RecycleConflictNodes",0,0) ;
373 pc.
defineInt(
"noRecursion",
"NoRecursion",0,0) ;
374 pc.
defineMutex(
"RenameConflictNodes",
"RenameAllNodes") ;
375 pc.
defineMutex(
"RenameConflictNodes",
"RecycleConflictNodes") ;
376 pc.
defineMutex(
"RenameAllNodes",
"RecycleConflictNodes") ;
377 pc.
defineMutex(
"RenameVariable",
"RenameAllVariables") ;
386 const char* suffixC = pc.
getString(
"conflictSuffix") ;
387 const char* suffixA = pc.
getString(
"allSuffix") ;
388 const char* suffixV = pc.
getString(
"allVarsSuffix") ;
389 const char* exceptVars = pc.
getString(
"allVarsExcept") ;
390 const char* varChangeIn = pc.
getString(
"varChangeIn") ;
391 const char* varChangeOut = pc.
getString(
"varChangeOut") ;
392 Bool_t renameConflictOrig = pc.
getInt(
"renameConflictOrig") ;
393 Int_t useExistingNodes = pc.
getInt(
"useExistingNodes") ;
399 if (suffixC && strlen(suffixC)==0) suffixC = 0 ;
400 if (suffixA && strlen(suffixA)==0) suffixA = 0 ;
403 const char* suffix = suffixA ? suffixA : suffixC ;
406 map<string,string> varMap ;
407 if (strlen(varChangeIn)>0) {
411 strlcpy(tmp,varChangeIn,10240) ;
412 list<string> tmpIn,tmpOut ;
413 char* ptr = strtok(tmp,
", ") ;
415 tmpIn.push_back(ptr) ;
416 ptr = strtok(0,
", ") ;
418 strlcpy(tmp,varChangeOut,10240) ;
419 ptr = strtok(tmp,
", ") ;
421 tmpOut.push_back(ptr) ;
422 ptr = strtok(0,
", ") ;
424 list<string>::iterator iin = tmpIn.begin() ;
425 list<string>::iterator iout = tmpOut.begin() ;
426 for (;iin!=tmpIn.end() ; ++iin,++iout) {
433 std::set<string> exceptVarNames ;
435 if (exceptVars && strlen(exceptVars)) {
436 strlcpy(tmp,exceptVars,10240) ;
437 char* ptr = strtok(tmp,
", ") ;
439 exceptVarNames.insert(ptr) ;
440 ptr = strtok(0,
", ") ;
444 if (suffixV != 0 && strlen(suffixV)>0) {
449 if (exceptVarNames.find(v->
GetName())==exceptVarNames.end()) {
463 Bool_t factoryMatch = (tagIn && tagWs && !strcmp(tagIn,tagWs)) ;
465 ((
RooAbsArg&)inArg).setAttribute(
"RooWorkspace::Recycle") ;
468 if (!suffix && wsarg && !useExistingNodes && !(inArg.
isFundamental() && varMap[inArg.
GetName()]!=
"")) {
472 <<
": another instance with same name already in the workspace and no conflict resolution protocol specified" << endl ;
481 coutI(
ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") Recycling existing object " << inArg.
GetName() <<
" created with identical factory specification" << endl ;
489 branchSet.
add(inArg) ;
497 if (wsbranch && wsbranch!=branch && !branch->
getAttribute(
"RooWorkspace::Recycle") && !useExistingNodes) {
498 conflictNodes.
add(*branch) ;
504 if (conflictNodes.
getSize()>0 && !suffix && !useExistingNodes) {
506 << conflictNodes <<
" already in the workspace and no conflict resolution protocol specified" << endl ;
517 conflictNodes.
add(branchSet) ;
521 string topName2 = cloneTop->
GetName() ;
522 if (!renameConflictOrig) {
528 string origName = cnode2->
GetName() ;
531 string tag =
Form(
"ORIGNAME:%s",origName.c_str()) ;
534 string tag2 =
Form(
"%s",origName.c_str()) ;
539 if (cnode2==cloneTop) {
545 <<
") Resolving name conflict in workspace by changing name of imported node "
546 << origName <<
" to " << cnode2->
GetName() << endl ;
557 string origName = cnode->
GetName() ;
572 string newname =
Form(
"%s_%s_%d",cnode->
GetName(),suffix,
n) ;
574 wsnode->
SetName(newname.c_str()) ;
583 <<
") Resolving name conflict in workspace by changing name of original node "
584 << origName <<
" to " << wsnode->
GetName() << endl ;
588 << origName <<
" to be renamed, but didn't find it..." << endl ;
597 if (strlen(varChangeIn)>0 || (suffixV && strlen(suffixV)>0)) {
604 if (varMap.find(cnode->
GetName())!=varMap.end()) {
605 string origName = cnode->
GetName() ;
607 string tag =
Form(
"ORIGNAME:%s",origName.c_str()) ;
610 string tag2 =
Form(
"%s",origName.c_str()) ;
616 << origName <<
" to " << cnode->
GetName() <<
" on request" << endl ;
619 if (cnode==cloneTop) {
640 conflictNodes2.
add(*branch2) ;
646 if (conflictNodes2.
getSize()) {
648 << conflictNodes2 <<
" cause naming conflict after conflict resolution protocol was executed" << endl ;
660 <<
" has an error in importing in one or more of its auxiliary objects, aborting" << endl ;
675 << node->IsA()->
GetName() <<
"::" << node->
GetName() <<
", reading of workspace will require external definition of class" << endl ;
689 if (!silence && useExistingNodes) {
691 <<
"::" << node->
GetName() <<
" for import of " << cloneTop2->IsA()->
GetName() <<
"::"
692 << cloneTop2->
GetName() << endl ;
733 if (recycledNodes.
getSize()>0) {
784 pc.
defineInt(
"embedded",
"Embedded",0,0) ;
793 const char* dsetName = pc.
getString(
"dsetName") ;
794 const char* varChangeIn = pc.
getString(
"varChangeIn") ;
795 const char* varChangeOut = pc.
getString(
"varChangeOut") ;
799 if (dsetName && strlen(dsetName)==0) {
806 if (dsetName && dataList.
FindObject(dsetName)) {
807 coutE(
ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") ERROR dataset with name " << dsetName <<
" already exists in workspace, import aborted" << endl ;
811 coutE(
ObjectHandling) <<
"RooWorkspace::import(" <<
GetName() <<
") ERROR dataset with name " << inData.
GetName() <<
" already exists in workspace, import aborted" << endl ;
826 if (strlen(varChangeIn)>0) {
830 strlcpy(tmp,varChangeIn,10240) ;
831 list<string> tmpIn,tmpOut ;
832 char* ptr = strtok(tmp,
",") ;
834 tmpIn.push_back(ptr) ;
835 ptr = strtok(0,
",") ;
837 strlcpy(tmp,varChangeOut,10240) ;
838 ptr = strtok(tmp,
",") ;
840 tmpOut.push_back(ptr) ;
841 ptr = strtok(0,
",") ;
843 list<string>::iterator iin = tmpIn.begin() ;
844 list<string>::iterator iout = tmpOut.begin() ;
846 for (; iin!=tmpIn.end() ; ++iin,++iout) {
847 coutI(
ObjectHandling) <<
"RooWorkSpace::import(" <<
GetName() <<
") changing name of dataset observable " << *iin <<
" to " << *iout << endl ;
864 dataList.
Add(clone) ;
874 while ((carg=iter2.
next())) {
893 map<string,RooArgSet>::iterator i =
_namedSets.find(name) ;
895 coutW(
InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName() <<
") WARNING redefining previously defined named set " << name << endl ;
910 <<
"\" is not in workspace and importMissing option is disabled" << endl ;
935 map<string,RooArgSet>::iterator i =
_namedSets.find(name) ;
937 coutW(
InputArguments) <<
"RooWorkspace::defineSet(" <<
GetName() <<
") WARNING redefining previously defined named set " << name << endl ;
944 strlcpy(buf,contentList,10240) ;
945 char* token = strtok(buf,
",") ;
950 <<
"\" is not in workspace" << endl ;
954 token = strtok(0,
",") ;
977 strlcpy(buf,newContents,10240) ;
978 char* token = strtok(buf,
",") ;
983 <<
"\" is not in workspace" << endl ;
987 token = strtok(0,
",") ;
1004 map<string,RooArgSet>::iterator i =
_namedSets.find(name) ;
1005 return (i!=
_namedSets.end()) ? &(i->second) : 0 ;
1019 <<
" does not exist" << endl ;
1026 <<
" already exists" << endl ;
1050 <<
" does not exist" << endl ;
1170 << carg->IsA()->
GetName() <<
"::" << carg->
GetName() <<
", reading of workspace will require external definition of class" << endl ;
1208 delete actualParams ;
1213 *snapshot = params ;
1218 coutI(
ObjectHandling) <<
"RooWorkspace::saveSnaphot(" <<
GetName() <<
") replacing previous snapshot with name " << name << endl ;
1239 coutE(
ObjectHandling) <<
"RooWorkspace::loadSnapshot(" <<
GetName() <<
") no snapshot with name " << name <<
" is available" << endl ;
1244 *actualParams = *snap ;
1245 delete actualParams ;
1262 coutE(
ObjectHandling) <<
"RooWorkspace::loadSnapshot(" <<
GetName() <<
") no snapshot with name " << name <<
" is available" << endl ;
1365 strlcpy(tmp,nameList,10240) ;
1366 char* token = strtok(tmp,
",") ;
1372 coutE(
InputArguments) <<
" RooWorkspace::argSet(" <<
GetName() <<
") no RooAbsArg named \"" << token <<
"\" in workspace" << endl ;
1374 token = strtok(0,
",") ;
1550 list<RooAbsData*> ret ;
1554 ret.push_back(dat) ;
1566 list<RooAbsData*> ret ;
1570 ret.push_back(dat) ;
1583 list<TObject*> ret ;
1592 ret.push_back(gobj) ;
1625 if (mapEntry && strlen(mapEntry)>0) {
1635 if (implfile.empty() || declfile.empty()) {
1637 << tc->
GetName() <<
" through ROOT TClass interface, unable to import code" << endl ;
1647 const char* implpath=0 ;
1654 << tc->
GetName() <<
" : it cannot be persisted because it doesn't have a default constructor. Please fix " << endl ;
1661 char* declpath = 0 ;
1687 << tc->
GetName() <<
" because header file " << declfile <<
" is not found in current directory nor in $ROOTSYS" ;
1702 <<
"path using RooWorkspace::addClassDeclDir(const char* dir)" << endl ;
1733 << tc->
GetName() <<
" because implementation file " << implfile <<
" is not found in current directory nor in $ROOTSYS" ;
1748 <<
"path using RooWorkspace::addClassImplDir(const char* dir)" << endl ;
1769 int dotpos2 = strrchr(declfilename.c_str(),
'.') - declfilename.c_str() ;
1770 string declfilebase = declfilename.substr(0,dotpos2) ;
1771 string declfileext = declfilename.substr(dotpos2+1) ;
1773 list<string> extraHeaders ;
1776 if (
_fmap.find(declfilebase) ==
_fmap.end()) {
1779 fstream fdecl(declpath?declpath:declfile.c_str()) ;
1784 <<
") ERROR opening declaration file " << declfile << endl ;
1789 <<
") importing code of class " << tc->
GetName()
1790 <<
" from " << (implpath?implpath:implfile.c_str())
1791 <<
" and " << (declpath?declpath:declfile.c_str()) << endl ;
1796 while(fdecl.getline(buf,1023)) {
1800 char* extincfile = 0 ;
1803 if (strstr(buf,
"#include")) {
1806 strlcpy(tmp,buf,10240) ;
1807 Bool_t stdinclude = strchr(buf,
'<') ;
1808 strtok(tmp,
" <\"") ;
1809 char* incfile = strtok(0,
" <>\"") ;
1814 hpath +=
"/include/" ;
1818 extraHeaders.push_back(incfile) ;
1819 extincfile = incfile ;
1820 processedInclude =
kTRUE ;
1826 if (processedInclude) {
1827 decl +=
"// external include file below retrieved from workspace code storage\n" ;
1828 decl +=
Form(
"#include \"%s\"\n",extincfile) ;
1836 fstream fimpl(implpath?implpath:implfile.c_str()) ;
1841 <<
") ERROR opening implementation file " << implfile << endl ;
1848 while(fimpl.getline(buf,1023)) {
1854 char* extincfile = 0 ;
1857 if (strstr(buf,
"#include")) {
1860 strlcpy(tmp,buf,10240) ;
1861 Bool_t stdinclude = strchr(buf,
'<') ;
1862 strtok(tmp,
" <\"") ;
1863 char* incfile = strtok(0,
" <>\"") ;
1865 if (strstr(incfile,declfilename.c_str())) {
1866 foundSelfInclude=
kTRUE ;
1869 if (!stdinclude && !foundSelfInclude) {
1872 hpath +=
"/include/" ;
1877 extraHeaders.push_back(incfile) ;
1878 extincfile = incfile ;
1879 processedInclude =
kTRUE ;
1887 if (foundSelfInclude) {
1890 impl +=
"// class declaration include file below retrieved from workspace code storage\n" ;
1891 impl +=
Form(
"#include \"%s.%s\"\n",declfilebase.c_str(),declfileext.c_str()) ;
1892 }
else if (processedInclude) {
1893 impl +=
"// external include file below retrieved from workspace code storage\n" ;
1894 impl +=
Form(
"#include \"%s\"\n",extincfile) ;
1902 _fmap[declfilebase]._hfile = decl ;
1903 _fmap[declfilebase]._cxxfile = impl ;
1904 _fmap[declfilebase]._hext = declfileext ;
1907 for (list<string>::iterator ehiter = extraHeaders.begin() ; ehiter != extraHeaders.end() ; ++ehiter ) {
1911 eh.
_hname = ehiter->c_str() ;
1912 fstream fehdr(ehiter->c_str()) ;
1915 while(fehdr.getline(buf2,1023)) {
1918 if (strstr(buf2,
"#include")) {
1921 strlcpy(tmp,buf2,10240) ;
1922 Bool_t stdinclude = strchr(buf,
'<') ;
1923 strtok(tmp,
" <\"") ;
1924 char* incfile = strtok(0,
" <>\"") ;
1929 hpath +=
"/include/" ;
1933 extraHeaders.push_back(incfile) ;
1941 eh.
_hfile = ehimpl.c_str() ;
1943 _ehmap[ehiter->c_str()] = eh ;
1951 <<
") code of class " << tc->
GetName()
1952 <<
" was already imported from " << (implpath?implpath:implfile.c_str())
1953 <<
" and " << (declpath?declpath:declfile.c_str()) << endl ;
1968 list<TClass*> bases ;
1970 if (baseNameList.
Length()>0) {
1971 baseNameList +=
"," ;
1983 list<TClass*>::iterator biter = bases.begin() ;
1984 while(biter!=bases.end()) {
2021 while((darg=(
RooAbsArg*)iter->Next())) {
2043 if (oldObj && !replaceExisting) {
2045 <<
object.GetName() <<
" is already in workspace and replaceExisting flag is set to false" << endl ;
2051 object.IsA()->SetDirectoryAutoAdd(0);
2062 object.IsA()->SetDirectoryAutoAdd(func);
2084 if (oldObj && !replaceExisting) {
2086 <<
object.GetName() <<
" is already in workspace and replaceExisting flag is set to false" << endl ;
2140 if (ret)
return ret ;
2144 if (ret)
return ret ;
2161 if (!gobj)
return 0 ;
2186 TFile
f(fileName,recreate?
"RECREATE":
"UPDATE") ;
2201 cxcoutD(
ObjectHandling) <<
"INFO: Creating RooFactoryWSTool associated with this workspace" << endl ;
2226 if (
TString(opts).Contains(
"t")) {
2230 cout << endl <<
"RooWorkspace(" <<
GetName() <<
") " <<
GetTitle() <<
" contents" << endl << endl ;
2263 funcSet.
add(*parg) ;
2271 catfuncSet.
add(*parg) ;
2279 convResoSet.
add(*parg) ;
2281 resoSet.
add(*parg) ;
2294 funcSet.
add(*parg) ;
2299 catfuncSet.
add(*parg) ;
2320 cout <<
"variables" << endl ;
2321 cout <<
"---------" << endl ;
2322 cout << varSet << endl ;
2327 cout <<
"p.d.f.s" << endl ;
2328 cout <<
"-------" << endl ;
2344 cout <<
"analytical resolution models" << endl ;
2345 cout <<
"----------------------------" << endl ;
2362 cout <<
"functions" << endl ;
2363 cout <<
"--------" << endl ;
2378 cout <<
"category functions" << endl ;
2379 cout <<
"------------------" << endl ;
2394 cout <<
"datasets" << endl ;
2395 cout <<
"--------" << endl ;
2399 cout << data2->IsA()->
GetName() <<
"::" << data2->
GetName() << *data2->
get() << endl ;
2406 cout <<
"embedded datasets (in pdfs and functions)" << endl ;
2407 cout <<
"-----------------------------------------" << endl ;
2411 cout << data2->IsA()->
GetName() <<
"::" << data2->
GetName() << *data2->
get() << endl ;
2418 cout <<
"parameter snapshots" << endl ;
2419 cout <<
"-------------------" << endl ;
2423 cout << snap->
GetName() <<
" = (" ;
2428 if (first) { first=
kFALSE ; }
else { cout <<
"," ; }
2435 cout <<
")" << endl ;
2444 cout <<
"named sets" << endl ;
2445 cout <<
"----------" << endl ;
2446 for (map<string,RooArgSet>::const_iterator it =
_namedSets.begin() ; it !=
_namedSets.end() ; it++) {
2447 cout << it->first <<
":" << it->second << endl ;
2455 cout <<
"generic objects" << endl ;
2456 cout <<
"---------------" << endl ;
2461 cout << ((
RooTObjWrap*)gobj)->obj()->IsA()->
GetName() <<
"::" << gobj->GetName() << endl ;
2463 cout << gobj->IsA()->
GetName() <<
"::" << gobj->
GetName() << endl ;
2472 cout <<
"study modules" << endl ;
2473 cout <<
"-------------" << endl ;
2477 cout << smobj->IsA()->
GetName() <<
"::" << smobj->
GetName() << endl ;
2485 cout <<
"embedded class code" << endl ;
2486 cout <<
"-------------------" << endl ;
2492 cout <<
"embedded precalculated expensive components" << endl ;
2493 cout <<
"-------------------------------------------" << endl ;
2509 void RooWorkspace::CodeRepo::Streamer(
TBuffer &R__b)
2511 typedef ::RooWorkspace::CodeRepo thisClass;
2524 name.Streamer(R__b) ;
2525 _fmap[
name]._hext.Streamer(R__b) ;
2526 _fmap[
name]._hfile.Streamer(R__b) ;
2527 _fmap[
name]._cxxfile.Streamer(R__b) ;
2535 name.Streamer(R__b) ;
2536 _c2fmap[
name]._baseName.Streamer(R__b) ;
2537 _c2fmap[
name]._fileBase.Streamer(R__b) ;
2546 name.Streamer(R__b) ;
2547 _ehmap[
name]._hname.Streamer(R__b) ;
2548 _ehmap[
name]._hfile.Streamer(R__b) ;
2555 _compiledOK = !compileClasses() ;
2563 UInt_t count = _fmap.size() ;
2565 map<TString,ClassFiles>::iterator iter = _fmap.begin() ;
2566 while(iter!=_fmap.end()) {
2567 TString key_copy(iter->first) ;
2568 key_copy.Streamer(R__b) ;
2569 iter->second._hext.Streamer(R__b) ;
2570 iter->second._hfile.Streamer(R__b);
2571 iter->second._cxxfile.Streamer(R__b);
2577 count = _c2fmap.size() ;
2579 map<TString,ClassRelInfo>::iterator iter2 = _c2fmap.begin() ;
2580 while(iter2!=_c2fmap.end()) {
2581 TString key_copy(iter2->first) ;
2582 key_copy.Streamer(R__b) ;
2583 iter2->second._baseName.Streamer(R__b) ;
2584 iter2->second._fileBase.Streamer(R__b);
2589 count = _ehmap.size() ;
2591 map<TString,ExtraHeader>::iterator iter3 = _ehmap.begin() ;
2592 while(iter3!=_ehmap.end()) {
2593 TString key_copy(iter3->first) ;
2594 key_copy.Streamer(R__b) ;
2595 iter3->second._hname.Streamer(R__b) ;
2596 iter3->second._hfile.Streamer(R__b);
2614 void RooWorkspace::Streamer(
TBuffer &R__b)
2623 while((node=fiter.
next())) {
2647 map<RooAbsArg*,list<RooAbsArg*> > extClients, extValueClients, extShapeClients ;
2660 extClients[tmparg].push_back(client) ;
2672 <<
" has external value client link to " << vclient <<
" (" << vclient->
GetName() <<
") with ref count " << tmparg->
_clientListValue.
refCount(vclient) << endl ;
2675 extValueClients[tmparg].push_back(vclient) ;
2679 delete vclientIter ;
2687 <<
" has external shape client link to " << sclient <<
" (" << sclient->
GetName() <<
") with ref count " << tmparg->
_clientListShape.
refCount(sclient) << endl ;
2690 extShapeClients[tmparg].push_back(sclient) ;
2694 delete sclientIter ;
2704 for (map<
RooAbsArg*,list<RooAbsArg*> >::iterator iterx = extClients.begin() ; iterx!=extClients.end() ; iterx++) {
2705 for (list<RooAbsArg*>::iterator citer = iterx->second.begin() ; citer!=iterx->second.end() ; citer++) {
2706 iterx->first->_clientList.Add(*citer) ;
2710 for (map<
RooAbsArg*,list<RooAbsArg*> >::iterator iterx = extValueClients.begin() ; iterx!=extValueClients.end() ; iterx++) {
2711 for (list<RooAbsArg*>::iterator citer = iterx->second.begin() ; citer!=iterx->second.end() ; citer++) {
2712 iterx->first->_clientListValue.Add(*citer) ;
2716 for (map<
RooAbsArg*,list<RooAbsArg*> >::iterator iterx = extShapeClients.begin() ; iterx!=extShapeClients.end() ; iterx++) {
2717 for (list<RooAbsArg*>::iterator citer = iterx->second.begin() ; citer!=iterx->second.end() ; citer++) {
2718 iterx->first->_clientListShape.Add(*citer) ;
2734 map<TString,ClassRelInfo>::const_iterator iter = _c2fmap.begin() ;
2735 while(iter!=_c2fmap.end()) {
2739 ret += iter->first ;
2767 map<TString,ClassRelInfo>::iterator iter = _c2fmap.begin() ;
2768 while(iter!=_c2fmap.end()) {
2770 oocxcoutD(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() now processing class " << iter->first.Data() << endl ;
2775 << iter->first <<
" already in ROOT class table, skipping" << endl ;
2785 oocoutI(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() reusing code export directory " << dirName.c_str()
2786 <<
" to extract coded embedded in workspace" << endl ;
2789 oocoutI(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() creating code export directory " << dirName.c_str()
2790 <<
" to extract coded embedded in workspace" << endl ;
2792 oocoutE(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() ERROR creating code export directory " << dirName.c_str()
2793 <<
" to extract coded embedded in workspace" << endl ;
2802 if (!writeExtraHeaders) {
2803 writeExtraHeaders =
kTRUE ;
2805 map<TString,ExtraHeader>::iterator eiter = _ehmap.begin() ;
2806 while(eiter!=_ehmap.end()) {
2810 string fdname =
Form(
"%s/%s",dirName.c_str(),eiter->second._hname.Data()) ;
2811 ifstream ifdecl(fdname.c_str()) ;
2815 while(ifdecl.getline(buf,10240)) {
2821 needEHWrite = (crcFile!=crcWS) ;
2826 oocoutI(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Extracting extra header file " << fdname << endl ;
2831 ofstream fdecl(fdname.c_str()) ;
2834 << fdname <<
" for writing" << endl ;
2837 fdecl << eiter->second._hfile.Data() ;
2846 ClassFiles& cfinfo = _fmap[iter->second._fileBase] ;
2848 oocxcoutD(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() now processing file with base " << iter->second._fileBase << endl ;
2852 oocxcoutD(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() file with base name " << iter->second._fileBase
2853 <<
" has already been extracted, skipping to next class" << endl ;
2859 string fdname =
Form(
"%s/%s.%s",dirName.c_str(),iter->second._fileBase.Data(),cfinfo.
_hext.
Data()) ;
2860 ifstream ifdecl(fdname.c_str()) ;
2864 while(ifdecl.getline(buf,10240)) {
2870 needDeclWrite = (crcFile!=crcWS) ;
2874 if (needDeclWrite) {
2875 oocoutI(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Extracting declaration code of class " << iter->first <<
", file " << fdname << endl ;
2876 ofstream fdecl(fdname.c_str()) ;
2879 << fdname <<
" for writing" << endl ;
2888 string finame =
Form(
"%s/%s.cxx",dirName.c_str(),iter->second._fileBase.Data()) ;
2889 ifstream ifimpl(finame.c_str()) ;
2893 while(ifimpl.getline(buf,10240)) {
2899 needImplWrite = (crcFile!=crcWS) ;
2903 if (needImplWrite) {
2904 oocoutI(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Extracting implementation code of class " << iter->first <<
", file " << finame << endl ;
2905 ofstream fimpl(finame.c_str()) ;
2908 << finame <<
" for writing" << endl ;
2917 oocxcoutD(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() marking code unit " << iter->second._fileBase <<
" as extracted" << endl ;
2920 oocoutI(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() Compiling code unit " << iter->second._fileBase.Data() <<
" to define class " << iter->first << endl ;
2924 oocoutE(_wspace,
ObjectHandling) <<
"RooWorkspace::CodeRepo::compileClasses() ERROR compiling class " << iter->first.Data() <<
", to fix this you can do the following: " << endl
2925 <<
" 1) Fix extracted source code files in directory " << dirName.c_str() <<
"/" << endl
2926 <<
" 2) In clean ROOT session compiled fixed classes by hand using '.x " << dirName.c_str() <<
"/ClassName.cxx+'" << endl
2927 <<
" 3) Reopen file with RooWorkspace with broken source code in UPDATE mode. Access RooWorkspace to force loading of class" << endl
2928 <<
" Broken instances in workspace will _not_ be compiled, instead precompiled fixed instances will be used." << endl
2929 <<
" 4) Reimport fixed code in workspace using 'RooWorkspace::importClassCode(\"*\",kTRUE)' method, Write() updated workspace to file and close file" << endl
2930 <<
" 5) Reopen file in clean ROOT session to confirm that problems are fixed" << endl ;
2947 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,19,02)
2959 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,19,02)
2965 if (dynamic_cast<RooAbsArg*>(obj) || dynamic_cast<RooAbsData*>(obj)) {
2966 coutE(
ObjectHandling) <<
"RooWorkspace::WSDir::Add(" <<
GetName() <<
") ERROR: Directory is read-only representation of a RooWorkspace, use RooWorkspace::import() to add objects" << endl ;
2968 InternalAppend(obj) ;
2976 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,19,02)
2982 if (dynamic_cast<RooAbsArg*>(obj) || dynamic_cast<RooAbsData*>(obj)) {
2983 coutE(
ObjectHandling) <<
"RooWorkspace::WSDir::Add(" <<
GetName() <<
") ERROR: Directory is read-only representation of a RooWorkspace, use RooWorkspace::import() to add objects" << endl ;
2985 InternalAppend(obj) ;
2999 coutE(
ObjectHandling) <<
"RooWorkspace::exportToCint(" <<
GetName() <<
") WARNING: repeated calls to exportToCint() have no effect" << endl ;
3007 if (!nsname) nsname =
GetName() ;
3011 <<
") INFO: references to all objects in this workspace will be created in CINT in 'namespace " <<
_exportNSName <<
"'" << endl ;
3016 while((wobj=iter->
Next())) {
3021 while((wobj=iter->
Next())) {
3046 cxcoutD(
ObjectHandling) <<
"RooWorkspace::exportObj(" <<
GetName() <<
") INFO: Workspace object name " << wobj->
GetName() <<
" is not a valid C++ identifier and is not exported to CINT" << endl ;
3052 gROOT->ProcessLine(cintExpr.c_str()) ;
3062 string oname(name) ;
3063 if (isdigit(oname[0])) {
3066 for (
UInt_t i=0 ; i<oname.size() ; i++) {
3068 if (!isalnum(c) && (c!=
'_')) {
3084 while((wobj=iter->
Next())) {
std::map< TString, ExtraHeader > _ehmap
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
RooArgSet allVars() const
Return set with all variable objects.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual const char * GetTitle() const
Returns title of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Bool_t saveSnapshot(const char *name, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of parameters 'params' If importValue...
TObject * genobj(const char *name) const
Return generic object with given name.
Bool_t HasDefaultConstructor() const
Return true if we have access to a default constructor.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
RooExpensiveObjectCache _eocache
Transient ROOT directory representation of workspace.
RooArgSet argSet(const char *nameList) const
Return set of RooAbsArgs matching to given list of names.
void sort(Bool_t ascend=kTRUE)
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void exportToCint(const char *namespaceName=0)
Activate export of workspace symbols to CINT in a namespace with given name.
static void ioStreamerPass2Finalize()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
virtual Bool_t Remove(TObject *arg)
Remove object from collection.
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
R__EXTERN TClassTable * gClassTable
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
static std::list< std::string > _classDeclDirList
RooExpensiveObjectCache is a singleton class that serves as repository for objects that are expensive...
const char * getString(const char *name, const char *defaultValue="", Bool_t convEmptyToNull=kFALSE)
Return string property registered with name 'name'.
RooFIter fwdIterator() const
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
virtual void Append(TObject *)
Overload TDirectory interface method to prohibit insertion of objects in read-only directory workspac...
virtual void SetName(const char *name)
Change (i.e.
RooLinkedList _embeddedDataList
Bool_t cancelTransaction()
Cancel an ongoing import transaction.
virtual Bool_t changeObservableName(const char *from, const char *to)
virtual Bool_t isFundamental() const
~RooWorkspace()
Workspace destructor.
std::list< RooAbsData * > allData() const
Return list of all dataset in the workspace.
RooFactoryWSTool * _factory
virtual int MakeDirectory(const char *name)
Make a directory.
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
Buffer base class used for serializing objects.
Regular expression class.
static const char * filename()
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Int_t refCount(TObject *obj)
Return reference count associated with 'obj'.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
std::string listOfClassNames() const
Return STL string with last of class names contained in the code repository.
static void addClassImplImportDir(const char *dir)
Add 'dir' to search path for class implementation (.cxx) files, when attempting to import class code ...
static std::list< std::string > _classImplDirList
RooAbsData * embeddedData(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
static RooMsgService & instance()
Return reference to singleton instance.
Bool_t compileClasses()
For all classes in the workspace for which no class definition is found in the ROOT class table extra...
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
static void autoImportClassCode(Bool_t flag)
If flag is true, source code of classes not the the ROOT distribution is automatically imported if on...
RooExpensiveObjectCache & expensiveObjectCache() const
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
RooAbsCategory * catfunc(const char *name) const
Retrieve discrete function (RooAbsCategory) with given name. A null pointer is returned if not found...
RooLinkedList _genObjects
Bool_t cd(const char *path=0)
Iterator abstract base class.
void(* DirAutoAdd_t)(void *, TDirectory *)
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
Bool_t Replace(const TObject *oldArg, const TObject *newArg)
Replace object 'oldArg' in collection with new object 'newArg'.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Bool_t importClassCode(const char *pat="*", Bool_t doReplace=kFALSE)
Inport code of all classes in the workspace that have a class name that matches pattern 'pat' and whi...
RooRefCountList _clientListValue
TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
const char * Data() const
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Bool_t startTransaction()
Open an import transaction operations.
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
void unExport()
Delete exported reference in CINT namespace.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
The TNamed class is the base class for all named ROOT classes.
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add element to an owning set.
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
std::map< std::string, std::string >::const_iterator iter
Bool_t 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...
RooArgSet allPdfs() const
Return set with all probability density function objects.
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 const char * Getenv(const char *env)
Get environment variable.
TIterator * createIterator(Bool_t dir=kIterForward) const
Bool_t hasClients() const
if on multiple lines(like in C++).**The" * configuration fragment. * * The "import myobject continue
Parses the configuration file.
Bool_t defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", Bool_t appendMode=kFALSE)
Define Double_t property name 'name' mapped to Double_t in slot 'stringNum' in RooCmdArg with name ar...
const char * GetImplFileName() const
TIterator * MakeIterator(Bool_t dir=kTRUE) const
Return an iterator over this list.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
RooWorkspace()
Default constructor.
Bool_t 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...
RooRealVar represents a fundamental (non-derived) real valued object.
virtual const RooArgSet * get() const
RooAbsStudy is an abstract base class for RooStudyManager modules.
RooFit::MsgLevel globalKillBelow() const
virtual void Add(TObject *)
Overload TDirectory interface method to prohibit insertion of objects in read-only directory workspac...
void importCacheObjects(RooExpensiveObjectCache &other, const char *ownerName, Bool_t verbose=kFALSE)
virtual void Add(TObject *arg)
std::map< TString, ClassFiles > _fmap
Bool_t autoImportClass(TClass *tc, Bool_t doReplace=kFALSE)
Import code of class 'tc' into the repository.
void defineMutex(const char *argName1, const char *argName2)
Define arguments named argName1 and argName2 mutually exclusive.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
Bool_t renameSet(const char *name, const char *newName)
Rename set to a new name.
RooAbsArg * find(const char *name) const
Find object with given name in list.
R__EXTERN TSystem * gSystem
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
Bool_t defineSet(const char *name, const RooArgSet &aset, Bool_t importMissing=kFALSE)
Define a named RooArgSet with given constituents.
void printComponentTree(const char *indent="", const char *namePat=0, Int_t nLevel=999)
Print tree structure of expression tree on given ostream, only branch nodes are printed.
RooArgSet _sandboxNodes
Is there a transaction open?
void SetName(const char *name)
Change (i.e.
char * Form(const char *fmt,...)
RooRefCountList _clientList
virtual void Append(TObject *obj, Bool_t replace=kFALSE)
Append object to this directory.
static UInt_t crc32(const char *data)
void setGlobalKillBelow(RooFit::MsgLevel level)
virtual const char * GetName() const
Returns name of object.
Bool_t writeToFile(const char *fileName, Bool_t recreate=kTRUE)
Save this current workspace into given file.
The ROOT global object gROOT contains a list of all defined classes.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
void branchNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with all branch nodes of the arg tree starting with ourself as top node...
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Bool_t loadSnapshot(const char *name)
Load the values and attributes of the parameters in the snapshot saved with the given name...
Bool_t ok(Bool_t verbose) const
Return true of parsing was successful.
RooRefCountList _clientListShape
RooCategory * cat(const char *name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found...
RooCategory represents a fundamental (non-derived) discrete value object.
Bool_t _openTrans
Name of CINT namespace to which contents are exported.
Each class (see TClass) has a linked list of its base class(es).
std::map< std::string, RooArgSet > _namedSets
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
Bool_t isConstant() const
virtual Bool_t Remove(TObject *obj)
Remove object from list and if reference count reaches zero delete object itself as well...
TIterator * componentIterator() const
std::list< TObject * > allGenericObjects() const
Return list of all generic objects in the workspace.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Bool_t isValidCPPID(const char *name)
Return true if given name is a valid C++ identifier name.
virtual void setExpensiveObjectCache(RooExpensiveObjectCache &cache)
RooCmdArg Index(RooCategory &icat)
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
void Delete(Option_t *o=0)
Remove all elements in collection and delete all elements NB: Collection does not own elements...
static void addClassDeclImportDir(const char *dir)
Add 'dir' to search path for class declaration (header) files, when attempting to import class code w...
virtual const char * GetName() const
Returns name of object.
std::string _exportNSName
Export contents of workspace to CINT?
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
Bool_t removeSet(const char *name)
Remove a named set from the workspace.
Bool_t _doExport
Factory tool associated with workspace.
const char * sealNotice() const
RooAbsArg * fundArg(const char *name) const
Return fundamental (i.e.
RooArgSet allCats() const
Return set with all category objects.
RooArgSet allFunctions() const
Return set with all function objects.
static Bool_t setAddDirectoryStatus(Bool_t flag)
double func(double *x, double *p)
TObject * find(const char *name) const
Return pointer to object with given name in collection.
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
Bool_t containsInstance(const RooAbsArg &var) const
std::map< TString, ClassRelInfo > _c2fmap
Mother of all ROOT objects.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooFactoryWSTool & factory()
Return instance to factory tool.
Bool_t commitTransaction()
const char * GetDeclFileName() const
static void setClassFileExportDir(const char *dir=0)
Specify the name of the directory in which embedded source code is unpacked and compiled.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Bool_t 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.
void clearStudies()
Remove all RooStudyManager modules.
RooAbsArg * arg(const char *name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
void Print(Option_t *opts=0) const
Print contents of the workspace.
RooExpensiveObjectCache & expensiveObjectCache()
virtual TObject * Next()=0
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
void setOwning(Bool_t flag)
virtual Bool_t importWorkspaceHook(RooWorkspace &)
const RooArgSet * set(const char *name)
Return pointer to previously defined named set with given nmame If no such set is found a null pointe...
void setName(const char *name)
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
std::list< RooAbsData * > allEmbeddedData() const
Return list of all dataset in the workspace.
RooArgSet allCatFunctions() const
Return set with all category function objects.
RooInt is a minimal implementation of a TNamed holding a TObject.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void setHashTableSize(Int_t i)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual void ioStreamerPass2()
Prevent 'AlwaysDirty' mode for this node.
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
virtual void printValue(std::ostream &os) const
Interface to print value of object.
Bool_t redirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE)
Iterator over _clientListValue.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Bool_t addStudy(RooAbsStudy &study)
Insert RooStudyManager module.
static std::string _classFileExportDir
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
The RooWorkspace is a persistable container for RooFit projects.
const char * GetName() const
Returns name of object.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
RooAbsReal * function(const char *name) const
Retrieve function (RooAbsReal) with given name. Note that all RooAbsPdfs are also RooAbsReals...
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
void InternalAppend(TObject *obj)
Internal access to TDirectory append method.
RooArgSet allResolutionModels() const
Return set with all resolution model objects.
Bool_t makeDir()
Create transient TDirectory representation of this workspace.
const RooArgSet * getSnapshot(const char *name) const
Return the RooArgSet containgin a snapshot of variables contained in the workspace.
void exportObj(TObject *obj)
Export reference to given workspace object to CINT.