Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
27
29public:
30 // Constructors, assignment etc.
31 /// Default constructor
32 inline RooErrorVar() {
33 }
34 RooErrorVar(const char *name, const char *title, const RooRealVar& input) ;
35 RooErrorVar(const RooErrorVar& other, const char* name=nullptr);
36 TObject* clone(const char* newname) const override { return new RooErrorVar(*this,newname); }
37 ~RooErrorVar() override ;
38
39 double getValV(const RooArgSet* set=nullptr) const override ;
40
41 double evaluate() const override {
42 // return error of input RooRealVar
43 return ((RooRealVar&)_realVar.arg()).getError() ;
44 }
45
46 void setVal(double value) override {
47 // Set error of input RooRealVar to value
49 }
50
51 inline bool isFundamental() const override {
52 // Return true as we implement a fundamental type of AbsArg that can be stored in a dataset
53 return true ;
54 }
55
56 // I/O streaming interface (machine readable)
57 bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
58 void writeToStream(std::ostream& os, bool compact) const override ;
59
60 // Set/get finite fit range limits
61 /// Set lower bound of default range to value
62 inline void setMin(double value) {
63 setMin(nullptr,value) ;
64 }
65 /// Set upper bound of default range to value
66 inline void setMax(double value) {
67 setMax(nullptr,value) ;
68 }
69 /// Set default ranges to [min,max]
70 inline void setRange(double min, double max) {
71 setRange(nullptr,min,max) ;
72 }
73 void setMin(const char* name, double value) ;
74 void setMax(const char* name, double value) ;
75 void setRange(const char* name, double min, double max) ;
76
77 void setBins(Int_t nBins);
78 void setBinning(const RooAbsBinning& binning, const char* name=nullptr) ;
79 const RooAbsBinning& getBinning(const char* name=nullptr, bool verbose=true, bool createOnTheFly=false) const override ;
80 RooAbsBinning& getBinning(const char* name=nullptr, bool verbose=true, bool createOnTheFly=false) override ;
81 bool hasBinning(const char* name) const override ;
82 std::list<std::string> getBinningNames() const override ;
83
84 // Set infinite fit range limits
85 void removeMin(const char* name=nullptr);
86 void removeMax(const char* name=nullptr);
87 void removeRange(const char* name=nullptr);
88
89 using RooAbsRealLValue::operator= ;
91
92protected:
93
94 RooLinkedList _altBinning ; ///<! Optional alternative ranges and binnings
95
96 void syncCache(const RooArgSet* set=nullptr) override ;
97
98 RooRealProxy _realVar ; ///< RealVar with the original error
99 std::unique_ptr<RooAbsBinning> _binning ; ///<! Pointer to default binning definition
100
101 ClassDefOverride(RooErrorVar,1) // RooAbsRealLValue representation of an error of a RooRealVar
102};
103
104#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
Abstract base class for RooRealVar binning definitions.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
virtual void setVal(double value)=0
Set the current value of the object. Needs to be overridden by implementations.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Auxiliary class that represents the error of a RooRealVar as a separate object.
Definition RooErrorVar.h:28
bool hasBinning(const char *name) const override
Return true if we have binning with given name.
void removeMin(const char *name=nullptr)
Remove lower bound from named binning, or default binning if name is null.
bool isFundamental() const override
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
Definition RooErrorVar.h:51
void setBinning(const RooAbsBinning &binning, const char *name=nullptr)
Store given binning with this variable under the given name.
~RooErrorVar() override
void removeRange(const char *name=nullptr)
Remove both upper and lower bounds from named binning, or default binning if name is null.
void setMax(double value)
Set upper bound of default range to value.
Definition RooErrorVar.h:66
std::list< std::string > getBinningNames() const override
Get a list of all binning names.
RooLinkedList _altBinning
! Optional alternative ranges and binnings
Definition RooErrorVar.h:94
void setRange(double min, double max)
Set default ranges to [min,max].
Definition RooErrorVar.h:70
TObject * clone(const char *newname) const override
Definition RooErrorVar.h:36
void setVal(double value) override
Set the current value of the object. Needs to be overridden by implementations.
Definition RooErrorVar.h:46
double getValV(const RooArgSet *set=nullptr) const override
Return value, i.e. error on input variable.
std::unique_ptr< RooAbsBinning > _binning
! Pointer to default binning definition
Definition RooErrorVar.h:99
RooErrorVar()
Default constructor.
Definition RooErrorVar.h:32
void setMin(double value)
Set lower bound of default range to value.
Definition RooErrorVar.h:62
void syncCache(const RooArgSet *set=nullptr) override
Force the internal value cache to be up to date.
void writeToStream(std::ostream &os, bool compact) const override
Write value to stream.
void removeMax(const char *name=nullptr)
Remove upper bound from named binning, or default binning if name is null.
const RooAbsBinning & getBinning(const char *name=nullptr, bool verbose=true, bool createOnTheFly=false) const override
Return binning with given name.
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition RooErrorVar.h:41
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from given stream.
void setBins(Int_t nBins)
Set default binning to nBins uniform bins.
RooRealProxy _realVar
RealVar with the original error.
Definition RooErrorVar.h:98
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
Variable that can be changed from the outside.
Definition RooRealVar.h:37
const T & arg() const
Return reference to object held in proxy.
Uses std::vector to store data columns.
Mother of all ROOT objects.
Definition TObject.h:41