33 RooCategory(
const char*
name,
const char* title,
const std::map<std::string, int>& allowedStates);
46 bool setLabel(
const char* label,
bool printError =
true)
override;
50 bool readFromStream(std::istream& is,
bool compact,
bool verbose=
false)
override;
51 void writeToStream(std::ostream& os,
bool compact)
const override ;
55 void defineTypes(
const std::map<std::string, int>& allowedStates);
57 std::map<std::string, RooAbsCategory::value_type>&
states();
74 void setRange(
const char* rangeName,
const char* stateNameList) ;
76 void addToRange(
const char* rangeName,
const char* stateNameList) ;
93 bool isStateInRange(
const char* rangeName,
const char* stateName)
const ;
96 bool inRange(
const char* rangeName)
const override {
100 bool hasRange(
const char* rangeName)
const override {
128 using RangeMap_t = std::map<std::string, std::vector<value_type>>;
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual bool setIndex(value_type index, bool printError=true)=0
Change category state by specifying the index code of the desired state.
virtual bool setLabel(const char *label, bool printError=true)=0
Change category state by specifying a state name.
value_type _currentIndex
Current category state.
std::map< std::string, value_type >::const_iterator end() const
Iterator for category state names. Points to pairs of index and name.
int value_type
The type used to denote a specific category state.
std::vector< std::string > _insertionOrder
Keeps track in which order state numbers have been inserted. Make sure this is updated in recomputeSh...
const std::map< std::string, value_type > & stateNames() const
Access the map of state names to index numbers.
bool hasIndex(value_type index) const
Check if a state with index index exists.
static const decltype(_stateNames) ::value_type & invalidCategory()
A category state to signify an invalid category.
void clearTypes()
Delete all currently defined states.
RooCategorySharedProperties is the container for all properties that are shared between instance of R...
RooCategory is an object to represent discrete states.
RangeMap_t * _rangesPointerForIO
Pointer to the same object as _ranges, but not shared for I/O.
void addToRange(const char *rangeName, RooAbsCategory::value_type stateIndex)
Add the given state to the given range.
bool setIndex(Int_t index, bool printError=true) override
Set value by specifying the index code of the desired state.
bool hasRange(const char *rangeName) const override
Returns true if category has a range with given name defined.
void setRange(const char *rangeName, const char *stateNameList)
void defineTypes(const std::map< std::string, int > &allowedStates)
Define multiple states in a single call.
void writeToStream(std::ostream &os, bool compact) const override
compact only at the moment
void recomputeShape() override
This category's shape does not depend on others, and does not need recomputing.
static std::map< std::string, std::weak_ptr< RangeMap_t > > _sharedRangeIOHelper
Helper for restoring shared ranges from current versions of this class read from files....
bool isDerived() const override
Does our value or shape depend on any other arg? Always false for RooCategory.
void installSharedRange(std::unique_ptr< RangeMap_t > &&rangeMap)
In current versions of the class, a map with ranges can be shared between instances.
bool defineType(const std::string &label)
Define a state with given name.
void clearRange(const char *name, bool silent)
Clear the named range.
std::shared_ptr< RangeMap_t > _ranges
Map range names to allowed category states.
std::map< std::string, std::vector< value_type > > RangeMap_t
value_type evaluate() const override
Evaluate the category state and return.
static std::map< RooSharedProperties::UUID, std::weak_ptr< RangeMap_t > > _uuidToSharedRangeIOHelper
Helper for restoring shared ranges from old versions of this class read from files....
value_type & operator[](const std::string &stateName)
Access a named state.
void clear()
Clear all defined category states.
bool isFundamental() const override
Tell whether we can be stored in a dataset. Always true for RooCategory.
TObject * clone(const char *newname) const override
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from given stream.
bool setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
std::map< std::string, RooAbsCategory::value_type > & states()
Return a reference to the map of state names to index states.
RooCategory & operator=(const RooCategory &)=delete
bool isStateInRange(const char *rangeName, RooAbsCategory::value_type stateIndex) const
Check if the state is in the given range.
value_type getCurrentIndex() const final
Return current index.
void installLegacySharedProp(const RooCategorySharedProperties *sp)
When reading old versions of the class, we get instances of shared properties.
bool inRange(const char *rangeName) const override
Check if the currently defined category state is in the range with the given name.
~RooCategory() override
Destructor.
Mother of all ROOT objects.