Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TGraphAsymmErrors.h
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 03/03/99
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGraphAsymmErrors
13#define ROOT_TGraphAsymmErrors
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TGraphAsymmErrors //
19// //
20// a Graph with asymmetric error bars //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TGraph.h"
25
26class TGraphAsymmErrors : public TGraph {
27
28protected:
29 Double_t *fEXlow{nullptr}; ///<[fNpoints] array of X low errors
30 Double_t *fEXhigh{nullptr}; ///<[fNpoints] array of X high errors
31 Double_t *fEYlow{nullptr}; ///<[fNpoints] array of Y low errors
32 Double_t *fEYhigh{nullptr}; ///<[fNpoints] array of Y high errors
33
34 void SwapPoints(Int_t pos1, Int_t pos2) override;
35 void UpdateArrays(const std::vector<Int_t> &sorting_indices, Int_t numSortedPoints, Int_t low) override;
36
38 void CopyAndRelease(Double_t **newarrays,
39 Int_t ibegin, Int_t iend, Int_t obegin) override;
40 Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
41 Int_t obegin) override;
43 void FillZero(Int_t begin, Int_t end,
44 Bool_t from_ctor = kTRUE) override;
45 Bool_t DoMerge(const TGraph * g) override;
46
47public:
50 TGraphAsymmErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *exl = nullptr, const Float_t *exh = nullptr, const Float_t *eyl = nullptr, const Float_t *eyh = nullptr);
51 TGraphAsymmErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *exl = nullptr, const Double_t *exh = nullptr, const Double_t *eyl = nullptr, const Double_t *eyh = nullptr);
52 TGraphAsymmErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vexl, const TVectorF &vexh, const TVectorF &veyl, const TVectorF &veyh);
53 TGraphAsymmErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vexl, const TVectorD &vexh, const TVectorD &veyl, const TVectorD &veyh);
57 TGraphAsymmErrors(const TH1* pass, const TH1* total, Option_t *option="");
58 TGraphAsymmErrors(const char *filename, const char *format="%lg %lg %lg %lg %lg %lg", Option_t *option="");
59
61
62 virtual void
63 AddPointError(Double_t x, Double_t y, Double_t exl = 0., Double_t exh = 0., Double_t eyl = 0., Double_t eyh = 0.);
64 void Apply(TF1 *f) override;
65 virtual void BayesDivide(const TH1* pass, const TH1* total, Option_t *opt="");
66 virtual void Divide(const TH1* pass, const TH1* total, Option_t *opt="cp");
68 Double_t GetErrorX(Int_t bin) const override;
69 Double_t GetErrorY(Int_t bin) const override;
70 Double_t GetErrorXlow(Int_t i) const override;
71 Double_t GetErrorXhigh(Int_t i) const override;
72 Double_t GetErrorYlow(Int_t i) const override;
73 Double_t GetErrorYhigh(Int_t i) const override;
74 Double_t *GetEXlow() const override {return fEXlow;}
75 Double_t *GetEXhigh() const override {return fEXhigh;}
76 Double_t *GetEYlow() const override {return fEYlow;}
77 Double_t *GetEYhigh() const override {return fEYhigh;}
78 Int_t Merge(TCollection* list) override;
79 void Print(Option_t *chopt="") const override;
80 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
81 void Scale(Double_t c1=1., Option_t *option="y") override; // *MENU*
82 virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh); // *MENU*
83 virtual void SetPointError(Int_t i, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh);
84 virtual void SetPointEXlow(Int_t i, Double_t exl);
85 virtual void SetPointEXhigh(Int_t i, Double_t exh);
86 virtual void SetPointEYlow(Int_t i, Double_t eyl);
87 virtual void SetPointEYhigh(Int_t i, Double_t eyh);
88
89 ClassDefOverride(TGraphAsymmErrors,3) //A graph with asymmetric error bars
90};
91
92#endif
#define f(i)
Definition RSha256.hxx:104
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
static unsigned int total
float xmin
float ymin
float xmax
float ymax
TVectorT< Double_t > TVectorD
Definition TVectorDfwd.h:23
TVectorT< Float_t > TVectorF
Definition TVectorFfwd.h:23
Collection abstract base class.
Definition TCollection.h:65
Definition TF1.h:182
Double_t * GetEXlow() const override
Double_t * fEXhigh
[fNpoints] array of X high errors
TGraphAsymmErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *exl=nullptr, const Double_t *exh=nullptr, const Double_t *eyl=nullptr, const Double_t *eyh=nullptr)
Double_t GetErrorY(Int_t bin) const override
void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE) override
Bool_t CtorAllocate()
virtual void SetPointEXlow(Int_t i, Double_t exl)
TGraphAsymmErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vexl, const TVectorD &vexh, const TVectorD &veyl, const TVectorD &veyh)
virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)
Double_t GetErrorXhigh(Int_t i) const override
Double_t * fEYhigh
[fNpoints] array of Y high errors
Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin) override
virtual void AddPointError(Double_t x, Double_t y, Double_t exl=0., Double_t exh=0., Double_t eyl=0., Double_t eyh=0.)
virtual void SetPointEYhigh(Int_t i, Double_t eyh)
void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override
virtual void Divide(const TH1 *pass, const TH1 *total, Option_t *opt="cp")
virtual void BayesDivide(const TH1 *pass, const TH1 *total, Option_t *opt="")
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Double_t * GetEYhigh() const override
virtual void SetPointEYlow(Int_t i, Double_t eyl)
void Print(Option_t *chopt="") const override
This method must be overridden when a class wants to print itself.
TGraphAsymmErrors(const TGraphAsymmErrors &gr)
Double_t GetErrorYhigh(Int_t i) const override
Int_t Merge(TCollection *list) override
Double_t GetErrorXlow(Int_t i) const override
Double_t * fEYlow
[fNpoints] array of Y low errors
void UpdateArrays(const std::vector< Int_t > &sorting_indices, Int_t numSortedPoints, Int_t low) override
void SwapPoints(Int_t pos1, Int_t pos2) override
TGraphAsymmErrors(const char *filename, const char *format="%lg %lg %lg %lg %lg %lg", Option_t *option="")
Double_t * GetEXhigh() const override
Double_t * fEXlow
[fNpoints] array of X low errors
void Apply(TF1 *f) override
Double_t ** Allocate(Int_t size) override
Double_t * GetEYlow() const override
virtual void SetPointError(Int_t i, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)
Bool_t DoMerge(const TGraph *g) override
void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin) override
virtual void SetPointEXhigh(Int_t i, Double_t exh)
TGraphAsymmErrors(const TH1 *pass, const TH1 *total, Option_t *option="")
TGraphAsymmErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *exl=nullptr, const Float_t *exh=nullptr, const Float_t *eyl=nullptr, const Float_t *eyh=nullptr)
TGraphAsymmErrors(Int_t n)
Double_t GetErrorYlow(Int_t i) const override
TGraphAsymmErrors(const TH1 *h)
Double_t GetErrorX(Int_t bin) const override
TGraphAsymmErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vexl, const TVectorF &vexh, const TVectorF &veyl, const TVectorF &veyh)
TGraphAsymmErrors & operator=(const TGraphAsymmErrors &gr)
~TGraphAsymmErrors() override
void Scale(Double_t c1=1., Option_t *option="y") override
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
return c1
Definition legend1.C:41
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TGraphErrors * gr
Definition legend1.C:25