Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
24#include <list>
25#include <map>
26#include <string>
27#include <vector>
28
30class RooAbsCategory;
31class RooAbsArg;
32class RooAbsPdf;
33class RooCatType;
34class RooSimultaneous;
35
36
37// Workspace oriented tool for customized cloning of p.d.f. into a simultaneous p.d.f
39
40public:
41
42 // Constructors, assignment etc
45
46 class BuildConfig ;
47 class MultiBuildConfig ;
48 class SplitRule ;
49
50 class ObjBuildConfig ;
51 class ObjSplitRule ;
52
53 RooSimultaneous* build(const char* simPdfName, const char* protoPdfName,
54 const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
55 const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
56 const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
57
58 RooSimultaneous* build(const char* simPdfName,BuildConfig& bc, bool verbose=true) ;
59
60
61protected:
62
64
65 std::unique_ptr<ObjBuildConfig> validateConfig(BuildConfig& bc) ;
66 RooSimultaneous* executeBuild(const char* simPdfName,ObjBuildConfig& obc, bool verbose=true) ;
67 std::string makeSplitName(const RooArgSet& splitCatSet) ;
68
70
71} ;
72
73
74// Split rule specification for prototype p.d.f
76public:
77 SplitRule(const char* pdfName="") : TNamed(pdfName,pdfName) {} ;
78 ~SplitRule() override {} ;
79 void splitParameter(const char* paramList, const char* categoryList) ;
80 void splitParameterConstrained(const char* paramNameList, const char* categoryNameList, const char* remainderStateName) ;
81
82protected:
83
84 friend class RooSimWSTool ;
85 friend class BuildConfig ;
86 friend class MultiBuildConfig ;
87 void configure(const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
88 const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
89 const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
90
91 std::list<std::string> _miStateNameList ;
92 std::map<std::string, std::pair<std::list<std::string>,std::string> > _paramSplitMap ; //<paramName,<std::list<splitCatSet>,remainderStateName>>
93} ;
94
95
96// Build configuration object for RooSimWSTool
98{
99 public:
100 BuildConfig(const char* pdfName, SplitRule& sr) ;
101 BuildConfig(const char* pdfName, const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
102 const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
103 const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
104
105 BuildConfig(const RooArgSet& legacyBuildConfig) ;
106
107 virtual ~BuildConfig() {} ;
108 void restrictBuild(const char* catName, const char* stateList) ;
109
110 protected:
112 friend class RooSimWSTool ;
113 std::string _masterCatName ;
114 std::map<std::string,SplitRule> _pdfmap ;
115 std::map<std::string,std::string> _restr ;
117
118 void internalAddPdf(const char* pdfName, const char* miStateList, SplitRule& sr) ;
119
120 } ;
121
122
123// Build configuration object for RooSimWSTool with multiple prototype p.d.f.
125{
126 public:
127 MultiBuildConfig(const char* masterIndexCat) ;
128 ~MultiBuildConfig() override {} ;
129 void addPdf(const char* miStateList, const char* pdfName, SplitRule& sr) ;
130 void addPdf(const char* miStateList, const char* pdfName,
131 const RooCmdArg& arg1=RooCmdArg::none(),const RooCmdArg& arg2=RooCmdArg::none(),
132 const RooCmdArg& arg3=RooCmdArg::none(),const RooCmdArg& arg4=RooCmdArg::none(),
133 const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none()) ;
134
135 protected:
136 friend class RooSimWSTool ;
137
138 } ;
139
140
141// Validated RooSimWSTool split rule
143public:
145 virtual ~ObjSplitRule() ;
146
147protected:
148 friend class RooSimWSTool ;
150 std::list<const RooCatType*> _miStateList ;
151 std::map<RooAbsArg*, std::pair<RooArgSet,std::string> > _paramSplitMap ; //<paramName,<std::list<splitCatSet>,remainderStateName>>
152 } ;
153
154
155// Validated RooSimWSTool build configuration
157{
158 public:
160 virtual ~ObjBuildConfig() {}
161 void print() ;
162
163 protected:
164 friend class RooSimWSTool ;
165 std::map<RooAbsPdf*,ObjSplitRule> _pdfmap ;
166 std::map<RooAbsCategory*,std::list<const RooCatType*> > _restr ;
170
171 } ;
172
173#endif
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:74
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
A space to attach TBranches.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
RooCategory is an object to represent discrete states.
Definition RooCategory.h:28
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition RooCmdArg.h:26
static const RooCmdArg & none()
Return reference to null argument.
Definition RooCmdArg.cxx:51
void restrictBuild(const char *catName, const char *stateList)
Restrict build by only considering state names in stateList for split in category catName.
std::map< std::string, SplitRule > _pdfmap
std::map< std::string, std::string > _restr
void internalAddPdf(const char *pdfName, const char *miStateList, SplitRule &sr)
Internal routine to add prototype pdf 'pdfName' with list of associated master states 'miStateNameLis...
void addPdf(const char *miStateList, const char *pdfName, SplitRule &sr)
Add protytpe p.d.f 'pdfName' to MultiBuildConfig associated with master indes states 'miStateList'.
std::map< RooAbsPdf *, ObjSplitRule > _pdfmap
void print()
Print details of a validated build configuration.
std::map< RooAbsCategory *, std::list< const RooCatType * > > _restr
virtual ~ObjSplitRule()
Destructor.
std::map< RooAbsArg *, std::pair< RooArgSet, std::string > > _paramSplitMap
std::list< const RooCatType * > _miStateList
void splitParameter(const char *paramList, const char *categoryList)
Specify that parameters names listed in paramNameList be split in (product of) category(s) listed in ...
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...
SplitRule(const char *pdfName="")
std::list< std::string > _miStateNameList
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...
std::map< std::string, std::pair< std::list< std::string >, std::string > > _paramSplitMap
The RooSimWSTool is a tool operating on RooWorkspace objects that can clone PDFs into a series of var...
RooWorkspace * _ws
std::unique_ptr< ObjBuildConfig > validateConfig(BuildConfig &bc)
Validate build configuration.
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...
RooSimultaneous * executeBuild(const char *simPdfName, ObjBuildConfig &obc, bool verbose=true)
Internal build driver from validation ObjBuildConfig.
RooSimWSTool(const RooSimWSTool &)
std::string makeSplitName(const RooArgSet &splitCatSet)
Construct name of composite split.
~RooSimWSTool()
Destructor.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
The RooWorkspace is a persistable container for RooFit projects.
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29