465 _protoPdfSet(protoPdfSet)
481 buildConfig->
addOwned(*
new RooStringVar(
"physModels",
"List and mapping of physics models to include in build",
"",4096)) ;
482 buildConfig->
addOwned(*
new RooStringVar(
"splitCats",
"List of categories used for splitting",
"",1024)) ;
511 const char* spaceChars =
" \t" ;
515 char *buf =
new char[buflen] ;
517 strlcpy(buf,((
RooStringVar*)buildConfig.
find(
"physModels"))->getVal(),buflen) ;
519 if (strstr(buf,
" : ")) {
520 const char* physCatName = strtok(buf,spaceChars) ;
523 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR physics index category " << physCatName
524 <<
" not found in dataset variables" << endl ;
528 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: category indexing physics model: " << physCatName << endl ;
536 strtok(0,spaceChars) ;
537 physName = strtok(0,spaceChars) ;
539 physName = strtok(buf,spaceChars) ;
543 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR: No models specified, nothing to do!" << endl ;
555 if (strchr(physName,
'=')) {
558 coutW(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: WARNING: without physCat specification "
559 <<
"<physCatState>=<pdfProtoName> association is meaningless" << endl ;
561 stateName = physName ;
562 physName = strchr(stateName,
'=') ;
567 stateName = physName ;
573 << (physName?physName:
"(null)") <<
" is not defined" << endl ;
579 if (stateMap.
find(stateName)) {
580 coutW(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: WARNING: multiple PDFs specified for state "
581 << stateName <<
", only first will be used" << endl ;
586 physModelSet.
add(*physModel,
kTRUE) ;
592 physName = strtok(0,spaceChars) ;
595 }
else if (physCat==0) {
596 coutW(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: WARNING: without physCat specification, only the first model will be used" << endl ;
600 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: list of physics models " << physModelSet << endl ;
605 TList splitStateList ;
609 buflen = strlen(((
RooStringVar*)buildConfig.
find(
"splitCats"))->getVal())+1 ;
610 buf =
new char[buflen] ;
611 strlcpy(buf,((
RooStringVar*)buildConfig.
find(
"splitCats"))->getVal(),buflen) ;
613 char *catName = strtok(buf,spaceChars) ;
619 if (strchr(catName,
'(')) {
630 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR requested split category " << (catName?catName:
"(null)")
631 <<
" is not a RooCategory in the dataset" << endl ;
635 splitCatSet.
add(*splitCat) ;
640 <<
" restricted to states (" << stateList <<
")" << endl ;
645 splitStateList.
Add(slist) ;
647 char* stateLabel =
R__STRTOK_R(stateList,
",",&tokenPtr) ;
654 <<
" doesn't have a state named " << stateLabel << endl ;
665 catName = strtok(0,spaceChars) ;
667 if (physCat) splitCatSet.
add(*physCat) ;
668 RooSuperCategory masterSplitCat(
"masterSplitCat",
"Master splitting category",splitCatSet) ;
670 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: list of splitting categories " << splitCatSet << endl ;
678 if (!auxSplitCloneSet) {
679 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf(" <<
GetName() <<
") Couldn't deep-clone set auxiliary splitcats, abort." << endl ;
692 coutW(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: WARNING: dataset contains a fundamental splitting category " << endl
693 <<
" with the same name as an auxiliary split function (" << aux->
GetName() <<
"). " << endl
694 <<
" Auxiliary split function will be ignored" << endl ;
702 <<
" because it has servers that are not listed in splitCatSet: " << *parSet << endl ;
711 auxSplitSet.
add(*aux) ;
715 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: list of auxiliary splitting categories " << auxSplitSet << endl ;
728 customizerList->
Add(physCustomizer) ;
735 buflen = strlen(ruleStr->
getVal())+1 ;
736 buf =
new char[buflen] ;
738 strlcpy(buf,ruleStr->
getVal(),buflen) ;
741 char* token =
R__STRTOK_R(buf,spaceChars,&tokenPtr) ;
743 enum Mode { SplitCat, Colon, ParamList } ;
744 Mode mode(SplitCat) ;
754 splitCatName = token ;
756 if (strchr(splitCatName,
',')) {
761 TString origCompCatName(splitCatName) ;
779 <<
" not found in the primary or auxilary splitcat list" << endl ;
780 customizerList->
Delete() ;
781 delete customizerList ;
787 compCatSet.
add(*cat) ;
801 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPDF: ERROR: Ill defined split: auxiliary splitting category " << arg->
GetName()
802 <<
" used in composite split " << compCatSet <<
" depends on one or more of the other splitting categories in the composite split" << endl ;
805 customizerList->
Delete() ;
806 delete customizerList ;
814 splitCat =
new RooMultiCategory(origCompCatName,origCompCatName,compCatSet) ;
831 << splitCatName <<
" not found in the primary or auxiliary splitcat list" << endl ;
832 customizerList->
Delete() ;
833 delete customizerList ;
845 if (strcmp(token,
":")) {
846 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR in parsing, expected ':' after "
847 << splitCat <<
", found " << token << endl ;
848 customizerList->
Delete() ;
849 delete customizerList ;
865 paramList->
add(*compList) ;
868 Bool_t lastCharIsComma = (token[strlen(token)-1]==
',') ;
874 char *remainderState = 0 ;
876 if (paramName &&
R__STRTOK_R(paramName,
"[",&tokptr2)) {
883 if (remainderState) {
886 << paramName <<
" has invalid remainder state name: " << remainderState << endl ;
888 customizerList->
Delete() ;
889 delete customizerList ;
899 <<
" is not a parameter of physics model " << physModel->
GetName() << endl ;
901 customizerList->
Delete() ;
902 delete customizerList ;
907 splitParamList.
add(*param) ;
910 if (remainderState) {
914 coutE(
InputArguments) <<
"RooSimPdfBuilder::buildPdf: ERROR fraction split requested of non-real valued parameter "
917 customizerList->
Delete() ;
918 delete customizerList ;
928 if (remStateSplitList && !remStateSplitList->
FindObject(remainderState)) {
930 <<
" remainder state " << remainderState <<
" in parameter split "
931 << param->
GetName() <<
" is not actually being built" << endl ;
933 customizerList->
Delete() ;
934 delete customizerList ;
952 if (remStateSplitList && !remStateSplitList->
FindObject(
type->GetName())) {
958 splitLeafName.
Append(
"_") ;
969 fracLeafList.
add(*splitLeaf) ;
977 remLeafName.
Append(remainderState) ;
984 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: creating remainder fraction formula for " << remainderState
985 <<
" specialization of split parameter " << param->
GetName() <<
" " << formExpr << endl ;
991 if (paramName &&
R__STRTOK_R(paramName,
"[",&tokptr2)) {
997 physCustomizer->
splitArgs(splitParamList,*splitCat) ;
1001 if (!lastCharIsComma) mode = SplitCat ;
1009 if (mode!=SplitCat) {
1011 << (mode==Colon?
":":
"parameter list") <<
" after " << (token?token:
"(null)") << endl ;
1020 coutI(
ObjectHandling) <<
"RooSimPdfBuilder::buildPdf: configured customizers for all physics models" << endl ;
1022 customizerList->
Print() ;
1027 if (physCat) fitCatList.
add(*physCat) ;
1028 fitCatList.
add(splitCatSet) ;
1050 if (!slist) continue ;
1056 if (!select) continue ;
1063 if (!physNameVar) continue ;
1070 <<
" for mode " << fcState->
GetName() << endl ;
1080 delete customizerList ;
1083 splitStateList.
Delete() ;
1085 if (auxSplitCloneSet)
delete auxSplitCloneSet ;
1104 std::list<RooSimultaneous*>::iterator iter =
_simPdfList.begin() ;
1110 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...
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.
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.
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)