ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "Riosfwd.h"
20 #include "RooAbsCategory.h"
21 #include "RooAbsLValue.h"
22 
24 public:
25  // Constructor, assignment etc.
27  // Default constructor
28  } ;
29  RooAbsCategoryLValue(const char *name, const char *title);
30  RooAbsCategoryLValue(const RooAbsCategoryLValue& other, const char* name=0) ;
31  virtual ~RooAbsCategoryLValue();
32 
33  // Value modifiers
34  virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE) = 0 ;
35  virtual Bool_t setLabel(const char* label, Bool_t printError=kTRUE) = 0 ;
36  RooAbsArg& operator=(int index) ;
37  RooAbsArg& operator=(const char* label) ;
38  RooAbsArg& operator=(const RooAbsCategory& other) ;
39 
40  // Binned fit interface
41  virtual void setBin(Int_t ibin, const char* rangeName=0) ;
42  virtual Int_t getBin(const char* rangeName=0) const ;
43  virtual Int_t numBins(const char* rangeName) const ;
44  virtual Double_t getBinWidth(Int_t /*i*/, const char* /*rangeName*/=0) const {
45  // Return volume of i-th bin (according to binning named rangeName if rangeName!=0)
46  return 1.0 ;
47  }
48  virtual Double_t volume(const char* rangeName) const {
49  // Return span of range with given name (=number of states included in this range)
50  return numTypes(rangeName) ;
51  }
52  virtual void randomize(const char* rangeName=0);
53 
54  virtual const RooAbsBinning* getBinningPtr(const char* /*rangeName*/) const { return 0 ; }
55  virtual std::list<std::string> getBinningNames() const { return std::list<std::string>(1, "") ; }
56  virtual Int_t getBin(const RooAbsBinning* /*ptr*/) const { return getBin((const char*)0) ; }
57 
58 
59  inline void setConstant(Bool_t value= kTRUE) {
60  // Declare category constant
61  setAttribute("Constant",value);
62  }
63 
64  inline virtual Bool_t isLValue() const {
65  // Object is an l-value
66  return kTRUE;
67  }
68 
69  // I/O streaming interface (machine readable)
70  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
71  virtual void writeToStream(std::ostream& os, Bool_t compact) const ;
72 
73 protected:
74 
75  friend class RooSimGenContext ;
76  friend class RooSimSplitGenContext ;
77  virtual void setIndexFast(Int_t index) { _value._value = index ; _value._label[0]=0 ; }
78 
79  Bool_t setOrdinal(UInt_t index, const char* rangeName);
80  void copyCache(const RooAbsArg* source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE) ;
81 
82  ClassDef(RooAbsCategoryLValue,1) // Abstract modifiable index variable
83 };
84 
85 #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:266
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream (dummy implementation)
virtual std::list< std::string > getBinningNames() const
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
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void setIndexFast(Int_t index)
RooSimSplitGenContext is an efficient implementation of the generator context specific for RooSimulta...
Bool_t setOrdinal(UInt_t index, const char *rangeName)
Set our state to our n'th defined type and return kTRUE.
virtual void randomize(const char *rangeName=0)
Randomize current value.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Int_t numTypes(const char *=0) const
char _label[256]
Definition: RooCatType.h:104
virtual Bool_t isLValue() const
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual Int_t getBin(const RooAbsBinning *) const
Int_t _value
Definition: RooCatType.h:103
RooSimGenContext is an efficient implementation of the generator context specific for RooSimultaneous...
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual Double_t getBinWidth(Int_t, const char *=0) const
virtual Int_t numBins(const char *rangeName) const
Returm the number of fit bins ( = number of types )
unsigned int UInt_t
Definition: RtypesCore.h:42
bool verbose
void setConstant(Bool_t value=kTRUE)
virtual const RooAbsBinning * getBinningPtr(const char *) const
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.
#define name(a, b)
Definition: linkTestLib0.cpp:5
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 Double_t volume(const char *rangeName) const
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:27
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
const Bool_t kTRUE
Definition: Rtypes.h:91
RooAbsArg & operator=(int index)
Assignment operator from integer index number.
float value
Definition: math.cpp:443
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to given stream (dummy implementation)
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)=0
virtual Int_t getBin(const char *rangeName=0) const
Get index of plot bin for current value this category.