Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/hist:$Id$
0002 // Author: Rene Brun   17/05/2006
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_TProfile3D
0013 #define ROOT_TProfile3D
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TProfile3D                                                           //
0019 //                                                                      //
0020 // Profile3D histogram class.                                           //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TH3.h"
0025 #include "TProfile.h"
0026 
0027 class TProfile3D : public TH3D {
0028 
0029 public:
0030    friend class TProfileHelper;
0031    friend class TH1Merger;
0032 
0033 protected:
0034    TArrayD       fBinEntries;      ///< Number of entries per bin
0035    EErrorType    fErrorMode;       ///< Option to compute errors
0036    Double_t      fTmin;            ///< Lower limit in T (if set)
0037    Double_t      fTmax;            ///< Upper limit in T (if set)
0038    Bool_t        fScaling;         ///<! True when TProfile3D::Scale is called
0039    Double_t      fTsumwt;          ///< Total Sum of weight*T
0040    Double_t      fTsumwt2;         ///< Total Sum of weight*T*T
0041    TArrayD       fBinSumw2;        ///< Array of sum of squares of weights per bin
0042    static Bool_t fgApproximate;    ///< Bin error approximation option
0043 
0044    Int_t    BufferFill(Double_t, Double_t) override {return -2;} //may not use
0045    Int_t    BufferFill(Double_t, Double_t, Double_t) override {return -2;} //may not use
0046    Int_t    BufferFill(Double_t, Double_t, Double_t, Double_t) override {return -2;} //may not use
0047    virtual Int_t    BufferFill(Double_t x, Double_t y, Double_t z, Double_t t, Double_t w);
0048 
0049    // helper methods for the Merge unification in TProfileHelper
0050    void SetBins(const Int_t* nbins,const Double_t* range) { SetBins(nbins[0], range[0], range[1],
0051                                                                     nbins[1], range[2], range[3],
0052                                                                     nbins[2], range[4], range[5]); };
0053    Int_t Fill(const Double_t* v) { return Fill(v[0], v[1], v[2], v[3], v[4]); };
0054 
0055 
0056    using TH3::Fill;
0057    Int_t             Fill(Double_t, Double_t,Double_t) override {return TH3::Fill(0); } //MayNotUse
0058    Int_t             Fill(const char *, const char *, const char *, Double_t) override {return TH3::Fill(0); } //MayNotUse
0059    Int_t             Fill(const char *, Double_t , const char *, Double_t) override {return TH3::Fill(0); } //MayNotUse
0060    Int_t             Fill(const char *, const char *, Double_t, Double_t) override {return TH3::Fill(0); } //MayNotUse
0061    Int_t             Fill(Double_t, const char *, const char *, Double_t) override {return TH3::Fill(0); } //MayNotUse
0062    Int_t             Fill(Double_t, const char *, Double_t, Double_t) override {return TH3::Fill(0); } //MayNotUse
0063    Int_t             Fill(Double_t, Double_t, const char *, Double_t) override {return TH3::Fill(0); } //MayNotUse
0064 
0065    Double_t RetrieveBinContent(Int_t bin) const override { return (fBinEntries.fArray[bin] > 0) ? fArray[bin]/fBinEntries.fArray[bin] : 0; }
0066    //virtual void     UpdateBinContent(Int_t bin, Double_t content);
0067    Double_t GetBinErrorSqUnchecked(Int_t bin) const override { Double_t err = GetBinError(bin); return err*err; }
0068 
0069    TProfile2D *DoProjectProfile2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
0070                                           bool originalRange, bool useUF, bool useOF) const override;
0071 
0072 private:
0073    Double_t *GetB()  {return &fBinEntries.fArray[0];}
0074    Double_t *GetB2() {return fBinSumw2.fN ? &fBinSumw2.fArray[0] : nullptr;}
0075    Double_t *GetW()  {return &fArray[0];}
0076    Double_t *GetW2() {return &fSumw2.fArray[0];}
0077    void  SetBins(Int_t, Double_t, Double_t) override
0078       { MayNotUse("SetBins(Int_t, Double_t, Double_t"); }
0079    void  SetBins(Int_t, const Double_t*) override
0080       { MayNotUse("SetBins(Int_t, const Double_t*"); }
0081    void SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t) override
0082       { MayNotUse("SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t"); }
0083    void SetBins(Int_t, const Double_t*, Int_t, const Double_t*) override
0084       { MayNotUse("SetBins(Int_t, const Double_t*, Int_t, const Double_t*"); }
0085 
0086 public:
0087    TProfile3D();
0088    TProfile3D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
0089                                                 ,Int_t nbinsy,Double_t ylow,Double_t yup
0090                                                 ,Int_t nbinsz,Double_t zlow,Double_t zup, Option_t *option="");
0091    TProfile3D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
0092                                                 ,Int_t nbinsy,const Double_t *ybins
0093                                                 ,Int_t nbinsz,const Double_t *zbins,Option_t *option="");
0094    TProfile3D(const TProfile3D &profile);
0095    TProfile3D &operator=(const TProfile3D &profile);
0096    ~TProfile3D() override;
0097    Bool_t    Add(TF1 *h1, Double_t c1=1, Option_t *option="") override;
0098    Bool_t    Add(const TH1 *h1, Double_t c1=1) override;
0099    Bool_t    Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1) override;
0100    static  void      Approximate(Bool_t approx=kTRUE);
0101    void              BuildOptions(Double_t tmin, Double_t tmax, Option_t *option);
0102    Int_t     BufferEmpty(Int_t action=0) override;
0103    void      Copy(TObject &hnew) const override;
0104    Bool_t    Divide(TF1 *h1, Double_t c1=1) override;
0105    Bool_t    Divide(const TH1 *h1) override;
0106    Bool_t    Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") override;
0107    void      ExtendAxis(Double_t x, TAxis *axis) override;
0108    Int_t     Fill(Double_t x, Double_t y, Double_t z, Double_t t) override;
0109    virtual Int_t     Fill(Double_t x, Double_t y, Double_t z, Double_t t, Double_t w);
0110    Double_t  GetBinContent(Int_t bin) const override;
0111    Double_t  GetBinContent(Int_t,Int_t) const override
0112                      { MayNotUse("GetBinContent(Int_t, Int_t"); return -1; }
0113    Double_t  GetBinContent(Int_t binx, Int_t biny, Int_t binz) const override {return GetBinContent(GetBin(binx,biny,binz));}
0114    Double_t  GetBinError(Int_t bin) const override;
0115    Double_t  GetBinError(Int_t,Int_t) const override
0116                      { MayNotUse("GetBinError(Int_t, Int_t"); return -1; }
0117    Double_t  GetBinError(Int_t binx, Int_t biny, Int_t binz) const override {return GetBinError(GetBin(binx,biny,binz));}
0118    virtual Double_t  GetBinEntries(Int_t bin) const;
0119    virtual Double_t  GetBinEffectiveEntries(Int_t bin);
0120    virtual TArrayD *GetBinSumw2() {return &fBinSumw2;}
0121    virtual const TArrayD *GetBinSumw2() const {return &fBinSumw2;}
0122    Option_t         *GetErrorOption() const;
0123    void      GetStats(Double_t *stats) const override;
0124    virtual Double_t  GetTmin() const {return fTmin;}
0125    virtual Double_t  GetTmax() const {return fTmax;}
0126    void      LabelsDeflate(Option_t *axis="X") override;
0127    void      LabelsInflate(Option_t *axis="X") override;
0128    void      LabelsOption(Option_t *option="h", Option_t *axis="X") override;
0129    Long64_t  Merge(TCollection *list) override;
0130    Bool_t    Multiply(TF1 *h1, Double_t c1=1) override;
0131    Bool_t    Multiply(const TH1 *h1) override;
0132    Bool_t    Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") override;
0133    virtual TH3D     *ProjectionXYZ(const char *name="_pxyz", Option_t *option="e") const;
0134    TProfile2D  *Project3DProfile(Option_t *option="xy") const override; // *MENU*
0135    void      PutStats(Double_t *stats) override;
0136    void      Reset(Option_t *option="") override;
0137    void      SavePrimitive(std::ostream &out, Option_t *option = "") override;
0138    void      Scale(Double_t c1=1, Option_t *option="") override;
0139    virtual void      SetBinEntries(Int_t bin, Double_t w);
0140    void      SetBins(Int_t nbinsx, Double_t xmin, Double_t xmax,
0141                              Int_t nbinsy, Double_t ymin, Double_t ymax,
0142                              Int_t nbinsz, Double_t zmin, Double_t zmax) override;
0143    void      SetBins(Int_t nx, const Double_t *xBins, Int_t ny, const Double_t * yBins, Int_t nz,
0144                              const Double_t *zBins) override;
0145    void      SetBinsLength(Int_t n=-1) override;
0146    void      SetBuffer(Int_t buffersize, Option_t *opt="") override;
0147    virtual void      SetErrorOption(Option_t *option=""); // *MENU*
0148    void      Sumw2(Bool_t flag = kTRUE) override;
0149 
0150    ClassDefOverride(TProfile3D,8)  //Profile3D histogram class
0151 };
0152 
0153 #endif