Logo ROOT  
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 "TList.h"
21 #include "TNamed.h"
22 #include "TString.h"
23 #include "RooArgSet.h"
24 #include "RooPrintable.h"
25 #include "RooFactoryWSTool.h"
26 
27 #include <vector>
28 #include <string>
29 
31 class RooAbsCategory ;
32 class RooAbsArg ;
33 class RooAbsPdf ;
34 
35 class RooCustomizer : public TNamed, public RooPrintable {
36 
37 public:
38 
39  // Constructors, assignment etc
40  RooCustomizer(const RooAbsArg& pdf, const RooAbsCategoryLValue& masterCat, RooArgSet& splitLeafListOwned, RooArgSet* splitLeafListAll=0) ;
41  RooCustomizer(const RooAbsArg& pdf, const char* name) ;
42  virtual ~RooCustomizer() ;
43 
44  void setOwning(Bool_t flag) {
45  // If flag is true, make customizer own all created components
46  _owning = flag ;
47  }
48 
49  void splitArgs(const RooArgSet& argSet, const RooAbsCategory& splitCat) ;
50  void splitArg(const RooAbsArg& arg, const RooAbsCategory& splitCat) ;
51  void replaceArg(const RooAbsArg& orig, const RooAbsArg& subst) ;
52  RooAbsArg* build(const char* masterCatState, Bool_t verbose=kFALSE) ;
54 
55  const RooArgSet& cloneBranchList() const {
56  // Return list of cloned branch nodes
57  return *_cloneBranchList ;
58  }
59  const RooArgSet& cloneLeafList() const {
60  // Return list of cloned leaf nodes
61  return *_cloneNodeListOwned ;
62  }
63 
64  // Printing interface
65  virtual void printName(std::ostream& os) const ;
66  virtual void printTitle(std::ostream& os) const ;
67  virtual void printClassName(std::ostream& os) const ;
68  virtual void printArgs(std::ostream& os) const ;
69  virtual void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent= "") const;
70 
71  inline virtual void Print(Option_t *options= 0) const {
72  // Printing interface
74  }
75 
76  // Releases ownership of list of cloned branch nodes
77  void setCloneBranchSet(RooArgSet& cloneBranchSet) ;
78 
79  // Factory interface
81  public:
82  virtual ~CustIFace() {} ;
83  std::string create(RooFactoryWSTool& ft, const char* typeName, const char* instanceName, std::vector<std::string> args) ;
84  } ;
85 
86 protected:
87 
89  void initialize() ;
90 
91  RooAbsArg* doBuild(const char* masterCatState, Bool_t verbose) ;
92 
93  Bool_t _sterile ; // If true we do not have as associated master category
94  Bool_t _owning ; // If true we own all created components
95  TString _name ; // Name of this object
96 
97  TList _splitArgList ; // List of RooAbsArgs to be split
98  TList _splitCatList ; // List of categories to be used for above splits
99 
100  TList _replaceArgList ; // List of RooAbsArgs to be replaced
101  TList _replaceSubList ; // List of replacement RooAbsArgs
102 
103  // Master nodes are not owned
104  RooAbsArg* _masterPdf ; // Pointer to input p.d.f
105  RooAbsCategoryLValue* _masterCat ; // Pointer to input master category
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
RooCustomizer::_masterPdf
RooAbsArg * _masterPdf
Definition: RooCustomizer.h:104
RooCustomizer::CustIFace::create
std::string create(RooFactoryWSTool &ft, const char *typeName, const char *instanceName, std::vector< std::string > args)
Definition: RooCustomizer.cxx:691
RooCustomizer::doBuild
RooAbsArg * doBuild(const char *masterCatState, Bool_t verbose)
Back-end implementation of the p.d.f building functionality.
Definition: RooCustomizer.cxx:420
RooCustomizer::_masterLeafList
RooArgSet _masterLeafList
Definition: RooCustomizer.h:108
RooCustomizer::printClassName
virtual void printClassName(std::ostream &os) const
Print class name of customizer.
Definition: RooCustomizer.cxx:628
RooCustomizer::setCloneBranchSet
void setCloneBranchSet(RooArgSet &cloneBranchSet)
Install the input RooArgSet as container in which all cloned branches will be stored.
Definition: RooCustomizer.cxx:680
RooCustomizer::cloneLeafList
const RooArgSet & cloneLeafList() const
Definition: RooCustomizer.h:59
RooCustomizer::splitArgs
void splitArgs(const RooArgSet &argSet, const RooAbsCategory &splitCat)
Split all arguments in 'set' into individualized clones for each defined state of 'splitCat'.
Definition: RooCustomizer.cxx:295
Option_t
const char Option_t
Definition: RtypesCore.h:66
RooCustomizer::setOwning
void setOwning(Bool_t flag)
Definition: RooCustomizer.h:44
RooCustomizer::_replaceArgList
TList _replaceArgList
Definition: RooCustomizer.h:100
RooCustomizer::_cloneNodeListOwned
RooArgSet * _cloneNodeListOwned
Definition: RooCustomizer.h:115
RooArgSet.h
RooCustomizer::printMultiline
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print customizer configuration details.
Definition: RooCustomizer.cxx:651
RooCustomizer::printName
virtual void printName(std::ostream &os) const
Print name of customizer.
Definition: RooCustomizer.cxx:610
RooCustomizer::_cloneNodeListAll
RooArgSet * _cloneNodeListAll
Definition: RooCustomizer.h:114
RooCustomizer
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
Definition: RooCustomizer.h:35
RooCustomizer::_cloneBranchList
RooArgSet * _cloneBranchList
Definition: RooCustomizer.h:111
TNamed.h
RooPrintable.h
TList.h
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooCustomizer::CustIFace
Definition: RooCustomizer.h:80
TString
Basic string class.
Definition: TString.h:136
RooPrintable
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
Definition: RooPrintable.h:25
RooCustomizer::printArgs
virtual void printArgs(std::ostream &os) const
Print arguments of customizer, i.e. input p.d.f and input master category (if any)
Definition: RooCustomizer.cxx:637
RooCustomizer::build
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...
Definition: RooCustomizer.cxx:397
TString.h
bool
RooCustomizer::replaceArg
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurence of arg 'orig' with arg 'subst'.
Definition: RooCustomizer.cxx:341
RooAbsCategory
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
Definition: RooAbsCategory.h:38
RooCustomizer::cloneBranchList
const RooArgSet & cloneBranchList() const
Definition: RooCustomizer.h:55
RooCustomizer::_splitArgList
TList _splitArgList
Definition: RooCustomizer.h:97
RooCustomizer::RooCustomizer
RooCustomizer(const RooAbsArg &pdf, const RooAbsCategoryLValue &masterCat, RooArgSet &splitLeafListOwned, RooArgSet *splitLeafListAll=0)
Constructor with a prototype and masterCat index category.
Definition: RooCustomizer.cxx:219
RooPrintable::defaultPrintContents
virtual Int_t defaultPrintContents(Option_t *opt) const
Default choice of contents to be printed (name and value)
Definition: RooPrintable.cxx:233
RooCustomizer::initialize
void initialize()
Initialize the customizer.
Definition: RooCustomizer.cxx:268
RooFactoryWSTool
RooFactoryWSTool is a class similar to TTree::MakeClass() that generates skeleton code for RooAbsPdf ...
Definition: RooFactoryWSTool.h:47
RooFactoryWSTool.h
RooCustomizer::CustIFace::~CustIFace
virtual ~CustIFace()
Definition: RooCustomizer.h:82
RooPrintable::defaultPrintStream
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
Definition: RooPrintable.cxx:272
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooCustomizer::_replaceSubList
TList _replaceSubList
Definition: RooCustomizer.h:101
RooCustomizer::RooCustomizer
RooCustomizer(const RooCustomizer &)
RooFactoryWSTool::IFace
Definition: RooFactoryWSTool.h:139
RooCustomizer::_masterBranchList
RooArgSet _masterBranchList
Definition: RooCustomizer.h:107
RooCustomizer::_internalCloneBranchList
RooArgSet _internalCloneBranchList
Definition: RooCustomizer.h:110
RooCustomizer::printTitle
virtual void printTitle(std::ostream &os) const
Print title of customizer.
Definition: RooCustomizer.cxx:619
RooCustomizer::_sterile
Bool_t _sterile
Definition: RooCustomizer.h:93
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooCustomizer::~RooCustomizer
virtual ~RooCustomizer()
Destructor.
Definition: RooCustomizer.cxx:279
RooCustomizer::splitArg
void splitArg(const RooAbsArg &arg, const RooAbsCategory &splitCat)
Split all argument 'arg' into individualized clones for each defined state of 'splitCat'.
Definition: RooCustomizer.cxx:318
name
char name[80]
Definition: TGX11.cxx:110
RooCustomizer::_splitCatList
TList _splitCatList
Definition: RooCustomizer.h:98
RooCustomizer::_owning
Bool_t _owning
Definition: RooCustomizer.h:94
RooPrintable::printStream
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,...
Definition: RooPrintable.cxx:75
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooAbsPdf
Definition: RooAbsPdf.h:43
RooCustomizer::_name
TString _name
Definition: RooCustomizer.h:95
RooAbsCategoryLValue
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
Definition: RooAbsCategoryLValue.h:25
RooPrintable::defaultPrintStyle
virtual StyleOption defaultPrintStyle(Option_t *opt) const
Definition: RooPrintable.cxx:241
RooCustomizer::Print
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooCustomizer.h:71
RooCustomizer::_masterCat
RooAbsCategoryLValue * _masterCat
Definition: RooCustomizer.h:105
TList
A doubly linked list.
Definition: TList.h:44
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
int