Logo ROOT   6.12/07
Reference Guide
RooCustomizer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooCustomizer.h,v 1.11 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 
17 #ifndef ROO_PDF_CUSTOMIZER
18 #define ROO_PDF_CUSTOMIZER
19 
20 #include "Rtypes.h"
21 #include "TList.h"
22 #include "TNamed.h"
23 #include "TString.h"
24 #include "RooArgSet.h"
25 #include "RooPrintable.h"
26 #include "RooFactoryWSTool.h"
27 class RooAbsCategoryLValue ;
28 class RooAbsCategory ;
29 class RooAbsArg ;
30 class RooAbsPdf ;
31 
32 class RooCustomizer : public TNamed, public RooPrintable {
33 
34 public:
35 
36  // Constructors, assignment etc
37  RooCustomizer(const RooAbsArg& pdf, const RooAbsCategoryLValue& masterCat, RooArgSet& splitLeafListOwned, RooArgSet* splitLeafListAll=0) ;
38  RooCustomizer(const RooAbsArg& pdf, const char* name) ;
39  virtual ~RooCustomizer() ;
40 
41  void setOwning(Bool_t flag) {
42  // If flag is true, make customizer own all created components
43  _owning = flag ;
44  }
45 
46  void splitArgs(const RooArgSet& argSet, const RooAbsCategory& splitCat) ;
47  void splitArg(const RooAbsArg& arg, const RooAbsCategory& splitCat) ;
48  void replaceArg(const RooAbsArg& orig, const RooAbsArg& subst) ;
49  RooAbsArg* build(const char* masterCatState, Bool_t verbose=kFALSE) ;
50  RooAbsArg* build(Bool_t verbose=kFALSE) ;
51 
52  const RooArgSet& cloneBranchList() const {
53  // Return list of cloned branch nodes
54  return *_cloneBranchList ;
55  }
56  const RooArgSet& cloneLeafList() const {
57  // Return list of cloned leaf nodes
58  return *_cloneNodeListOwned ;
59  }
60 
61  // Printing interface
62  virtual void printName(std::ostream& os) const ;
63  virtual void printTitle(std::ostream& os) const ;
64  virtual void printClassName(std::ostream& os) const ;
65  virtual void printArgs(std::ostream& os) const ;
66  virtual void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent= "") const;
67 
68  inline virtual void Print(Option_t *options= 0) const {
69  // Printing interface
71  }
72 
73  // Releases ownership of list of cloned branch nodes
74  void setCloneBranchSet(RooArgSet& cloneBranchSet) ;
75 
76  // Factory interface
78  public:
79  virtual ~CustIFace() {} ;
80  std::string create(RooFactoryWSTool& ft, const char* typeName, const char* instanceName, std::vector<std::string> args) ;
81  } ;
82 
83 protected:
84 
86  void initialize() ;
87 
88  RooAbsArg* doBuild(const char* masterCatState, Bool_t verbose) ;
89 
90  Bool_t _sterile ; // If true we do not have as associated master category
91  Bool_t _owning ; // If true we own all created components
92  TString _name ; // Name of this object
93 
94  TList _splitArgList ; // List of RooAbsArgs to be split
95  TList _splitCatList ; // List of categories to be used for above splits
96 
97  TList _replaceArgList ; // List of RooAbsArgs to be replaced
98  TList _replaceSubList ; // List of replacement RooAbsArgs
99 
100  // Master nodes are not owned
101  RooAbsArg* _masterPdf ; // Pointer to input p.d.f
102  RooAbsCategoryLValue* _masterCat ; // Pointer to input master category
103 
104  TIterator* _masterLeafListIter ; // Iterator over leaf list
105  TIterator* _masterBranchListIter ; // Iterator over branch list
106 
107  RooArgSet _masterBranchList ; // List of branch nodes
108  RooArgSet _masterLeafList ; // List of leaf nodes
109 
110  RooArgSet _internalCloneBranchList ; // List of branches of internal clone
111  RooArgSet* _cloneBranchList ; // Pointer to list of cloned branches used
112 
113  // Cloned leafs are owned by the user supplied list in the ctor
114  RooArgSet* _cloneNodeListAll ; // List of all cloned nodes
115  RooArgSet* _cloneNodeListOwned ; // List of owned cloned nodes
116 
117  ClassDef(RooCustomizer,0) // Editing tool for RooAbsArg composite object expressions
118 } ;
119 
120 #endif
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer, which is interpreted as an OR of &#39;enum ContentsOptions&#39; values and in the style given by &#39;enum StyleOption&#39;.
RooArgSet * _cloneBranchList
void splitArg(const RooAbsArg &arg, const RooAbsCategory &splitCat)
Split all argument &#39;arg&#39; into individualized clones for each defined state of &#39;splitCat&#39;.
TList _splitArgList
Definition: RooCustomizer.h:94
const char Option_t
Definition: RtypesCore.h:62
RooCustomizer(const RooAbsArg &pdf, const RooAbsCategoryLValue &masterCat, RooArgSet &splitLeafListOwned, RooArgSet *splitLeafListAll=0)
Constructor with a prototype and masterCat index category.
RooFactoryWSTool is a clase like TTree::MakeClass() that generates skeleton code for RooAbsPdf and Ro...
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void printArgs(std::ostream &os) const
Print arguments of customizer, i.e. input p.d.f and input master category (if any) ...
Iterator abstract base class.
Definition: TIterator.h:30
TList _splitCatList
Definition: RooCustomizer.h:95
#define ClassDef(name, id)
Definition: Rtypes.h:320
RooPlotable is a &#39;mix-in&#39; base class that define the standard RooFit plotting and printing methods...
Definition: RooPrintable.h:25
RooArgSet _masterLeafList
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
void setOwning(Bool_t flag)
Definition: RooCustomizer.h:41
virtual void printTitle(std::ostream &os) const
Print title of customizer.
RooArgSet _masterBranchList
RooArgSet _internalCloneBranchList
TList _replaceArgList
Definition: RooCustomizer.h:97
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooCustomizer.h:68
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
A doubly linked list.
Definition: TList.h:44
TIterator * _masterBranchListIter
const RooArgSet & cloneBranchList() const
Definition: RooCustomizer.h:52
const RooArgSet & cloneLeafList() const
Definition: RooCustomizer.h:56
virtual Int_t defaultPrintContents(Option_t *opt) const
Default choice of contents to be printed (name and value)
RooAbsCategoryLValue * _masterCat
const Bool_t kFALSE
Definition: RtypesCore.h:88
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurence of arg &#39;orig&#39; with arg &#39;subst&#39;.
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
RooAbsArg * _masterPdf
virtual StyleOption defaultPrintStyle(Option_t *opt) const
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.
void splitArgs(const RooArgSet &argSet, const RooAbsCategory &splitCat)
Split all arguments in &#39;set&#39; into individualized clones for each defined state of &#39;splitCat&#39;...
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print customizer configuration details.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
RooArgSet * _cloneNodeListOwned
RooAbsArg * build(const char *masterCatState, Bool_t verbose=kFALSE)
Build a clone of the prototype executing all registered &#39;replace&#39; rules and &#39;split&#39; rules for the mas...
std::string create(RooFactoryWSTool &ft, const char *typeName, const char *instanceName, std::vector< std::string > args)
RooArgSet * _cloneNodeListAll
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
TList _replaceSubList
Definition: RooCustomizer.h:98
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
virtual ~RooCustomizer()
Destructor.
void initialize()
Initialize the customizer.
char name[80]
Definition: TGX11.cxx:109