Logo ROOT   6.16/01
Reference Guide
RooAbsRealLValue.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsRealLValue.h,v 1.37 2007/07/13 21:50:24 wouter 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_REAL_LVALUE
17#define ROO_ABS_REAL_LVALUE
18
19#include <cmath>
20#include <float.h>
21#include "TString.h"
22
23#include "RooAbsReal.h"
24#include "RooNumber.h"
25#include "RooAbsLValue.h"
26#include "RooAbsBinning.h"
27
28class RooArgSet ;
29
31public:
32 // Constructors, assignment etc.
33 inline RooAbsRealLValue() { }
34 RooAbsRealLValue(const char *name, const char *title, const char *unit= "") ;
35 RooAbsRealLValue(const RooAbsRealLValue& other, const char* name=0);
36 virtual ~RooAbsRealLValue();
37
38 // Parameter value and error accessors
39 virtual void setVal(Double_t value)=0;
40 virtual RooAbsArg& operator=(const RooAbsReal& other) ;
41 virtual RooAbsArg& operator=(Double_t newValue);
42 virtual RooAbsArg& operator=(Int_t ival) { return operator=((Double_t)ival) ; }
43
44 // Implementation of RooAbsLValue
45 virtual void setBin(Int_t ibin, const char* rangeName=0) ;
46 virtual Int_t getBin(const char* rangeName=0) const { return getBinning(rangeName).binNumber(getVal()) ; }
47 virtual Int_t numBins(const char* rangeName=0) const { return getBins(rangeName) ; }
48 virtual Double_t getBinWidth(Int_t i, const char* rangeName=0) const { return getBinning(rangeName).binWidth(i) ; }
49 virtual Double_t volume(const char* rangeName) const { return getMax(rangeName)-getMin(rangeName) ; }
50 virtual void randomize(const char* rangeName=0);
51
52 virtual const RooAbsBinning* getBinningPtr(const char* rangeName) const { return &getBinning(rangeName) ; }
53 virtual Int_t getBin(const RooAbsBinning* ptr) const { return ptr->binNumber(getVal()) ; }
54
55 virtual void setBin(Int_t ibin, const RooAbsBinning& binning) ;
56 virtual Int_t getBin(const RooAbsBinning& binning) const { return binning.binNumber(getVal()) ; }
57 virtual Int_t numBins(const RooAbsBinning& binning) const { return binning.numBins() ; }
58 virtual Double_t getBinWidth(Int_t i, const RooAbsBinning& binning) const { return binning.binWidth(i) ; }
59 virtual Double_t volume(const RooAbsBinning& binning) const { return binning.highBound() - binning.lowBound() ; }
60 virtual void randomize(const RooAbsBinning& binning) ;
61
62
63 virtual void setBinFast(Int_t ibin, const RooAbsBinning& binning) ;
64
65 // Get fit range limits
66
67 virtual const RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const = 0 ;
68 virtual RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) = 0 ;
69 virtual Bool_t hasBinning(const char* name) const = 0 ;
70 virtual Bool_t inRange(const char* name) const ;
71 virtual Int_t getBins(const char* name=0) const { return getBinning(name).numBins(); }
72 virtual Double_t getMin(const char* name=0) const { return getBinning(name).lowBound(); }
73 virtual Double_t getMax(const char* name=0) const { return getBinning(name).highBound(); }
74 inline Bool_t hasMin(const char* name=0) const { return !RooNumber::isInfinite(getMin(name)); }
75 inline Bool_t hasMax(const char* name=0) const { return !RooNumber::isInfinite(getMax(name)); }
76 virtual Bool_t hasRange(const char* name) const { return hasBinning(name) ; }
77
78 // Jacobian term management
79 virtual Bool_t isJacobianOK(const RooArgSet& depList) const ;
80 virtual Double_t jacobian() const { return 1 ; }
81
82 inline virtual Bool_t isLValue() const { return kTRUE; }
83
84 // Test a value against our fit range
85 Bool_t inRange(Double_t value, const char* rangeName, Double_t* clippedValue=0) const;
86 virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const ;
87
88 // Constant and Projected flags
89 inline void setConstant(Bool_t value= kTRUE) { setAttribute("Constant",value); setValueDirty() ; setShapeDirty() ; }
90
91 // I/O streaming interface (machine readable)
92 virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
93 virtual void writeToStream(std::ostream& os, Bool_t compact) const ;
94
95 // Printing interface (human readable)
96 virtual void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
97
98
99 // Build 1-dimensional plots
100 RooPlot* frame(const RooCmdArg& arg1, const RooCmdArg& arg2=RooCmdArg::none(),
101 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),
102 const RooCmdArg& arg6=RooCmdArg::none(), const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
103 RooPlot *frame(const RooLinkedList& cmdList) const ;
104 RooPlot *frame(Double_t lo, Double_t hi, Int_t nbins) const;
105 RooPlot *frame(Double_t lo, Double_t hi) const;
106 RooPlot *frame(Int_t nbins) const;
107 RooPlot *frame() const;
108
109 // Create empty 1,2, and 3D histograms from a list of 1-3 RooAbsReals
110 TH1 *createHistogram(const char *name,
111 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),
112 const RooCmdArg& arg3=RooCmdArg::none(), const RooCmdArg& arg4=RooCmdArg::none(),
113 const RooCmdArg& arg5=RooCmdArg::none(), const RooCmdArg& arg6=RooCmdArg::none(),
114 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none()) const ;
115 TH1 *createHistogram(const char *name, const RooLinkedList& cmdList) const ;
116
117 TH1F *createHistogram(const char *name, const char *yAxisLabel) const ;
118 TH1F *createHistogram(const char *name, const char *yAxisLabel, Double_t xlo, Double_t xhi, Int_t nBins) const ;
119 TH1F *createHistogram(const char *name, const char *yAxisLabel, const RooAbsBinning& bins) const ;
120
121 TH2F *createHistogram(const char *name, const RooAbsRealLValue &yvar, const char *zAxisLabel=0,
122 Double_t* xlo=0, Double_t* xhi=0, Int_t* nBins=0) const ;
123 TH2F *createHistogram(const char *name, const RooAbsRealLValue &yvar, const char *zAxisLabel, const RooAbsBinning** bins) const ;
124
125
126 TH3F *createHistogram(const char *name, const RooAbsRealLValue &yvar, const RooAbsRealLValue &zvar,
127 const char *tAxisLabel, Double_t* xlo=0, Double_t* xhi=0, Int_t* nBins=0) const ;
128 TH3F *createHistogram(const char *name, const RooAbsRealLValue &yvar, const RooAbsRealLValue &zvar, const char* tAxisLabel, const RooAbsBinning** bins) const ;
129
130 static TH1* createHistogram(const char *name, RooArgList &vars, const char *tAxisLabel, Double_t* xlo, Double_t* xhi, Int_t* nBins) ;
131 static TH1* createHistogram(const char *name, RooArgList &vars, const char *tAxisLabel, const RooAbsBinning** bins) ;
132
133protected:
134
135 friend class RooRealBinding ;
136
137 virtual void setValFast(Double_t value) { setVal(value) ; }
138
139 virtual void setVal(Double_t value, const char* /*rangeName*/) {
140 // Set object value to 'value'
141 return setVal(value) ;
142 }
144 void copyCache(const RooAbsArg* source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE) ;
145
146 ClassDef(RooAbsRealLValue,1) // Abstract modifiable real-valued object
147};
148
149#endif
int Int_t
Definition: RtypesCore.h:41
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
float type_of_call hi(const int &, const int &)
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
void setShapeDirty() const
Definition: RooAbsArg.h:442
void setValueDirty() const
Definition: RooAbsArg.h:441
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
Int_t numBins() const
Definition: RooAbsBinning.h:37
virtual Double_t highBound() const =0
virtual Int_t binNumber(Double_t x) const =0
virtual Double_t lowBound() const =0
virtual Double_t binWidth(Int_t bin) const =0
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:26
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getBinWidth(Int_t i, const char *rangeName=0) const
virtual Double_t getMax(const char *name=0) const
Bool_t hasMax(const char *name=0) const
void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy cache of another RooAbsArg to our cache.
virtual void setVal(Double_t value, const char *)
virtual const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const =0
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Check if given value is valid.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
virtual Double_t volume(const char *rangeName) const
virtual void setBin(Int_t ibin, const char *rangeName=0)
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
virtual void setVal(Double_t value)=0
virtual Int_t numBins(const char *rangeName=0) const
virtual Double_t getBinWidth(Int_t i, const RooAbsBinning &binning) const
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream.
virtual Bool_t hasRange(const char *name) const
virtual void randomize(const char *rangeName=0)
Set a new value sampled from a uniform distribution over the fit range.
virtual Bool_t isLValue() const
RooPlot * frame() const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
virtual Int_t getBin(const RooAbsBinning *ptr) const
virtual RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE)=0
TH1 * createHistogram(const char *name, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to given stream.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const
virtual Bool_t hasBinning(const char *name) const =0
virtual RooAbsArg & operator=(const RooAbsReal &other)
Assignment operator from other RooAbsReal.
virtual Int_t getBin(const RooAbsBinning &binning) const
virtual RooAbsArg & operator=(Int_t ival)
virtual Bool_t inRange(const char *name) const
Check if current value is inside range with given name.
virtual Bool_t isJacobianOK(const RooArgSet &depList) const
virtual Int_t getBins(const char *name=0) const
virtual void setValFast(Double_t value)
virtual Double_t volume(const RooAbsBinning &binning) const
void setConstant(Bool_t value=kTRUE)
virtual Double_t jacobian() const
Bool_t hasMin(const char *name=0) const
virtual ~RooAbsRealLValue()
Destructor.
virtual Double_t getMin(const char *name=0) const
virtual Int_t numBins(const RooAbsBinning &binning) const
virtual Int_t getBin(const char *rangeName=0) const
Bool_t fitRangeOKForPlotting() const
Check if fit range is usable as plot range, i.e.
virtual void setBinFast(Int_t ibin, const RooAbsBinning &binning)
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
Double_t getVal(const RooArgSet *set=0) const
Evaluate object. Returns either cached value or triggers a recalculation.
Definition: RooAbsReal.h:64
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:50
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
static Int_t isInfinite(Double_t x)
Return true if x is infinite by RooNumBer internal specification.
Definition: RooNumber.cxx:58
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:41
Lightweight interface adaptor that binds a RooAbsReal object to a subset of its servers and present i...
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:571
The TH1 histogram class.
Definition: TH1.h:56
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:250
3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:267
Basic string class.
Definition: TString.h:131