169 BuildConfig bc(protoPdfName,arg1,arg2,arg3,arg4,arg5,arg6) ;
170 return build(simPdfName,bc) ;
210 <<
" that was designated as master index category in the build configuration" << endl ;
218 map<string,SplitRule>::iterator pdfiter ;
220 for (pdfiter = bc.
_pdfmap.begin() ; pdfiter != bc.
_pdfmap.end() ; ++pdfiter) {
226 <<
" does not contain a pdf named " << pdfiter->second.GetName() << endl ;
237 map<string, pair<list<string>,
string> >::iterator pariter ;
238 for (pariter=
sr._paramSplitMap.begin() ; pariter!=
sr._paramSplitMap.end() ; ++pariter) {
244 <<
" does not contain a variable named " << pariter->first.c_str()
245 <<
" as specified in splitting rule of parameter " << pariter->first <<
" of p.d.f " << pdf << endl ;
253 <<
" in split is not function of p.d.f " << pdf->
GetName() << endl ;
260 list<string>::iterator catiter ;
261 for (catiter = pariter->second.first.begin() ; catiter!=pariter->second.first.end() ; ++catiter) {
265 <<
" does not contain a category named " << catiter->c_str()
266 <<
" as specified in splitting rule of parameter " << pariter->first <<
" of p.d.f " << pdf << endl ;
270 splitCatSet.
add(*cat) ;
281 <<
" used in composite split " << splitCatSet <<
" of parameter " << farg->
GetName() <<
" of pdf " << pdf->
GetName()
282 <<
" depends on one or more of the other splitting categories in the composite split" << endl ;
291 if (pariter->second.second.size()>0) {
293 coutE(
InputArguments) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: Constrained split specified in non real-valued parameter " << farg->
GetName() << endl ;
305 list<string>::iterator misi ;
306 for (misi=
sr._miStateNameList.begin() ; misi!=
sr._miStateNameList.end() ; ++misi) {
310 <<
" does not have a state named " << *misi <<
" which was specified as state associated with p.d.f "
311 <<
sr.GetName() << endl ;
324 if (
sr._paramSplitMap.size()==0) {
327 list<string>::iterator misi ;
328 for (misi=
sr._miStateNameList.begin() ; misi!=
sr._miStateNameList.end() ; ++misi) {
332 <<
" does not have a state named " << *misi <<
" which was specified as state associated with p.d.f "
333 <<
sr.GetName() << endl ;
347 map<string,string>::iterator riter ;
348 for (riter=bc.
_restr.begin() ; riter!=bc.
_restr.end() ; ++riter) {
352 <<
" does not contain a category named " << riter->first
353 <<
" for which build was requested to be restricted to states " << riter->second << endl ;
359 list<const RooCatType*> rlist ;
360 strlcpy(buf,riter->second.c_str(),4096) ;
362 char* tok = strtok(buf,
"{,}") ;
367 <<
" does not have state " << tok <<
" as specified in restriction list" << endl ;
371 rlist.push_back(ctype) ;
372 tok = strtok(0,
"{,}") ;
375 obc->
_restr[cat] = rlist ;
394 map<string,RooAbsPdf*> stateMap ;
396 map<RooAbsPdf*,ObjSplitRule>::iterator physIter = obc.
_pdfmap.begin() ;
397 while(physIter!=obc.
_pdfmap.end()) {
401 physModelSet.
add(*physModel,
kTRUE) ;
403 list<const RooCatType*>::iterator stiter ;
404 for (stiter=physIter->second._miStateList.begin() ; stiter!=physIter->second._miStateList.end() ; ++stiter) {
405 stateMap[(*stiter)->GetName()] = physModel ;
414 if (physCat) splitCatSet.
add(*physCat) ;
421 splitCatSetFund.
add(*scat) ;
424 splitCatSetFund.
add(*scatvars) ;
432 if (splitCatSetFund.
getSize()>1) {
433 masterSplitCat =
new RooSuperCategory(
"masterSplitCat",
"Master splitting category",splitCatSetFund) ;
450 customizerList->
Add(physCustomizer) ;
452 map<RooAbsArg*, pair<RooArgSet,string> >::iterator splitIter ;
453 for (splitIter = obc.
_pdfmap[physModel]._paramSplitMap.begin() ; splitIter != obc.
_pdfmap[physModel]._paramSplitMap.end() ; ++splitIter) {
464 splitCat =
new RooMultiCategory(splitName.c_str(),splitName.c_str(),splitCatSetTmp) ;
470 if(splitIter->second.second.size()>0) {
473 if (!splitCat->
lookupType(splitIter->second.second.c_str())) {
474 coutE(
InputArguments) <<
"RooSimWSTool::executeBuild(" <<
GetName() <<
") ERROR: name of remainder state for constrained split, '"
475 << splitIter->second.second <<
"' , does not match any state name of (composite) split category " << splitCat->
GetName() << endl ;
486 if (splitIter->second.second ==
type->GetName()) continue ;
489 TString splitLeafName(splitIter->first->GetName()) ;
490 splitLeafName.
Append(
"_") ;
500 fracLeafList.
add(*splitLeaf) ;
514 physCustomizer->
splitArgs(*splitIter->first,*splitCat) ;
526 if (physCat) fitCatList.
add(*physCat) ;
533 fitCatList.
add(*scat) ;
536 fitCatList.
add(*scatvars) ;
544 string mcatname = string(simPdfName) +
"_index" ;
547 fitCat =
new RooSuperCategory(mcatname.c_str(),mcatname.c_str(),fitCatList) ;
569 if (obc.
_restr.size()>0) {
573 list<const RooCatType*> slist = obc.
_restr[splitCat] ;
578 list<const RooCatType*>::iterator sli ;
579 for (sli=slist.begin() ; sli!=slist.end() ; ++sli) {
580 if (
string(splitCat->
getLabel())==(*sli)->GetName()) {
585 if (!select) continue ;
603 <<
" for mode " << fcState->
GetName() << endl ;
614 customizerList->
Delete() ;
615 delete customizerList ;
654 char paramBuf[4096] ;
656 strlcpy(paramBuf,paramNameList,4096) ;
657 strlcpy(catBuf,categoryNameList,4096) ;
660 list<string> catList ;
661 char* cat = strtok(catBuf,
"{,}") ;
663 catList.push_back(cat) ;
664 cat = strtok(0,
"{,}") ;
668 char* param = strtok(paramBuf,
"{,}") ;
671 param = strtok(0,
"{,}") ;
682 char paramBuf[4096] ;
684 strlcpy(paramBuf,paramNameList,4096) ;
685 strlcpy(catBuf,categoryNameList,4096) ;
688 list<string> catList ;
689 char* cat = strtok(catBuf,
"{,}") ;
691 catList.push_back(cat) ;
692 cat = strtok(0,
"{,}") ;
696 char* param = strtok(paramBuf,
"{,}") ;
698 _paramSplitMap[param] = pair<list<string>,
string>(catList,remainderStateName) ;
699 param = strtok(0,
"{,}") ;
711 list<const RooCmdArg*> cmdList ;
712 cmdList.push_back(&arg1) ; cmdList.push_back(&arg2) ;
713 cmdList.push_back(&arg3) ; cmdList.push_back(&arg4) ;
714 cmdList.push_back(&arg5) ; cmdList.push_back(&arg6) ;
716 list<const RooCmdArg*>::iterator iter ;
717 for (iter=cmdList.begin() ; iter!=cmdList.end() ; ++iter) {
719 if ((*iter)->opcode()==0) continue ;
721 string name = (*iter)->opcode() ;
723 if (
name==
"SplitParam") {
724 splitParameter((*iter)->getString(0),(*iter)->getString(1)) ;
725 }
else if (
name==
"SplitParamConstrained") {
726 splitParameterConstrained((*iter)->getString(0),(*iter)->getString(1),(*iter)->getString(2)) ;
739 internalAddPdf(pdfName,
"",
sr) ;
752 sr.configure(arg1,arg2,arg3,arg4,arg5,arg6) ;
753 internalAddPdf(pdfName,
"",
sr) ;
756 list<const RooCmdArg*> cmdList ;
757 cmdList.push_back(&arg1) ; cmdList.push_back(&arg2) ;
758 cmdList.push_back(&arg3) ; cmdList.push_back(&arg4) ;
759 cmdList.push_back(&arg5) ; cmdList.push_back(&arg6) ;
761 list<const RooCmdArg*>::iterator iter ;
762 for (iter=cmdList.begin() ; iter!=cmdList.end() ; ++iter) {
763 if ((*iter)->opcode()==0) continue ;
764 string name = (*iter)->opcode() ;
765 if (
name==
"Restrict") {
766 restrictBuild((*iter)->getString(0),(*iter)->getString(1)) ;
768 if (
name==
"RenameConflictNodes") {
769 _conflProtocol = *(*iter) ;
791 strlcpy(buf,miStateNameList,4096) ;
793 char* tok = strtok(buf,
",") ;
795 sr._miStateNameList.push_back(tok) ;
796 tok = strtok(0,
",") ;
799 _pdfmap[pdfName] =
sr ;
808 _restr[catName] = stateList ;
821 _masterCatName = masterIndexCat ;
834 sr.configure(arg1,arg2,arg3,arg4,arg5,arg6) ;
835 internalAddPdf(pdfName,miStateList,
sr) ;
845 internalAddPdf(pdfName,miStateList,
sr) ;
867 map<RooAbsPdf*,ObjSplitRule>::iterator ri ;
868 for (ri = _pdfmap.begin() ; ri != _pdfmap.end() ; ++ri ) {
869 cout <<
"Splitrule for p.d.f " << ri->first->GetName() <<
" with state list " ;
870 for (std::list<const RooCatType*>::iterator misi= ri->second._miStateList.begin() ; misi!=ri->second._miStateList.end() ; ++misi) {
871 cout << (*misi)->GetName() <<
" " ;
875 map<RooAbsArg*,pair<RooArgSet,string> >::iterator csi ;
876 for (csi = ri->second._paramSplitMap.begin() ; csi != ri->second._paramSplitMap.end() ; ++csi ) {
877 if (csi->second.second.length()>0) {
878 cout <<
" parameter " << csi->first->GetName() <<
" is split with constraint in categories " << csi->second.first
879 <<
" with remainder in state " << csi->second.second << endl ;
881 cout <<
" parameter " << csi->first->GetName() <<
" is split with constraint in categories " << csi->second.first << endl ;
886 map<RooAbsCategory*,list<const RooCatType*> >::iterator riter ;
887 for (riter=_restr.begin() ; riter!=_restr.end() ; ++riter) {
888 cout <<
"Restricting build in category " << riter->first->GetName() <<
" to states " ;
889 list<const RooCatType*>::iterator i ;
890 for (i=riter->second.begin() ; i!=riter->second.end() ; ++i) {
891 if (i!=riter->second.begin()) cout <<
"," ;
892 cout << (*i)->GetName() ;
906 string tn(typeName) ;
907 if (tn==
"SIMCLONE") {
910 for (
unsigned int i=1 ; i<args.size() ; i++) {
911 if (args[i].find(
"$SplitParam(")!=0 &&
912 args[i].find(
"$SplitParamConstrained(")!=0 &&
913 args[i].find(
"$SplitRestrict(")!=0 &&
914 args[i].find(
"$Verbose(")!=0) {
915 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: unknown token %s encountered",args[i].c_str())) ;
921 for (
unsigned int i=1 ; i<args.size() ; i++) {
922 if (args[i].find(
"$SplitParam(")==0) {
924 if (subargs.size()!=2) {
925 throw string(
Form(
"Incorrect number of arguments in $SplitParam, have %d, expect 2",(
Int_t)subargs.size())) ;
927 sr.splitParameter(subargs[0].c_str(),subargs[1].c_str()) ;
928 }
else if (args[i].find(
"$SplitParamConstrained(")==0) {
930 if (subargs.size()!=3) {
931 throw string(
Form(
"Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(
Int_t)subargs.size())) ;
933 sr.splitParameterConstrained(subargs[0].c_str(), subargs[1].c_str(), subargs[2].c_str()) ;
939 for (
unsigned int i=1 ; i<args.size() ; i++) {
940 if (args[i].find(
"$Restrict(")==0) {
942 if (subargs.size()!=2) {
943 throw string(
Form(
"Incorrect number of arguments in $Restrict, have %d, expect 2",(
Int_t)subargs.size())) ;
951 for (
unsigned int i=1 ; i<args.size() ; i++) {
952 if (args[i].find(
"$Verbose(")==0) {
954 if (subargs.size()>0) {
955 verbose = atoi(subargs[0].c_str()) ;
964 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",instanceName)) ;
970 }
else if (tn==
"MSIMCLONE") {
975 for (
unsigned int i=1 ; i<args.size() ; i++) {
976 if (args[i].find(
"$AddPdf(")==0) {
982 for (
unsigned int j=2 ; j<subargs.size() ; j++) {
983 if (subargs[j].find(
"$SplitParam(")==0) {
985 if (subsubargs.size()!=2) {
986 throw string(
Form(
"Incorrect number of arguments in $SplitParam, have %d, expect 2",(
Int_t)subsubargs.size())) ;
988 sr.splitParameter(subsubargs[0].c_str(),subsubargs[1].c_str()) ;
989 }
else if (subargs[j].find(
"$SplitParamConstrained(")==0) {
991 if (subsubargs.size()!=3) {
992 throw string(
Form(
"Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(
Int_t)subsubargs.size())) ;
994 sr.splitParameterConstrained(subsubargs[0].c_str(), subsubargs[1].c_str(), subsubargs[2].c_str()) ;
997 mbc.
addPdf(subargs[0].c_str(),subargs[1].c_str(),
sr) ;
999 }
else if (args[i].find(
"$Restrict(")==0) {
1003 if (subargs.size()!=2) {
1004 throw string(
Form(
"Incorrect number of arguments in $Restrict, have %d, expect 2",(
Int_t)subargs.size())) ;
1009 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: unknown token in MSIMCLONE: %s",args[i].c_str())) ;
1017 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",instanceName)) ;
1025 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: Unknown meta-type %s requested",typeName)) ;
1028 return string(instanceName) ;
char * Form(const char *fmt,...)
typedef void((*Func_t)())
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
virtual Bool_t isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
Bool_t dependsOnValue(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0) const
virtual TObject * clone(const char *newname=0) const =0
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
TIterator * typeIterator() const
Return iterator over all defined states.
virtual const char * getLabel() const
Return label string of current state.
const RooCatType * lookupType(Int_t index, Bool_t printError=kFALSE) const
Find our type corresponding to the specified index, or return 0 for no match.
RooAbsArg * first() const
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
TIterator-style iteration over contained elements.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t addOwned(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling addOwned() for each element in the source...
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
virtual const Text_t * GetName() const
Returns name of object.
RooCategory represents a fundamental (non-derived) discrete value object.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
void splitArgs(const RooArgSet &argSet, const RooAbsCategory &splitCat)
Split all arguments in 'set' into individualized clones for each defined state of 'splitCat'.
RooAbsArg * build(const char *masterCatState, Bool_t verbose=kFALSE)
Build a clone of the prototype executing all registered 'replace' rules and 'split' rules for the mas...
RooFracRemainder calculates the remainder fraction of a sum of RooAbsReal fraction,...
RooMultiCategory consolidates several RooAbsCategory objects into a single category.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
Bool_t addPdf(const RooAbsPdf &pdf, const char *catLabel)
Associate given PDF with index category state label 'catLabel'.
RooSuperCategory can join several RooAbsCategoryLValue objects into a single category.
The RooWorkspace is a persistable container for RooFit projects.
RooAbsArg * fundArg(const char *name) const
Return fundamental (i.e.
RooCategory * cat(const char *name) const
Retrieve discrete variable (RooCategory) with given name. A null pointer is returned if not found.
RooAbsCategory * catfunc(const char *name) const
Retrieve discrete function (RooAbsCategory) with given name. A null pointer is returned if not found.
Bool_t import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
const RooArgSet & components() const
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
Iterator abstract base class.
virtual TObject * Next()=0
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual const char * GetName() const
Returns name of object.
TString & Append(const char *cs)
RooCmdArg RenameConflictNodes(const char *suffix, Bool_t renameOrigNodes=kFALSE)
RooCmdArg Silence(Bool_t flag=kTRUE)
static constexpr double sr