Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TGraphErrors.h
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 15/09/96
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_TGraphErrors
13#define ROOT_TGraphErrors
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TGraphErrors //
19// //
20// a Graph with error bars //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TGraph.h"
25
26class TGraphErrors : public TGraph {
27
28protected:
29 Double_t *fEX{nullptr}; ///<[fNpoints] array of X errors
30 Double_t *fEY{nullptr}; ///<[fNpoints] array of Y errors
31
32 void SwapPoints(Int_t pos1, Int_t pos2) override;
33 void UpdateArrays(const std::vector<Int_t> &sorting_indices, Int_t numSortedPoints, Int_t low) override;
34
35 Double_t** Allocate(Int_t size) override;
36 void CopyAndRelease(Double_t **newarrays,
37 Int_t ibegin, Int_t iend, Int_t obegin) override;
38 Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
39 Int_t obegin) override;
41 void FillZero(Int_t begin, Int_t end,
42 Bool_t from_ctor = kTRUE) override;
43 Bool_t DoMerge(const TGraph * g) override;
44
45
46public:
49 TGraphErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *ex = nullptr, const Float_t *ey = nullptr);
50 TGraphErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *ex = nullptr, const Double_t *ey = nullptr);
51 TGraphErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vex, const TVectorF &vey);
52 TGraphErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vex, const TVectorD &vey);
56 TGraphErrors(const char *filename, const char *format="%lg %lg %lg %lg", Option_t *option="");
57 ~TGraphErrors() override;
58 virtual void AddPointError(Double_t x, Double_t y, Double_t ex = 0., Double_t ey = 0.);
59 void Apply(TF1 *f) override;
60 virtual void ApplyX(TF1 *f);
61 static Int_t CalculateScanfFields(const char *fmt);
63 Double_t GetErrorX(Int_t bin) const override;
64 Double_t GetErrorY(Int_t bin) const override;
65 Double_t GetErrorXhigh(Int_t bin) const override;
66 Double_t GetErrorXlow(Int_t bin) const override;
67 Double_t GetErrorYhigh(Int_t bin) const override;
68 Double_t GetErrorYlow(Int_t bin) const override;
69 Double_t *GetEX() const override {return fEX;}
70 Double_t *GetEY() const override {return fEY;}
71 Int_t Merge(TCollection* list) override;
72 void Print(Option_t *chopt="") const override;
73 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
74 void Scale(Double_t c1=1., Option_t *option="y") override; // *MENU*
75 virtual void SetPointError(Double_t ex, Double_t ey); // *MENU
77
78 ClassDefOverride(TGraphErrors,3) //A graph with error bars
79};
80
84
85#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
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
TGraphErrors(const TH1 *h)
void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override
void UpdateArrays(const std::vector< Int_t > &sorting_indices, Int_t numSortedPoints, Int_t low) override
virtual void ApplyX(TF1 *f)
Double_t GetErrorY(Int_t bin) const override
Double_t * GetEX() const override
Double_t GetErrorX(Int_t bin) const override
Double_t * fEY
[fNpoints] array of Y errors
~TGraphErrors() override
void Scale(Double_t c1=1., Option_t *option="y") override
TGraphErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *ex=nullptr, const Double_t *ey=nullptr)
TGraphErrors(const TGraphErrors &gr)
TGraphErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *ex=nullptr, const Float_t *ey=nullptr)
void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE) override
TGraphErrors(const char *filename, const char *format="%lg %lg %lg %lg", Option_t *option="")
Double_t * fEX
[fNpoints] array of X errors
void Print(Option_t *chopt="") const override
This method must be overridden when a class wants to print itself.
TGraphErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vex, const TVectorF &vey)
virtual void AddPointError(Double_t x, Double_t y, Double_t ex=0., Double_t ey=0.)
Bool_t DoMerge(const TGraph *g) override
Double_t * GetEY() const override
Double_t ** Allocate(Int_t size) override
void SwapPoints(Int_t pos1, Int_t pos2) override
Double_t GetErrorXhigh(Int_t bin) const override
Double_t GetErrorYlow(Int_t bin) const override
Double_t GetErrorYhigh(Int_t bin) const override
TGraphErrors & operator=(const TGraphErrors &gr)
static Int_t CalculateScanfFields(const char *fmt)
Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin) override
Int_t Merge(TCollection *list) override
void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin) override
TGraphErrors(Int_t n)
virtual void SetPointError(Int_t i, Double_t ex, Double_t ey)
virtual void SetPointError(Double_t ex, Double_t ey)
Double_t GetErrorXlow(Int_t bin) const override
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void Apply(TF1 *f) override
Bool_t CtorAllocate()
TGraphErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vex, const TVectorD &vey)
Double_t ** AllocateArrays(Int_t Narrays, Int_t arraySize)
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
Double_t ey[n]
Definition legend1.C:17
TGraphErrors * gr
Definition legend1.C:25
Double_t ex[n]
Definition legend1.C:17