Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TProfile3D.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Rene Brun 17/05/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TProfile3D
13 #define ROOT_TProfile3D
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TProfile3D //
19 // //
20 // Profile3D histogram class. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TH3.h"
25 #include "TProfile.h"
26 
27 class TProfile3D : public TH3D {
28 
29 public:
30  friend class TProfileHelper;
31 
32 protected:
33  TArrayD fBinEntries; //number of entries per bin
34  EErrorType fErrorMode; //Option to compute errors
35  Double_t fTmin; //Lower limit in T (if set)
36  Double_t fTmax; //Upper limit in T (if set)
37  Bool_t fScaling; //!True when TProfile3D::Scale is called
38  Double_t fTsumwt; //Total Sum of weight*T
39  Double_t fTsumwt2; //Total Sum of weight*T*T
40  TArrayD fBinSumw2; //Array of sum of squares of weights per bin
41  static Bool_t fgApproximate; //bin error approximation option
42 
43  virtual Int_t BufferFill(Double_t, Double_t) {return -2;} //may not use
44  virtual Int_t BufferFill(Double_t, Double_t, Double_t) {return -2;} //may not use
45  virtual Int_t BufferFill(Double_t, Double_t, Double_t, Double_t) {return -2;} //may not use
46  virtual Int_t BufferFill(Double_t x, Double_t y, Double_t z, Double_t t, Double_t w);
47 
48  // helper methods for the Merge unification in TProfileHelper
49  void SetBins(const Int_t* nbins,const Double_t* range) { SetBins(nbins[0], range[0], range[1],
50  nbins[1], range[2], range[3],
51  nbins[2], range[4], range[5]); };
52  Int_t Fill(const Double_t* v) { return Fill(v[0], v[1], v[2], v[3], v[4]); };
53 
54 
55  using TH3::Fill;
56  Int_t Fill(Double_t, Double_t,Double_t) {return TH3::Fill(0); } //MayNotUse
57  Int_t Fill(const char *, const char *, const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
58  Int_t Fill(const char *, Double_t , const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
59  Int_t Fill(const char *, const char *, Double_t, Double_t) {return TH3::Fill(0); } //MayNotUse
60  Int_t Fill(Double_t, const char *, const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
61  Int_t Fill(Double_t, const char *, Double_t, Double_t) {return TH3::Fill(0); } //MayNotUse
62  Int_t Fill(Double_t, Double_t, const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
63 
64  virtual Double_t RetrieveBinContent(Int_t bin) const { return (fBinEntries.fArray[bin] > 0) ? fArray[bin]/fBinEntries.fArray[bin] : 0; }
65  //virtual void UpdateBinContent(Int_t bin, Double_t content);
66  virtual Double_t GetBinErrorSqUnchecked(Int_t bin) const { Double_t err = GetBinError(bin); return err*err; }
67 
68  virtual TProfile2D *DoProjectProfile2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
69  bool originalRange, bool useUF, bool useOF) const;
70 
71 private:
72  Double_t *GetB() {return &fBinEntries.fArray[0];}
73  Double_t *GetB2() {return (fBinSumw2.fN ? &fBinSumw2.fArray[0] : 0 ); }
74  Double_t *GetW() {return &fArray[0];}
75  Double_t *GetW2() {return &fSumw2.fArray[0];}
76  void SetBins(Int_t, Double_t, Double_t)
77  { MayNotUse("SetBins(Int_t, Double_t, Double_t"); }
78  void SetBins(Int_t, const Double_t*)
79  { MayNotUse("SetBins(Int_t, const Double_t*"); }
80  void SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t)
81  { MayNotUse("SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t"); }
82  void SetBins(Int_t, const Double_t*, Int_t, const Double_t*)
83  { MayNotUse("SetBins(Int_t, const Double_t*, Int_t, const Double_t*"); }
84 
85 public:
86  TProfile3D();
87  TProfile3D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
88  ,Int_t nbinsy,Double_t ylow,Double_t yup
89  ,Int_t nbinsz,Double_t zlow,Double_t zup, Option_t *option="");
90  TProfile3D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
91  ,Int_t nbinsy,const Double_t *ybins
92  ,Int_t nbinsz,const Double_t *zbins,Option_t *option="");
93  TProfile3D(const TProfile3D &profile);
94  TProfile3D &operator=(const TProfile3D &profile);
95  virtual ~TProfile3D();
96  virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="");
97  virtual Bool_t Add(const TH1 *h1, Double_t c1=1);
98  virtual Bool_t Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1);
99  static void Approximate(Bool_t approx=kTRUE);
100  void BuildOptions(Double_t tmin, Double_t tmax, Option_t *option);
101  virtual Int_t BufferEmpty(Int_t action=0);
102  virtual void Copy(TObject &hnew) const;
103  virtual Bool_t Divide(TF1 *h1, Double_t c1=1);
104  virtual Bool_t Divide(const TH1 *h1);
105  virtual Bool_t Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="");
106  virtual void ExtendAxis(Double_t x, TAxis *axis);
107  virtual Int_t Fill(Double_t x, Double_t y, Double_t z, Double_t t);
108  virtual Int_t Fill(Double_t x, Double_t y, Double_t z, Double_t t, Double_t w);
109  virtual Double_t GetBinContent(Int_t bin) const;
110  virtual Double_t GetBinContent(Int_t,Int_t) const
111  { MayNotUse("GetBinContent(Int_t, Int_t"); return -1; }
112  virtual Double_t GetBinContent(Int_t binx, Int_t biny, Int_t binz) const {return GetBinContent(GetBin(binx,biny,binz));}
113  virtual Double_t GetBinError(Int_t bin) const;
114  virtual Double_t GetBinError(Int_t,Int_t) const
115  { MayNotUse("GetBinError(Int_t, Int_t"); return -1; }
116  virtual Double_t GetBinError(Int_t binx, Int_t biny, Int_t binz) const {return GetBinError(GetBin(binx,biny,binz));}
117  virtual Double_t GetBinEntries(Int_t bin) const;
118  virtual Double_t GetBinEffectiveEntries(Int_t bin);
119  virtual TArrayD *GetBinSumw2() {return &fBinSumw2;}
120  virtual const TArrayD *GetBinSumw2() const {return &fBinSumw2;}
121  Option_t *GetErrorOption() const;
122  virtual void GetStats(Double_t *stats) const;
123  virtual Double_t GetTmin() const {return fTmin;}
124  virtual Double_t GetTmax() const {return fTmax;}
125  virtual Long64_t Merge(TCollection *list);
126  virtual Bool_t Multiply(TF1 *h1, Double_t c1=1);
127  virtual Bool_t Multiply(const TH1 *h1);
128  virtual Bool_t Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="");
129  virtual TH3D *ProjectionXYZ(const char *name="_pxyz", Option_t *option="e") const;
130  virtual TProfile2D *Project3DProfile(Option_t *option="xy") const; // *MENU*
131  virtual void PutStats(Double_t *stats);
132  virtual void Reset(Option_t *option="");
133  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
134  virtual void Scale(Double_t c1=1, Option_t *option="");
135  virtual void SetBinEntries(Int_t bin, Double_t w);
136  virtual void SetBins(Int_t nbinsx, Double_t xmin, Double_t xmax,
137  Int_t nbinsy, Double_t ymin, Double_t ymax,
138  Int_t nbinsz, Double_t zmin, Double_t zmax);
139  virtual void SetBins(Int_t nx, const Double_t *xBins, Int_t ny, const Double_t * yBins, Int_t nz,
140  const Double_t *zBins);
141  virtual void SetBinsLength(Int_t n=-1);
142  virtual void SetBuffer(Int_t buffersize, Option_t *opt="");
143  virtual void SetErrorOption(Option_t *option=""); // *MENU*
144  virtual void Sumw2(Bool_t flag = kTRUE);
145 
146  ClassDef(TProfile3D,8) //Profile3D histogram class
147 };
148 
149 #endif