Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TProfile.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/hist:$Id$
0002 // Author: Rene Brun   29/09/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, 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_TProfile
0013 #define ROOT_TProfile
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TProfile                                                             //
0019 //                                                                      //
0020 // Profile histogram class.                                             //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TH1.h"
0025 
0026 class TProfileHelper;
0027 
0028 enum EErrorType { kERRORMEAN = 0, kERRORSPREAD, kERRORSPREADI, kERRORSPREADG };
0029 
0030 class TF1;
0031 
0032 class TProfile : public TH1D {
0033 
0034 public:
0035    friend class TProfileHelper;
0036    friend class TH1Merger;
0037 
0038 protected:
0039    TArrayD fBinEntries;   ///< number of entries per bin
0040    EErrorType fErrorMode; ///< Option to compute errors
0041    Double_t fYmin;        ///< Lower limit in Y (if set)
0042    Double_t fYmax;        ///< Upper limit in Y (if set)
0043    Bool_t fScaling;       ///<! True when TProfile::Scale is called
0044    Double_t fTsumwy;      ///< Total Sum of weight*Y
0045    Double_t fTsumwy2;     ///< Total Sum of weight*Y*Y
0046    TArrayD fBinSumw2;     ///< Array of sum of squares of weights per bin
0047 
0048    static Bool_t fgApproximate; ///< bin error approximation option
0049 
0050    Int_t    BufferFill(Double_t, Double_t) override {return -2;} //may not use
0051    virtual Int_t    BufferFill(Double_t x, Double_t y, Double_t w);
0052 
0053    // helper methods for the Merge unification in TProfileHelper
0054    void SetBins(const Int_t* nbins, const Double_t* range) { SetBins(nbins[0], range[0], range[1]); };
0055    Int_t Fill(const Double_t* v) { return Fill(v[0], v[1], v[2]); };
0056 
0057    Double_t RetrieveBinContent(Int_t bin) const override { return (fBinEntries.fArray[bin] > 0) ? fArray[bin]/fBinEntries.fArray[bin] : 0; }
0058    //virtual void     UpdateBinContent(Int_t bin, Double_t content);
0059    Double_t GetBinErrorSqUnchecked(Int_t bin) const override { Double_t err = GetBinError(bin); return err*err; }
0060 
0061 private:
0062    Int_t Fill(Double_t) override { MayNotUse("Fill(Double_t)"); return -1;}
0063    void FillN(Int_t, const Double_t *, const Double_t *, Int_t) override { MayNotUse("FillN(Int_t, Double_t*, Double_t*, Int_t)"); }
0064    Double_t *GetB()  {return &fBinEntries.fArray[0];}
0065    Double_t *GetB2() {return fBinSumw2.fN ? &fBinSumw2.fArray[0] : nullptr; }
0066    Double_t *GetW()  {return &fArray[0];}
0067    Double_t *GetW2() {return &fSumw2.fArray[0];}
0068    void SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t) override
0069       { MayNotUse("SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t"); }
0070    void SetBins(Int_t, const Double_t*, Int_t, const Double_t*) override
0071       { MayNotUse("SetBins(Int_t, const Double_t*, Int_t, const Double_t*"); }
0072    void SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t, Int_t, Double_t, Double_t) override
0073       { MayNotUse("SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t, Int_t, Double_t, Double_t"); }
0074    void SetBins(Int_t, const Double_t *, Int_t, const Double_t *, Int_t, const Double_t *) override
0075       { MayNotUse("SetBins(Int_t, const Double_t*, Int_t, const Double_t*, Int_t, const Double_t*"); }
0076 
0077 public:
0078    TProfile();
0079    TProfile(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup, Option_t *option="");
0080    TProfile(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup,Double_t ylow,Double_t yup,Option_t *option="");
0081    TProfile(const char *name,const char *title,Int_t nbinsx,const Float_t  *xbins, Option_t *option="");
0082    TProfile(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins, Option_t *option="");
0083    TProfile(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins, Double_t ylow,Double_t yup, Option_t *option="");
0084    TProfile(const TProfile &profile);
0085    TProfile &operator=(const TProfile &profile);
0086    ~TProfile() override;
0087    Bool_t   Add(TF1 *h1, Double_t c1=1, Option_t *option="") override;
0088    Bool_t   Add(const TH1 *h1, Double_t c1=1) override;
0089    Bool_t   Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1) override; // *MENU*
0090    static  void     Approximate(Bool_t approx=kTRUE);
0091    Int_t    BufferEmpty(Int_t action=0) override;
0092            void     BuildOptions(Double_t ymin, Double_t ymax, Option_t *option);
0093    void     Copy(TObject &hnew) const override;
0094    Bool_t   Divide(TF1 *h1, Double_t c1=1) override;
0095    Bool_t   Divide(const TH1 *h1) override;
0096    Bool_t   Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") override; // *MENU*
0097    void     ExtendAxis(Double_t x, TAxis *axis) override;
0098    Int_t    Fill(Double_t x, Double_t y) override;
0099    Int_t    Fill(const char *namex, Double_t y) override;
0100    virtual Int_t    Fill(Double_t x, Double_t y, Double_t w);
0101    virtual Int_t    Fill(const char *namex, Double_t y, Double_t w);
0102    void     FillN(Int_t ntimes, const Double_t *x, const Double_t *y, const Double_t *w, Int_t stride=1) override;
0103    Double_t GetBinContent(Int_t bin) const override;
0104    Double_t GetBinContent(Int_t bin, Int_t) const override {return GetBinContent(bin);}
0105    Double_t GetBinContent(Int_t bin, Int_t, Int_t) const override {return GetBinContent(bin);}
0106    Double_t GetBinError(Int_t bin) const override;
0107    Double_t GetBinError(Int_t bin, Int_t) const override {return GetBinError(bin);}
0108    Double_t GetBinError(Int_t bin, Int_t, Int_t) const override {return GetBinError(bin);}
0109    virtual Double_t GetBinEntries(Int_t bin) const;
0110    virtual Double_t GetBinEffectiveEntries(Int_t bin) const;
0111    virtual TArrayD *GetBinSumw2() {return &fBinSumw2;}
0112    virtual const TArrayD *GetBinSumw2() const {return &fBinSumw2;}
0113    Option_t        *GetErrorOption() const;
0114    void     GetStats(Double_t *stats) const override;
0115    virtual Double_t GetYmin() const {return fYmin;}
0116    virtual Double_t GetYmax() const {return fYmax;}
0117    void     LabelsDeflate(Option_t *axis="X") override;
0118    void     LabelsInflate(Option_t *axis="X") override;
0119    void     LabelsOption(Option_t *option="h", Option_t *axis="X") override;
0120    Long64_t Merge(TCollection *list) override;
0121    Bool_t   Multiply(TF1 *h1, Double_t c1=1) override;
0122    Bool_t   Multiply(const TH1 *h1) override;
0123    Bool_t   Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") override; // *MENU*
0124            TH1D    *ProjectionX(const char *name="_px", Option_t *option="e") const;
0125    void     PutStats(Double_t *stats) override;
0126            TH1     *Rebin(Int_t ngroup = 2, const char *newname = "", const Double_t *xbins = nullptr) override;
0127    void     Reset(Option_t *option="") override;
0128    void     SavePrimitive(std::ostream &out, Option_t *option = "") override;
0129    void     Scale(Double_t c1=1, Option_t *option="") override;
0130    virtual void     SetBinEntries(Int_t bin, Double_t w);
0131    void     SetBins(Int_t nbins, Double_t xmin, Double_t xmax) override;
0132    void     SetBins(Int_t nx, const Double_t *xbins) override;
0133    void     SetBinsLength(Int_t n=-1) override;
0134    void     SetBuffer(Int_t buffersize, Option_t *option="") override;
0135    virtual void     SetErrorOption(Option_t *option=""); // *MENU*
0136    void     Sumw2(Bool_t flag = kTRUE) override;
0137 
0138    ClassDefOverride(TProfile,7)  //Profile histogram class
0139 };
0140 
0141 #endif