118using std::string, std::endl, std::map, std::list, std::pair, std::cout, std::vector;
129Int_t dummy = init() ;
133 static SimWSIFace
iface{};
189 if (!
obc)
return nullptr;
209 auto obc = std::make_unique<ObjBuildConfig>();
211 if (
bc._masterCatName.length()>0) {
213 if (!
obc->_masterCat) {
214 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: associated workspace " <<
_ws->
GetName()
215 <<
" does not contain a category named " <<
bc._masterCatName
216 <<
" that was designated as master index category in the build configuration" << endl ;
220 obc->_masterCat = nullptr ;
223 map<string,SplitRule>::iterator
pdfiter ;
230 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: associated workspace " <<
_ws->
GetName()
231 <<
" does not contain a pdf named " <<
pdfiter->second.GetName() << endl ;
247 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: associated workspace " <<
_ws->
GetName()
248 <<
" does not contain a variable named " <<
pariter->first.c_str()
249 <<
" as specified in splitting rule of parameter " <<
pariter->first <<
" of p.d.f " << pdf << endl ;
255 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: specified parameter " <<
pariter->first
256 <<
" in split is not function of p.d.f " << pdf->
GetName() << endl ;
262 list<string>::iterator
catiter ;
266 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: associated workspace " <<
_ws->
GetName()
267 <<
" does not contain a category named " <<
catiter->c_str()
268 <<
" as specified in splitting rule of parameter " <<
pariter->first <<
" of p.d.f " << pdf << endl ;
278 if (arg->dependsOnValue(tmp)) {
279 oocoutE(
nullptr, InputArguments) <<
"RooSimWSTool::build() ERROR: Ill defined split: splitting category function " << arg->GetName()
280 <<
" used in composite split " <<
splitCatSet <<
" of parameter " <<
farg->GetName() <<
" of pdf " << pdf->
GetName()
281 <<
" depends on one or more of the other splitting categories in the composite split" << endl ;
287 if (!
pariter->second.second.empty()) {
289 oocoutE(
nullptr, InputArguments) <<
"RooSimWSTool::build() ERROR: Constrained split specified in non real-valued parameter " <<
farg->GetName() << endl ;
299 if (
obc->_masterCat) {
300 list<string>::iterator
misi ;
303 if (
ctype==
nullptr) {
304 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: master index category " <<
obc->_masterCat->GetName()
305 <<
" does not have a state named " << *
misi <<
" which was specified as state associated with p.d.f "
320 if (
obc->_masterCat) {
321 list<string>::iterator
misi ;
324 if (
ctype==
nullptr) {
325 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: master index category " <<
obc->_masterCat->GetName()
326 <<
" does not have a state named " << *
misi <<
" which was specified as state associated with p.d.f "
340 map<string,string>::iterator
riter ;
344 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: associated workspace " <<
_ws->
GetName()
345 <<
" does not contain a category named " <<
riter->first
346 <<
" for which build was requested to be restricted to states " <<
riter->second << endl ;
358 oocoutE(
nullptr, ObjectHandling) <<
"RooSimWSTool::build() ERROR: restricted build category " << cat->
GetName()
359 <<
" does not have state " <<
tok <<
" as specified in restriction list" << endl ;
362 rlist.push_back(
ctype) ;
366 obc->_restr[cat] = rlist ;
394 list<const RooCatType*>::iterator
stiter ;
403 oocoutI(
nullptr, ObjectHandling) <<
"RooSimWSTool::executeBuild: list of prototype pdfs " <<
physModelSet << endl ;
411 if (
scat->isFundamental()) {
414 std::unique_ptr<RooArgSet>
scatvars{
scat->getVariables()};
429 oocoutI(
nullptr, ObjectHandling) <<
"RooSimWSTool::executeBuild: list of splitting categories " <<
splitCatSet << endl ;
439 oocoutI(
nullptr, ObjectHandling) <<
"RooSimPdfBuilder::executeBuild: processing prototype pdf " <<
physModel->GetName() << endl ;
468 oocoutE(
nullptr, InputArguments) <<
"RooSimWSTool::executeBuild() ERROR: name of remainder state for constrained split, '"
469 <<
splitIter->second.second <<
"' , does not match any state name of (composite) split category " <<
splitCat->GetName() << endl ;
477 std::string
const& typeName =
type.first;
513 oocoutI(
nullptr, ObjectHandling) <<
"RooSimWSTool::executeBuild: configured customizers for all prototype pdfs" << endl ;
523 if (
scat->isFundamental()) {
526 fitCatList.add(*std::unique_ptr<RooArgSet>{
scat->getVariables()}) ;
555 if (!
obc._restr.empty()) {
564 list<const RooCatType*>::iterator
sli ;
566 if (
string(
splitCat->getCurrentLabel())==(*sli)->GetName()) {
585 [&](
auto const&
c){ return pdfName == c->pdf().GetName(); });
592 oocoutI(
nullptr, ObjectHandling) <<
"RooSimWSTool::executeBuild: Customizing prototype pdf " <<
physCustomizer->pdf().GetName()
623 name += arg->GetName() ;
648 cat =
strtok(
nullptr,
"{,}") ;
655 param =
strtok(
nullptr,
"{,}") ;
676 cat =
strtok(
nullptr,
"{,}") ;
683 param =
strtok(
nullptr,
"{,}") ;
700 list<const RooCmdArg*>::iterator iter ;
703 if ((*iter)->opcode()==
nullptr)
continue ;
705 string name = (*iter)->opcode() ;
707 if (
name==
"SplitParam") {
708 splitParameter((*iter)->getString(0),(*iter)->getString(1)) ;
709 }
else if (
name==
"SplitParamConstrained") {
710 splitParameterConstrained((*iter)->getString(0),(*iter)->getString(1),(*iter)->getString(2)) ;
723 internalAddPdf(
pdfName,
"",sr) ;
737 internalAddPdf(
pdfName,
"",sr) ;
745 list<const RooCmdArg*>::iterator iter ;
747 if ((*iter)->opcode()==
nullptr)
continue ;
748 string name = (*iter)->opcode() ;
749 if (
name==
"Restrict") {
750 restrictBuild((*iter)->getString(0),(*iter)->getString(1)) ;
752 if (
name==
"RenameConflictNodes") {
753 _conflProtocol = *(*iter) ;
851 map<RooAbsPdf*,ObjSplitRule>::iterator ri ;
852 for (ri = _pdfmap.begin() ; ri != _pdfmap.end() ; ++ri ) {
853 cout <<
"Splitrule for p.d.f " << ri->first->GetName() <<
" with state list " ;
854 for (std::list<const RooCatType*>::iterator
misi= ri->second._miStateList.begin() ;
misi!=ri->second._miStateList.end() ; ++
misi) {
855 cout << (*misi)->GetName() <<
" " ;
860 for (
csi = ri->second._paramSplitMap.begin() ;
csi != ri->second._paramSplitMap.end() ; ++
csi ) {
861 if (
csi->second.second.length()>0) {
862 cout <<
" parameter " <<
csi->first->GetName() <<
" is split with constraint in categories " <<
csi->second.first
863 <<
" with remainder in state " <<
csi->second.second << endl ;
865 cout <<
" parameter " <<
csi->first->GetName() <<
" is split with constraint in categories " <<
csi->second.first << endl ;
872 cout <<
"Restricting build in category " <<
riter->first->GetName() <<
" to states " ;
873 list<const RooCatType*>::iterator i ;
876 cout << (*i)->GetName() ;
890 string tn(typeName) ;
891 if (
tn==
"SIMCLONE") {
894 for (
unsigned int i=1 ; i<args.size() ; i++) {
895 if (args[i].find(
"$SplitParam(")!=0 &&
896 args[i].find(
"$SplitParamConstrained(")!=0 &&
897 args[i].find(
"$SplitRestrict(")!=0 &&
898 args[i].find(
"$Verbose(")!=0) {
899 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: unknown token %s encountered",args[i].c_str())) ;
905 for (
unsigned int i=1 ; i<args.size() ; i++) {
906 if (args[i].find(
"$SplitParam(")==0) {
909 throw string(
Form(
"Incorrect number of arguments in $SplitParam, have %d, expect 2",(
Int_t)
subargs.size())) ;
912 }
else if (args[i].find(
"$SplitParamConstrained(")==0) {
915 throw string(
Form(
"Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(
Int_t)
subargs.size())) ;
923 for (
unsigned int i=1 ; i<args.size() ; i++) {
924 if (args[i].find(
"$Restrict(")==0) {
927 throw string(
Form(
"Incorrect number of arguments in $Restrict, have %d, expect 2",(
Int_t)
subargs.size())) ;
935 for (
unsigned int i=1 ; i<args.size() ; i++) {
936 if (args[i].find(
"$Verbose(")==0) {
948 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",
instanceName)) ;
954 }
else if (
tn==
"MSIMCLONE") {
959 for (
unsigned int i=1 ; i<args.size() ; i++) {
960 if (args[i].find(
"$AddPdf(")==0) {
966 for (
unsigned int j=2 ;
j<
subargs.size() ;
j++) {
967 if (
subargs[
j].find(
"$SplitParam(")==0) {
970 throw string(
Form(
"Incorrect number of arguments in $SplitParam, have %d, expect 2",(
Int_t)
subsubargs.size())) ;
973 }
else if (
subargs[
j].find(
"$SplitParamConstrained(")==0) {
976 throw string(
Form(
"Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(
Int_t)
subsubargs.size())) ;
983 }
else if (args[i].find(
"$Restrict(")==0) {
988 throw string(
Form(
"Incorrect number of arguments in $Restrict, have %d, expect 2",(
Int_t)
subargs.size())) ;
993 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: unknown token in MSIMCLONE: %s",args[i].c_str())) ;
1001 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",
instanceName)) ;
1009 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: Unknown meta-type %s requested",typeName)) ;
virtual RooAbsTestStatistic * create(const char *name, const char *title, RooAbsReal &real, RooAbsData &data, const RooArgSet &projDeps, Configuration const &cfg)=0
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=nullptr, bool valueOnly=false) const
Test whether we depend on (ie, are served by) any object in the specified collection.
Abstract base class for objects that represent a discrete value that can be set from the outside,...
A space to attach TBranches.
const RooCatType * lookupType(value_type index, bool printError=false) const
Find our type corresponding to the specified index, or return nullptr for no match.
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCatType is an auxiliary class for RooAbsCategory and defines a a single category state.
Object to represent discrete states.
Named container for two doubles, two integers two object points and three string pointers that can be...
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
Persistable container for RooFit projects.
RooAbsCategory * catfunc(RooStringView name) const
Retrieve discrete function (RooAbsCategory) with given name. A null pointer is returned if not found.
RooAbsPdf * pdf(RooStringView name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
RooCategory * cat(RooStringView name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found.
RooAbsArg * fundArg(RooStringView name) const
Return fundamental (i.e.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={})
Import a RooAbsArg object, e.g.
const RooArgSet & components() const
const char * GetName() const override
Returns name of object.
RooCmdArg Silence(bool flag=true)
RooCmdArg RenameConflictNodes(const char *suffix, bool renameOrigNodes=false)