32 RooCategory(
const char*
name,
const char* title,
const std::map<std::string, int>& allowedStates);
45 virtual Bool_t setLabel(
const char* label,
bool printError =
true)
override;
54 void defineTypes(
const std::map<std::string, int>& allowedStates);
56 std::map<std::string, RooAbsCategory::value_type>&
states();
73 void setRange(
const char* rangeName,
const char* stateNameList) ;
75 void addToRange(
const char* rangeName,
const char* stateNameList) ;
99 virtual bool hasRange(
const char* rangeName)
const override {
127 using RangeMap_t = std::map<std::string, std::vector<value_type>>;
#define ClassDefOverride(name, id)
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_t printError=kTRUE)=0
Change category state by specifying a state name.
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.
bool hasIndex(value_type index) const
Check if a state with index index exists.
std::vector< std::string > _insertionOrder
Map state names to index numbers. Make sure state names are updated in recomputeShape().
const std::map< std::string, value_type > & stateNames() const
Access the map of state names to index numbers.
static const decltype(_stateNames) ::value_type & invalidCategory()
Is this category attached to a tree?
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.
virtual Bool_t isFundamental() const override
Tell whether we can be stored in a dataset. Always true for RooCategory.
RangeMap_t * _rangesPointerForIO
void addToRange(const char *rangeName, RooAbsCategory::value_type stateIndex)
Add the given state to the given range.
virtual void writeToStream(std::ostream &os, Bool_t compact) const override
compact only at the moment
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 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
void installSharedRange(std::unique_ptr< RangeMap_t > &&rangeMap)
In current versions of the class, a map with ranges can be shared between instances.
virtual value_type evaluate() const override
Evaluate the category state and return.
bool defineType(const std::string &label)
Define a state with given name.
virtual ~RooCategory()
Destructor.
std::shared_ptr< RangeMap_t > _ranges
Map range names to allowed category states.
std::map< std::string, std::vector< value_type > > RangeMap_t
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE) override
Read object contents from given stream.
virtual Bool_t setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
virtual Bool_t inRange(const char *rangeName) const override
Check if the currently defined category state is in the range with the given name.
virtual value_type getCurrentIndex() const override final
Return current index.
value_type & operator[](const std::string &stateName)
Access a named state.
void clear()
Clear all defined category states.
static std::map< std::string, std::weak_ptr< RangeMap_t > > _uuidToSharedRangeIOHelper
virtual Bool_t setIndex(Int_t index, bool printError=true) override
Set value by specifying the index code of the desired state.
virtual bool hasRange(const char *rangeName) const override
Returns true if category has a range with given name defined.
virtual Bool_t isDerived() const override
Does our value or shape depend on any other arg? Always false for RooCategory.
void clearRange(const char *name, Bool_t silent)
Clear the named range.
virtual TObject * clone(const char *newname) const override
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_t isStateInRange(const char *rangeName, RooAbsCategory::value_type stateIndex) const
Check if the state is in the given range.
void installLegacySharedProp(const RooCategorySharedProperties *sp)
When reading old versions of the class, we get instances of shared properties.
Mother of all ROOT objects.