200 if (!assumeSameType) {
271 << index <<
" already assigned" << endl ;
277 << label <<
" already assigned or not allowed" << endl ;
306 if((*type) == other)
return type;
328 if((*type) == index)
return type;
347 if((*type) == label)
return type;
352 Int_t idx=strtol(label,&endptr,10) ;
353 if (endptr==label+strlen(label)) {
356 if((*type) == idx)
return type;
443 os << indent <<
"--- RooAbsCategory ---" << endl;
445 os << indent <<
" ** No values defined **" << endl;
448 os << indent <<
" Value is \"" <<
getLabel() <<
"\" (" <<
getIndex() <<
")" << endl;
449 os << indent <<
" Has the following possible values:" << endl;
487 if (!typeName.CompareTo(
"Int_t")) {
491 <<
" will be interpreted as category index" << endl ;
497 }
else if (!typeName.CompareTo(
"UChar_t")) {
499 <<
" will be interpreted as category index" << endl ;
523 cxcoutD(
Contents) <<
"RooAbsCategory::attachToTree(" <<
GetName() <<
") Fixing compression level of branch " << idxName << endl ;
531 branch = t.
Branch(idxName, ptr, (
const Text_t*)format, bufSize);
540 cxcoutD(
DataHandling) <<
"RooAbsCategory::attachToTree(" <<
GetName() <<
") Fixing compression level of branch " << lblName << endl ;
548 branch = t.
Branch(lblName, ptr, (
const Text_t*)format, bufSize);
569 if (!idxBranch||!lblBranch) {
624 <<
") ERROR: index of source arg " << source->
GetName()
626 <<
"), value not updated" << endl ;
628 }
if (source->
getAttribute(
"UCHARIDXONLY_TREE_BRANCH")) {
636 <<
") ERROR: index of source arg " << source->
GetName()
637 <<
" is invalid (" << tmp
638 <<
"), value not updated" << endl ;
CatVector * addCategory(RooAbsCategory *cat)
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
virtual const char * GetTitle() const
Returns title of object.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValueDirty=kTRUE)
Copy the cached value from given source and raise dirty flag.
void setShapeDirty() const
RooCatType traceEval() const
Recalculate current value and check validity of new result.
virtual Bool_t isValid() const
Check if current value is a valid state.
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from stream (dummy for now)
virtual void setTreeBranchStatus(TTree &t, Bool_t active)
(De)activate associate tree branch
virtual void SetBranchStatus(const char *bname, Bool_t status=1, UInt_t *found=0)
Set branch status to Process or DoNotProcess.
void setBuffer(RooCatType *newBuf)
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'.
TString cleanBranchName() const
Construct a mangled name from the actual name that is free of any math symbols that might be interpre...
RooAbsArg * createFundamental(const char *newname=0) const
Create a RooCategory fundamental object with our properties.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
RooCatType _value
Transient cache for byte values from tree branches.
virtual Int_t getIndex() const
Return index number of current state.
virtual void attachToVStore(RooVectorDataStore &vstore)
Attach the category index and label to as branches to the given vector store.
virtual Bool_t traceEvalHook(RooCatType) const
void SetCompressionLevel(Int_t level=1)
Set compression level.
virtual void printValue(std::ostream &os) const
Print value (label name)
void clearTypes()
Delete all currently defined states.
const RooCatType * getOrdinal(UInt_t n, const char *rangeName=0) const
Return state definition of ordinal nth defined state, needed by the generator mechanism.
static std::string format(double x, double y, int digits, int width)
virtual void syncCache(const RooArgSet *set=0)
Explicitly synchronize RooAbsCategory internal cache.
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns an array iterator.
Iterator abstract base class.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Implement multi-line detailed printing.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
Bool_t isShapeDirty() const
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
Int_t numTypes(const char *=0) const
TString & Append(const char *cs)
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state...
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Print info about this object to the specified stream.
void clearShapeDirty() const
Bool_t isSignType(Bool_t mustHaveZero=kFALSE) const
Determine if category has 2 or 3 states with index values -1,0,1.
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
virtual Int_t Fill()
Loop on all leaves of this branch to fill Basket buffer.
const RooCatType * defineType(const char *label)
Define a new state with given name.
Roo1DTable * createTable(const char *label) const
Create a table matching the shape of this category.
virtual Bool_t isIdentical(const RooAbsArg &other, Bool_t assumeSameType=kFALSE)
virtual RooCatType evaluate() const =0
virtual void attachToTree(TTree &t, Int_t bufSize=32000)
Attach the category index and label to as branches to the given TTree.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Bool_t operator==(Int_t index) const
Equality operator with a integer (compares with state index number)
char * Form(const char *fmt,...)
Bool_t isValidLabel(const char *label) const
Check if state with given name is defined.
virtual const char * GetName() const
Returns name of object.
static void indent(ostringstream &buf, int indent_level)
RooCategory represents a fundamental (non-derived) discrete value object.
virtual ~RooAbsCategory()
Destructor.
void setValueDirty() const
TObjArray * GetListOfLeaves()
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual void SetName(const Text_t *name)
Constructor with name argument.
Mother of all ROOT objects.
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
virtual void fillTreeBranch(TTree &t)
Fill tree branches associated with current object with current value.
virtual TObject * Next()=0
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
Bool_t isValueDirty() const
virtual const char * getLabel() const
Return label string of current state.
A TTree object has a header with a name and a title.
Bool_t isValidIndex(Int_t index) const
Check if state with given index is defined.
void clearValueDirty() const
TObject * At(Int_t idx) const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
A TTree is a list of TBranches.
Int_t GetCompressionLevel() const
Roo1DTable implements a one-dimensional table.
const RooCatType * defineTypeUnchecked(const char *label, Int_t index)
Internal version of defineType that does not check if type already exists.
virtual const Text_t * GetName() const
Returns name of object.
TIterator * typeIterator() const
Return iterator over all defined states.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to ostream.
const RooCatType * lookupType(Int_t index, Bool_t printError=kFALSE) const
Find our type corresponding to the specified index, or return 0 for no match.