Logo ROOT  
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 "RooAbsReal.h"
20 #include "RooRealVar.h"
21 #include "RooRealProxy.h"
22 
23 #include <list>
24 #include <string>
25 
26 class RooVectorDataStore;
27 
28 class RooErrorVar : public RooAbsRealLValue {
29 public:
30  // Constructors, assignment etc.
31  inline RooErrorVar() {
32  // Default constructor
33  }
34  RooErrorVar(const char *name, const char *title, const RooRealVar& input) ;
35  RooErrorVar(const RooErrorVar& other, const char* name=0);
36  virtual TObject* clone(const char* newname) const { return new RooErrorVar(*this,newname); }
37  virtual ~RooErrorVar() ;
38 
39  virtual Double_t getValV(const RooArgSet* set=0) const ;
40 
41  virtual Double_t evaluate() const {
42  // return error of input RooRealVar
43  return ((RooRealVar&)_realVar.arg()).getError() ;
44  }
45 
46  virtual void setVal(Double_t value) {
47  // Set error of input RooRealVar to value
48  ((RooRealVar&)_realVar.arg()).setVal(value) ;
49  }
50 
51  inline virtual Bool_t isFundamental() const {
52  // Return kTRUE as we implement a fundamental type of AbsArg that can be stored in a dataset
53  return kTRUE ;
54  }
55 
56  // I/O streaming interface (machine readable)
57  virtual Bool_t readFromStream(std::istream& is, Bool_t compact, Bool_t verbose=kFALSE) ;
58  virtual void writeToStream(std::ostream& os, Bool_t compact) const ;
59 
60  // Set/get finite fit range limits
61  inline void setMin(Double_t value) {
62  // Set lower bound of default range to value
63  setMin(0,value) ;
64  }
65  inline void setMax(Double_t value) {
66  // Set upper bound of default range to value
67  setMax(0,value) ;
68  }
69  inline void setRange(Double_t min, Double_t max) {
70  // Set default ranges to [min,max]
71  setRange(0,min,max) ;
72  }
73  void setMin(const char* name, Double_t value) ;
74  void setMax(const char* name, Double_t value) ;
75  void setRange(const char* name, Double_t min, Double_t max) ;
76 
77  void setBins(Int_t nBins);
78  void setBinning(const RooAbsBinning& binning, const char* name=0) ;
79  const RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const ;
80  RooAbsBinning& getBinning(const char* name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) ;
81  Bool_t hasBinning(const char* name) const ;
82  std::list<std::string> getBinningNames() const ;
83 
84  // Set infinite fit range limits
85  void removeMin(const char* name=0);
86  void removeMax(const char* name=0);
87  void removeRange(const char* name=0);
88 
89  using RooAbsRealLValue::operator= ;
91 
92 protected:
93 
94  RooLinkedList _altBinning ; //! Optional alternative ranges and binnings
95 
96  void syncCache(const RooArgSet* set=0) ;
97 
98  RooRealProxy _realVar ; // RealVar with the original error
99  RooAbsBinning* _binning ; //! Pointer to default binning definition
100 
101  ClassDef(RooErrorVar,1) // RooAbsRealLValue representation of an error of a RooRealVar
102 };
103 
104 #endif
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsReal.h
RooErrorVar::setMin
void setMin(Double_t value)
Definition: RooErrorVar.h:61
RooTemplateProxy::arg
const T & arg() const
Return reference to object held in proxy.
Definition: RooTemplateProxy.h:259
RooErrorVar::getValV
virtual Double_t getValV(const RooArgSet *set=0) const
Return value, i.e. error on input variable.
Definition: RooErrorVar.cxx:88
RooErrorVar::hasBinning
Bool_t hasBinning(const char *name) const
Return true if we have binning with given name.
Definition: RooErrorVar.cxx:98
RooErrorVar::setBins
void setBins(Int_t nBins)
Set default binning to nBins uniform bins.
Definition: RooErrorVar.cxx:275
RooErrorVar::removeRange
void removeRange(const char *name=0)
Remove both upper and lower bounds from named binning, or default binning if name is null.
Definition: RooErrorVar.cxx:180
RooErrorVar::_realVar
RooRealProxy _realVar
Definition: RooErrorVar.h:98
RooErrorVar::~RooErrorVar
virtual ~RooErrorVar()
Destructor.
Definition: RooErrorVar.cxx:78
RooErrorVar::removeMin
void removeMin(const char *name=0)
Remove lower bound from named binning, or default binning if name is null.
Definition: RooErrorVar.cxx:167
RooErrorVar::isFundamental
virtual Bool_t isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
Definition: RooErrorVar.h:51
RooErrorVar
RooErrorVar is an auxilary class that represents the error of a RooRealVar as a seperate object.
Definition: RooErrorVar.h:28
RooErrorVar::evaluate
virtual Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition: RooErrorVar.h:41
RooErrorVar::setVal
virtual void setVal(Double_t value)
Set the current value of the object. Needs to be overridden by implementations.
Definition: RooErrorVar.h:46
bool
RooErrorVar::_altBinning
RooLinkedList _altBinning
Definition: RooErrorVar.h:94
RooErrorVar::setBinning
void setBinning(const RooAbsBinning &binning, const char *name=0)
Store given binning with this variable under the given name.
Definition: RooErrorVar.cxx:188
RooErrorVar::setVal
virtual void setVal(Double_t value)=0
Set the current value of the object. Needs to be overridden by implementations.
RooErrorVar::_binning
RooAbsBinning * _binning
Definition: RooErrorVar.h:99
RooErrorVar::setMax
void setMax(Double_t value)
Definition: RooErrorVar.h:65
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooLinkedList
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
RooAbsBinning
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:26
RooRealProxy.h
RooErrorVar::removeMax
void removeMax(const char *name=0)
Remove upper bound from named binning, or default binning if name is null.
Definition: RooErrorVar.cxx:173
RooRealVar.h
RooErrorVar::writeToStream
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write value to stream.
Definition: RooErrorVar.cxx:336
RooTemplateProxy< RooAbsReal >
Double_t
double Double_t
Definition: RtypesCore.h:59
RooErrorVar::getBinning
const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const
Return binning with given name.
Definition: RooErrorVar.cxx:109
RooErrorVar::RooErrorVar
RooErrorVar()
Definition: RooErrorVar.h:31
RooErrorVar::setRange
void setRange(Double_t min, Double_t max)
Definition: RooErrorVar.h:69
RooVectorDataStore
RooVectorDataStore uses std::vectors to store data columns.
Definition: RooVectorDataStore.h:36
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooErrorVar::clone
virtual TObject * clone(const char *newname) const
Definition: RooErrorVar.h:36
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooAbsRealLValue::setVal
virtual void setVal(Double_t value)=0
Set the current value of the object. Needs to be overridden by implementations.
RooErrorVar::readFromStream
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream.
Definition: RooErrorVar.cxx:313
RooErrorVar::getBinningNames
std::list< std::string > getBinningNames() const
Get a list of all binning names.
Definition: RooErrorVar.cxx:152
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
int
RooErrorVar::syncCache
void syncCache(const RooArgSet *set=0)
Optional alternative ranges and binnings.
Definition: RooErrorVar.cxx:345