001 #ifndef HEPHIST2D_H
002 #define HEPHIST2D_H
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050 #ifdef HEP_SHORT_NAMES
051 #define Hist2D HepHist2D
052 #endif
053
054
055 #ifndef HEPHIST_H
056 #include "HepTuple/HepHist.h"
057 #endif
058
059
060 ZM_BEGIN_NAMESPACE( zmht )
061
062
063 class HepFileManager;
064 class HepRawHist;
065
066
067 class HepHist2D : public HepHist {
068
069 protected:
070
071
072 HepHist2D(
073 HepFileManager * manager
074 , const std::string& title
075 , const int nBinsX, const float lowX, const float highX
076 , const int nBinsY, const float lowY, const float highY
077 , const int id_req = 0
078 );
079
080
081
082 HepHist2D( );
083
084 public:
085
086
087 static const char typeId;
088
089 virtual ~HepHist2D();
090
091 virtual ZM_COVARIANT_TYPE(HepObj,HepHist2D) & makeClone(
092 const std::string& title
093 , const int id = 0
094 ) const;
095
096 virtual ZM_COVARIANT_TYPE(HepObj,HepHist2D) & makeEmpty(
097 const std::string& title
098 , const int id = 0
099 ) const;
100
101 virtual ZM_COVARIANT_TYPE(HepObj,HepHist2D) & makeClone(
102 HepFileManager *manager
103 , const std::string& title
104 , const int id = 0
105 ) const;
106
107 virtual ZM_COVARIANT_TYPE(HepObj,HepHist2D) & makeEmpty(
108 HepFileManager *manager
109 , const std::string& title
110 , const int id = 0
111 ) const;
112
113 virtual void accumulate(
114 const float xValue
115 , const float yValue
116 , const float weight = 1.0
117 );
118
119 virtual void reset();
120
121 virtual float bin(
122 const int binNumX
123 , const int binNumY
124 ) const;
125
126 virtual int nBinsX() const;
127 virtual int nBinsY() const;
128
129 virtual float minX() const;
130 virtual float minY() const;
131
132 virtual float maxX() const;
133 virtual float maxY() const;
134
135 virtual int entries() const;
136
137 virtual float weight() const;
138 virtual float weight2() const;
139
140 virtual float sumX() const;
141 virtual float sumY() const;
142 virtual float sumX2() const;
143 virtual float sumXY() const;
144 virtual float sumY2() const;
145
146
147
148
149
150
151
152
153 virtual void getContents(
154 float * data
155 ) const;
156
157 virtual void putContents(
158 float * data
159 ) const;
160
161 virtual void getErrors(
162 float * data
163 ) const;
164
165 virtual void putErrors(
166 float * data
167 ) const;
168
169 virtual float binError(
170 int binNumX
171 , int binNumY
172 ) const;
173
174 virtual void getStatistics( int & numEntries, float & sumW, float & sumW2,
175 double & sumWX, double & sumWX2 ) const;
176
177 virtual void getOverflows( float * numXOverYOver, float * numXOverYUnder,
178 float * numXUnderYUnder, float * numXUnderYOver,
179 float * numTop, float * numRight,
180 float * numBottom, float * numLeft ) const;
181
182 bool compatibleHist2D( const HepHist2D & h );
183
184 virtual HepRawHist importHist2D( const HepHist2D & h );
185
186 virtual void setXTitle( const std::string& label );
187 virtual void setYTitle( const std::string& label );
188 virtual void setZTitle( const std::string& label );
189 virtual void setTitle ( const std::string& label );
190
191 virtual void addHist2D( const HepRawHist & h );
192 virtual void multiplyHist2D( const HepRawHist & h );
193 virtual void subtractHist2D( const HepRawHist & h );
194 virtual void divideHist2D( const HepRawHist & h );
195
196 virtual void removeImportedHist2D( const HepRawHist & h );
197
198
199
200 HepHist2D & operator += ( const HepHist2D & );
201
202
203 HepHist2D & operator -= ( const HepHist2D & );
204
205
206 HepHist2D & operator *= ( const HepHist2D & );
207
208
209 HepHist2D & operator /= ( const HepHist2D & );
210
211 protected:
212
213 virtual void _accumulate(
214 const float xValue
215 , const float yValue
216 , const float weight = 1.0
217 );
218
219
220 private:
221
222 const int _nBinsX;
223 const float _minX;
224 const float _maxX;
225
226 const int _nBinsY;
227 const float _minY;
228 const float _maxY;
229
230
231 HepHist2D( const HepHist2D & );
232 HepHist2D & operator=( const HepHist2D & );
233
234 };
235
236
237 ZM_END_NAMESPACE( zmht )
238
239
240 #endif
241
Send problems or questions to cdfcode@fnal.gov