Logo ROOT   6.08/07
Reference Guide
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 #ifndef ROOT_TH3
25 #include "TH3.h"
26 #endif
27 #ifndef ROOT_TProfile
28 #include "TProfile.h"
29 #endif
30 
31 class TProfile3D : public TH3D {
32 
33 public:
34  friend class TProfileHelper;
35 
36 protected:
37  TArrayD fBinEntries; //number of entries per bin
38  EErrorType fErrorMode; //Option to compute errors
39  Double_t fTmin; //Lower limit in T (if set)
40  Double_t fTmax; //Upper limit in T (if set)
41  Bool_t fScaling; //!True when TProfile3D::Scale is called
42  Double_t fTsumwt; //Total Sum of weight*T
43  Double_t fTsumwt2; //Total Sum of weight*T*T
44  TArrayD fBinSumw2; //Array of sum of squares of weights per bin
45  static Bool_t fgApproximate; //bin error approximation option
46 
47  virtual Int_t BufferFill(Double_t, Double_t) {return -2;} //may not use
48  virtual Int_t BufferFill(Double_t, Double_t, Double_t) {return -2;} //may not use
49  virtual Int_t BufferFill(Double_t, Double_t, Double_t, Double_t) {return -2;} //may not use
51 
52  // helper methods for the Merge unification in TProfileHelper
53  void SetBins(const Int_t* nbins,const Double_t* range) { SetBins(nbins[0], range[0], range[1],
54  nbins[1], range[2], range[3],
55  nbins[2], range[4], range[5]); };
56  Int_t Fill(const Double_t* v) { return Fill(v[0], v[1], v[2], v[3], v[4]); };
57 
58 
59  using TH3::Fill;
60  Int_t Fill(Double_t, Double_t,Double_t) {return TH3::Fill(0); } //MayNotUse
61  Int_t Fill(const char *, const char *, const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
62  Int_t Fill(const char *, Double_t , const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
63  Int_t Fill(const char *, const char *, Double_t, Double_t) {return TH3::Fill(0); } //MayNotUse
64  Int_t Fill(Double_t, const char *, const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
65  Int_t Fill(Double_t, const char *, Double_t, Double_t) {return TH3::Fill(0); } //MayNotUse
66  Int_t Fill(Double_t, Double_t, const char *, Double_t) {return TH3::Fill(0); } //MayNotUse
67 
68  virtual Double_t RetrieveBinContent(Int_t bin) const { return (fBinEntries.fArray[bin] > 0) ? fArray[bin]/fBinEntries.fArray[bin] : 0; }
69  //virtual void UpdateBinContent(Int_t bin, Double_t content);
70  virtual Double_t GetBinErrorSqUnchecked(Int_t bin) const { Double_t err = GetBinError(bin); return err*err; }
71 
72  virtual TProfile2D *DoProjectProfile2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
73  bool originalRange, bool useUF, bool useOF) const;
74 
75 private:
76  Double_t *GetB() {return &fBinEntries.fArray[0];}
77  Double_t *GetB2() {return (fBinSumw2.fN ? &fBinSumw2.fArray[0] : 0 ); }
78  Double_t *GetW() {return &fArray[0];}
79  Double_t *GetW2() {return &fSumw2.fArray[0];}
81  { MayNotUse("SetBins(Int_t, Double_t, Double_t"); }
82  void SetBins(Int_t, const Double_t*)
83  { MayNotUse("SetBins(Int_t, const Double_t*"); }
85  { MayNotUse("SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t"); }
86  void SetBins(Int_t, const Double_t*, Int_t, const Double_t*)
87  { MayNotUse("SetBins(Int_t, const Double_t*, Int_t, const Double_t*"); }
88 
89 public:
90  TProfile3D();
91  TProfile3D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
92  ,Int_t nbinsy,Double_t ylow,Double_t yup
93  ,Int_t nbinsz,Double_t zlow,Double_t zup, Option_t *option="");
94  TProfile3D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
95  ,Int_t nbinsy,const Double_t *ybins
96  ,Int_t nbinsz,const Double_t *zbins,Option_t *option="");
97  TProfile3D(const TProfile3D &profile);
98  virtual ~TProfile3D();
99  virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="");
100  virtual Bool_t Add(const TH1 *h1, Double_t c1=1);
101  virtual Bool_t Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1); // *MENU*
102  static void Approximate(Bool_t approx=kTRUE);
103  void BuildOptions(Double_t tmin, Double_t tmax, Option_t *option);
104  virtual Int_t BufferEmpty(Int_t action=0);
105  virtual void Copy(TObject &hnew) const;
106  virtual Bool_t Divide(TF1 *h1, Double_t c1=1);
107  virtual Bool_t Divide(const TH1 *h1);
108  virtual Bool_t Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option=""); // *MENU*
109  virtual void ExtendAxis(Double_t x, TAxis *axis);
110  virtual Int_t Fill(Double_t x, Double_t y, Double_t z, Double_t t);
111  virtual Int_t Fill(Double_t x, Double_t y, Double_t z, Double_t t, Double_t w);
112  virtual Double_t GetBinContent(Int_t bin) const;
114  { MayNotUse("GetBinContent(Int_t, Int_t"); return -1; }
115  virtual Double_t GetBinContent(Int_t binx, Int_t biny, Int_t binz) const {return GetBinContent(GetBin(binx,biny,binz));}
116  virtual Double_t GetBinError(Int_t bin) const;
118  { MayNotUse("GetBinError(Int_t, Int_t"); return -1; }
119  virtual Double_t GetBinError(Int_t binx, Int_t biny, Int_t binz) const {return GetBinError(GetBin(binx,biny,binz));}
120  virtual Double_t GetBinEntries(Int_t bin) const;
122  virtual TArrayD *GetBinSumw2() {return &fBinSumw2;}
123  virtual const TArrayD *GetBinSumw2() const {return &fBinSumw2;}
124  Option_t *GetErrorOption() const;
125  virtual void GetStats(Double_t *stats) const;
126  virtual Double_t GetTmin() const {return fTmin;}
127  virtual Double_t GetTmax() const {return fTmax;}
128  virtual Long64_t Merge(TCollection *list);
129  virtual Bool_t Multiply(TF1 *h1, Double_t c1=1);
130  virtual Bool_t Multiply(const TH1 *h1);
131  virtual Bool_t Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option=""); // *MENU*
132  virtual TH3D *ProjectionXYZ(const char *name="_pxyz", Option_t *option="e") const;
133  virtual TProfile2D *Project3DProfile(Option_t *option="xy") const; // *MENU*
134  virtual void PutStats(Double_t *stats);
135  virtual void Reset(Option_t *option="");
136  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
137  virtual void Scale(Double_t c1=1, Option_t *option="");
138  virtual void SetBinEntries(Int_t bin, Double_t w);
139  virtual void SetBins(Int_t nbinsx, Double_t xmin, Double_t xmax,
140  Int_t nbinsy, Double_t ymin, Double_t ymax,
141  Int_t nbinsz, Double_t zmin, Double_t zmax);
142  virtual void SetBins(Int_t nx, const Double_t *xBins, Int_t ny, const Double_t * yBins, Int_t nz,
143  const Double_t *zBins);
144  virtual void SetBinsLength(Int_t n=-1);
145  virtual void SetBuffer(Int_t buffersize, Option_t *opt="");
146  virtual void SetErrorOption(Option_t *option=""); // *MENU*
147  virtual void Sumw2(Bool_t flag = kTRUE);
148 
149  ClassDef(TProfile3D,7) //Profile3D histogram class
150 };
151 
152 #endif
const int nx
Definition: kalman.C:16
Int_t Fill(const char *, const char *, const char *, Double_t)
Increment cell defined by namex,namey,namez by a weight w.
Definition: TProfile3D.h:61
Int_t Fill(const char *, Double_t, const char *, Double_t)
Increment cell defined by namex,y,namez by a weight w.
Definition: TProfile3D.h:62
Double_t fTmin
Definition: TProfile3D.h:39
float xmin
Definition: THbookFile.cxx:93
Double_t fTsumwt2
Definition: TProfile3D.h:43
virtual Double_t GetBinError(Int_t bin) const
-*Return bin error of a Profile3D histogram
Definition: TProfile3D.cxx:734
virtual void SetBinEntries(Int_t bin, Double_t w)
Set the number of entries in bin.
virtual void SetBuffer(Int_t buffersize, Option_t *opt="")
set the buffer size in units of 8 bytes (double)
long long Long64_t
Definition: RtypesCore.h:69
virtual TH3D * ProjectionXYZ(const char *name="_pxyz", Option_t *option="e") const
*-*-*-*-*Project this profile3D into a 3-D histogram along X,Y,Z -* *-* =============================...
virtual TProfile2D * DoProjectProfile2D(const char *name, const char *title, const TAxis *projX, const TAxis *projY, bool originalRange, bool useUF, bool useOF) const
internal method to project to a 2D Profile called from TH3::Project3DProfile but re-implemented in ca...
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this profile2D by a constant c1.
Option_t * GetErrorOption() const
-*Return option to compute profile2D errors *-* ========================================= ...
Definition: TProfile3D.cxx:743
const char Option_t
Definition: RtypesCore.h:62
virtual Int_t BufferFill(Double_t, Double_t, Double_t)
Definition: TProfile3D.h:48
void SetBins(Int_t, const Double_t *, Int_t, const Double_t *)
Redefine x and y axis parameters with variable bin sizes.
Definition: TProfile3D.h:86
return c1
Definition: legend1.C:41
virtual void Sumw2(Bool_t flag=kTRUE)
Create/Delete structure to store sum of squares of weights per bin This is needed to compute the corr...
void Reset()
Definition: TArrayD.h:49
float ymin
Definition: THbookFile.cxx:93
virtual ~TProfile3D()
Default destructor for Profile3D histograms.
Definition: TProfile3D.cxx:87
Double_t fTmax
Definition: TProfile3D.h:40
void SetBins(Int_t, Double_t, Double_t)
Redefine x axis parameters.
Definition: TProfile3D.h:80
virtual Double_t GetBinEntries(Int_t bin) const
Return bin entries of a Profile3D histogram.
Definition: TProfile3D.cxx:693
virtual Int_t BufferFill(Double_t, Double_t)
accumulate arguments in buffer.
Definition: TProfile3D.h:47
virtual Int_t GetBin(Int_t binx, Int_t biny, Int_t binz) const
See comments in TH1::GetBin.
Definition: TH3.cxx:950
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
void BuildOptions(Double_t tmin, Double_t tmax, Option_t *option)
Set Profile3D histogram structure and options.
Definition: TProfile3D.cxx:142
Int_t Fill(Double_t, Double_t, const char *, Double_t)
Increment cell defined by x,y,namez by a weight w.
Definition: TProfile3D.h:66
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Profile3D histograms are used to display the mean value of T and its RMS for each cell in X...
Definition: TProfile3D.h:31
int nbins[3]
TArrayD fSumw2
Array of sum of squares of weights.
Definition: TH1.h:118
Double_t * GetB()
Definition: TProfile3D.h:76
virtual TProfile2D * Project3DProfile(Option_t *option="xy") const
*-*-*-*-*Project a 3-D profile into a 2D-profile histogram depending on the option parameter option m...
Double_t * GetW2()
Definition: TProfile3D.h:79
EErrorType
Definition: TProfile.h:30
Int_t Fill(Double_t, Double_t, Double_t)
Increment cell defined by x,y,z by 1 .
Definition: TProfile3D.h:60
virtual Bool_t Multiply(TF1 *h1, Double_t c1=1)
Performs the operation: this = this*c1*f1.
virtual Int_t BufferFill(Double_t, Double_t, Double_t, Double_t)
accumulate arguments in buffer.
Definition: TProfile3D.h:49
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Double_t GetBinErrorSqUnchecked(Int_t bin) const
Definition: TProfile3D.h:70
static Bool_t fgApproximate
Definition: TProfile3D.h:45
virtual void GetStats(Double_t *stats) const
fill the array stats from the contents of this profile The array stats must be correctly dimensionned...
Definition: TProfile3D.cxx:773
const int ny
Definition: kalman.C:17
virtual Double_t RetrieveBinContent(Int_t bin) const
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition: TProfile3D.h:68
Double_t fTsumwt
True when TProfile3D::Scale is called.
Definition: TProfile3D.h:42
Double_t * fArray
Definition: TArrayD.h:32
virtual void Copy(TObject &hnew) const
Copy a Profile3D histogram to a new profile2D histogram.
Definition: TProfile3D.cxx:339
virtual Double_t GetBinContent(Int_t bin) const
Return bin content of a Profile3D histogram.
Definition: TProfile3D.cxx:680
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Definition: TObject.cxx:978
TH1F * h1
Definition: legend1.C:5
virtual TArrayD * GetBinSumw2()
Definition: TProfile3D.h:122
void SetBins(Int_t, Double_t, Double_t, Int_t, Double_t, Double_t)
Redefine x and y axis parameters.
Definition: TProfile3D.h:84
Int_t fN
Definition: TArray.h:40
static void Approximate(Bool_t approx=kTRUE)
set the fgApproximate flag.
Definition: TProfile3D.cxx:224
float ymax
Definition: THbookFile.cxx:93
Class to manage histogram axis.
Definition: TAxis.h:36
tomato 3-D histogram with a double per channel (see TH1 documentation)}
Definition: TH3.h:308
SVector< double, 2 > v
Definition: Dict.h:5
Int_t Fill(const Double_t *v)
Definition: TProfile3D.h:56
Collection abstract base class.
Definition: TCollection.h:48
virtual const TArrayD * GetBinSumw2() const
Definition: TProfile3D.h:123
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1.
Definition: TProfile3D.cxx:167
Int_t Fill(Double_t)
Invalid Fill method.
Definition: TH3.cxx:280
float xmax
Definition: THbookFile.cxx:93
virtual Long64_t Merge(TCollection *list)
Merge all histograms in the collection in this histogram.
Definition: TProfile3D.cxx:840
virtual void SetErrorOption(Option_t *option="")
Set option to compute profile3D errors.
virtual Double_t GetBinContent(Int_t, Int_t) const
Definition: TProfile3D.h:113
Int_t Fill(Double_t, const char *, const char *, Double_t)
Increment cell defined by x,namey,namezz by a weight w.
Definition: TProfile3D.h:64
Int_t Fill(Double_t, const char *, Double_t, Double_t)
Increment cell defined by x,namey,z by a weight w.
Definition: TProfile3D.h:65
virtual Double_t GetBinEffectiveEntries(Int_t bin)
Return bin effective entries for a weighted filled Profile histogram.
Definition: TProfile3D.cxx:711
TProfile3D()
Default constructor for Profile3D histograms.
Definition: TProfile3D.cxx:77
return c2
Definition: legend2.C:14
virtual void PutStats(Double_t *stats)
Replace current statistics with the values in array stats.
double Double_t
Definition: RtypesCore.h:55
virtual Double_t GetTmax() const
Definition: TProfile3D.h:127
Double_t y[n]
Definition: legend1.C:17
The TH1 histogram class.
Definition: TH1.h:80
TArrayD fBinEntries
Definition: TProfile3D.h:37
void SetBins(const Int_t *nbins, const Double_t *range)
Definition: TProfile3D.h:53
virtual Double_t GetBinContent(Int_t binx, Int_t biny, Int_t binz) const
Definition: TProfile3D.h:115
Profile2D histograms are used to display the mean value of Z and its RMS for each cell in X...
Definition: TProfile2D.h:31
Array of doubles (64 bits per element).
Definition: TArrayD.h:29
Double_t * GetB2()
Definition: TProfile3D.h:77
Double_t * GetW()
Definition: TProfile3D.h:78
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
Bool_t fScaling
Definition: TProfile3D.h:41
Int_t Fill(const char *, const char *, Double_t, Double_t)
Increment cell defined by namex,namey,z by a weight w.
Definition: TProfile3D.h:63
EErrorType fErrorMode
Definition: TProfile3D.h:38
1-Dim function class
Definition: TF1.h:149
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
Definition: TProfile3D.cxx:238
virtual Double_t GetTmin() const
Definition: TProfile3D.h:126
virtual void ExtendAxis(Double_t x, TAxis *axis)
Profile histogram is resized along axis such that x is in the axis range.
void SetBins(Int_t, const Double_t *)
Redefine x axis parameters with variable bin sizes.
Definition: TProfile3D.h:82
virtual Double_t GetBinError(Int_t binx, Int_t biny, Int_t binz) const
Definition: TProfile3D.h:119
const Bool_t kTRUE
Definition: Rtypes.h:91
const Int_t n
Definition: legend1.C:16
char name[80]
Definition: TGX11.cxx:109
virtual Double_t GetBinError(Int_t, Int_t) const
Definition: TProfile3D.h:117
virtual Bool_t Divide(TF1 *h1, Double_t c1=1)
Performs the operation: this = this/(c1*f1) This function is not implemented.
Definition: TProfile3D.cxx:367
TArrayD fBinSumw2
Definition: TProfile3D.h:44