Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:04

0001 // @(#)root/hist:$Id$
0002 // Author: Dave Morrison  30/06/2003
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGraphBentErrors
0013 #define ROOT_TGraphBentErrors
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TGraphBentErrors                                                     //
0018 //                                                                      //
0019 // a Graph with bent, asymmetric error bars                             //
0020 //                                                                      //
0021 //////////////////////////////////////////////////////////////////////////
0022 
0023 #include "TGraph.h"
0024 
0025 class TGraphBentErrors : public TGraph {
0026 
0027 protected:
0028    Double_t    *fEXlow;        ///<[fNpoints] array of X low errors
0029    Double_t    *fEXhigh;       ///<[fNpoints] array of X high errors
0030    Double_t    *fEYlow;        ///<[fNpoints] array of Y low errors
0031    Double_t    *fEYhigh;       ///<[fNpoints] array of Y high errors
0032 
0033    Double_t    *fEXlowd;       ///<[fNpoints] array of X low displacements
0034    Double_t    *fEXhighd;      ///<[fNpoints] array of X high displacements
0035    Double_t    *fEYlowd;       ///<[fNpoints] array of Y low displacements
0036    Double_t    *fEYhighd;      ///<[fNpoints] array of Y high displacements
0037 
0038    void       SwapPoints(Int_t pos1, Int_t pos2) override;
0039    void       UpdateArrays(const std::vector<Int_t> &sorting_indices, Int_t numSortedPoints, Int_t low) override;
0040 
0041    Double_t** Allocate(Int_t size) override;
0042    void       CopyAndRelease(Double_t **newarrays,
0043                                      Int_t ibegin, Int_t iend, Int_t obegin) override;
0044    Bool_t     CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
0045                                  Int_t obegin) override;
0046    Bool_t             CtorAllocate();
0047    void       FillZero(Int_t begin, Int_t end,
0048                                Bool_t from_ctor = kTRUE) override;
0049    Bool_t     DoMerge(const TGraph * g) override;
0050 
0051 
0052 public:
0053    TGraphBentErrors();
0054    TGraphBentErrors(Int_t n);
0055    TGraphBentErrors(Int_t n,
0056                     const Float_t *x, const Float_t *y,
0057                     const Float_t *exl=nullptr, const Float_t *exh=nullptr,
0058                     const Float_t *eyl=nullptr, const Float_t *eyh=nullptr,
0059                     const Float_t *exld=nullptr, const Float_t *exhd=nullptr,
0060                     const Float_t *eyld=nullptr, const Float_t *eyhd=nullptr);
0061    TGraphBentErrors(Int_t n,
0062                     const Double_t *x, const Double_t *y,
0063                     const Double_t *exl=nullptr, const Double_t *exh=nullptr,
0064                     const Double_t *eyl=nullptr, const Double_t *eyh=nullptr,
0065                     const Double_t *exld=nullptr, const Double_t *exhd=nullptr,
0066                     const Double_t *eyld=nullptr, const Double_t *eyhd=nullptr);
0067    TGraphBentErrors(const TGraphBentErrors &gr);
0068    ~TGraphBentErrors() override;
0069    void    Apply(TF1 *f) override;
0070    void    ComputeRange(Double_t &xmin, Double_t &ymin,
0071                                 Double_t &xmax, Double_t &ymax) const override;
0072    Double_t        GetErrorX(Int_t bin)     const override;
0073    Double_t        GetErrorY(Int_t bin)     const override;
0074    Double_t        GetErrorXlow(Int_t bin)  const override;
0075    Double_t        GetErrorXhigh(Int_t bin) const override;
0076    Double_t        GetErrorYlow(Int_t bin)  const override;
0077    Double_t        GetErrorYhigh(Int_t bin) const override;
0078    Double_t       *GetEXlow()   const override {return fEXlow;}
0079    Double_t       *GetEXhigh()  const override {return fEXhigh;}
0080    Double_t       *GetEYlow()   const override {return fEYlow;}
0081    Double_t       *GetEYhigh()  const override {return fEYhigh;}
0082    Double_t       *GetEXlowd()  const override {return fEXlowd;}
0083    Double_t       *GetEXhighd() const override {return fEXhighd;}
0084    Double_t       *GetEYlowd()  const override {return fEYlowd;}
0085    Double_t       *GetEYhighd() const override {return fEYhighd;}
0086    void    Print(Option_t *chopt="") const override;
0087    void    SavePrimitive(std::ostream &out, Option_t *option = "") override;
0088    void    Scale(Double_t c1=1., Option_t *option="y") override; // *MENU*
0089    virtual void    SetPointError(Double_t exl, Double_t exh,
0090                                  Double_t eyl, Double_t eyh,
0091                                  Double_t exld=0, Double_t exhd=0,
0092                                  Double_t eyld=0, Double_t eyhd=0); // *MENU*
0093    virtual void    SetPointError(Int_t i,
0094                                  Double_t exl, Double_t exh,
0095                                  Double_t eyl, Double_t eyh,
0096                                  Double_t exld=0, Double_t exhd=0,
0097                                  Double_t eyld=0, Double_t eyhd=0);
0098 
0099    ClassDefOverride(TGraphBentErrors,1)  //A graph with bent, asymmetric error bars
0100 };
0101 
0102 inline Double_t **TGraphBentErrors::Allocate(Int_t size) {
0103    return AllocateArrays(10, size);
0104 }
0105 
0106 #endif