464 _protoPdfSet(protoPdfSet)
480 buildConfig->
addOwned(*
new RooStringVar(
"physModels",
"List and mapping of physics models to include in build",
"",4096)) ;
481 buildConfig->
addOwned(*
new RooStringVar(
"splitCats",
"List of categories used for splitting",
"",1024)) ;
510 const char* spaceChars =
" \t" ;
514 char *buf =
new char[buflen] ;
516 strlcpy(buf,((
RooStringVar*)buildConfig.
find(
"physModels"))->getVal(),buflen) ;
518 if (strstr(buf,
" : ")) {
519 const char* physCatName = strtok(buf,spaceChars) ;
522 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR physics index category " << physCatName
523 <<
" not found in dataset variables" << endl ;
527 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: category indexing physics model: " << physCatName << endl ;
535 strtok(0,spaceChars) ;
536 physName = strtok(0,spaceChars) ;
538 physName = strtok(buf,spaceChars) ;
542 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR: No models specified, nothing to do!" << endl ;
554 if (strchr(physName,
'=')) {
557 coutW(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: WARNING: without physCat specification "
558 <<
"<physCatState>=<pdfProtoName> association is meaningless" << endl ;
560 stateName = physName ;
561 physName = strchr(stateName,
'=') ;
566 stateName = physName ;
572 << (physName?physName:
"(null)") <<
" is not defined" << endl ;
578 if (stateMap.
find(stateName)) {
579 coutW(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: WARNING: multiple PDFs specified for state "
580 << stateName <<
", only first will be used" << endl ;
585 physModelSet.
add(*physModel,
kTRUE) ;
591 physName = strtok(0,spaceChars) ;
594 }
else if (physCat==0) {
595 coutW(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: WARNING: without physCat specification, only the first model will be used" << endl ;
599 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: list of physics models " << physModelSet << endl ;
604 TList splitStateList ;
608 buflen = strlen(((
RooStringVar*)buildConfig.
find(
"splitCats"))->getVal())+1 ;
609 buf =
new char[buflen] ;
610 strlcpy(buf,((
RooStringVar*)buildConfig.
find(
"splitCats"))->getVal(),buflen) ;
612 char *catName = strtok(buf,spaceChars) ;
618 if (strchr(catName,
'(')) {
629 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR requested split category " << (catName?catName:
"(null)")
630 <<
" is not a RooCategory in the dataset" << endl ;
634 splitCatSet.
add(*splitCat) ;
639 <<
" restricted to states (" << stateList <<
")" << endl ;
644 splitStateList.
Add(slist) ;
646 char* stateLabel =
R__STRTOK_R(stateList,
",",&tokenPtr) ;
653 <<
" doesn't have a state named " << stateLabel << endl ;
664 catName = strtok(0,spaceChars) ;
666 if (physCat) splitCatSet.
add(*physCat) ;
667 RooSuperCategory masterSplitCat(
"masterSplitCat",
"Master splitting category",splitCatSet) ;
669 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: list of splitting categories " << splitCatSet << endl ;
677 if (!auxSplitCloneSet) {
678 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf(" <<
GetName() <<
") Couldn't deep-clone set auxiliary splitcats, abort." << endl ;
691 coutW(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: WARNING: dataset contains a fundamental splitting category " << endl
692 <<
" with the same name as an auxiliary split function (" << aux->
GetName() <<
"). " << endl
693 <<
" Auxiliary split function will be ignored" << endl ;
701 <<
" because it has servers that are not listed in splitCatSet: " << *parSet << endl ;
710 auxSplitSet.
add(*aux) ;
714 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: list of auxiliary splitting categories " << auxSplitSet << endl ;
727 customizerList->
Add(physCustomizer) ;
734 buflen = strlen(ruleStr->
getVal())+1 ;
735 buf =
new char[buflen] ;
737 strlcpy(buf,ruleStr->
getVal(),buflen) ;
740 char* token =
R__STRTOK_R(buf,spaceChars,&tokenPtr) ;
742 enum Mode { SplitCat, Colon, ParamList } ;
743 Mode mode(SplitCat) ;
753 splitCatName = token ;
755 if (strchr(splitCatName,
',')) {
760 TString origCompCatName(splitCatName) ;
778 <<
" not found in the primary or auxilary splitcat list" << endl ;
779 customizerList->
Delete() ;
780 delete customizerList ;
786 compCatSet.
add(*cat) ;
800 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPDF: ERROR: Ill defined split: auxiliary splitting category " << arg->
GetName()
801 <<
" used in composite split " << compCatSet <<
" depends on one or more of the other splitting categories in the composite split" << endl ;
804 customizerList->
Delete() ;
805 delete customizerList ;
813 splitCat =
new RooMultiCategory(origCompCatName,origCompCatName,compCatSet) ;
830 << splitCatName <<
" not found in the primary or auxiliary splitcat list" << endl ;
831 customizerList->
Delete() ;
832 delete customizerList ;
844 if (strcmp(token,
":")) {
845 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR in parsing, expected ':' after "
846 << splitCat <<
", found " << token << endl ;
847 customizerList->
Delete() ;
848 delete customizerList ;
864 paramList->
add(*compList) ;
867 Bool_t lastCharIsComma = (token[strlen(token)-1]==
',') ;
873 char *remainderState = 0 ;
875 if (paramName &&
R__STRTOK_R(paramName,
"[",&tokptr2)) {
882 if (remainderState) {
885 << paramName <<
" has invalid remainder state name: " << remainderState << endl ;
887 customizerList->
Delete() ;
888 delete customizerList ;
898 <<
" is not a parameter of physics model " << physModel->
GetName() << endl ;
900 customizerList->
Delete() ;
901 delete customizerList ;
906 splitParamList.
add(*param) ;
909 if (remainderState) {
913 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR fraction split requested of non-real valued parameter "
916 customizerList->
Delete() ;
917 delete customizerList ;
927 if (remStateSplitList && !remStateSplitList->
FindObject(remainderState)) {
929 <<
" remainder state " << remainderState <<
" in parameter split "
930 << param->
GetName() <<
" is not actually being built" << endl ;
932 customizerList->
Delete() ;
933 delete customizerList ;
939 TIterator* iter = splitCat->typeIterator() ;
951 if (remStateSplitList && !remStateSplitList->
FindObject(
type->GetName())) {
957 splitLeafName.
Append(
"_") ;
968 fracLeafList.
add(*splitLeaf) ;
976 remLeafName.
Append(remainderState) ;
983 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: creating remainder fraction formula for " << remainderState
984 <<
" specialization of split parameter " << param->
GetName() <<
" " << formExpr << endl ;
990 if (paramName &&
R__STRTOK_R(paramName,
"[",&tokptr2)) {
996 physCustomizer->
splitArgs(splitParamList,*splitCat) ;
1000 if (!lastCharIsComma) mode = SplitCat ;
1008 if (mode!=SplitCat) {
1010 << (mode==Colon?
":":
"parameter list") <<
" after " << (token?token:
"(null)") << endl ;
1019 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: configured customizers for all physics models" << endl ;
1021 customizerList->
Print() ;
1026 if (physCat) fitCatList.
add(*physCat) ;
1027 fitCatList.
add(splitCatSet) ;
1035 TIterator* fcIter = fitCat->typeIterator() ;
1049 if (!slist) continue ;
1055 if (!select) continue ;
1062 if (!physNameVar) continue ;
1069 <<
" for mode " << fcState->
GetName() << endl ;
1079 delete customizerList ;
1082 splitStateList.
Delete() ;
1084 if (auxSplitCloneSet)
delete auxSplitCloneSet ;
1103 std::list<RooSimultaneous*>::iterator iter =
_simPdfList.begin() ;
1109 std::list<RooSuperCategory*>::iterator iter2 =
_fitCatList.begin() ;
char * R__STRTOK_R(char *str, const char *delim, char **saveptr)
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Bool_t dependsOnValue(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0) const
RooArgSet * getComponents() const
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
virtual TObject * clone(const char *newname=0) const =0
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
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.
void setHashTableSize(Int_t)
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
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.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
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.
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...
RooMultiCategory consolidates several RooAbsCategory objects into a single category.
This tool has now been superseded by RooSimWSTool
RooArgSet _compSplitCatSet
std::list< RooSuperCategory * > _fitCatList
std::list< RooSimultaneous * > _simPdfList
RooSimultaneous * buildPdf(const RooArgSet &buildConfig, const RooArgSet &dependents, const RooArgSet *auxSplitCats=0, Bool_t verbose=kFALSE)
Initialize needed components.
RooArgSet * createProtoBuildConfig()
Make RooArgSet of configuration objects.
void addSpecializations(const RooArgSet &specSet)
RooArgSet _splitNodeListOwned
TList _retiredCustomizerList
RooSimPdfBuilder(const RooArgSet &pdfProtoList)
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'.
RooStringVar implements a string values RooAbsArg.
virtual const char * getVal() const
Return value of object. Calculated if dirty, otherwise cached value is returned.
RooSuperCategory can join several RooAbsCategoryLValue objects into a single category.
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)
Set the value of the super category by specifying the state name by setting the state names of the co...
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
void SetName(const char *name)
virtual void AddAll(const TCollection *col)
Add all objects from collection col to this collection.
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.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
TString & Append(const char *cs)