Logo ROOT   6.16/01
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
23public:
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
72protected:
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
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:324
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:241
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)=0
virtual Double_t volume(const char *rangeName) const
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 Int_t getBin(const char *rangeName=0) const
Get index of plot bin for current value this category.
virtual void randomize(const char *rangeName=0)
Randomize current value.
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream (dummy implementation)
virtual const RooAbsBinning * getBinningPtr(const char *) 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.
virtual void setIndexFast(Int_t index)
void setConstant(Bool_t value=kTRUE)
virtual ~RooAbsCategoryLValue()
Destructor.
virtual Int_t getBin(const RooAbsBinning *) const
virtual std::list< std::string > getBinningNames() const
virtual Double_t getBinWidth(Int_t, const char *=0) const
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to given stream (dummy implementation)
RooAbsArg & operator=(int index)
Assignment operator from integer index number.
virtual Bool_t isLValue() const
virtual Int_t numBins(const char *rangeName) const
Returm the number of fit bins ( = number of types )
Bool_t setOrdinal(UInt_t index, const char *rangeName)
Set our state to our n'th defined type and return kTRUE.
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooCatType _value
Transient cache for byte values from tree branches.
Int_t numTypes(const char *=0) const
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:26
char _label[256]
Definition: RooCatType.h:103
Int_t _value
Definition: RooCatType.h:102
RooSimGenContext is an efficient implementation of the generator context specific for RooSimultaneous...
RooSimSplitGenContext is an efficient implementation of the generator context specific for RooSimulta...