46 RooAbsCategory(name, title), _inputCat("input","Input category",this,inputCat)
50 if (defOutIdx==NoCatIdx) {
53 _defCat = (
RooCatType*) defineType(defOut,defOutIdx) ;
59 RooAbsCategory(other,name), _inputCat(
"input",this,other._inputCat), _mapArray(other._mapArray)
81 if (!inKeyRegExp || !outKey)
return kTRUE ;
86 << inKeyRegExp <<
" already mapped" << endl ;
101 <<
"): ERROR, unable to output type " << outKey << endl ;
106 Entry e(inKeyRegExp,outType) ;
109 <<
"): ERROR, expression " << inKeyRegExp <<
" didn't compile" << endl ;
126 if (
iter->second.match(inKey)) {
127 return iter->second.outCat() ;
148 os << indent <<
"--- RooMappedCategory ---" << endl
149 << indent <<
" Maps from " ;
152 os << indent <<
" Default value is ";
155 os << indent <<
" Mapping rules:" << endl;
157 os << indent <<
" " <<
iter->first <<
" -> " <<
iter->second.outCat().GetName() << endl ;
177 TString token,errorPrefix(
"RooMappedCategory::readFromStream(") ;
188 if (readToken) token=parser.
readToken() ;
189 if (token.
IsNull())
break ;
201 if (
map(srcKey,destKey))
return kTRUE ;
228 if (
iter->second.outCat().getVal()!=prevOutCat.
getVal()) {
229 if (!first) { os <<
" " ; }
232 os <<
iter->second.outCat().GetName() <<
":" <<
iter->first ;
233 prevOutCat=
iter->second.outCat() ;
235 os <<
"," <<
iter->first ;
239 if (!first) { os <<
" " ; }
261 if (
iter->second.outCat().getVal()!=prevOutCat.
getVal()) {
262 if (!first) { os <<
" " ; }
265 os <<
iter->second.outCat().GetName() <<
"<-" <<
iter->first ;
266 prevOutCat=
iter->second.outCat() ;
268 os <<
"," <<
iter->first ;
272 if (!first) { os <<
" " ; }
284 if (&other==
this)
return *this ;
286 _expr = other.
_expr ;
305 const char *
c =
exp ;
307 if (*c==
'+') t.
Append(
'\\') ;
318 void RooMappedCategory::Entry::Streamer(
TBuffer &R__b)
320 typedef ::RooMappedCategory::Entry ThisClass;
330 _cat.Streamer(R__b) ;
341 _cat.Streamer(R__b) ;
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, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'.
virtual ~RooMappedCategory()
Buffer base class used for serializing objects.
Regular expression class.
void clearTypes()
Delete all currently defined states.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to ostream.
Entry & operator=(const Entry &other)
TString mangle(const char *exp) const
Mangle name : escape regexp character '+'.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual RooCatType evaluate() const
std::map< std::string, std::string >::const_iterator iter
TString & Append(const char *cs)
RooCatType is an auxilary class for RooAbsCategory and defines a a single category 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.
void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print info about this object to the specified stream.
Bool_t map(const char *inKeyRegExp, const char *outKeyName, Int_t outKeyNum=NoCatIdx)
ClassImp(RooMappedCategory) ClassImp(RooMappedCategory
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
TString readToken()
Read one token separated by any of the know punctuation characters This function recognizes and handl...
virtual const char * GetName() const
Returns name of object.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
static void indent(ostringstream &buf, int indent_level)
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.
std::map< std::string, RooMappedCategory::Entry > _mapArray
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooMappedCategory to more intuitively reflect the contents of t...
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from stream (dummy for now)
void setPunctuation(const TString &punct)
Change list of characters interpreted as punctuation.
RooCategoryProxy _inputCat
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 RooAbsCategory & arg() const
const char * label() const
virtual const Text_t * GetName() const
Returns name of object.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
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.