library: libGraf #include "TGraphBentErrors.h"

# TGraphBentErrors

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

## class TGraphBentErrors : public TGraph

| Inheritance Chart:

`TObject`

<-

`TNamed`

`TAttLine`

`TAttFill`

`TAttMarker`

<-

`TGraph`

<-

`TGraphBentErrors`

        protected:

          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 GetErrorY(Int_t bin) const
                  Double_t* GetEXhigh() const
                  Double_t* GetEXlow() const
                  Double_t* GetEYhigh() const
                  Double_t* GetEYlow() const
              virtual Int_t InsertPoint()
            virtual TClass* IsA() const
          TGraphBentErrors& operator=(const TGraphBentErrors&)
               virtual void Paint(Option_t* chopt)
               virtual void Print(Option_t* chopt) const
              virtual Int_t RemovePoint()
              virtual Int_t RemovePoint(Int_t ipoint)
               virtual void SavePrimitive(ofstream& out, Option_t* option)
               virtual void Set(Int_t n)
               virtual void SetPoint(Int_t i, Double_t x, Double_t y)
               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:
    ------------------------------------------------------------------------
    {
       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,.0,.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

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.

Int_t InsertPoint()

     Insert a new point at the mouse position

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.

void Print(Option_t *) const

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

Int_t RemovePoint()

     Delete point close to the mouse position

Int_t RemovePoint(Int_t ipnt)

     Delete point number ipnt

void SavePrimitive(ofstream &out, Option_t *option)

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

void Set(Int_t n)

     Set number of points in the graph
     Existing coordinates are preserved
     New coordinates and errors above fNpoints are preset to 0.

void SetPoint(Int_t i, Double_t x, Double_t y)

    *-*-*-*-*-*-*-*-*-*-*Set x and y values for point number i*-*-*-*-*-*-*-*-*
    *-*                  =====================================

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* 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.4 2004/07/06 14:55:04 brun Exp $
Copyright (C) 1995-2003, Rene Brun and Fons Rademakers. *