|
ROOT
Reference Guide |
|
Go to the documentation of this file.
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>>;
virtual ~RooCategory()
Destructor.
void setRange(const char *rangeName, const char *stateNameList)
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 bool setLabel(const char *label, Bool_t printError=kTRUE)=0
Change category state by specifying a state name.
virtual TObject * clone(const char *newname) const override
void defineTypes(const std::map< std::string, int > &allowedStates)
Define multiple states in a single call.
virtual bool setIndex(value_type index, bool printError=true)=0
Change category state by specifying the index code of the desired state.
void installLegacySharedProp(const RooCategorySharedProperties *sp)
When reading old versions of the class, we get instances of shared properties.
int value_type
The type used to denote a specific category state.
RooCategorySharedProperties is the container for all properties that are shared between instance of R...
std::map< std::string, std::vector< value_type > > RangeMap_t
value_type & operator[](const std::string &stateName)
Access a named state.
void clearRange(const char *name, Bool_t silent)
Clear the named range.
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.
#define ClassDefOverride(name, id)
bool defineType(const std::string &label)
Define a state with given name.
std::map< std::string, value_type >::const_iterator end() const
Iterator for category state names. Points to pairs of index and name.
bool hasIndex(value_type index) const
Check if a state with index index exists.
static decltype(_stateNames) const ::value_type & invalidCategory()
Is this category attached to a tree?
virtual bool setIndex(value_type index, bool printError=true)=0
Change category state by specifying the index code of the desired state.
virtual void writeToStream(std::ostream &os, Bool_t compact) const override
compact only at the moment
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE) override
Read object contents from given stream.
std::map< std::string, RooAbsCategory::value_type > & states()
Return a reference to the map of state names to index states.
std::shared_ptr< RangeMap_t > _ranges
Map range names to allowed category states.
virtual bool hasRange(const char *rangeName) const override
Returns true if category has a range with given name defined.
std::vector< std::string > _insertionOrder
Map state names to index numbers. Make sure state names are updated in recomputeShape().
void addToRange(const char *rangeName, RooAbsCategory::value_type stateIndex)
Add the given state to the given range.
static std::map< std::string, std::weak_ptr< RangeMap_t > > _uuidToSharedRangeIOHelper
void clear()
Clear all defined category states.
RangeMap_t * _rangesPointerForIO
RooCategory is an object to represent discrete states.
virtual Bool_t isDerived() const override
Does our value or shape depend on any other arg? Always false for RooCategory.
Mother of all ROOT objects.
virtual Bool_t isFundamental() const override
Tell whether we can be stored in a dataset. Always true for RooCategory.
Bool_t isStateInRange(const char *rangeName, RooAbsCategory::value_type stateIndex) const
Check if the state is in the given range.
RooCategory & operator=(const RooCategory &)=delete
const std::map< std::string, value_type > & stateNames() const
Access the map of state names to index numbers.
virtual bool setLabel(const char *label, Bool_t printError=kTRUE)=0
Change category state by specifying a state name.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual value_type getCurrentIndex() const override final
Return current index.
void recomputeShape() override
This category's shape does not depend on others, and does not need recomputing.
void clearTypes()
Delete all currently defined states.
static std::map< std::string, std::weak_ptr< RangeMap_t > > _sharedRangeIOHelper