16#ifndef ROO_ABS_CATEGORY
17#define ROO_ABS_CATEGORY
48 const std::map<std::string, value_type>::value_type&
getOrdinal(
unsigned int n)
const;
60 bool hasLabel(
const std::string& label)
const {
72 bool isSignType(
bool mustHaveZero=
false)
const ;
77 bool readFromStream(std::istream& is,
bool compact,
bool verbose=
false)
override ;
78 void writeToStream(std::ostream& os,
bool compact)
const override ;
80 void printValue(std::ostream& os)
const override ;
91 std::map<std::string, value_type>::const_iterator
begin()
const {
95 std::map<std::string, value_type>::const_iterator
end()
const {
121 lookupType(const
char* label,
bool printError=false) const;
186 virtual const std::map<std::string, RooAbsCategory::value_type>::value_type&
defineState(
const std::string& label);
187 virtual const std::map<std::string, RooAbsCategory::value_type>::value_type&
defineState(
const std::string& label,
value_type index);
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
#define ClassDefOverride(name, id)
static void indent(ostringstream &buf, int indent_level)
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Common abstract base class for objects that represent a value and a "shape" in RooFit.
void setShapeDirty()
Notify that a shape-like property (e.g. binning) has changed.
bool isShapeDirty() const
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
void clearShapeDirty() const
A space to attach TBranches.
virtual void recomputeShape()=0
If a category depends on the shape of others, i.e. its state numbers or names depend on the states of...
std::map< std::string, value_type > & stateNames()
Access the map of state names to index numbers.
virtual value_type getCurrentIndex() const
Return index number of current state.
void setCachedValue(double value, bool notifyClients=true) final
Overwrite the value stored in this object's cache.
unsigned int getCurrentOrdinalNumber() const
Return ordinal number of the current state.
bool hasLabel(const std::string &label) const
Check if a state with name label exists.
virtual const char * getCurrentLabel() const
Return label string of current state.
virtual bool isIntegrationSafeLValue(const RooArgSet *) const
const std::string & lookupName(value_type index) const
Get the name corresponding to the given index.
TIterator * typeIterator() const
bool operator==(value_type index) const
Equality operator with a integer (compares with state index number)
RooCatType * retrieveLegacyState(value_type index) const
Return the legacy RooCatType corresponding to index. If it doesn't exist, create one.
void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValueDirty=true) override
Copy the cached value from given source and raise dirty flag.
value_type _currentIndex
Current category state.
Roo1DTable * createTable(const char *label) const
Create a table matching the shape of this category.
void defineStateUnchecked(const std::string &label, value_type index)
Internal version of defineState() that does not check if type already exists.
const RooCatType * defineTypeUnchecked(const char *label, value_type index)
void setTreeBranchStatus(TTree &t, bool active) override
(De)activate associate tree branch
const RooCatType * lookupType(value_type index, bool printError=false) const
Find our type corresponding to the specified index, or return nullptr for no match.
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to ostream.
Int_t getIndex() const
Retrieve the current index. Use getCurrentIndex() for more clarity.
value_type nextAvailableStateIndex() const
bool operator!=(const char *label)
const char * getLabel() const
Retrieve current label. Use getCurrentLabel() for more clarity.
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from stream (dummy for now)
bool isSignType(bool mustHaveZero=false) const
Determine if category has 2 or 3 states with index values -1,0,1.
std::map< std::string, value_type >::const_iterator end() const
Iterator for category state names. Points to pairs of index and name.
std::map< std::string, value_type >::const_iterator begin() const
Iterator for category state names. Points to pairs of index and name.
virtual const std::map< std::string, RooAbsCategory::value_type >::value_type & defineState(const std::string &label)
Define a new state with given label.
virtual value_type evaluate() const =0
Evaluate the category state and return.
int value_type
The type used to denote a specific category state.
bool operator!=(const RooAbsArg &other)
Int_t numTypes(const char *=nullptr) const
Return number of types defined (in range named rangeName if rangeName!=nullptr)
void syncCache(const RooArgSet *set=nullptr) override
Explicitly synchronize RooAbsCategory internal cache.
const std::map< std::string, value_type >::value_type & getOrdinal(unsigned int n) const
Return name and index of the nth defined state.
std::size_t size() const
Number of states defined.
RooFit::OwningPtr< RooAbsArg > createFundamental(const char *newname=nullptr) const override
Create a RooCategory fundamental object with our properties.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print info about this object to the specified stream.
std::map< value_type, std::unique_ptr< RooCatType, std::function< void(RooCatType *)> > > _legacyStates
! Map holding pointers to RooCatType instances. Only for legacy interface. Don't use if possible.
bool isIdentical(const RooAbsArg &other, bool assumeSameType=false) const override
~RooAbsCategory() override
Destructor.
std::vector< std::string > _insertionOrder
Keeps track in which order state numbers have been inserted. Make sure this is updated in recomputeSh...
std::map< std::string, value_type > _stateNames
Map state names to index numbers. Make sure state names are updated in recomputeShape().
bool isValid() const override
WVE (08/21/01) Probably obsolete now.
const RooCatType * defineType(const char *label)
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.
void attachToVStore(RooVectorDataStore &vstore) override
Attach the category index and label to as branches to the given vector store.
static const decltype(_stateNames) ::value_type & invalidCategory()
A category state to signify an invalid category.
value_type lookupIndex(const std::string &stateName) const
Find the index number corresponding to the state name.
std::unique_ptr< TreeReadBuffer > _treeReadBuffer
void attachToTree(TTree &t, Int_t bufSize=32000) override
Attach the category index and label as branches to the given TTree.
void fillTreeBranch(TTree &t) override
Fill tree branches associated with current object with current value.
bool empty() const
If there are no states defined.
bool isCategory() const override
void clearTypes()
Delete all currently defined states.
void printValue(std::ostream &os) const override
Print value (label name)
bool operator!=(value_type index)
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCatType is an auxiliary class for RooAbsCategory and defines a a single category state.
Uses std::vector to store data columns.
Iterator abstract base class.
A TTree represents a columnar dataset.
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...