TProfile.h

Go to the documentation of this file.
00001 // @(#)root/hist:$Id: TProfile.h 35194 2010-09-08 09:07:44Z moneta $
00002 // Author: Rene Brun   29/09/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TProfile
00013 #define ROOT_TProfile
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TProfile                                                             //
00019 //                                                                      //
00020 // Profile histogram class.                                             //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TH1
00025 #include "TH1.h"
00026 #endif
00027 
00028 class TProfileHelper;
00029 
00030 enum EErrorType { kERRORMEAN = 0, kERRORSPREAD, kERRORSPREADI, kERRORSPREADG };
00031 
00032 class TF1;
00033 
00034 class TProfile : public TH1D {
00035 
00036 public:
00037    friend class TProfileHelper;
00038 
00039 protected:
00040     TArrayD     fBinEntries;      //number of entries per bin
00041     EErrorType  fErrorMode;       //Option to compute errors
00042     Double_t    fYmin;            //Lower limit in Y (if set)
00043     Double_t    fYmax;            //Upper limit in Y (if set)
00044     Bool_t      fScaling;         //!True when TProfile::Scale is called
00045     Double_t    fTsumwy;          //Total Sum of weight*Y
00046     Double_t    fTsumwy2;         //Total Sum of weight*Y*Y
00047     TArrayD     fBinSumw2;        //Array of sum of squares of weights per bin 
00048 
00049 static Bool_t   fgApproximate;    //bin error approximation option
00050 
00051    virtual Int_t    BufferFill(Double_t, Double_t) {return -2;} //may not use
00052    virtual Int_t    BufferFill(Double_t x, Double_t y, Double_t w);
00053 
00054    // helper methods for the Merge unification in TProfileHelper
00055    void SetBins(const Int_t* nbins, const Double_t* range) { SetBins(nbins[0], range[0], range[1]); };
00056    Int_t Fill(const Double_t* v) { return Fill(v[0], v[1], v[2]); };
00057 
00058 private:
00059    Int_t Fill(Double_t) { MayNotUse("Fill(Double_t)"); return -1;}
00060    void FillN(Int_t, const Double_t *, const Double_t *, Int_t) { MayNotUse("FillN(Int_t, Double_t*, Double_t*, Int_t)"); }
00061    Double_t *GetB()  {return &fBinEntries.fArray[0];}
00062    Double_t *GetB2() {return (fBinSumw2.fN ? &fBinSumw2.fArray[0] : 0 ); }
00063    Double_t *GetW()  {return &fArray[0];}
00064    Double_t *GetW2() {return &fSumw2.fArray[0];}
00065    void SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t)
00066       { MayNotUse("SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t"); }
00067    void SetBins(Int_t, const Double_t*, Int_t, const Double_t*)
00068       { MayNotUse("SetBins(Int_t, const Double_t*, Int_t, const Double_t*"); }
00069    void SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t, Int_t, Double_t, Double_t)
00070       { MayNotUse("SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t, Int_t, Double_t, Double_t"); }
00071    void SetBins(Int_t, const Double_t *, Int_t, const Double_t *, Int_t, const Double_t *)
00072       { MayNotUse("SetBins(Int_t, const Double_t*, Int_t, const Double_t*, Int_t, const Double_t*"); }
00073 
00074 public:
00075    TProfile();
00076    TProfile(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup, Option_t *option="");
00077    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="");
00078    TProfile(const char *name,const char *title,Int_t nbinsx,const Float_t  *xbins, Option_t *option="");
00079    TProfile(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins, Option_t *option="");
00080    TProfile(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins, Double_t ylow,Double_t yup, Option_t *option="");
00081    TProfile(const TProfile &profile);
00082    virtual ~TProfile();
00083    virtual void     Add(TF1 *h1, Double_t c1=1, Option_t *option="");
00084    virtual void     Add(const TH1 *h1, Double_t c1=1);
00085    virtual void     Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1); // *MENU*
00086    static  void     Approximate(Bool_t approx=kTRUE);
00087    virtual Int_t    BufferEmpty(Int_t action=0);
00088            void     BuildOptions(Double_t ymin, Double_t ymax, Option_t *option);
00089    virtual void     Copy(TObject &hnew) const;
00090    virtual void     Divide(TF1 *h1, Double_t c1=1);
00091    virtual void     Divide(const TH1 *h1);
00092    virtual void     Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option=""); // *MENU*
00093    virtual TH1     *DrawCopy(Option_t *option="") const;
00094    virtual Int_t    Fill(Double_t x, Double_t y);
00095    virtual Int_t    Fill(const char *namex, Double_t y);
00096    virtual Int_t    Fill(Double_t x, Double_t y, Double_t w);
00097    virtual Int_t    Fill(const char *namex, Double_t y, Double_t w);
00098    virtual void     FillN(Int_t ntimes, const Double_t *x, const Double_t *y, const Double_t *w, Int_t stride=1);
00099    virtual Double_t GetBinContent(Int_t bin) const;
00100    virtual Double_t GetBinContent(Int_t bin, Int_t) const {return GetBinContent(bin);}
00101    virtual Double_t GetBinContent(Int_t bin, Int_t, Int_t) const {return GetBinContent(bin);}
00102    virtual Double_t GetBinError(Int_t bin) const;
00103    virtual Double_t GetBinError(Int_t bin, Int_t) const {return GetBinError(bin);}
00104    virtual Double_t GetBinError(Int_t bin, Int_t, Int_t) const {return GetBinError(bin);}
00105    virtual Double_t GetBinEntries(Int_t bin) const;
00106    virtual Double_t GetBinEffectiveEntries(Int_t bin) const;
00107    virtual TArrayD *GetBinSumw2() {return &fBinSumw2;}
00108    virtual const TArrayD *GetBinSumw2() const {return &fBinSumw2;}
00109    Option_t        *GetErrorOption() const;
00110    virtual char    *GetObjectInfo(Int_t px, Int_t py) const;
00111    virtual void     GetStats(Double_t *stats) const;
00112    virtual Double_t GetYmin() const {return fYmin;}
00113    virtual Double_t GetYmax() const {return fYmax;}
00114    virtual void     LabelsDeflate(Option_t *axis="X");
00115    virtual void     LabelsInflate(Option_t *axis="X");
00116    virtual void     LabelsOption(Option_t *option="h", Option_t *axis="X");
00117    virtual Long64_t Merge(TCollection *list);
00118    virtual void     Multiply(TF1 *h1, Double_t c1=1);
00119    virtual void     Multiply(const TH1 *h1);
00120    virtual void     Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option=""); // *MENU*
00121            TH1D    *ProjectionX(const char *name="_px", Option_t *option="e") const;
00122    virtual void     PutStats(Double_t *stats);
00123            TH1     *Rebin(Int_t ngroup=2, const char*newname="", const Double_t *xbins=0);
00124    virtual void     RebinAxis(Double_t x, TAxis *axis);
00125    virtual void     Reset(Option_t *option="");
00126    virtual void     SavePrimitive(ostream &out, Option_t *option = "");
00127    virtual void     Scale(Double_t c1=1, Option_t *option="");
00128    virtual void     SetBinEntries(Int_t bin, Double_t w);
00129    virtual void     SetBins(Int_t nbins, Double_t xmin, Double_t xmax);
00130    virtual void     SetBins(Int_t nx, const Double_t *xbins);
00131    virtual void     SetBuffer(Int_t buffersize, Option_t *option="");
00132    virtual void     SetErrorOption(Option_t *option=""); // *MENU*
00133    virtual void     Sumw2(); 
00134 
00135    ClassDef(TProfile,6)  //Profile histogram class
00136 };
00137 
00138 #endif
00139 

Generated on Tue Jul 5 14:22:57 2011 for ROOT_528-00b_version by  doxygen 1.5.1