File indexing completed on 2025-01-18 10:11:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef ROO_SIM_WS_TOOL_HH
0018 #define ROO_SIM_WS_TOOL_HH
0019
0020 #include "Rtypes.h"
0021 #include "RooWorkspace.h"
0022 #include "RooCmdArg.h"
0023
0024 #include <list>
0025 #include <map>
0026 #include <string>
0027 #include <vector>
0028
0029 class RooAbsCategoryLValue;
0030 class RooAbsCategory;
0031 class RooAbsArg;
0032 class RooAbsPdf;
0033 class RooCatType;
0034 class RooSimultaneous;
0035
0036
0037
0038 class RooSimWSTool {
0039
0040 public:
0041
0042
0043 RooSimWSTool(RooWorkspace& ws) ;
0044 ~RooSimWSTool() ;
0045
0046 class BuildConfig ;
0047 class MultiBuildConfig ;
0048 class SplitRule ;
0049
0050 class ObjBuildConfig ;
0051 class ObjSplitRule ;
0052
0053 RooSimultaneous* build(const char* simPdfName, const char* protoPdfName,
0054 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
0055 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
0056 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
0057
0058 RooSimultaneous* build(const char* simPdfName,BuildConfig& bc, bool verbose=true) ;
0059
0060
0061 protected:
0062
0063 RooSimWSTool(const RooSimWSTool&) ;
0064
0065 std::unique_ptr<ObjBuildConfig> validateConfig(BuildConfig& bc) ;
0066 RooSimultaneous* executeBuild(const char* simPdfName,ObjBuildConfig& obc, bool verbose=true) ;
0067 std::string makeSplitName(const RooArgSet& splitCatSet) ;
0068
0069 RooWorkspace* _ws ;
0070
0071 } ;
0072
0073
0074
0075 class RooSimWSTool::SplitRule : public TNamed {
0076 public:
0077 SplitRule(const char* pdfName="") : TNamed(pdfName,pdfName) {} ;
0078 void splitParameter(const char* paramList, const char* categoryList) ;
0079 void splitParameterConstrained(const char* paramNameList, const char* categoryNameList, const char* remainderStateName) ;
0080
0081 protected:
0082
0083 friend class RooSimWSTool ;
0084 friend class BuildConfig ;
0085 friend class MultiBuildConfig ;
0086 void configure(const RooCmdArg& arg1={},const RooCmdArg& arg2={},
0087 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
0088 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
0089
0090 std::list<std::string> _miStateNameList ;
0091 std::map<std::string, std::pair<std::list<std::string>,std::string> > _paramSplitMap ;
0092 } ;
0093
0094
0095
0096 class RooSimWSTool::BuildConfig
0097 {
0098 public:
0099 BuildConfig(const char* pdfName, SplitRule& sr) ;
0100 BuildConfig(const char* pdfName, const RooCmdArg& arg1={},const RooCmdArg& arg2={},
0101 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
0102 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
0103
0104 BuildConfig(const RooArgSet& legacyBuildConfig) ;
0105
0106 virtual ~BuildConfig() {} ;
0107 void restrictBuild(const char* catName, const char* stateList) ;
0108
0109 protected:
0110 BuildConfig() {} ;
0111 friend class RooSimWSTool ;
0112 std::string _masterCatName ;
0113 std::map<std::string,SplitRule> _pdfmap ;
0114 std::map<std::string,std::string> _restr ;
0115 RooCmdArg _conflProtocol ;
0116
0117 void internalAddPdf(const char* pdfName, const char* miStateList, SplitRule& sr) ;
0118
0119 } ;
0120
0121
0122
0123 class RooSimWSTool::MultiBuildConfig : public RooSimWSTool::BuildConfig
0124 {
0125 public:
0126 MultiBuildConfig(const char* masterIndexCat) ;
0127 void addPdf(const char* miStateList, const char* pdfName, SplitRule& sr) ;
0128 void addPdf(const char* miStateList, const char* pdfName,
0129 const RooCmdArg& arg1={},const RooCmdArg& arg2={},
0130 const RooCmdArg& arg3={},const RooCmdArg& arg4={},
0131 const RooCmdArg& arg5={},const RooCmdArg& arg6={}) ;
0132
0133 protected:
0134 friend class RooSimWSTool ;
0135
0136 } ;
0137
0138
0139
0140 class RooSimWSTool::ObjSplitRule {
0141 public:
0142 ObjSplitRule() {} ;
0143 virtual ~ObjSplitRule() ;
0144
0145 protected:
0146 friend class RooSimWSTool ;
0147 friend class RooSimWSTool::ObjBuildConfig ;
0148 std::list<const RooCatType*> _miStateList ;
0149 std::map<RooAbsArg*, std::pair<RooArgSet,std::string> > _paramSplitMap ;
0150 } ;
0151
0152
0153
0154 class RooSimWSTool::ObjBuildConfig
0155 {
0156 public:
0157 ObjBuildConfig() : _masterCat(nullptr) {}
0158 virtual ~ObjBuildConfig() {}
0159 void print() ;
0160
0161 protected:
0162 friend class RooSimWSTool ;
0163 std::map<RooAbsPdf*,ObjSplitRule> _pdfmap ;
0164 std::map<RooAbsCategory*,std::list<const RooCatType*> > _restr ;
0165 RooCategory* _masterCat ;
0166 RooArgSet _usedSplitCats ;
0167 RooCmdArg _conflProtocol ;
0168
0169 } ;
0170
0171 #endif