 ROOT   Reference Guide RooCurve.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooCurve.h,v 1.24 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_CURVE
17 #define ROO_CURVE
18
19 #include "TGraph.h"
20 #include "RooPlotable.h"
21 #include <list>
22 #include <vector>
23 #include "TMatrixDfwd.h"
24
25 class RooAbsReal;
26 class RooRealVar;
27 class RooAbsFunc;
28 class RooArgSet;
29 class RooAbsRealLValue ;
30 class RooHist ;
31
32 class RooCurve : public TGraph, public RooPlotable {
33 public:
34  RooCurve();
35  enum WingMode { NoWings=0 ,Straight=1, Extended=2 } ;
37  Double_t scaleFactor= 1, const RooArgSet *normVars= 0, Double_t prec= 1e-3, Double_t resolution= 1e-3,
38  Bool_t shiftToZero=kFALSE, WingMode wmode=Extended, Int_t nEvalError=-1, Int_t doEEVal=kFALSE, Double_t eeVal=0,
39  Bool_t showProgress=kFALSE);
40  RooCurve(const char *name, const char *title, const RooAbsFunc &func, Double_t xlo,
41  Double_t xhi, UInt_t minPoints, Double_t prec= 1e-3, Double_t resolution= 1e-3,
42  Bool_t shiftToZero=kFALSE, WingMode wmode=Extended, Int_t nEvalError=-1, Int_t doEEVal=kFALSE, Double_t eeVal=0);
43  virtual ~RooCurve();
44
45  RooCurve(const char* name, const char* title, const RooCurve& c1, const RooCurve& c2, Double_t scale1=1., Double_t scale2=1.) ;
46
47  void addPoint(Double_t x, Double_t y);
48
49  Double_t getFitRangeBinW() const;
50  Double_t getFitRangeNEvt(Double_t xlo, Double_t xhi) const ;
51  Double_t getFitRangeNEvt() const;
52
53
54  virtual void printName(std::ostream& os) const ;
55  virtual void printTitle(std::ostream& os) const ;
56  virtual void printClassName(std::ostream& os) const ;
57  virtual void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const;
58
59  inline virtual void Print(Option_t *options= 0) const {
60  // Printing interface
62  }
63
64  Double_t chiSquare(const RooHist& hist, int nFitParam) const ;
65  Int_t findPoint(Double_t value, Double_t tolerance=1e-10) const ;
66  Double_t average(Double_t lo, Double_t hi) const ;
67  Double_t interpolate(Double_t x, Double_t tolerance=1e-10) const ;
68
69  Bool_t isIdentical(const RooCurve& other, Double_t tol=1e-6) const ;
70
71  RooCurve* makeErrorBand(const std::vector<RooCurve*>& variations, Double_t Z=1) const ;
72  RooCurve* makeErrorBand(const std::vector<RooCurve*>& plusVar, const std::vector<RooCurve*>& minusVar, const TMatrixD& V, Double_t Z=1) const ;
73
74 protected:
75
76  void calcBandInterval(const std::vector<RooCurve*>& variations,Int_t i,Double_t Z,Double_t& lo, Double_t& hi, Bool_t approxGauss) const ;
77  void calcBandInterval(const std::vector<RooCurve*>& plusVar, const std::vector<RooCurve*>& minusVar, Int_t i, const TMatrixD& V,
78  Double_t Z,Double_t& lo, Double_t& hi) const ;
79
80  void initialize();
81  void addPoints(const RooAbsFunc &func, Double_t xlo, Double_t xhi,
82  Int_t minPoints, Double_t prec, Double_t resolution, WingMode wmode,
83  Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0.,std::list<Double_t>* samplingHint=0) ;
84  void addRange(const RooAbsFunc& func, Double_t x1, Double_t x2, Double_t y1,
85  Double_t y2, Double_t minDy, Double_t minDx,
86  Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0.) ;
87
88
89  void shiftCurveToZero(Double_t prevYMax) ;
90
91  Bool_t _showProgress ; //! Show progress indication when adding points
92
93  ClassDef(RooCurve,1) // 1-dimensional smooth curve for use in RooPlots
94 };
95
96 #endif
TMatrixDfwd.h
RooCurve::printTitle
virtual void printTitle(std::ostream &os) const
Print the title of this curve.
Definition: RooCurve.cxx:521
RooCurve::getFitRangeBinW
Double_t getFitRangeBinW() const
Get the bin width associated with this plotable object.
Definition: RooCurve.cxx:502
e
#define e(i)
Definition: RSha256.hxx:103
RooCurve::average
Double_t average(Double_t lo, Double_t hi) const
Return average curve value in [xFirst,xLast] by integrating curve between points and dividing by xLas...
Definition: RooCurve.cxx:606
RooCurve::shiftCurveToZero
void shiftCurveToZero(Double_t prevYMax)
Find lowest point in curve and move all points in curve so that lowest point will go exactly through ...
Definition: RooCurve.cxx:273
Option_t
const char Option_t
Definition: RtypesCore.h:66
RooCurve::~RooCurve
virtual ~RooCurve()
Destructor.
Definition: RooCurve.cxx:250
RooCurve::findPoint
Int_t findPoint(Double_t value, Double_t tolerance=1e-10) const
Find the nearest point to xvalue.
Definition: RooCurve.cxx:670
TGraph.h
RooCurve::printName
virtual void printName(std::ostream &os) const
Print name of object.
Definition: RooCurve.cxx:510
x
Double_t x[n]
Definition: legend1.C:17
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooCurve::chiSquare
Double_t chiSquare(const RooHist &hist, int nFitParam) const
Calculate the chi^2/NDOF of this curve with respect to the histogram 'hist' accounting nFitParam floa...
Definition: RooCurve.cxx:558
TString
Basic string class.
Definition: TString.h:136
TMatrixT< Double_t >
RooCurve::Extended
@ Extended
Definition: RooCurve.h:35
bool
RooAbsFunc
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
x1
static const double x1
Definition: RooGaussKronrodIntegrator1D.cxx:346
hi
float type_of_call hi(const int &, const int &)
RooCurve::Straight
@ Straight
Definition: RooCurve.h:35
RooPrintable::defaultPrintContents
virtual Int_t defaultPrintContents(Option_t *opt) const
Default choice of contents to be printed (name and value)
Definition: RooPrintable.cxx:233
RooCurve::makeErrorBand
RooCurve * makeErrorBand(const std::vector< RooCurve * > &variations, Double_t Z=1) const
Construct filled RooCurve represented error band that captures alpha% of the variations of the curves...
Definition: RooCurve.cxx:739
RooCurve::WingMode
WingMode
Definition: RooCurve.h:35
RooCurve::printMultiline
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Print the details of this curve.
Definition: RooCurve.cxx:540
RooPrintable::defaultPrintStream
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
Definition: RooPrintable.cxx:272
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
RooCurve::RooCurve
RooCurve()
Default constructor.
Definition: RooCurve.cxx:70
RooCurve::initialize
void initialize()
Perform initialization that is common to all curves.
Definition: RooCurve.cxx:259
RooCurve::getFitRangeNEvt
Double_t getFitRangeNEvt() const
Return the number of events associated with the plotable object, it is always 1 for curves.
Definition: RooCurve.cxx:483
RooCurve
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition: RooCurve.h:32
y
Double_t y[n]
Definition: legend1.C:17
RooHist
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class.
Definition: RooHist.h:27
RooCurve::NoWings
@ NoWings
Definition: RooCurve.h:35
unsigned int
RooPlotable.h
RooCurve::printClassName
virtual void printClassName(std::ostream &os) const
Print the class name of this curve.
Definition: RooCurve.cxx:530
Double_t
double Double_t
Definition: RtypesCore.h:59
TGraph
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
RooCurve::interpolate
Double_t interpolate(Double_t x, Double_t tolerance=1e-10) const
Return linearly interpolated value of curve at xvalue.
Definition: RooCurve.cxx:692
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name
Definition: TGX11.cxx:110
RooPrintable::printStream
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
Definition: RooPrintable.cxx:75
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
c2
return c2
Definition: legend2.C:14
x2
static const double x2
Definition: RooGaussKronrodIntegrator1D.cxx:364
RooPlotable
Class RooPotable is a base class for objects that can be inserted into RooPlots and take advantage of...
Definition: RooPlotable.h:26
RooCurve::addPoint
void addPoint(Double_t x, Double_t y)
Add a point with the specified coordinates. Update our y-axis limits.
Definition: RooCurve.cxx:470
RooPrintable::defaultPrintStyle
virtual StyleOption defaultPrintStyle(Option_t *opt) const
Definition: RooPrintable.cxx:241
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooCurve::addRange
void addRange(const RooAbsFunc &func, Double_t x1, Double_t x2, Double_t y1, Double_t y2, Double_t minDy, Double_t minDx, Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0.)
Fill the range (x1,x2) with points calculated using func(&x).
Definition: RooCurve.cxx:425
RooCurve::Print
virtual void Print(Option_t *options=0) const
Print graph values.
Definition: RooCurve.h:59
RooCurve::addPoints
void addPoints(const RooAbsFunc &func, Double_t xlo, Double_t xhi, Int_t minPoints, Double_t prec, Double_t resolution, WingMode wmode, Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0., std::list< Double_t > *samplingHint=0)
Add points calculated with the specified function, over the range (xlo,xhi).
Definition: RooCurve.cxx:309
RooCurve::_showProgress
Bool_t _showProgress
Definition: RooCurve.h:91
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
fw3dlego::xbins
const double xbins[xbins_n]
Definition: collection_proxies.C:48
RooCurve::calcBandInterval
void calcBandInterval(const std::vector< RooCurve * > &variations, Int_t i, Double_t Z, Double_t &lo, Double_t &hi, Bool_t approxGauss) const
Definition: RooCurve.cxx:849
int
RooCurve::isIdentical
Bool_t isIdentical(const RooCurve &other, Double_t tol=1e-6) const
Return true if curve is identical to other curve allowing for given absolute tolerance on each point ...
Definition: RooCurve.cxx:887
c1
return c1
Definition: legend1.C:41