180 BuildConfig bc(protoPdfName,arg1,arg2,arg3,arg4,arg5,arg6) ;
181 return build(simPdfName,bc) ;
219 coutE(ObjectHandling) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: associated workspace " <<
_ws->
GetName()
221 <<
" that was designated as master index category in the build configuration" << endl ;
229 map<string,SplitRule>::iterator pdfiter ;
231 for (pdfiter = bc.
_pdfmap.begin() ; pdfiter != bc.
_pdfmap.end() ; ++pdfiter) {
236 coutE(ObjectHandling) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: associated workspace " <<
_ws->
GetName()
237 <<
" does not contain a pdf named " << pdfiter->second.GetName() << endl ;
248 map<string, pair<list<string>,
string> >::iterator pariter ;
254 coutE(ObjectHandling) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: associated workspace " <<
_ws->
GetName()
255 <<
" does not contain a variable named " << pariter->first.c_str()
256 <<
" as specified in splitting rule of parameter " << pariter->first <<
" of p.d.f " << pdf << endl ;
263 coutE(ObjectHandling) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: specified parameter " << pariter->first
264 <<
" in split is not function of p.d.f " << pdf->
GetName() << endl ;
271 list<string>::iterator catiter ;
272 for (catiter = pariter->second.first.begin() ; catiter!=pariter->second.first.end() ; ++catiter) {
275 coutE(ObjectHandling) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: associated workspace " <<
_ws->
GetName()
276 <<
" does not contain a category named " << catiter->c_str()
277 <<
" as specified in splitting rule of parameter " << pariter->first <<
" of p.d.f " << pdf << endl ;
281 splitCatSet.
add(*cat) ;
291 coutE(InputArguments) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: Ill defined split: splitting category function " << arg->
GetName()
292 <<
" used in composite split " << splitCatSet <<
" of parameter " << farg->
GetName() <<
" of pdf " << pdf->
GetName()
293 <<
" depends on one or more of the other splitting categories in the composite split" << endl ;
302 if (pariter->second.second.size()>0) {
304 coutE(InputArguments) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: Constrained split specified in non real-valued parameter " << farg->
GetName() << endl ;
316 list<string>::iterator misi ;
321 <<
" does not have a state named " << *misi <<
" which was specified as state associated with p.d.f "
338 list<string>::iterator misi ;
343 <<
" does not have a state named " << *misi <<
" which was specified as state associated with p.d.f "
358 map<string,string>::iterator riter ;
359 for (riter=bc.
_restr.begin() ; riter!=bc.
_restr.end() ; ++riter) {
362 coutE(ObjectHandling) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: associated workspace " <<
_ws->
GetName()
363 <<
" does not contain a category named " << riter->first
364 <<
" for which build was requested to be restricted to states " << riter->second << endl ;
370 list<const RooCatType*> rlist ;
371 strlcpy(buf,riter->second.c_str(),4096) ;
373 char* tok = strtok(buf,
"{,}") ;
377 coutE(ObjectHandling) <<
"RooSimWSTool::build(" <<
GetName() <<
") ERROR: restricted build category " << cat->
GetName()
378 <<
" does not have state " << tok <<
" as specified in restriction list" << endl ;
382 rlist.push_back(ctype) ;
383 tok = strtok(0,
"{,}") ;
386 obc->
_restr[cat] = rlist ;
405 map<string,RooAbsPdf*> stateMap ;
407 map<RooAbsPdf*,ObjSplitRule>::iterator physIter = obc.
_pdfmap.begin() ;
408 while(physIter!=obc.
_pdfmap.end()) {
412 physModelSet.
add(*physModel,
kTRUE) ;
414 list<const RooCatType*>::iterator stiter ;
415 for (stiter=physIter->second._miStateList.begin() ; stiter!=physIter->second._miStateList.end() ; ++stiter) {
416 stateMap[(*stiter)->GetName()] = physModel ;
422 if (verbose)
coutI(ObjectHandling) <<
"RooSimWSTool::executeBuild: list of prototype pdfs " << physModelSet << endl ;
425 if (physCat) splitCatSet.
add(*physCat) ;
432 splitCatSetFund.
add(*scat) ;
435 splitCatSetFund.
add(*scatvars) ;
443 if (splitCatSetFund.
getSize()>1) {
444 masterSplitCat =
new RooSuperCategory(
"masterSplitCat",
"Master splitting category",splitCatSetFund) ;
448 if (verbose)
coutI(ObjectHandling) <<
"RooSimWSTool::executeBuild: list of splitting categories " << splitCatSet << endl ;
458 if (verbose)
coutI(ObjectHandling) <<
"RooSimPdfBuilder::executeBuild: processing prototype pdf " << physModel->
GetName() << endl ;
461 customizerList->
Add(physCustomizer) ;
463 map<RooAbsArg*, pair<RooArgSet,string> >::iterator splitIter ;
464 for (splitIter = obc.
_pdfmap[physModel]._paramSplitMap.begin() ; splitIter != obc.
_pdfmap[physModel]._paramSplitMap.end() ; ++splitIter) {
475 splitCat =
new RooMultiCategory(splitName.c_str(),splitName.c_str(),splitCatSetTmp) ;
481 if(splitIter->second.second.size()>0) {
484 if (!splitCat->
hasLabel(splitIter->second.second)) {
485 coutE(InputArguments) <<
"RooSimWSTool::executeBuild(" <<
GetName() <<
") ERROR: name of remainder state for constrained split, '"
486 << splitIter->second.second <<
"' , does not match any state name of (composite) split category " << splitCat->
GetName() << endl ;
497 if (splitIter->second.second ==
type->GetName()) continue ;
500 TString splitLeafName(splitIter->first->GetName()) ;
501 splitLeafName.
Append(
"_") ;
511 fracLeafList.
add(*splitLeaf) ;
525 physCustomizer->
splitArgs(*splitIter->first,*splitCat) ;
532 if (verbose)
coutI(ObjectHandling) <<
"RooSimWSTool::executeBuild: configured customizers for all prototype pdfs" << endl ;
536 if (physCat) fitCatList.
add(*physCat) ;
543 fitCatList.
add(*scat) ;
546 fitCatList.
add(*scatvars) ;
554 string mcatname = string(simPdfName) +
"_index" ;
557 fitCat =
new RooSuperCategory(mcatname.c_str(),mcatname.c_str(),fitCatList) ;
579 if (obc.
_restr.size()>0) {
583 list<const RooCatType*> slist = obc.
_restr[splitCat] ;
588 list<const RooCatType*>::iterator sli ;
589 for (sli=slist.begin() ; sli!=slist.end() ; ++sli) {
595 if (!select) continue ;
612 if (verbose)
coutI(ObjectHandling) <<
"RooSimWSTool::executeBuild: Customizing prototype pdf " << physCustomizer->
GetName()
613 <<
" for mode " << fcState->
GetName() << endl ;
624 customizerList->
Delete() ;
625 delete customizerList ;
664 char paramBuf[4096] ;
666 strlcpy(paramBuf,paramNameList,4096) ;
667 strlcpy(catBuf,categoryNameList,4096) ;
670 list<string> catList ;
671 char* cat = strtok(catBuf,
"{,}") ;
673 catList.push_back(cat) ;
674 cat = strtok(0,
"{,}") ;
678 char* param = strtok(paramBuf,
"{,}") ;
681 param = strtok(0,
"{,}") ;
692 char paramBuf[4096] ;
694 strlcpy(paramBuf,paramNameList,4096) ;
695 strlcpy(catBuf,categoryNameList,4096) ;
698 list<string> catList ;
699 char* cat = strtok(catBuf,
"{,}") ;
701 catList.push_back(cat) ;
702 cat = strtok(0,
"{,}") ;
706 char* param = strtok(paramBuf,
"{,}") ;
708 _paramSplitMap[param] = pair<list<string>,
string>(catList,remainderStateName) ;
709 param = strtok(0,
"{,}") ;
721 list<const RooCmdArg*> cmdList ;
722 cmdList.push_back(&arg1) ; cmdList.push_back(&arg2) ;
723 cmdList.push_back(&arg3) ; cmdList.push_back(&arg4) ;
724 cmdList.push_back(&arg5) ; cmdList.push_back(&arg6) ;
726 list<const RooCmdArg*>::iterator iter ;
727 for (iter=cmdList.begin() ; iter!=cmdList.end() ; ++iter) {
729 if ((*iter)->opcode()==0)
continue ;
731 string name = (*iter)->opcode() ;
733 if (
name==
"SplitParam") {
734 splitParameter((*iter)->getString(0),(*iter)->getString(1)) ;
735 }
else if (
name==
"SplitParamConstrained") {
736 splitParameterConstrained((*iter)->getString(0),(*iter)->getString(1),(*iter)->getString(2)) ;
749 internalAddPdf(pdfName,
"",sr) ;
762 sr.
configure(arg1,arg2,arg3,arg4,arg5,arg6) ;
763 internalAddPdf(pdfName,
"",sr) ;
766 list<const RooCmdArg*> cmdList ;
767 cmdList.push_back(&arg1) ; cmdList.push_back(&arg2) ;
768 cmdList.push_back(&arg3) ; cmdList.push_back(&arg4) ;
769 cmdList.push_back(&arg5) ; cmdList.push_back(&arg6) ;
771 list<const RooCmdArg*>::iterator iter ;
772 for (iter=cmdList.begin() ; iter!=cmdList.end() ; ++iter) {
773 if ((*iter)->opcode()==0)
continue ;
774 string name = (*iter)->opcode() ;
775 if (
name==
"Restrict") {
776 restrictBuild((*iter)->getString(0),(*iter)->getString(1)) ;
778 if (
name==
"RenameConflictNodes") {
779 _conflProtocol = *(*iter) ;
801 strlcpy(buf,miStateNameList,4096) ;
803 char* tok = strtok(buf,
",") ;
806 tok = strtok(0,
",") ;
809 _pdfmap[pdfName] = sr ;
818 _restr[catName] = stateList ;
831 _masterCatName = masterIndexCat ;
844 sr.
configure(arg1,arg2,arg3,arg4,arg5,arg6) ;
845 internalAddPdf(pdfName,miStateList,sr) ;
855 internalAddPdf(pdfName,miStateList,sr) ;
877 map<RooAbsPdf*,ObjSplitRule>::iterator ri ;
878 for (ri = _pdfmap.begin() ; ri != _pdfmap.end() ; ++ri ) {
879 cout <<
"Splitrule for p.d.f " << ri->first->GetName() <<
" with state list " ;
880 for (std::list<const RooCatType*>::iterator misi= ri->second._miStateList.begin() ; misi!=ri->second._miStateList.end() ; ++misi) {
881 cout << (*misi)->GetName() <<
" " ;
885 map<RooAbsArg*,pair<RooArgSet,string> >::iterator csi ;
886 for (csi = ri->second._paramSplitMap.begin() ; csi != ri->second._paramSplitMap.end() ; ++csi ) {
887 if (csi->second.second.length()>0) {
888 cout <<
" parameter " << csi->first->GetName() <<
" is split with constraint in categories " << csi->second.first
889 <<
" with remainder in state " << csi->second.second << endl ;
891 cout <<
" parameter " << csi->first->GetName() <<
" is split with constraint in categories " << csi->second.first << endl ;
896 map<RooAbsCategory*,list<const RooCatType*> >::iterator riter ;
897 for (riter=_restr.begin() ; riter!=_restr.end() ; ++riter) {
898 cout <<
"Restricting build in category " << riter->first->GetName() <<
" to states " ;
899 list<const RooCatType*>::iterator i ;
900 for (i=riter->second.begin() ; i!=riter->second.end() ; ++i) {
901 if (i!=riter->second.begin()) cout <<
"," ;
902 cout << (*i)->GetName() ;
916 string tn(typeName) ;
917 if (tn==
"SIMCLONE") {
920 for (
unsigned int i=1 ; i<args.size() ; i++) {
921 if (args[i].find(
"$SplitParam(")!=0 &&
922 args[i].find(
"$SplitParamConstrained(")!=0 &&
923 args[i].find(
"$SplitRestrict(")!=0 &&
924 args[i].find(
"$Verbose(")!=0) {
925 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: unknown token %s encountered",args[i].c_str())) ;
931 for (
unsigned int i=1 ; i<args.size() ; i++) {
932 if (args[i].find(
"$SplitParam(")==0) {
934 if (subargs.size()!=2) {
935 throw string(
Form(
"Incorrect number of arguments in $SplitParam, have %d, expect 2",(
Int_t)subargs.size())) ;
938 }
else if (args[i].find(
"$SplitParamConstrained(")==0) {
940 if (subargs.size()!=3) {
941 throw string(
Form(
"Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(
Int_t)subargs.size())) ;
949 for (
unsigned int i=1 ; i<args.size() ; i++) {
950 if (args[i].find(
"$Restrict(")==0) {
952 if (subargs.size()!=2) {
953 throw string(
Form(
"Incorrect number of arguments in $Restrict, have %d, expect 2",(
Int_t)subargs.size())) ;
961 for (
unsigned int i=1 ; i<args.size() ; i++) {
962 if (args[i].find(
"$Verbose(")==0) {
964 if (subargs.size()>0) {
965 verbose = atoi(subargs[0].c_str()) ;
974 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",instanceName)) ;
980 }
else if (tn==
"MSIMCLONE") {
985 for (
unsigned int i=1 ; i<args.size() ; i++) {
986 if (args[i].find(
"$AddPdf(")==0) {
992 for (
unsigned int j=2 ; j<subargs.size() ; j++) {
993 if (subargs[j].find(
"$SplitParam(")==0) {
995 if (subsubargs.size()!=2) {
996 throw string(
Form(
"Incorrect number of arguments in $SplitParam, have %d, expect 2",(
Int_t)subsubargs.size())) ;
999 }
else if (subargs[j].find(
"$SplitParamConstrained(")==0) {
1001 if (subsubargs.size()!=3) {
1002 throw string(
Form(
"Incorrect number of arguments in $SplitParamConstrained, have %d, expect 3",(
Int_t)subsubargs.size())) ;
1007 mbc.
addPdf(subargs[0].c_str(),subargs[1].c_str(),sr) ;
1009 }
else if (args[i].find(
"$Restrict(")==0) {
1013 if (subargs.size()!=2) {
1014 throw string(
Form(
"Incorrect number of arguments in $Restrict, have %d, expect 2",(
Int_t)subargs.size())) ;
1019 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: unknown token in MSIMCLONE: %s",args[i].c_str())) ;
1027 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() error in RooSimWSTool::build() for %s",instanceName)) ;
1035 throw string(
Form(
"RooSimWSTool::SimWSIFace::create() ERROR: Unknown meta-type %s requested",typeName)) ;
1038 return string(instanceName) ;
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
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
Check whether this object depends on values from an element in the serverList.
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 setLabel(const char *label, Bool_t printError=kTRUE)=0
Change category state by specifying a state name.
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
bool hasLabel(const std::string &label) const
Check if a state with name label exists.
virtual const char * getCurrentLabel() const
Return label string of current state.
TIterator * typeIterator() const
const RooCatType * lookupType(value_type index, Bool_t printError=kFALSE) const
Find our type corresponding to the specified index, or return nullptr for no match.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add an argument and transfer the ownership to the collection.
RooAbsArg * first() const
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
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.
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 is an object to represent discrete states.
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 connects 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'.
The 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.
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.
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.
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)
void init()
Inspect hardware capabilities, and load the optimal library for RooFit computations.