60 mutable std::map<Int_t, const RooCatType*> _map;
70 inCat; inCat =
static_cast<const RooCatType*
>(tit->Next())) {
71 const char* inKey = inCat->GetName();
74 for (std::map<std::string, RooMappedCategory::Entry>::const_iterator
76 end = parent.
_mapArray.end(); end != iter; ++iter) {
77 if (iter->second.match(inKey)) {
79 _map[inCat->getVal()] = &(iter->second.outCat());
83 if (!found) _map[inCat->getVal()] = parent.
_defCat;
103 RooAbsCategory(other,
name), _inputCat(
"input",this,other._inputCat), _mapArray(other._mapArray),
127 if (!inKeyRegExp || !outKey)
return kTRUE ;
132 << inKeyRegExp <<
" already mapped" << std::endl ;
147 <<
"): ERROR, unable to output type " << outKey << std::endl ;
152 Entry e(inKeyRegExp,outType) ;
155 <<
"): ERROR, expression " << inKeyRegExp <<
" didn't compile" << std::endl ;
190 os <<
indent <<
"--- RooMappedCategory ---" << std::endl
191 <<
indent <<
" Maps from " ;
194 os <<
indent <<
" Default value is ";
197 os <<
indent <<
" Mapping rules:" << std::endl;
198 for (std::map<std::string,Entry>::const_iterator iter =
_mapArray.begin() ; iter!=
_mapArray.end() ; ++iter) {
199 os <<
indent <<
" " << iter->first <<
" -> " << iter->second.outCat().GetName() << std::endl ;
221 TString token,errorPrefix(
"RooMappedCategory::readFromStream(") ;
232 if (readToken) token=parser.
readToken() ;
233 if (token.
IsNull()) break ;
245 if (
map(srcKey,destKey))
return kTRUE ;
271 for (std::map<std::string,Entry>::const_iterator iter =
_mapArray.begin() ; iter!=
_mapArray.end() ; ++iter) {
272 if (iter->second.outCat().getVal()!=prevOutCat.
getVal()) {
273 if (!
first) { os <<
" " ; }
276 os << iter->second.outCat().GetName() <<
":" << iter->first ;
277 prevOutCat=iter->second.outCat() ;
279 os <<
"," << iter->first ;
283 if (!
first) { os <<
" " ; }
304 for (std::map<std::string,Entry>::const_iterator iter =
_mapArray.begin() ; iter!=
_mapArray.end() ; ++iter) {
305 if (iter->second.outCat().getVal()!=prevOutCat.
getVal()) {
306 if (!
first) { os <<
" " ; }
309 os << iter->second.outCat().GetName() <<
"<-" << iter->first ;
310 prevOutCat=iter->second.outCat() ;
312 os <<
"," << iter->first ;
316 if (!
first) { os <<
" " ; }
328 if (&other==
this)
return *this ;
349 const char *
c =
exp ;
362void RooMappedCategory::Entry::Streamer(
TBuffer &R__b)
374 _cat.Streamer(R__b) ;
385 _cat.Streamer(R__b) ;
static void initialise(gsl_integration_workspace *workspace, double a, double b)
static void indent(ostringstream &buf, int indent_level)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooAbsCache is the abstract base class for data members of RooAbsArgs that cache other (composite) Ro...
virtual Bool_t redirectServersHook(const RooAbsCollection &, Bool_t, Bool_t, Bool_t)
Interface for server redirect calls.
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.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Print info about this object to the specified stream.
const RooCatType * defineType(const char *label)
Define a new state with given name.
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 clearTypes()
Delete all currently defined states.
RooAbsCollection is an abstract 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.
const RooAbsCategory & arg() const
Entry & operator=(const Entry &other)
TString mangle(const char *exp) const
Mangle name : escape regexp character '+'.
virtual ~RooMappedCategory()
const RooMappedCategoryCache * getOrCreateCache() const
RooCategoryProxy _inputCat
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from stream (dummy for now)
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to ostream.
std::map< std::string, RooMappedCategory::Entry > _mapArray
friend class RooMappedCategoryCache
Bool_t map(const char *inKeyRegExp, const char *outKeyName, Int_t outKeyNum=NoCatIdx)
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooMappedCategory to more intuitively reflect the contents of t...
virtual RooCatType evaluate() const
transient member: cache the mapping
RooMappedCategoryCache * _mapcache
void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print info about this object to the specified stream.
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
void setPunctuation(const TString &punct)
Change list of characters interpreted as punctuation.
Bool_t expectToken(const TString &expected, Bool_t zapOnError=kFALSE)
Read the next token and return kTRUE if it is identical to the given 'expected' token.
TString readToken()
Read one token separated by any of the know punctuation characters This function recognizes and handl...
Buffer base class used for serializing objects.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual const char * GetName() const
Returns name of object.
Regular expression class.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * Data() const
TString & Append(const char *cs)