Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <RooArgList.h>
21#include <RooArgSet.h>
22#include <RooPrintable.h>
23
24#include <TNamed.h>
25#include <TString.h>
26
27#include <vector>
28#include <string>
29
31class RooAbsCategory ;
32class RooAbsArg ;
33class RooAbsPdf ;
34
35// Editing tool for RooAbsArg composite object expressions
37
38public:
39
40 // Constructors, assignment etc
41 RooCustomizer(const RooAbsArg& pdf, const RooAbsCategoryLValue& masterCat, RooArgSet& splitLeafListOwned, RooArgSet* splitLeafListAll=nullptr) ;
42 RooCustomizer(const RooAbsArg& pdf, const char* name) ;
43
44 /// If flag is true, make customizer own all created components
45 void setOwning(bool flag) {
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 verbose=false) ;
53 RooAbsArg* build(bool verbose=false) ;
54
55 /// Return list of cloned branch nodes
56 const RooArgSet& cloneBranchList() const {
57 return *_cloneBranchList ;
58 }
59 /// Return list of cloned leaf nodes
60 const RooArgSet& cloneLeafList() const {
61 return *_cloneNodeListOwned ;
62 }
63
64 // Printing interface
65 void printArgs(std::ostream& os) const ;
66 void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent= "") const;
67
68 /// Releases ownership of list of cloned branch nodes
69 void setCloneBranchSet(RooArgSet& cloneBranchSet) ;
70
71 RooAbsPdf const& pdf() const;
72
73 RooCustomizer(const RooCustomizer &) = delete;
77
78protected:
79
80 void initialize() ;
81
82 RooAbsArg* doBuild(const char* masterCatState, bool verbose) ;
83
84 bool _sterile ; ///< If true we do not have as associated master category
85 bool _owning ; ///< If true we own all created components
86 TString _name ; ///< Name of this object
87
88 RooArgList _splitArgList ; ///< List of RooAbsArgs to be split
89 RooArgList _splitCatList ; ///< List of categories to be used for above splits
90
91 RooArgList _replaceArgList ; ///< List of RooAbsArgs to be replaced
92 RooArgList _replaceSubList ; ///< List of replacement RooAbsArgs
93
94 // Master nodes are not owned
95 RooAbsArg* _masterPdf ; ///< Pointer to input p.d.f
96 RooAbsCategoryLValue* _masterCat = nullptr; ///< Pointer to input master category
97
98 RooArgSet _masterBranchList ; ///< List of branch nodes
99 RooArgSet _masterLeafList ; ///< List of leaf nodes
100
101 RooArgSet _internalCloneBranchList; ///< List of branches of internal clone
102 RooArgSet* _cloneBranchList = nullptr; ///< Pointer to list of cloned branches used
103
104 // Cloned leaves are owned by the user supplied list in the constructor
105 RooArgSet* _cloneNodeListAll = nullptr; ///< List of all cloned nodes
106 RooArgSet* _cloneNodeListOwned = nullptr;///< List of owned cloned nodes
107} ;
108
109#endif
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:79
Abstract base class for objects that represent a discrete value that can be set from the outside,...
A space to attach TBranches.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
TString _name
Name of this object.
RooArgList _replaceSubList
List of replacement RooAbsArgs.
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 occurrence of arg 'orig' with arg 'subst'.
RooAbsArg * _masterPdf
Pointer to input p.d.f.
bool _owning
If true we own all created components.
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...
RooArgList _splitArgList
List of RooAbsArgs to be split.
const RooArgSet & cloneBranchList() const
Return list of cloned branch nodes.
RooArgList _splitCatList
List of categories to be used for above splits.
RooArgSet * _cloneBranchList
Pointer to list of cloned branches used.
RooCustomizer(const RooCustomizer &)=delete
RooCustomizer(RooCustomizer &&)=delete
void setOwning(bool flag)
If flag is true, make customizer own all created components.
RooArgSet _masterBranchList
List of branch nodes.
RooArgSet _masterLeafList
List of leaf nodes.
RooArgSet _internalCloneBranchList
List of branches of internal clone.
RooCustomizer & operator=(const RooCustomizer &)=delete
void initialize()
Initialize the customizer.
const RooArgSet & cloneLeafList() const
Return list of cloned leaf nodes.
RooAbsCategoryLValue * _masterCat
Pointer to input master category.
RooArgList _replaceArgList
List of RooAbsArgs to be replaced.
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.
RooCustomizer & operator=(RooCustomizer &&)=delete
RooAbsArg * doBuild(const char *masterCatState, bool verbose)
Back-end implementation of the p.d.f building functionality.
bool _sterile
If true we do not have as associated master category.
RooAbsPdf const & pdf() const
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)
Basic string class.
Definition TString.h:139