131 static char *strtok_r(
char *s1,
const char *s2,
char **lasts)
137 while(*s1 && strchr(s2, *s1))
142 while(*s1 && !strchr(s2, *s1))
186 _masterBranchList(
"masterBranchList"),
187 _masterLeafList(
"masterLeafList"),
188 _internalCloneBranchList(
"cloneBranchList"),
189 _cloneNodeListAll(splitLeafsAll),
190 _cloneNodeListOwned(&splitLeafs)
272 <<
") ERROR cannot set spitting rules on this sterile customizer" << endl ;
297 << arg.
GetName() <<
" only using first rule" << endl ;
303 <<
") ERROR cannot set spitting rules on this sterile customizer" << endl ;
320 << orig.
GetName() <<
" only using first rule" << endl ;
351 allOwned.remove(*ret) ;
355 if (allOwned.getSize()>0) {
376 <<
") ERROR cannot use leaf spitting build() on this sterile customizer" << endl ;
383 <<
"' not defined for master splitting category " <<
_masterCat->
GetName() << endl ;
387 return doBuild(masterCatState,verbose) ;
398 RooArgSet masterNodesToBeSplit(
"masterNodesToBeSplit") ;
399 RooArgSet masterNodesToBeReplaced(
"masterNodesToBeReplaced") ;
400 RooArgSet masterReplacementNodes(
"masterReplacementNodes") ;
401 RooArgSet clonedMasterNodes(
"clonedMasterNodes") ;
424 <<
"): tree node " << node->
GetName() <<
" is split by category " << splitCat->
GetName() << endl ;
427 TString newName(node->
GetName()) ;
428 if (masterCatState) {
429 newName.Append(
"_") ;
430 newName.Append(splitCat->
getLabel()) ;
438 clonedMasterNodes.
add(*specNode) ;
441 <<
") Adding existing node specialization " << newName <<
" to clonedMasterNodes" << endl ;
445 TString nameAttrib(
"ORIGNAME:") ;
446 nameAttrib.Append(node->
GetName()) ;
459 <<
"): WARNING: branch node " << node->
GetName() <<
" is split but has no pre-defined specializations" << endl ;
462 TString newTitle(node->
GetTitle()) ;
463 newTitle.Append(
" (") ;
464 newTitle.Append(splitCat->
getLabel()) ;
465 newTitle.Append(
")") ;
473 TString nameAttrib(
"ORIGNAME:") ;
474 nameAttrib.Append(node->
GetName()) ;
482 clonedMasterNodes.
add(*clone) ;
492 masterNodesToBeSplit.
add(*node) ;
500 <<
"): tree node " << node->
GetName() <<
" will be replaced by " << substArg->
GetName() << endl ;
504 TString nameAttrib(
"ORIGNAME:") ;
505 nameAttrib.Append(node->
GetName()) ;
509 masterNodesToBeReplaced.
add(*node) ;
510 masterReplacementNodes.
add(*substArg) ;
516 RooArgSet masterBranchesToBeCloned(
"masterBranchesToBeCloned") ;
523 if (masterNodesToBeSplit.
find(branch->
GetName())) {
529 if (masterNodesToBeReplaced.
find(branch->
GetName())) {
536 if (branch->
dependsOn(masterNodesToBeSplit)) {
539 << branch->IsA()->
GetName() <<
"::" << branch->
GetName() <<
" cloned: depends on a split parameter" << endl ;
541 masterBranchesToBeCloned.
add(*branch) ;
542 }
else if (branch->
dependsOn(masterNodesToBeReplaced)) {
545 << branch->IsA()->
GetName() <<
"::" << branch->
GetName() <<
" cloned: depends on a replaced parameter" << endl ;
547 masterBranchesToBeCloned.
add(*branch) ;
553 RooArgSet clonedMasterBranches(
"clonedMasterBranches") ;
557 TString newName(branch->
GetName()) ;
558 if (masterCatState) {
559 newName.Append(
"_") ;
560 newName.Append(masterCatState) ;
566 TString nameAttrib(
"ORIGNAME:") ;
567 nameAttrib.Append(branch->
GetName()) ;
574 clonedMasterBranches.
add(*clone) ;
622 os << IsA()->GetName() ;
649 os << indent <<
" Splitting rules:" << endl ;
650 for (i=0 ; i<nsplit ; i++) {
657 os << indent <<
" Replacement rules:" << endl ;
658 for (i=0 ; i<nrepl ; i++) {
687 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: expect at least 2 arguments for EDIT: the input object and at least one $Replace() rule")) ;
690 if (
string(typeName)!=
"EDIT") {
691 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: unknown type requested: %s",typeName)) ;
697 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: input RooAbsArg %s does not exist",args[0].c_str())) ;
701 if (args[0]==instanceName) {
708 for (
unsigned int i=1 ; i<args.size() ; i++) {
710 strlcpy(buf,args[i].c_str(),1024) ;
711 char*
sep = strchr(buf,
'=') ;
713 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: unknown argument: %s, expect form orig=subst",args[i].c_str())) ;
718 if (
string(sep+1).find(
"$REMOVE")==0) {
724 char* sep2 = strchr(sep+1,
'(') ;
727 strlcpy(buf2,sep2+1,1024) ;
729 char* tok = strtok_r(buf2,
",)",&saveptr) ;
733 tok = strtok_r(0,
",)",&saveptr) ;
741 subst = ft.
ws().
arg(sep+1) ;
752 oocoutW((
TObject*)0,
ObjectHandling) <<
"RooCustomizer::CustIFace::create() WARNING: input or replacement of a replacement operation not found, operation ignored"<< endl ;
759 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR in customizer build, object %snot created",instanceName)) ;
771 return string(instanceName?instanceName:targ->
GetName()) ;
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
virtual const char * GetName() const
Returns name of object.
std::string GetName(const std::string &scope_name)
TIterator * createIterator(Bool_t dir=kIterForward) const
RooArgSet * _cloneBranchList
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
void splitArg(const RooAbsArg &arg, const RooAbsCategory &splitCat)
Split all argument 'arg' into individualized clones for each defined state of 'splitCat'.
void leafNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with all leaf nodes of the arg tree, starting with ourself as top node...
RooCustomizer(const RooAbsArg &pdf, const RooAbsCategoryLValue &masterCat, RooArgSet &splitLeafListOwned, RooArgSet *splitLeafListAll=0)
Constructor with a prototype and masterCat index category.
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
virtual void printArgs(std::ostream &os) const
Print arguments of customizer, i.e. input p.d.f and input master category (if any) ...
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
RooAbsArg * arg(const char *name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Iterator abstract base class.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
RooArgSet _masterLeafList
The TNamed class is the base class for all named ROOT classes.
virtual void printTitle(std::ostream &os) const
Print title of customizer.
if on multiple lines(like in C++). **The " * configuration fragment. * * The "import myobject continue
Parses the configuration file.
RooArgSet _masterBranchList
RooArgSet _internalCloneBranchList
RooCmdArg Silence(Bool_t flag=kTRUE)
virtual void printName(std::ostream &os) const
Print name of customizer.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
TIterator * _masterLeafListIter
TIterator * _masterBranchListIter
const RooArgSet & cloneBranchList() const
RooCmdArg NoRecursion(Bool_t flag=kTRUE)
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...
void SetName(const char *name)
Set the name of the TNamed.
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
char * Form(const char *fmt,...)
virtual Bool_t addOwned(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling addOwned() for each element in the source...
virtual const char * getLabel() const
Return label string of current state.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
static void indent(ostringstream &buf, int indent_level)
RooAbsCategoryLValue * _masterCat
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurence of arg 'orig' with arg 'subst'.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsArg * doBuild(const char *masterCatState, Bool_t verbose)
Back-end implementation of the p.d.f building functionality.
virtual void printClassName(std::ostream &os) const
Print class name of customizer.
void setCloneBranchSet(RooArgSet &cloneBranchSet)
Install the input RooArgSet as container in which all cloned branches will be stored.
Mother of all ROOT objects.
void splitArgs(const RooArgSet &argSet, const RooAbsCategory &splitCat)
Split all arguments in 'set' into individualized clones for each defined state of 'splitCat'...
typedef void((*Func_t)())
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print customizer configuration details.
RooArgSet * _cloneNodeListOwned
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.
virtual Bool_t isDerived() const
RooAbsArg * build(const char *masterCatState, Bool_t verbose=kFALSE)
Build a clone of the prototype executing all registered 'replace' rules and 'split' rules for the mas...
static RooConstVar & removalDummy()
Create a dummy node used in node-removal operations.
virtual void Add(TObject *obj)
std::string create(RooFactoryWSTool &ft, const char *typeName, const char *instanceName, std::vector< std::string > args)
RooArgSet * _cloneNodeListAll
virtual TObject * Next()=0
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooCmdArg RenameConflictNodes(const char *suffix, Bool_t renameOrigNodes=kFALSE)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void setHashTableSize(Int_t i)
virtual ~RooCustomizer()
Destructor.
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetSize() const
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Bool_t redirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE)
Iterator over _clientListValue.
void initialize()
Initialize the customizer.
virtual const char * GetTitle() const
Returns title of object.
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.