56 mutable std::map<Int_t, RooAbsCategory::value_type>
_map;
98 _inputCat(
"input",
this,
other._inputCat),
99 _mapArray(
other._mapArray)
118 coutE(InputArguments) <<
"RooMappedCategory::map(" <<
GetName() <<
"): ERROR expression "
134 coutE(InputArguments) <<
"RooMappedCategory::map(" <<
GetName()
135 <<
"): ERROR, unable to define category for output type " <<
outKey << std::endl ;
142 coutE(InputArguments) <<
"RooMappedCategory::map(" <<
GetName()
143 <<
"): ERROR, expression " <<
inKeyRegExp <<
" didn't compile" << std::endl ;
178 os <<
indent <<
"--- RooMappedCategory ---" << std::endl
179 <<
indent <<
" Maps from " ;
184 os <<
indent <<
" Mapping rules:" << std::endl;
196 coutE(InputArguments) <<
"RooMappedCategory::readFromSteam(" <<
GetName() <<
"): can't read in compact mode" << std::endl ;
212 parser.setPunctuation(
":,") ;
216 bool readToken(
true) ;
225 if (
parser.expectToken(
":",
true))
return true ;
237 if (
token.CompareTo(
",")) {
261 if (!first) { os <<
" " ; }
264 os << iter.second.outCat() <<
":" << iter.first ;
267 os <<
"," << iter.first ;
271 if (!first) { os <<
" " ; }
294 if (!first) { os <<
" " ; }
297 os << iter.second.outCat() <<
"<-" << iter.first ;
300 os <<
"," << iter.first ;
304 if (!first) { os <<
" " ; }
331 _expr =
other._expr ;
332 _catIdx =
other._catIdx;
352 const char *
c = exp ;
363 _regexp =
new TRegexp(mangle(_expr),
true);
static void indent(ostringstream &buf, int indent_level)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for data members of RooAbsArgs that cache other (composite) RooAbsArg expressions...
RooAbsArg * _owner
Pointer to owning RooAbsArg.
A space to attach TBranches.
virtual value_type getCurrentIndex() const
Return index number of current state.
virtual const char * getCurrentLabel() const
Return label string of current state.
const std::string & lookupName(value_type index) const
Get the name corresponding to the given index.
static const decltype(_stateNames) ::value_type & invalidCategory()
A category state to signify an invalid category.
virtual const std::map< std::string, RooAbsCategory::value_type >::value_type & defineState(const std::string &label)
Define a new state with given label.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print info about this object to the specified stream.
value_type lookupIndex(const std::string &stateName) const
Find the index number corresponding to the state name.
void clearTypes()
Delete all currently defined states.
Abstract container object that can hold multiple RooAbsArg objects.
RooAbsCategory::value_type lookup(Int_t idx) const
bool redirectServersHook(const RooAbsCollection &, bool, bool, bool) override
Interface for server redirect calls.
void wireCache() override
RooMappedCategoryCache(const RooAbsCache &, RooAbsArg *owner)
RooMappedCategoryCache(RooAbsArg *owner)
std::map< Int_t, RooAbsCategory::value_type > _map
Entry & operator=(const Entry &other)
const TRegexp * regexp() const
TString mangle(const char *exp) const
Mangle name : escape regexp character '+'.
bool match(const char *testPattern) const
RooMappedCategory provides a category-to-category mapping defined by pattern matching on their state ...
value_type _defCat
Default (unmapped) output type.
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to ostream.
const RooMappedCategoryCache * getOrCreateCache() const
RooCategoryProxy _inputCat
Input category.
void printMetaArgs(std::ostream &os) const override
Customized printing of arguments of a RooMappedCategory to more intuitively reflect the contents of t...
std::map< std::string, RooMappedCategory::Entry > _mapArray
List of mapping rules.
void recomputeShape() override
When the input category changes states, the cached state mappings are invalidated.
void setDefCat(value_type defCat)
std::unique_ptr< RooMappedCategoryCache > _mapcache
! transient member: cache the mapping
static constexpr value_type NoCatIdx
bool map(const char *inKeyRegExp, const char *outKeyName, Int_t outKeyNum=NoCatIdx)
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Print info about this object to the specified stream.
~RooMappedCategory() override
value_type evaluate() const override
Evaluate the category state and return.
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from stream (dummy for now)
const T & arg() const
Return reference to object held in proxy.
const char * GetName() const override
Returns name of object.
Regular expression class.
TString & Append(const char *cs)