library: libRooFit #include "RooCustomizer.h"

# RooCustomizer

class description - source file - inheritance tree (.pdf)

## class RooCustomizer : public TNamed, public RooPrintable

| Inheritance Chart:
`TObject`
| <- | `TNamed`
`RooPrintable`
| <- | `RooCustomizer` |

        protected:

                        RooCustomizer(const RooCustomizer&)
             RooAbsArg* doBuild(const char* masterCatState, Bool_t verbose)
                   void initialize()

        public:

                           RooCustomizer(const RooAbsArg& pdf, const RooAbsCategoryLValue& masterCat, RooArgSet& splitLeafList)
                           RooCustomizer(const RooAbsArg& pdf, const char* name)
                   virtual ~RooCustomizer()
                RooAbsArg* build(const char* masterCatState, Bool_t verbose = kFALSE)
                RooAbsArg* build(Bool_t verbose = kFALSE)
            static TClass* Class()
          const RooArgSet& cloneBranchList() const
          const RooArgSet& cloneLeafList() const
           virtual TClass* IsA() const
              virtual void Print(Option_t* options = "0") const
              virtual void printToStream(ostream& os, RooPrintable::PrintOption opt = Standard, TString indent = ) const
                      void replaceArg(const RooAbsArg& orig, const RooAbsArg& subst)
                      void setCloneBranchSet(RooArgSet& cloneBranchSet)
              virtual void ShowMembers(TMemberInspector& insp, char* parent)
                      void splitArg(const RooAbsArg& arg, const RooAbsCategory& splitCat)
                      void splitArgs(const RooArgSet& argSet, const RooAbsCategory& splitCat)
              virtual void Streamer(TBuffer& b)
                      void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                         Bool_t _sterile
                        TString _name
                          TList _splitArgList
                          TList _splitCatList
                          TList _replaceArgList
                          TList _replaceSubList
                     RooAbsArg* _masterPdf
          RooAbsCategoryLValue* _masterCat
                     TIterator* _masterLeafListIter
                     TIterator* _masterBranchListIter
                      RooArgSet _masterBranchList
                      RooArgSet _masterLeafList
                      RooArgSet _internalCloneBranchList
                     RooArgSet* _cloneBranchList
                     RooArgSet* _cloneNodeList

## Class Description

     -> replace(leaf_arg,repl_arg)
     replaces each occurence of leaf_arg with repl_arg in the composite pdf.

     -> split(split_arg)
     is used when building multiple clones of the same prototype. Each
     occurrence of split_arg is replaceed with a clone of split_arg
     named split_arg_[MCstate], where [MCstate] is the name of the
     'master category state' that indexes the clones to be built.

     [Example]

     Splitting is particularly useful when building simultaneous fits to
     subsets of the data sample with different background properties.
     In such a case, the user builds a single prototype PDF representing
     the structure of the signal and background and splits the dataset
     into categories with different background properties. Using
     RooCustomizer a PDF for each subfit can be constructed from the
     prototype that has same structure and signal parameters, but
     different instances of the background parameters: e.g.

         ...
         RooExponential bg("bg","background",x,alpha) ;
         RooGaussian sig("sig","signal",x,mean,sigma) ;
         RooAddPdf pdf("pdf","pdf",sig,bg,sigfrac) ;

         RooDataSet data("data","dataset",RooArgSet(x,runblock),...)

         RooCategory runblock("runblock","run block") ;
         runblock.defineType("run1") ;
         runblock.defineType("run2") ;

         RooArgSet splitLeafs
         RooCustomizer cust(pdf,runblock,splitLeafs)
         cust.split(alpha,runblock)

         RooAbsPdf* pdf_run1 = cust.build("run1") ;
         RooAbsPdf* pdf_run2 = cust.build("run2") ;

         RooSimultaneous simpdf("simpdf","simpdf",RooArgSet(*pdf_run1,*pdf_run2))

     If the master category state is a super category, leafs may be split
     by any subset of that master category. E.g. if the master category
     is 'A x B', leafs may be split by A, B or AxB.

     In addition to replacing leaf nodes, RooCustomizer clones all branch
     nodes that depend directly or indirectly on modified leaf nodes, so
     that the input pdf is untouched by each build operation.

     The customizer owns all the branch nodes including the returned top
     level node, so the customizer should live as longs as the cloned
     composites are needed.

     Any leaf nodes that are created by the customizer will be put into
     the leaf list that is passed into the customizers constructor (splitLeafs in
     the above example. The list owner is responsible for deleting these leaf
     nodes after the customizer is deleted.

     [Advanced techniques]

     By default the customizer clones the prototype leaf node when splitting a leaf,
     but the user can feed pre-defined split leafs in leaf list. These leafs
     must have the name <split_leaf>_<splitcat_label> to be picked up. The list
     of pre-supplied leafs may be partial, any missing split leafs will be auto
     generated.

     Another common construction is to have two prototype PDFs, each to be customized
     by a separate customizer instance, that share parameters. To ensure that
     the customized clones also share their respective split leafs, i.e.

       PDF1(x,y;A) and PDF2(z,A)   ---> PDF1_run1(x,y,A_run1) and PDF2_run1(x,y,A_run1)
                                        PDF1_run2(x,y,A_run2) and PDF2_run2(x,y,A_run2)

     feed the same split leaf list into both customizers. In that case the second customizer
     will pick up the split leafs instantiated by the first customizer and the link between
     the two PDFs is retained

RooCustomizer(const RooAbsArg& pdf, const RooAbsCategoryLValue& masterCat, RooArgSet& splitLeafs) : TNamed(pdf.GetName(),pdf.GetTitle()), _sterile(kFALSE), _masterPdf((RooAbsArg*)&pdf), _masterCat((RooAbsCategoryLValue*)&masterCat), _masterBranchList("masterBranchList"), _masterLeafList("masterLeafList"), _internalCloneBranchList("cloneBranchList"), _cloneNodeList(&splitLeafs)

     Constructor with masterCat state. Customizers created by this constructor offer the full functionality

RooCustomizer(const RooAbsArg& pdf, const char* name) : TNamed(pdf.GetName(),pdf.GetTitle()), _sterile(kTRUE), _name(name), _masterPdf((RooAbsArg*)&pdf), _masterCat(0), _masterBranchList("masterBranchList"), _masterLeafList("masterLeafList"), _internalCloneBranchList("cloneBranchList"), _cloneNodeList(0)

     Sterile Constructor. Customizers created by this constructor offer only the replace() method. The supplied
     'name' is used as suffix for any cloned branch nodes

void initialize()

     Initialization function

~RooCustomizer()

     Destructor

void splitArgs(const RooArgSet& set, const RooAbsCategory& splitCat)

     Split all args in 'set' by 'splitCat' states. 'splitCats' must be subset of
     or equal to the master category supplied in the customizer constructor.

     Splitting is only available on customizers created with a master index category

void splitArg(const RooAbsArg& arg, const RooAbsCategory& splitCat)

     Split 'arg' by 'splitCat' states. 'splitCats' must be subset of
     or equal to the master category supplied in the customizer constructor.

     Splitting is only available on customizers created with a master index category

void replaceArg(const RooAbsArg& orig, const RooAbsArg& subst)

     Replace any occurence of arg 'orig' with arg 'subst'

RooAbsArg* build(Bool_t verbose)

     Build a clone of the prototype executing all registered 'replace' rules
     If verbose is set a message is printed for each leaf or branch node
     modification. The returned composite arg is owned by the customizer

RooAbsArg* build(const char* masterCatState, Bool_t verbose)

     Build a clone of the prototype executing all registered 'replace' rules
     and 'split' rules for the masterCat state named 'masterCatState'.
     If verbose is set a message is printed for each leaf or branch node
     modification. The returned composite arg is owned by the customizer.
     This function cannot be called on customizer build with the sterile constructor.

RooAbsArg* doBuild(const char* masterCatState, Bool_t verbose)

     Protected build engine
       RooAbsArg::setDirtyInhibit(kTRUE) ;

void printToStream(ostream& os, PrintOption /*opt*/, TString indent) const

void setCloneBranchSet(RooArgSet& cloneBranchSet)

### Inline Functions

            const RooArgSet& cloneBranchList() const
            const RooArgSet& cloneLeafList() const
                        void Print(Option_t* options = "0") const
               RooCustomizer RooCustomizer(const RooCustomizer&)
                     TClass* Class()
                     TClass* IsA() const
                        void ShowMembers(TMemberInspector& insp, char* parent)
                        void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)

Last update: Tue Jun 28 18:11:40 2005
Copyright (c) 2000-2005, Regents of the University of California *