// @(#)root/hist:$Id$
// Author: Rene Brun   03/03/99

/*************************************************************************
 * Copyright (C) 1995-2000, 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_TGraphAsymmErrors
#define ROOT_TGraphAsymmErrors


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGraphAsymmErrors                                                    //
//                                                                      //
// a Graph with asymmetric error bars                                   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

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

class TGraphAsymmErrors : 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

   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:
   TGraphAsymmErrors();
   TGraphAsymmErrors(Int_t n);
   TGraphAsymmErrors(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);
   TGraphAsymmErrors(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);
   TGraphAsymmErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vexl, const TVectorF &vexh, const TVectorF &veyl, const TVectorF &veyh);
   TGraphAsymmErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vexl, const TVectorD &vexh, const TVectorD &veyl, const TVectorD &veyh);
   TGraphAsymmErrors(const TGraphAsymmErrors &gr);
   TGraphAsymmErrors& operator=(const TGraphAsymmErrors &gr);
   TGraphAsymmErrors(const TH1 *h);
   TGraphAsymmErrors(const TH1* pass, const TH1* total, Option_t *option="");
   virtual ~TGraphAsymmErrors();

   virtual void    Apply(TF1 *f);
   virtual void    BayesDivide(const TH1* pass, const TH1* total, Option_t *opt="");
   virtual void    Divide(const TH1* pass, const TH1* total, Option_t *opt="cp");
   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 i)  const;
   Double_t        GetErrorXhigh(Int_t i) const;
   Double_t        GetErrorYlow(Int_t i)  const;
   Double_t        GetErrorYhigh(Int_t i) 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;}
   virtual Int_t   Merge(TCollection* list);
   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); // *MENU*
   virtual void    SetPointError(Int_t i, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh);
   virtual void    SetPointEXlow(Int_t i, Double_t exl);
   virtual void    SetPointEXhigh(Int_t i, Double_t exh);
   virtual void    SetPointEYlow(Int_t i, Double_t eyl);
   virtual void    SetPointEYhigh(Int_t i, Double_t eyh);

   ClassDef(TGraphAsymmErrors,3)  //A graph with asymmetric error bars
};

inline Double_t** TGraphAsymmErrors::Allocate(Int_t size) {
   return AllocateArrays(6, size);
}

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