Logo ROOT   master
Reference Guide
RooSimWSTool.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id$
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_SIM_WS_TOOL_HH
18 #define ROO_SIM_WS_TOOL_HH
19 
20 #include "Rtypes.h"
21 #include "RooWorkspace.h"
22 #include "RooCmdArg.h"
23 #include "RooFactoryWSTool.h"
24 #include <list>
25 #include <map>
26 #include <string>
27 
28 class RooAbsCategoryLValue ;
29 class RooAbsCategory ;
30 class RooAbsArg ;
31 class RooAbsPdf ;
32 class RooCatType ;
33 class RooSimultaneous ;
34 
35 
36 class RooSimWSTool : public TNamed, public RooPrintable {
37 
38 public:
39 
40  // Constructors, assignment etc
42  virtual ~RooSimWSTool() ;
43 
44  class BuildConfig ;
45  class MultiBuildConfig ;
46  class SplitRule ;
47 
48  class ObjBuildConfig ;
49  class ObjSplitRule ;
50 
51  RooSimultaneous* build(const char* simPdfName, const char* protoPdfName,
52  const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
53  const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
54  const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
55 
56  RooSimultaneous* build(const char* simPdfName,BuildConfig& bc, Bool_t verbose=kTRUE) ;
57 
59  public:
60  virtual ~SimWSIFace() {} ;
61  std::string create(RooFactoryWSTool& ft, const char* typeName, const char* instanceName, std::vector<std::string> args) ;
62  } ;
63 
64 
65 protected:
66 
67  RooSimWSTool(const RooSimWSTool&) ;
68 
69  ObjBuildConfig* validateConfig(BuildConfig& bc) ;
70  RooSimultaneous* executeBuild(const char* simPdfName,ObjBuildConfig& obc, Bool_t verbose=kTRUE) ;
71  std::string makeSplitName(const RooArgSet& splitCatSet) ;
72 
74 
75  ClassDef(RooSimWSTool,0) // Workspace oriented tool for customized cloning of p.d.f. into a simultaneous p.d.f
76 } ;
77 
78 
80 public:
81  SplitRule(const char* pdfName="") : TNamed(pdfName,pdfName) {} ;
82  virtual ~SplitRule() {} ;
83  void splitParameter(const char* paramList, const char* categoryList) ;
84  void splitParameterConstrained(const char* paramNameList, const char* categoryNameList, const char* remainderStateName) ;
85 
86 protected:
87 
88  friend class RooSimWSTool ;
89  friend class BuildConfig ;
90  friend class MultiBuildConfig ;
91  void configure(const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
92  const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
93  const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
94 
95  std::list<std::string> _miStateNameList ;
96  std::map<std::string, std::pair<std::list<std::string>,std::string> > _paramSplitMap ; //<paramName,<std::list<splitCatSet>,remainderStateName>>
97  ClassDef(SplitRule,0) // Split rule specification for prototype p.d.f
98 } ;
99 
100 
102 {
103  public:
104  BuildConfig(const char* pdfName, SplitRule& sr) ;
105  BuildConfig(const char* pdfName, const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
106  const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
107  const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
108 
109  BuildConfig(const RooArgSet& legacyBuildConfig) ;
110 
111  virtual ~BuildConfig() {} ;
112  void restrictBuild(const char* catName, const char* stateList) ;
113 
114  protected:
115  BuildConfig() {} ;
116  friend class RooSimWSTool ;
117  std::string _masterCatName ;
118  std::map<std::string,SplitRule> _pdfmap ;
119  std::map<std::string,std::string> _restr ;
121 
122  void internalAddPdf(const char* pdfName, const char* miStateList, SplitRule& sr) ;
123 
124  ClassDef(BuildConfig,0) // Build configuration object for RooSimWSTool
125  } ;
126 
127 
129 {
130  public:
131  MultiBuildConfig(const char* masterIndexCat) ;
132  virtual ~MultiBuildConfig() {} ;
133  void addPdf(const char* miStateList, const char* pdfName, SplitRule& sr) ;
134  void addPdf(const char* miStateList, const char* pdfName,
135  const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
136  const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
137  const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
138 
139  protected:
140  friend class RooSimWSTool ;
141 
142  ClassDef(MultiBuildConfig,0) // Build configuration object for RooSimWSTool with multiple prototype p.d.f.
143  } ;
144 
145 
146 
147 
148 
149 
151 public:
152  ObjSplitRule() {} ;
153  virtual ~ObjSplitRule() ;
154 
155 protected:
156  friend class RooSimWSTool ;
158  std::list<const RooCatType*> _miStateList ;
159  std::map<RooAbsArg*, std::pair<RooArgSet,std::string> > _paramSplitMap ; //<paramName,<std::list<splitCatSet>,remainderStateName>>
160  ClassDef(ObjSplitRule,0) // Validated RooSimWSTool split rule
161  } ;
162 
163 
165 {
166  public:
168  virtual ~ObjBuildConfig() {} ;
169  void print() ;
170 
171  protected:
172  friend class RooSimWSTool ;
173  std::map<RooAbsPdf*,ObjSplitRule> _pdfmap ;
174  std::map<RooAbsCategory*,std::list<const RooCatType*> > _restr ;
178 
179  ClassDef(ObjBuildConfig,0) // Validated RooSimWSTool build configuration
180  } ;
181 
182 #endif
static constexpr double sr
std::list< const RooCatType * > _miStateList
Definition: RooSimWSTool.h:158
MultiBuildConfig(const char *masterIndexCat)
Construct MultiBuildConfig for build configuration with multiple prototype p.d.f.s masterIndexCat is ...
void configure(const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none())
Construct the SplitRule object from a list of named arguments past to RooSimWSTool::build This method...
void internalAddPdf(const char *pdfName, const char *miStateList, SplitRule &sr)
Internal routine to add prototype pdf &#39;pdfName&#39; with list of associated master states &#39;miStateNameLis...
ObjBuildConfig * validateConfig(BuildConfig &bc)
Validate build configuration.
std::map< std::string, std::pair< std::list< std::string >, std::string > > _paramSplitMap
Definition: RooSimWSTool.h:96
void ws()
Definition: ws.C:66
std::map< std::string, std::string > _restr
Definition: RooSimWSTool.h:119
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
virtual ~ObjSplitRule()
Destructor.
RooFactoryWSTool is a class similar to TTree::MakeClass() that generates skeleton code for RooAbsPdf ...
std::map< std::string, SplitRule > _pdfmap
Definition: RooSimWSTool.h:118
SplitRule(const char *pdfName="")
Definition: RooSimWSTool.h:81
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:52
void splitParameterConstrained(const char *paramNameList, const char *categoryNameList, const char *remainderStateName)
Specify that parameters names listed in paramNameList be split in constrained way in (product of) cat...
#define ClassDef(name, id)
Definition: Rtypes.h:322
RooPlotable is a &#39;mix-in&#39; base class that define the standard RooFit plotting and printing methods...
Definition: RooPrintable.h:25
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
std::map< RooAbsCategory *, std::list< const RooCatType * > > _restr
Definition: RooSimWSTool.h:174
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state...
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
std::map< RooAbsArg *, std::pair< RooArgSet, std::string > > _paramSplitMap
Definition: RooSimWSTool.h:159
RooSimultaneous * executeBuild(const char *simPdfName, ObjBuildConfig &obc, Bool_t verbose=kTRUE)
Internal build driver from validation ObjBuildConfig.
std::string makeSplitName(const RooArgSet &splitCatSet)
Construct name of composite split.
RooWorkspace * _ws
Definition: RooSimWSTool.h:73
std::map< RooAbsPdf *, ObjSplitRule > _pdfmap
Definition: RooSimWSTool.h:173
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:23
void addPdf(const char *miStateList, const char *pdfName, SplitRule &sr)
Add protytpe p.d.f &#39;pdfName&#39; to MultiBuildConfig associated with master indes states &#39;miStateList&#39;...
void print()
Print details of a validated build configuration.
RooSimWSTool(RooWorkspace &ws)
Constructor of SimWSTool on given workspace.
void splitParameter(const char *paramList, const char *categoryList)
Specify that parameters names listed in paramNameList be split in (product of) category(s) listed in ...
RooAbsPdf, the base class of all PDFs
Definition: RooAbsPdf.h:40
The RooSimWSTool is a tool operating on RooWorkspace objects that can clone PDFs into a series of var...
Definition: RooSimWSTool.h:36
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
void restrictBuild(const char *catName, const char *stateList)
Restrict build by only considering state names in stateList for split in category catName...
RooSimultaneous * build(const char *simPdfName, const char *protoPdfName, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none())
Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPd...
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:73
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset...
const Bool_t kTRUE
Definition: RtypesCore.h:89
std::list< std::string > _miStateNameList
Definition: RooSimWSTool.h:95
std::string create(RooFactoryWSTool &ft, const char *typeName, const char *instanceName, std::vector< std::string > args)
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
virtual ~RooSimWSTool()
Destructor.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:28