library: libGraf #include "TGraphBentErrors.h"

# TGraphBentErrors

class description - source file - inheritance tree (.pdf)

## class TGraphBentErrors : public TGraph

| Inheritance Chart:

`TObject`

<-

`TNamed`

`TAttLine`

`TAttFill`

`TAttMarker`

<-

`TGraph`

<-

`TGraphBentErrors`

        protected:

          virtual Double_t** Allocate(Int_t size)
                virtual void CopyAndRelease(Double_t** newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
              virtual Bool_t CopyPoints(Double_t** arrays, Int_t ibegin, Int_t iend, Int_t obegin)
                      Bool_t CtorAllocate()
                virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor = kTRUE)
                virtual void SwapPoints(Int_t pos1, Int_t pos2)

        public:

                            TGraphBentErrors()
                            TGraphBentErrors(Int_t n)
                            TGraphBentErrors(Int_t n, const Float_t* x, const Float_t* y, const Float_t* exl = 0, const Float_t* exh = 0, const Float_t* eyl = 0, const Float_t* eyh = 0, const Float_t* exld = 0, const Float_t* exhd = 0, const Float_t* eyld = 0, const Float_t* eyhd = 0)
                            TGraphBentErrors(Int_t n, const Double_t* x, const Double_t* y, const Double_t* exl = 0, const Double_t* exh = 0, const Double_t* eyl = 0, const Double_t* eyh = 0, const Double_t* exld = 0, const Double_t* exhd = 0, const Double_t* eyld = 0, const Double_t* eyhd = 0)
                            TGraphBentErrors(const TGraphBentErrors& gr)
                    virtual ~TGraphBentErrors()
               virtual void Apply(TF1* f)
             static TClass* Class()
               virtual void ComputeRange(Double_t& xmin, Double_t& ymin, Double_t& xmax, Double_t& ymax) const
           virtual Double_t GetErrorX(Int_t bin) const
           virtual Double_t GetErrorXhigh(Int_t bin) const
           virtual Double_t GetErrorXlow(Int_t bin) const
           virtual Double_t GetErrorY(Int_t bin) const
           virtual Double_t GetErrorYhigh(Int_t bin) const
           virtual Double_t GetErrorYlow(Int_t bin) const
          virtual Double_t* GetEXhigh() const
          virtual Double_t* GetEXlow() const
          virtual Double_t* GetEYhigh() const
          virtual Double_t* GetEYlow() const
            virtual TClass* IsA() const
          TGraphBentErrors& operator=(const TGraphBentErrors&)
               virtual void Paint(Option_t* chopt = "")
               virtual void Print(Option_t* chopt = "") const
               virtual void SavePrimitive(ofstream& out, Option_t* option)
               virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)
               virtual void SetPointError(Int_t i, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)
               virtual void ShowMembers(TMemberInspector& insp, char* parent)
               virtual void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          Double_t* fEXlow    [fNpoints] array of X low errors
          Double_t* fEXhigh   [fNpoints] array of X high errors
          Double_t* fEYlow    [fNpoints] array of Y low errors
          Double_t* fEYhigh   [fNpoints] array of Y high errors
          Double_t* fEXlowd   [fNpoints] array of X low displacements
          Double_t* fEXhighd  [fNpoints] array of X high displacements
          Double_t* fEYlowd   [fNpoints] array of Y low displacements
          Double_t* fEYhighd  [fNpoints] array of Y high displacements

## Class Description

       A TGraphBentErrors is a TGraph with bent, assymetric error bars.
       The various format options to draw a TGraphBentErrors are explained in
         TGraphBentErrors::Paint.

      The picture below has been generated by the following macro:
      FIXME There are 2 bent error bars in the picture, not one!
    ------------------------------------------------------------------------
    {
       gROOT->Reset();

       Int_t n = 10;
       Double_t x[n]  = {-0.22, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};
       Double_t y[n]  = {1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};
       Double_t exl[n] = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};
       Double_t eyl[n] = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};
       Double_t exh[n] = {.02,.08,.05,.05,.03,.03,.04,.05,.06,.03};
       Double_t eyh[n] = {.6,.5,.4,.3,.2,.2,.3,.4,.5,.6};
       Double_t exld[n] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
       Double_t eyld[n] = {.0,.0,.05,.0,.0,.0,.0,.0,.0,.0};
       Double_t exhd[n] = {.0,.0,.0,.0,.0,.0,.0,.0,.0,.0};
       Double_t eyhd[n] = {.0,.0,.0,.0,.0,.0,.0,.0,.05,.0};
       gr = new TGraphBentErrors(n,x,y,exl,exh,eyl,eyh,exld,exhd,eyld,eyhd);
       gr->SetTitle("TGraphBentErrors Example");
       gr->SetMarkerColor(4);
       gr->SetMarkerStyle(21);
       gr->Draw("ALP");
    }

/* */

TGraphBentErrors(): TGraph()

    *-*-*-*-*-*-*-*-*-*-*TGraphBentErrors default constructor*-*-*-*-*-*-*-*-*-*
    *-*                  =====================================

TGraphBentErrors(const TGraphBentErrors &gr) : TGraph(gr)

     TGraphBentErrors copy constructor

TGraphBentErrors(Int_t n) : TGraph(n)

    *-*-*-*-*-*-*-*-*-*-*TGraphBentErrors normal constructor*-*-*-*-*-*-*-*-*-*-*
    *-*                  ====================================

      the arrays are preset to zero

TGraphBentErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *exl, const Float_t *exh, const Float_t *eyl, const Float_t *eyh, const Float_t *exld, const Float_t *exhd, const Float_t *eyld, const Float_t *eyhd) : TGraph(n,x,y)

    *-*-*-*-*-*-*-*-*-*-*TGraphBentErrors normal constructor*-*-*-*-*-*-*-*-*-*-*
    *-*                  ====================================

      if exl,h or eyl,h are null, the corresponding arrays are preset to zero

TGraphBentErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *exl, const Double_t *exh, const Double_t *eyl, const Double_t *eyh, const Double_t *exld, const Double_t *exhd, const Double_t *eyld, const Double_t *eyhd) : TGraph(n,x,y)

    *-*-*-*-*-*-*-*-*-*-*TGraphBentErrors normal constructor*-*-*-*-*-*-*-*-*-*-*
    *-*                  ====================================

      if exl,h or eyl,h are null, the corresponding arrays are preset to zero

~TGraphBentErrors()

    *-*-*-*-*-*-*-*-*-*-*TGraphBentErrors default destructor*-*-*-*-*-*-*-*-*-*-*
    *-*                  ===============================

void Apply(TF1 *f)

     apply a function to all data points
     y = f(x,y)

     Errors are calculated as eyh = f(x,y+eyh)-f(x,y) and
     eyl = f(x,y)-f(x,y-eyl)

     Special treatment has to be applied for the functions where the
     role of "up" and "down" is reversed.
     function suggested/implemented by Miroslav Helbich <helbich@mail.desy.de>

void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const

void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)

Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin)

     Copy errors from fE*** to arrays[***]
     or to f*** Copy points.

Bool_t CtorAllocate(void)

     Should be called from ctors after fNpoints has been set

Double_t GetErrorX(Int_t i) const

        This function is called by GraphFitChisquare.
        It returns the error along X at point i.

Double_t GetErrorY(Int_t i) const

        This function is called by GraphFitChisquare.
        It returns the error along Y at point i.

Double_t GetErrorXhigh(Int_t i) const

Double_t GetErrorXlow(Int_t i) const

Double_t GetErrorYhigh(Int_t i) const

Double_t GetErrorYlow(Int_t i) const

void FillZero(Int_t begin, Int_t end, Bool_t from_ctor)

     Set zero values for point arrays in the range [begin, end)

void Paint(Option_t *option)

     Paint this TGraphBentErrors with its current attributes

     by default horizonthal and vertical small lines are drawn at
     the end of the error bars. if option "z" or "Z" is specified,
     these lines are not drawn.

     if option contains ">" an arrow is drawn at the end of the error bars
     if option contains "|>" a full arrow is drawn at the end of the error bars
     the size of the arrow is set to 2/3 of the marker size.

     By default, error bars are drawn. If option "X" is specified,
     the errors are not drawn (TGraph::Paint equivalent).

     if option "[]" is specified only the end vertical/horizonthal lines
     of the error bars are drawn. This option is interesting to superimpose
     systematic errors on top of a graph with statistical errors.
     if option "2" is specified error rectangles are drawn.

     if option "3" is specified a filled area is drawn through the end points >
     the vertical error bars.

     if option "4" is specified a smoothed filled area is drawn through the end
     points of the vertical error bars.

void Print(Option_t *) const

    *-*-*-*-*-*-*-*-*-*-*Print graph and errors values*-*-*-*-*-*-*-*-*-*-*-*
    *-*                  =============================

void SavePrimitive(ofstream &out, Option_t *option)

     Save primitive as a C++ statement(s) on output stream out

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*-*-*-*
    *-*          ===================================================

void SetPointError(Int_t i, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)

    *-*-*-*-*-*-*-*-*-*-*Set ex and ey values for point number i*-*-*-*-*-*-*-*
    *-*                  =======================================

void SwapPoints(Int_t pos1, Int_t pos2)

### Inline Functions

                   Double_t** Allocate(Int_t size)
                    Double_t* GetEXlow() const
                    Double_t* GetEXhigh() const
                    Double_t* GetEYlow() const
                    Double_t* GetEYhigh() const
                      TClass* Class()
                      TClass* IsA() const
                         void ShowMembers(TMemberInspector& insp, char* parent)
                         void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)
            TGraphBentErrors& operator=(const TGraphBentErrors&)

Author: Dave Morrison 30/06/2003
Last update: root/graf:$Name: $:$Id: TGraphBentErrors.cxx,v 1.14 2005/03/07 09:15:45 brun Exp $
Copyright (C) 1995-2003, Rene Brun and Fons Rademakers. *