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