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
37 Double_t** Allocate(Int_t size) override;
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);
56 TGraphAsymmErrors(const TH1 *h);
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
60 ~TGraphAsymmErrors() override;
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");
67 void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override;
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
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:93
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
static unsigned int total
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:233
TGraph with asymmetric error bars.
Double_t * GetEXlow() const override
virtual void SetPointEYlow(Int_t i, Double_t eyl)
Set EYlow for point i.
Double_t * fEXhigh
[fNpoints] array of X high errors
Double_t GetErrorY(Int_t bin) const override
Returns the combined error along Y at point i by computing the average of the lower and upper varianc...
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]
virtual void Divide(const TH1 *pass, const TH1 *total, Option_t *opt="cp")
Fill this TGraphAsymmErrors by dividing two 1-dimensional histograms pass/total.
Bool_t CtorAllocate()
Should be called from ctors after fNpoints has been set.
virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)
Set ex and ey values for point pointed by the mouse.
Double_t GetErrorXhigh(Int_t i) const override
Get high error on X.
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
Copy errors from fE*** to arrays[***] or to f*** Copy points.
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.)
Add a point with asymmetric errorbars to the graph.
void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override
Compute Range.
virtual void SetPointEXlow(Int_t i, Double_t exl)
Set EXlow for point i.
virtual void SetPointEYhigh(Int_t i, Double_t eyh)
Set EYhigh for point i.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
virtual void BayesDivide(const TH1 *pass, const TH1 *total, Option_t *opt="")
This function is only kept for backward compatibility.
Double_t * GetEYhigh() const override
void Print(Option_t *chopt="") const override
Print graph and errors values.
Double_t GetErrorYhigh(Int_t i) const override
Get high error on Y.
Int_t Merge(TCollection *list) override
Adds all graphs with asymmetric errors from the collection to this graph.
Double_t GetErrorXlow(Int_t i) const override
Get low error on X.
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
Update the fX, fY, fEXlow, fEXhigh, fEYlow and fEYhigh arrays with the sorted values.
void SwapPoints(Int_t pos1, Int_t pos2) override
Swap points.
Double_t * GetEXhigh() const override
Double_t * fEXlow
[fNpoints] array of X low errors
void Apply(TF1 *f) override
Apply a function to all data points .
Double_t ** Allocate(Int_t size) override
Allocate internal data structures for size points.
Double_t * GetEYlow() const override
Bool_t DoMerge(const TGraph *g) override
Protected function to perform the merge operation of a graph with asymmetric errors.
void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin) override
Copy and release.
virtual void SetPointEXhigh(Int_t i, Double_t exh)
Set EXhigh for point i.
Double_t GetErrorYlow(Int_t i) const override
Get low error on Y.
Double_t GetErrorX(Int_t bin) const override
Returns the combined error along X at point i by computing the average of the lower and upper varianc...
TGraphAsymmErrors()
TGraphAsymmErrors default constructor.
TGraphAsymmErrors & operator=(const TGraphAsymmErrors &gr)
TGraphAsymmErrors assignment operator.
~TGraphAsymmErrors() override
TGraphAsymmErrors default destructor.
void Scale(Double_t c1=1., Option_t *option="y") override
Multiply the values and errors of a TGraphAsymmErrors by a constant c1.
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
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
const Int_t n
Definition legend1.C:16
TGraphErrors * gr
Definition legend1.C:25