Logo ROOT   6.14/05
Reference Guide
RooAbsCategoryLValue.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooAbsCategoryLValue.h,v 1.22 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 #ifndef ROO_ABS_CATEGORY_LVALUE
17 #define ROO_ABS_CATEGORY_LVALUE
18 
19 #include "RooAbsCategory.h"
20 #include "RooAbsLValue.h"
21 
23 public:
24  // Constructor, assignment etc.
26  // Default constructor
27  } ;
28  RooAbsCategoryLValue(const char *name, const char *title);
29  RooAbsCategoryLValue(const RooAbsCategoryLValue& other, const char* name=0) ;
30  virtual ~RooAbsCategoryLValue();
31 
32  // Value modifiers
33  virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE) = 0 ;
34  virtual Bool_t setLabel(const char* label, Bool_t printError=kTRUE) = 0 ;
35  RooAbsArg& operator=(int index) ;
36  RooAbsArg& operator=(const char* label) ;
37  RooAbsArg& operator=(const RooAbsCategory& other) ;
38 
39  // Binned fit interface
40  virtual void setBin(Int_t ibin, const char* rangeName=0) ;
41  virtual Int_t getBin(const char* rangeName=0) const ;
42  virtual Int_t numBins(const char* rangeName) const ;
43  virtual Double_t getBinWidth(Int_t /*i*/, const char* /*rangeName*/=0) const {
44  // Return volume of i-th bin (according to binning named rangeName if rangeName!=0)
45  return 1.0 ;
46  }
47  virtual Double_t volume(const char* rangeName) const {
48  // Return span of range with given name (=number of states included in this range)
49  return numTypes(rangeName) ;
50  }
51  virtual void randomize(const char* rangeName=0);
52 
53  virtual const RooAbsBinning* getBinningPtr(const char* /*rangeName*/) const { return 0 ; }
54  virtual std::list<std::string> getBinningNames() const { return std::list<std::string>(1, "") ; }
55  virtual Int_t getBin(const RooAbsBinning* /*ptr*/) const { return getBin((const char*)0) ; }
56 
57 
58  inline void setConstant(Bool_t value= kTRUE) {
59  // Declare category constant
60  setAttribute("Constant",value);
61  }
62 
63  inline virtual Bool_t isLValue() const {
64  // Object is an l-value
65  return kTRUE;
66  }
67 
68  // I/O streaming interface (machine readable)
69  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
70  virtual void writeToStream(std::ostream& os, Bool_t compact) const ;
71 
72 protected:
73 
74  friend class RooSimGenContext ;
75  friend class RooSimSplitGenContext ;
76  virtual void setIndexFast(Int_t index) { _value._value = index ; _value._label[0]=0 ; }
77 
78  Bool_t setOrdinal(UInt_t index, const char* rangeName);
79  void copyCache(const RooAbsArg* source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE) ;
80 
81  ClassDef(RooAbsCategoryLValue,1) // Abstract modifiable index variable
82 };
83 
84 #endif
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:240
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream (dummy implementation)
RooCatType _value
Transient cache for byte values from tree branches.
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void setIndexFast(Int_t index)
RooSimSplitGenContext is an efficient implementation of the generator context specific for RooSimulta...
virtual Double_t volume(const char *rangeName) const
Bool_t setOrdinal(UInt_t index, const char *rangeName)
Set our state to our n&#39;th defined type and return kTRUE.
virtual void randomize(const char *rangeName=0)
Randomize current value.
virtual Int_t getBin(const char *rangeName=0) const
Get index of plot bin for current value this category.
virtual Int_t numBins(const char *rangeName) const
Returm the number of fit bins ( = number of types )
Int_t numTypes(const char *=0) const
#define ClassDef(name, id)
Definition: Rtypes.h:320
char _label[256]
Definition: RooCatType.h:103
virtual Bool_t isLValue() const
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to given stream (dummy implementation)
Int_t _value
Definition: RooCatType.h:102
RooSimGenContext is an efficient implementation of the generator context specific for RooSimultaneous...
unsigned int UInt_t
Definition: RtypesCore.h:42
void setConstant(Bool_t value=kTRUE)
virtual const RooAbsBinning * getBinningPtr(const char *) const
const Bool_t kFALSE
Definition: RtypesCore.h:88
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
double Double_t
Definition: RtypesCore.h:55
void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy the cached value from given source and raise dirty flag.
virtual ~RooAbsCategoryLValue()
Destructor.
virtual Double_t getBinWidth(Int_t, const char *=0) const
virtual Int_t getBin(const RooAbsBinning *) const
virtual void setBin(Int_t ibin, const char *rangeName=0)
Set category to i-th fit bin, which is the i-th registered state.
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
virtual std::list< std::string > getBinningNames() const
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:26
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
RooAbsArg & operator=(int index)
Assignment operator from integer index number.
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)=0