// @(#)root/hist:$Id$
// Author: Dave Morrison  30/06/2003

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGraphBentErrors
#define ROOT_TGraphBentErrors

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGraphBentErrors                                                     //
//                                                                      //
// a Graph with bent, asymmetric error bars                             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGraph
#include "TGraph.h"
#endif

class TGraphBentErrors : public TGraph {

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

   virtual void       SwapPoints(Int_t pos1, Int_t pos2);

   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 Bool_t     DoMerge(const TGraph * g);


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);
   virtual void    ComputeRange(Double_t &xmin, Double_t &ymin,
                                Double_t &xmax, Double_t &ymax) const;
   Double_t        GetErrorX(Int_t bin)     const;
   Double_t        GetErrorY(Int_t bin)     const;
   Double_t        GetErrorXlow(Int_t bin)  const;
   Double_t        GetErrorXhigh(Int_t bin) const;
   Double_t        GetErrorYlow(Int_t bin)  const;
   Double_t        GetErrorYhigh(Int_t bin) const;
   Double_t       *GetEXlow()   const {return fEXlow;}
   Double_t       *GetEXhigh()  const {return fEXhigh;}
   Double_t       *GetEYlow()   const {return fEYlow;}
   Double_t       *GetEYhigh()  const {return fEYhigh;}
   Double_t       *GetEXlowd()  const {return fEXlowd;}
   Double_t       *GetEXhighd() const {return fEXhighd;}
   Double_t       *GetEYlowd()  const {return fEYlowd;}
   Double_t       *GetEYhighd() const {return fEYhighd;}
   virtual void    Print(Option_t *chopt="") const;
   virtual void    SavePrimitive(std::ostream &out, Option_t *option = "");
   virtual void    SetPointError(Double_t exl, Double_t exh,
                                 Double_t eyl, Double_t eyh,
                                 Double_t exld=0, Double_t exhd=0,
                                 Double_t eyld=0, Double_t eyhd=0); // *MENU*
   virtual void    SetPointError(Int_t i,
                                 Double_t exl, Double_t exh,
                                 Double_t eyl, Double_t eyh,
                                 Double_t exld=0, Double_t exhd=0,
                                 Double_t eyld=0, Double_t eyhd=0);

   ClassDef(TGraphBentErrors,1)  //A graph with bent, asymmetric error bars
};

inline Double_t **TGraphBentErrors::Allocate(Int_t size) {
   return AllocateArrays(10, size);
}

#endif
 TGraphBentErrors.h:1
 TGraphBentErrors.h:2
 TGraphBentErrors.h:3
 TGraphBentErrors.h:4
 TGraphBentErrors.h:5
 TGraphBentErrors.h:6
 TGraphBentErrors.h:7
 TGraphBentErrors.h:8
 TGraphBentErrors.h:9
 TGraphBentErrors.h:10
 TGraphBentErrors.h:11
 TGraphBentErrors.h:12
 TGraphBentErrors.h:13
 TGraphBentErrors.h:14
 TGraphBentErrors.h:15
 TGraphBentErrors.h:16
 TGraphBentErrors.h:17
 TGraphBentErrors.h:18
 TGraphBentErrors.h:19
 TGraphBentErrors.h:20
 TGraphBentErrors.h:21
 TGraphBentErrors.h:22
 TGraphBentErrors.h:23
 TGraphBentErrors.h:24
 TGraphBentErrors.h:25
 TGraphBentErrors.h:26
 TGraphBentErrors.h:27
 TGraphBentErrors.h:28
 TGraphBentErrors.h:29
 TGraphBentErrors.h:30
 TGraphBentErrors.h:31
 TGraphBentErrors.h:32
 TGraphBentErrors.h:33
 TGraphBentErrors.h:34
 TGraphBentErrors.h:35
 TGraphBentErrors.h:36
 TGraphBentErrors.h:37
 TGraphBentErrors.h:38
 TGraphBentErrors.h:39
 TGraphBentErrors.h:40
 TGraphBentErrors.h:41
 TGraphBentErrors.h:42
 TGraphBentErrors.h:43
 TGraphBentErrors.h:44
 TGraphBentErrors.h:45
 TGraphBentErrors.h:46
 TGraphBentErrors.h:47
 TGraphBentErrors.h:48
 TGraphBentErrors.h:49
 TGraphBentErrors.h:50
 TGraphBentErrors.h:51
 TGraphBentErrors.h:52
 TGraphBentErrors.h:53
 TGraphBentErrors.h:54
 TGraphBentErrors.h:55
 TGraphBentErrors.h:56
 TGraphBentErrors.h:57
 TGraphBentErrors.h:58
 TGraphBentErrors.h:59
 TGraphBentErrors.h:60
 TGraphBentErrors.h:61
 TGraphBentErrors.h:62
 TGraphBentErrors.h:63
 TGraphBentErrors.h:64
 TGraphBentErrors.h:65
 TGraphBentErrors.h:66
 TGraphBentErrors.h:67
 TGraphBentErrors.h:68
 TGraphBentErrors.h:69
 TGraphBentErrors.h:70
 TGraphBentErrors.h:71
 TGraphBentErrors.h:72
 TGraphBentErrors.h:73
 TGraphBentErrors.h:74
 TGraphBentErrors.h:75
 TGraphBentErrors.h:76
 TGraphBentErrors.h:77
 TGraphBentErrors.h:78
 TGraphBentErrors.h:79
 TGraphBentErrors.h:80
 TGraphBentErrors.h:81
 TGraphBentErrors.h:82
 TGraphBentErrors.h:83
 TGraphBentErrors.h:84
 TGraphBentErrors.h:85
 TGraphBentErrors.h:86
 TGraphBentErrors.h:87
 TGraphBentErrors.h:88
 TGraphBentErrors.h:89
 TGraphBentErrors.h:90
 TGraphBentErrors.h:91
 TGraphBentErrors.h:92
 TGraphBentErrors.h:93
 TGraphBentErrors.h:94
 TGraphBentErrors.h:95
 TGraphBentErrors.h:96
 TGraphBentErrors.h:97
 TGraphBentErrors.h:98
 TGraphBentErrors.h:99
 TGraphBentErrors.h:100
 TGraphBentErrors.h:101
 TGraphBentErrors.h:102
 TGraphBentErrors.h:103
 TGraphBentErrors.h:104
 TGraphBentErrors.h:105
 TGraphBentErrors.h:106