185  ~CustIFace()
 override {} ;
 
  186  std::string 
create(
RooFactoryWSTool& ft, 
const char* typeName, 
const char* instanceName, std::vector<std::string> args) 
override ;
 
  232  _masterBranchList(
"masterBranchList"),
 
  233  _masterLeafList(
"masterLeafList"),
 
  234  _internalCloneBranchList(
"cloneBranchList"),
 
  235  _cloneNodeListAll(splitLeafsAll),
 
  236  _cloneNodeListOwned(&splitLeafs)
 
  256  _masterBranchList(
"masterBranchList"),
 
  257  _masterLeafList(
"masterLeafList"),
 
  258  _internalCloneBranchList(
"cloneBranchList"),
 
  259  _cloneNodeListAll(0),
 
  260  _cloneNodeListOwned(0)
 
  303    oocoutE(
nullptr, InputArguments) << 
"RooCustomizer::splitArgs(" << 
_name 
  304           << 
") ERROR cannot set spitting rules on this sterile customizer" << endl ;
 
  308  for (
auto arg : set) {
 
  326    oocoutE(
nullptr, InputArguments) << 
"RooCustomizer(" << 
_masterPdf->
GetName() << 
") ERROR: multiple splitting rules defined for " 
  327           << arg.
GetName() << 
" only using first rule" << endl ;
 
  332    oocoutE(
nullptr, InputArguments) << 
"RooCustomizer::splitArg(" << 
_name 
  333    << 
") ERROR cannot set spitting rules on this sterile customizer" << endl ;
 
  349    oocoutE(
nullptr, InputArguments) << 
"RooCustomizer(" << 
_masterPdf->
GetName() << 
") ERROR: multiple replacement rules defined for " 
  350    << orig.
GetName() << 
" only using first rule" << endl ;
 
  381  allOwned.remove(*ret) ;
 
  385  if (allOwned.getSize()>0) {
 
  405    oocoutE(
nullptr, InputArguments) << 
"RooCustomizer::build(" << 
_name 
  406           << 
") ERROR cannot use leaf spitting build() on this sterile customizer" << endl ;
 
  412    oocoutE(
nullptr, InputArguments) << 
"RooCustomizer::build(" << 
_masterPdf->
GetName() << 
"): ERROR label '" << masterCatState
 
  413           << 
"' not defined for master splitting category " << 
_masterCat->
GetName() << endl ;
 
  417  return doBuild(masterCatState,verbose) ;
 
  428  RooArgSet masterNodesToBeSplit(
"masterNodesToBeSplit") ;
 
  429  RooArgSet masterNodesToBeReplaced(
"masterNodesToBeReplaced") ;
 
  430  RooArgSet masterReplacementNodes(
"masterReplacementNodes") ;
 
  431  RooArgSet clonedMasterNodes(
"clonedMasterNodes") ;
 
  438  for (
auto node : nodeList) {
 
  444               << 
"): tree node " << node->GetName() << 
" is split by category " << splitCat->
GetName() << endl ;
 
  447      TString newName(node->GetName()) ;
 
  448      if (masterCatState) {
 
  458   clonedMasterNodes.
add(*specNode) ;
 
  461            << 
") Adding existing node specialization " << newName << 
" to clonedMasterNodes" << endl ;
 
  465   TString nameAttrib(
"ORIGNAME:") ;
 
  466   nameAttrib.
Append(node->GetName()) ;
 
  477   if (node->isDerived()) {
 
  479            << 
"): WARNING: branch node " << node->GetName() << 
" is split but has no pre-defined specializations" << endl ;
 
  482   TString newTitle(node->GetTitle()) ;
 
  493   TString nameAttrib(
"ORIGNAME:") ;
 
  494   nameAttrib.
Append(node->GetName()) ;
 
  502   clonedMasterNodes.
add(*clone) ;
 
  512      masterNodesToBeSplit.
add(*node) ;
 
  520               << 
"): tree node " << node->GetName() << 
" will be replaced by " << substArg->
GetName() << endl ;
 
  524      TString nameAttrib(
"ORIGNAME:") ;
 
  525      nameAttrib.
Append(node->GetName()) ;
 
  529      masterNodesToBeReplaced.
add(*node) ;
 
  530      masterReplacementNodes.
add(*substArg) ;
 
  535  RooArgSet masterBranchesToBeCloned(
"masterBranchesToBeCloned") ;
 
  539    if (masterNodesToBeSplit.
find(branch->GetName())) {
 
  541   oocoutI(
nullptr, ObjectHandling) << 
"RooCustomizer::build(" << 
_masterPdf->
GetName() << 
") Branch node " << branch->GetName() << 
" is already split" << endl ;
 
  545    if (masterNodesToBeReplaced.
find(branch->GetName())) {
 
  547   oocoutI(
nullptr, ObjectHandling) << 
"RooCustomizer::build(" << 
_masterPdf->
GetName() << 
") Branch node " << branch->GetName() << 
" is already replaced" << endl ;
 
  552    if (branch->dependsOn(masterNodesToBeSplit)) {
 
  555               << branch->ClassName() << 
"::" << branch->GetName() << 
" cloned: depends on a split parameter" << endl ;
 
  557      masterBranchesToBeCloned.
add(*branch) ;
 
  558    } 
else if (branch->dependsOn(masterNodesToBeReplaced)) {
 
  561               << branch->ClassName() << 
"::" << branch->GetName() << 
" cloned: depends on a replaced parameter" << endl ;
 
  563      masterBranchesToBeCloned.
add(*branch) ;
 
  569  RooArgSet clonedMasterBranches(
"clonedMasterBranches") ;
 
  571  for (
auto branch : masterBranchesToBeCloned) {
 
  572    TString newName(branch->GetName()) ;
 
  573    if (masterCatState) {
 
  575      newName.
Append(masterCatState) ;
 
  581    TString nameAttrib(
"ORIGNAME:") ;
 
  582    nameAttrib.
Append(branch->GetName()) ;
 
  589    clonedMasterBranches.
add(*clone) ;
 
  602  for (
auto branch : clonedMasterBranches) {
 
  603    branch->redirectServers(clonedMasterBranches,
false,
true) ;
 
  604    branch->redirectServers(clonedMasterNodes,
false,
true) ;
 
  605    branch->redirectServers(masterReplacementNodes,
false,
true) ;
 
  608  return cloneTopPdf ? cloneTopPdf : 
_masterPdf ;
 
  635    os << 
indent << 
"  Splitting rules:" << endl ;
 
  636    for (i=0 ; i<nsplit ; i++) {
 
  643    os << 
indent << 
"  Replacement rules:" << endl ;
 
  644    for (i=0 ; i<nrepl ; i++) {
 
  666  return static_cast<RooAbsPdf&
>(*_masterPdf);
 
  674std::string CustIFace::create(
RooFactoryWSTool& ft, 
const char* typeName, 
const char* instanceName, std::vector<std::string> args)
 
  678    throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: expect at least 2 arguments for EDIT: the input object and at least one $Replace() rule")) ;
 
  681  if (
string(typeName)!=
"EDIT") {
 
  682    throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: unknown type requested: %s",typeName)) ;
 
  688    throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: input RooAbsArg %s does not exist",args[0].c_str())) ;
 
  692  if (args[0]==instanceName) {
 
  699  for (
unsigned int i=1 ; i<args.size() ; i++) {
 
  701    strlcpy(buf,args[i].c_str(),1024) ;
 
  702    char* 
sep = strchr(buf,
'=') ;
 
  704      throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR: unknown argument: %s, expect form orig=subst",args[i].c_str())) ;
 
  709    if (
string(sep+1).find(
"$REMOVE")==0) {
 
  715      char* sep2 = strchr(sep+1,
'(') ;
 
  718   strlcpy(buf2,sep2+1,1024) ;
 
  720   char* tok = R__STRTOK_R(buf2,
",)",&saveptr) ;
 
  723     subst->setAttribute(
Form(
"REMOVE_FROM_%s",tok)) ;
 
  724     tok = R__STRTOK_R(0,
",)",&saveptr) ;
 
  728   subst->setAttribute(
"REMOVE_ALL") ;
 
  732      subst = ft.
ws().
arg(sep+1) ;
 
  741      cust.replaceArg(*orig,*subst) ;
 
  743      oocoutW(
nullptr,ObjectHandling) << 
"RooCustomizer::CustIFace::create() WARNING: input or replacement of a replacement operation not found, operation ignored"<< endl ;
 
  750    throw string(
Form(
"RooCustomizer::CustIFace::create() ERROR in customizer build, object %snot created",instanceName)) ;
 
  763  return string(instanceName?instanceName:targ->GetName()) ;
 
static void indent(ostringstream &buf, int indent_level)
 
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
 
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'.
 
void SetName(const char *name) override
Set the name of the TNamed.
 
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
 
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
 
void removeStringAttribute(const Text_t *key)
Delete a string attribute with a given key.
 
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.
 
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
 
void leafNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=nullptr, bool recurseNonDerived=false) const
Fill supplied list with all leaf nodes of the arg tree, starting with ourself as top node.
 
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
 
virtual bool setLabel(const char *label, bool printError=true)=0
Change category state by specifying a state name.
 
A space to attach TBranches.
 
virtual const char * getCurrentLabel() const
Return label string of current state.
 
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
 
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
 
void useHashMapForFind(bool flag) const
 
RooAbsArg * find(const char *name) const
Find object with given name in list.
 
RooArgSet is a container object that can hold multiple RooAbsArg objects.
 
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
 
TString _name
Name of this object.
 
TList _splitArgList
List of RooAbsArgs to be split.
 
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)
Releases ownership of list of cloned branch nodes.
 
RooArgSet * _cloneNodeListAll
List of all cloned nodes.
 
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurence of arg 'orig' with arg 'subst'.
 
RooAbsArg * _masterPdf
Pointer to input p.d.f.
 
bool _owning
If true we own all created components.
 
TList _replaceSubList
List of replacement RooAbsArgs.
 
RooAbsArg * build(const char *masterCatState, bool verbose=false)
Build a clone of the prototype executing all registered 'replace' rules and 'split' rules for the mas...
 
RooArgSet * _cloneBranchList
Pointer to list of cloned branches used.
 
RooCustomizer(const RooAbsArg &pdf, const RooAbsCategoryLValue &masterCat, RooArgSet &splitLeafListOwned, RooArgSet *splitLeafListAll=nullptr)
Constructor with a prototype and masterCat index category.
 
RooArgSet _masterBranchList
List of branch nodes.
 
RooArgSet _masterLeafList
List of leaf nodes.
 
~RooCustomizer()
Destructor.
 
RooArgSet _internalCloneBranchList
List of branches of internal clone.
 
void initialize()
Initialize the customizer.
 
RooAbsCategoryLValue * _masterCat
Pointer to input master category.
 
void splitArgs(const RooArgSet &argSet, const RooAbsCategory &splitCat)
Split all arguments in 'set' into individualized clones for each defined state of 'splitCat'.
 
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const
Print customizer configuration details.
 
RooAbsArg * doBuild(const char *masterCatState, bool verbose)
Back-end implementation of the p.d.f building functionality.
 
TList _replaceArgList
List of RooAbsArgs to be replaced.
 
bool _sterile
If true we do not have as associated master category.
 
RooAbsPdf const & pdf() const
 
TList _splitCatList
List of categories to be used for above splits.
 
RooArgSet * _cloneNodeListOwned
List of owned cloned nodes.
 
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.
 
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.
 
RooAbsArg * arg(RooStringView name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
 
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
 
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
 
void Add(TObject *obj) override
 
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
 
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
 
const char * GetName() const override
Returns name of object.
 
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)
 
RooCmdArg RecycleConflictNodes(bool flag=true)
 
RooCmdArg Silence(bool flag=true)
 
RooCmdArg NoRecursion(bool flag=true)
 
RooCmdArg RenameConflictNodes(const char *suffix, bool renameOrigNodes=false)
 
void(off) SmallVectorTemplateBase< T
 
void init()
Inspect hardware capabilities, and load the optimal library for RooFit computations.