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);
55 TGraphErrors(const TH1 *h);
56 TGraphErrors(const char *filename, const char *format="%lg %lg %lg %lg", Option_t *option="");
57 ~TGraphErrors() override;
58 void Apply(TF1 *f) override;
59 virtual void ApplyX(TF1 *f);
60 static Int_t CalculateScanfFields(const char *fmt);
61 void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override;
62 Double_t GetErrorX(Int_t bin) const override;
63 Double_t GetErrorY(Int_t bin) const override;
64 Double_t GetErrorXhigh(Int_t bin) const override;
65 Double_t GetErrorXlow(Int_t bin) const override;
66 Double_t GetErrorYhigh(Int_t bin) const override;
67 Double_t GetErrorYlow(Int_t bin) const override;
68 Double_t *GetEX() const override {return fEX;}
69 Double_t *GetEY() const override {return fEY;}
70 Int_t Merge(TCollection* list) override;
71 void Print(Option_t *chopt="") const override;
72 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
73 void Scale(Double_t c1=1., Option_t *option="y") override; // *MENU*
74 virtual void SetPointError(Double_t ex, Double_t ey); // *MENU
75 virtual void SetPointError(Int_t i, Double_t ex, Double_t ey);
76
77 ClassDefOverride(TGraphErrors,3) //A graph with error bars
78};
79
81 return AllocateArrays(4, size);
82}
83
84#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
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
float xmin
float ymin
float xmax
float ymax
Collection abstract base class.
Definition TCollection.h:65
1-Dim function class
Definition TF1.h:214
A TGraphErrors is a TGraph with error bars.
void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override
Compute range.
void UpdateArrays(const std::vector< Int_t > &sorting_indices, Int_t numSortedPoints, Int_t low) override
Update the fX, fY, fEX, and fEY arrays with the sorted values.
Double_t GetErrorY(Int_t bin) const override
It returns the error along Y at point i.
Double_t * GetEX() const override
Double_t GetErrorX(Int_t bin) const override
It returns the error along X at point i.
Double_t * fEY
[fNpoints] array of Y errors
~TGraphErrors() override
TGraphErrors default destructor.
void Scale(Double_t c1=1., Option_t *option="y") override
Multiply the values and errors of a TGraphErrors by a constant c1.
static Int_t CalculateScanfFields(const char *fmt)
Calculate scan fields.
void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE) override
Set zero values for point arrays in the range [begin, end].
Double_t * fEX
[fNpoints] array of X errors
void Print(Option_t *chopt="") const override
Print graph and errors values.
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
Bool_t DoMerge(const TGraph *g) override
Protected function to perform the merge operation of a graph with errors.
Double_t * GetEY() const override
Double_t ** Allocate(Int_t size) override
Allocate internal data structures for newsize points.
void SwapPoints(Int_t pos1, Int_t pos2) override
Swap points.
virtual void ApplyX(TF1 *f)
Apply function to all the data points .
Double_t GetErrorXhigh(Int_t bin) const override
It returns the error along X at point i.
Double_t GetErrorYlow(Int_t bin) const override
It returns the error along Y at point i.
Double_t GetErrorYhigh(Int_t bin) const override
It returns the error along Y at point i.
TGraphErrors & operator=(const TGraphErrors &gr)
TGraphErrors assignment operator.
Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin) override
Copy errors from fEX and fEY to arrays[0] and arrays[1] or to fEX and fEY if arrays == 0 and ibegin !...
Int_t Merge(TCollection *list) override
Adds all graphs with errors from the collection to this graph.
void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin) override
Copy and release.
TGraphErrors()
TGraphErrors default constructor.
Double_t GetErrorXlow(Int_t bin) const override
It returns the error along X at point i.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
void Apply(TF1 *f) override
Apply function to all the data points .
Bool_t CtorAllocate()
Constructor allocate.
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
Double_t ** AllocateArrays(Int_t Narrays, Int_t arraySize)
Allocate arrays.
Definition TGraph.cxx:593
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
TVectorT.
Definition TVectorT.h:27
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
Double_t ey[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TGraphErrors * gr
Definition legend1.C:25
Double_t ex[n]
Definition legend1.C:17