Logo ROOT   6.08/07
Reference Guide
RooErrorVar.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooErrorVar.h,v 1.16 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_ERROR_VAR
17 #define ROO_ERROR_VAR
18 
19 #include "Riosfwd.h"
20 #include <math.h>
21 #include <float.h>
22 
23 #include "RooNumber.h"
24 #include "RooAbsReal.h"
25 #include "RooRealVar.h"
26 #include "RooRealProxy.h"
27 class RooVectorDataStore ;
28 
29 class RooErrorVar : public RooAbsRealLValue {
30 public:
31  // Constructors, assignment etc.
32  inline RooErrorVar() {
33  // Default constructor
34  }
35  RooErrorVar(const char *name, const char *title, const RooRealVar& input) ;
36  RooErrorVar(const RooErrorVar& other, const char* name=0);
37  virtual TObject* clone(const char* newname) const { return new RooErrorVar(*this,newname); }
38  virtual ~RooErrorVar() ;
39 
40  virtual Double_t getValV(const RooArgSet* set=0) const ;
41 
42  virtual Double_t evaluate() const {
43  // return error of input RooRealVar
44  return ((RooRealVar&)_realVar.arg()).getError() ;
45  }
46 
47  virtual void setVal(Double_t value) {
48  // Set error of input RooRealVar to value
49  ((RooRealVar&)_realVar.arg()).setVal(value) ;
50  }
51 
52  inline virtual Bool_t isFundamental() const {
53  // Return kTRUE as we implement a fundamental type of AbsArg that can be stored in a dataset
54  return kTRUE ;
55  }
56 
57  // I/O streaming interface (machine readable)
58  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
59  virtual void writeToStream(std::ostream& os, Bool_t compact) const ;
60 
61  // Set/get finite fit range limits
62  inline void setMin(Double_t value) {
63  // Set lower bound of default range to value
64  setMin(0,value) ;
65  }
66  inline void setMax(Double_t value) {
67  // Set upper bound of default range to value
68  setMax(0,value) ;
69  }
70  inline void setRange(Double_t min, Double_t max) {
71  // Set default ranges to [min,max]
72  setRange(0,min,max) ;
73  }
74  void setMin(const char* name, Double_t value) ;
75  void setMax(const char* name, Double_t value) ;
76  void setRange(const char* name, Double_t min, Double_t max) ;
77 
78  void setBins(Int_t nBins) {
79  // Set default binning to nBins uniform bins
81  }
82  void setBinning(const RooAbsBinning& binning, const char* name=0) ;
83  const RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const ;
84  RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) ;
85  Bool_t hasBinning(const char* name) const ;
86  std::list<std::string> getBinningNames() const ;
87 
88  // Set infinite fit range limits
89  inline void removeMin(const char* name=0) {
90  // Remove lower bound from named binning, or default binning if name is null
92  }
93  inline void removeMax(const char* name=0) {
94  // Remove upper bound from named binning, or default binning if name is null
96  }
97  inline void removeRange(const char* name=0) {
98  // Remove both upper and lower bounds from named binning, or
99  // default binning if name is null
101  }
102 
103  using RooAbsRealLValue::operator= ;
105 
106 protected:
107 
108  RooLinkedList _altBinning ; //! Optional alternative ranges and binnings
109 
110  void syncCache(const RooArgSet* set=0) ;
111 
112  RooRealProxy _realVar ; // RealVar with the original error
113  RooAbsBinning* _binning ; //! Pointer to default binning definition
114 
115  ClassDef(RooErrorVar,1) // RooAbsRealLValue representation of an error of a RooRealVar
116 };
117 
118 #endif
virtual Double_t getMin(const char *name=0) const
void removeMin(const char *name=0)
Definition: RooErrorVar.h:89
virtual Bool_t isFundamental() const
Definition: RooErrorVar.h:52
void removeRange(const char *name=0)
Definition: RooErrorVar.h:97
virtual void setMin(Double_t xlo)
Definition: RooAbsBinning.h:51
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream.
virtual Double_t getMax(const char *name=0) const
virtual Double_t evaluate() const
Definition: RooErrorVar.h:42
virtual TObject * clone(const char *newname) const
Definition: RooErrorVar.h:37
void setBinning(const RooAbsBinning &binning, const char *name=0)
Store given binning with this variable under the given name.
void syncCache(const RooArgSet *set=0)
Optional alternative ranges and binnings.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Bool_t hasBinning(const char *name) const
Return true if we have binning with given name.
RooAbsBinning * _binning
Definition: RooErrorVar.h:113
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void setRange(Double_t xlo, Double_t xhi)=0
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
RooErrorVar is an auxilary class that represents the error of a RooRealVar as a seperate object...
Definition: RooErrorVar.h:29
RooRealProxy _realVar
Definition: RooErrorVar.h:112
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
virtual void setVal(Double_t value)
Definition: RooErrorVar.h:47
virtual ~RooErrorVar()
Destructor.
Definition: RooErrorVar.cxx:83
RooLinkedList _altBinning
Definition: RooErrorVar.h:108
void setRange(Double_t min, Double_t max)
Definition: RooErrorVar.h:70
bool verbose
static Double_t infinity()
Return internal infinity representation.
Definition: RooNumber.cxx:49
void setMax(Double_t value)
Definition: RooErrorVar.h:66
virtual void setVal(Double_t value)=0
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
RooUniformBinning is an implementation of RooAbsBinning that provides a uniform binning in &#39;n&#39; bins b...
double Double_t
Definition: RtypesCore.h:55
std::list< std::string > getBinningNames() const
Get a list of all binning names.
void removeMax(const char *name=0)
Definition: RooErrorVar.h:93
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
Definition: RooRealProxy.h:23
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write value to stream.
void setMin(Double_t value)
Definition: RooErrorVar.h:62
void setBins(Int_t nBins)
Definition: RooErrorVar.h:78
char name[80]
Definition: TGX11.cxx:109
virtual void setMax(Double_t xhi)
Definition: RooAbsBinning.h:55
virtual Double_t getValV(const RooArgSet *set=0) const
Return value, i.e. error on input variable.
Definition: RooErrorVar.cxx:93
const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const
Return binning with given name.