169 _masterBranchList(
"masterBranchList"),
170 _masterLeafList(
"masterLeafList"),
171 _internalCloneBranchList(
"cloneBranchList"),
172 _cloneNodeListAll(splitLeafsAll),
173 _cloneNodeListOwned(&splitLeafs)
198 _masterBranchList(
"masterBranchList"),
199 _masterLeafList(
"masterLeafList"),
200 _internalCloneBranchList(
"cloneBranchList"),
201 _cloneNodeListAll(0),
202 _cloneNodeListOwned(0)
255 <<
") ERROR cannot set spitting rules on this sterile customizer" << endl ;
280 << arg.
GetName() <<
" only using first rule" << endl ;
286 <<
") ERROR cannot set spitting rules on this sterile customizer" << endl ;
303 << orig.
GetName() <<
" only using first rule" << endl ;
359 <<
") ERROR cannot use leaf spitting build() on this sterile customizer" << endl ;
366 <<
"' not defined for master splitting category " <<
_masterCat->
GetName() << endl ;
381 RooArgSet masterNodesToBeSplit(
"masterNodesToBeSplit") ;
382 RooArgSet masterNodesToBeReplaced(
"masterNodesToBeReplaced") ;
383 RooArgSet masterReplacementNodes(
"masterReplacementNodes") ;
384 RooArgSet clonedMasterNodes(
"clonedMasterNodes") ;
407 <<
"): tree node " << node->
GetName() <<
" is split by category " << splitCat->
GetName() << endl ;
411 if (masterCatState) {
421 clonedMasterNodes.
add(*specNode) ;
424 <<
") Adding existing node specialization " << newName <<
" to clonedMasterNodes" << endl ;
428 TString nameAttrib(
"ORIGNAME:") ;
442 <<
"): WARNING: branch node " << node->
GetName() <<
" is split but has no pre-defined specializations" << endl ;
456 TString nameAttrib(
"ORIGNAME:") ;
465 clonedMasterNodes.
add(*clone) ;
475 masterNodesToBeSplit.
add(*node) ;
483 <<
"): tree node " << node->
GetName() <<
" will be replaced by " << substArg->
GetName() << endl ;
487 TString nameAttrib(
"ORIGNAME:") ;
492 masterNodesToBeReplaced.
add(*node) ;
493 masterReplacementNodes.
add(*substArg) ;
499 RooArgSet masterBranchesToBeCloned(
"masterBranchesToBeCloned") ;
506 if (masterNodesToBeSplit.
find(branch->
GetName())) {
512 if (masterNodesToBeReplaced.
find(branch->
GetName())) {
519 if (branch->
dependsOn(masterNodesToBeSplit)) {
522 << branch->IsA()->
GetName() <<
"::" << branch->
GetName() <<
" cloned: depends on a split parameter" << endl ;
524 masterBranchesToBeCloned.
add(*branch) ;
525 }
else if (branch->
dependsOn(masterNodesToBeReplaced)) {
528 << branch->IsA()->
GetName() <<
"::" << branch->
GetName() <<
" cloned: depends on a replaced parameter" << endl ;
530 masterBranchesToBeCloned.
add(*branch) ;
536 RooArgSet clonedMasterBranches(
"clonedMasterBranches") ;
541 if (masterCatState) {
543 newName.
Append(masterCatState) ;
549 TString nameAttrib(
"ORIGNAME:") ;
557 clonedMasterBranches.
add(*clone) ;
605 os << IsA()->GetName() ;
632 os <<
indent <<
" Splitting rules:" << endl ;
633 for (i=0 ; i<nsplit ; i++) {
640 os <<
indent <<
" Replacement rules:" << endl ;
641 for (i=0 ; i<nrepl ; i++) {
670 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: expect at least 2 arguments for EDIT: the input object and at least one $Replace() rule")) ;
673 if (
string(typeName)!=
"EDIT") {
674 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: unknown type requested: %s",typeName)) ;
680 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: input RooAbsArg %s does not exist",args[0].c_str())) ;
684 if (args[0]==instanceName) {
691 for (
unsigned int i=1 ; i<args.size() ; i++) {
693 strlcpy(buf,args[i].c_str(),1024) ;
694 char*
sep = strchr(buf,
'=') ;
696 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: unknown argument: %s, expect form orig=subst",args[i].c_str())) ;
701 if (
string(
sep+1).find(
"$REMOVE")==0) {
707 char* sep2 = strchr(
sep+1,
'(') ;
710 strlcpy(buf2,sep2+1,1024) ;
735 oocoutW((
TObject*)0,
ObjectHandling) <<
"RooCustomizer::CustIFace::create() WARNING: input or replacement of a replacement operation not found, operation ignored"<< endl ;
742 throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR in customizer build, object %snot created",instanceName)) ;
754 return string(instanceName?instanceName:targ->
GetName()) ;
char * R__STRTOK_R(char *str, const char *delim, char **saveptr)
static void indent(ostringstream &buf, int indent_level)
char * Form(const char *fmt,...)
typedef void((*Func_t)())
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Bool_t redirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t isRecursionStep=kFALSE)
Substitute our servers with those listed in newSet.
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 setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
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.
virtual TObject * Clone(const char *newname=0) 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'.
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
virtual Bool_t isDerived() const
Does value or shape of this arg depend on any other arg?
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
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.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
virtual const char * getLabel() const
Return label string of current state.
void setHashTableSize(Int_t)
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
TIterator-style iteration over contained elements.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
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 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...
std::string create(RooFactoryWSTool &ft, const char *typeName, const char *instanceName, std::vector< std::string > args)
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
void splitArg(const RooAbsArg &arg, const RooAbsCategory &splitCat)
Split all argument 'arg' into individualized clones for each defined state of 'splitCat'.
void setCloneBranchSet(RooArgSet &cloneBranchSet)
Install the input RooArgSet as container in which all cloned branches will be stored.
RooArgSet * _cloneNodeListAll
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurence of arg 'orig' with arg 'subst'.
const RooArgSet & cloneBranchList() const
RooArgSet * _cloneBranchList
virtual void printName(std::ostream &os) const
Print name of customizer.
TIterator * _masterLeafListIter
virtual void printTitle(std::ostream &os) const
Print title of customizer.
RooCustomizer(const RooAbsArg &pdf, const RooAbsCategoryLValue &masterCat, RooArgSet &splitLeafListOwned, RooArgSet *splitLeafListAll=0)
Constructor with a prototype and masterCat index category.
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print customizer configuration details.
RooArgSet _masterBranchList
RooAbsArg * doBuild(const char *masterCatState, Bool_t verbose)
Back-end implementation of the p.d.f building functionality.
RooArgSet _masterLeafList
virtual void printClassName(std::ostream &os) const
Print class name of customizer.
virtual ~RooCustomizer()
Destructor.
RooArgSet _internalCloneBranchList
void initialize()
Initialize the customizer.
TIterator * _masterBranchListIter
RooAbsCategoryLValue * _masterCat
void splitArgs(const RooArgSet &argSet, const RooAbsCategory &splitCat)
Split all arguments in 'set' into individualized clones for each defined state of 'splitCat'.
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...
RooArgSet * _cloneNodeListOwned
virtual void printArgs(std::ostream &os) const
Print arguments of customizer, i.e. input p.d.f and input master category (if any)
static RooConstVar & removalDummy()
Create a dummy node used in node-removal operations.
RooAbsArg * arg(const char *name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
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 Int_t GetSize() const
Return the capacity of the collection, i.e.
Iterator abstract base class.
virtual TObject * Next()=0
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
const char * Data() const
TString & Append(const char *cs)
std::string GetName(const std::string &scope_name)
RooCmdArg NoRecursion(Bool_t flag=kTRUE)
RooCmdArg RenameConflictNodes(const char *suffix, Bool_t renameOrigNodes=kFALSE)
RooCmdArg Silence(Bool_t flag=kTRUE)