YODA is hosted by Hepforge, IPPP Durham
YODA::Dbn3D Class Reference

A 2D distribution. More...

#include <Dbn3D.h>

Public Member Functions

Constructors
 Dbn3D ()
 Default constructor of a new distribution. More...
 
 Dbn3D (unsigned long numEntries, double sumW, double sumW2, double sumWX, double sumWX2, double sumWY, double sumWY2, double sumWZ, double sumWZ2, double sumWXY, double sumWXZ, double sumWYZ)
 
 Dbn3D (const Dbn3D &toCopy)
 
Dbn3Doperator= (const Dbn3D &toCopy)
 
Modifiers
void fill (double valX, double valY, double valZ, double weight=1.0)
 Fill, providing the fill coordinates as three different numbers. More...
 
void fill (std::vector< double > val, double weight=1.0)
 Fill, providing the fill coordinates as a vector. More...
 
void reset ()
 Reset the distribution to an unfilled state. More...
 
void scaleW (double scalefactor)
 Rescale as if all fill weights had been different by factor scalefactor. More...
 
void scaleX (double xscale)
 Rescale x: needed if x histo bin edges are rescaled. More...
 
void scaleY (double yscale)
 Rescale y: needed if y histo bin edges are rescaled. More...
 
void scaleZ (double zscale)
 Rescale z: needed if z histo bin edges are rescaled. More...
 
void scaleXYZ (double xscale, double yscale, double zscale)
 Rescale x, y and z: needed if histo bin edges are rescaled. More...
 
Distribution statistics
double errW () const
 The absolute error on sumW. More...
 
double relErrW () const
 The relative error on sumW. More...
 
double xMean () const
 Weighted mean, $ \bar{x} $, of distribution. More...
 
double yMean () const
 Weighted mean, $ \bar{y} $, of distribution. More...
 
double zMean () const
 Weighted mean, $ \bar{z} $, of distribution. More...
 
double xVariance () const
 Weighted $ x $ variance, $ \sigma_x^2 $, of distribution. More...
 
double yVariance () const
 Weighted $ y $ variance, $ \sigma_y^2 $, of distribution. More...
 
double zVariance () const
 Weighted $ z $ variance, $ \sigma_z^2 $, of distribution. More...
 
double xStdDev () const
 Weighted $ x $ standard deviation, $ \sigma_x $, of distribution. More...
 
double yStdDev () const
 Weighted $ y $ standard deviation, $ \sigma_y $, of distribution. More...
 
double zStdDev () const
 Weighted $ z $ standard deviation, $ \sigma_z $, of distribution. More...
 
double xStdErr () const
 Weighted standard error on the $ x $ mean, $ \sim \sigma_x/\sqrt{N-1} $, of distribution. More...
 
double yStdErr () const
 Weighted standard error on the $ y $ mean, $ \sim \sigma_y/\sqrt{N-1} $, of distribution. More...
 
double zStdErr () const
 Weighted standard error on the $ z $ mean, $ \sim \sigma_z/\sqrt{N-1} $, of distribution. More...
 
double xRMS () const
 Weighted RMS, $ \sqrt{ \sum{w x^2}/\sum{w} } $, of distribution. More...
 
double yRMS () const
 Weighted RMS, $ \sqrt{ \sum{w y^2}/\sum{w} } $, of distribution. More...
 
double zRMS () const
 Weighted RMS, $ \sqrt{ \sum{w z^2}/\sum{w} } $, of distribution. More...
 
Raw distribution running sums
unsigned long numEntries () const
 Number of entries (number of times fill was called, ignoring weights) More...
 
double effNumEntries () const
 Effective number of entries $ = (\sum w)^2 / \sum w^2 $. More...
 
double sumW () const
 The sum of weights. More...
 
double sumW2 () const
 The sum of weights squared. More...
 
double sumWX () const
 The sum of x*weight. More...
 
double sumWX2 () const
 The sum of x^2*weight. More...
 
double sumWY () const
 The sum of y*weight. More...
 
double sumWY2 () const
 The sum of y^2*weight. More...
 
double sumWZ () const
 The sum of z*weight. More...
 
double sumWZ2 () const
 The sum of z^2*weight. More...
 
double sumWXY () const
 The sum of x*y*weight. More...
 
double sumWXZ () const
 The sum of x*z*weight. More...
 
double sumWYZ () const
 The sum of y*z*weight. More...
 
Operators
Dbn3Doperator+= (const Dbn3D &d)
 Add two dbns. More...
 
Dbn3Doperator-= (const Dbn3D &d)
 Subtract one dbn from another. More...
 
void flipXY ()
 Interchange X and Y subdistributions. More...
 
void flipXZ ()
 Interchange X and Z subdistributions. More...
 
void flipYZ ()
 Interchange Y and Z subdistributions. More...
 
Dbn1D transformX ()
 Transform into a Dbn1D parallel to X axis (dropping Y and Z terms) More...
 
Dbn1D transformY ()
 Transform into a Dbn1D parallel to Y axis (dropping X and Z terms) More...
 
Dbn1D transformZ ()
 Transform into a Dbn1D parallel to Z axis (dropping X and Y terms) More...
 

Protected Member Functions

Dbn3Dadd (const Dbn3D &d)
 Add two dbns (internal, explicitly named version) More...
 
Dbn3Dsubtract (const Dbn3D &d)
 Subtract one dbn from another (internal, explicitly named version) More...
 

Detailed Description

A 2D distribution.

Definition at line 16 of file Dbn3D.h.

Constructor & Destructor Documentation

YODA::Dbn3D::Dbn3D ( )
inline

Default constructor of a new distribution.

Definition at line 23 of file Dbn3D.h.

References reset().

23  {
24  reset();
25  }
void reset()
Reset the distribution to an unfilled state.
Definition: Dbn3D.h:95
YODA::Dbn3D::Dbn3D ( unsigned long  numEntries,
double  sumW,
double  sumW2,
double  sumWX,
double  sumWX2,
double  sumWY,
double  sumWY2,
double  sumWZ,
double  sumWZ2,
double  sumWXY,
double  sumWXZ,
double  sumWYZ 
)
inline

Constructor to set a distribution with a pre-filled state.

Principally designed for internal persistency use.

Definition at line 31 of file Dbn3D.h.

37  : _dbnX(numEntries, sumW, sumW2, sumWX, sumWX2),
38  _dbnY(numEntries, sumW, sumW2, sumWY, sumWY2),
39  _dbnZ(numEntries, sumW, sumW2, sumWZ, sumWZ2),
40  _sumWXY(sumWXY), _sumWXZ(sumWXZ), _sumWYZ(sumWYZ)
41  { }
double sumWYZ() const
The sum of y*z*weight.
Definition: Dbn3D.h:294
double sumWY2() const
The sum of y^2*weight.
Definition: Dbn3D.h:269
double sumWZ2() const
The sum of z^2*weight.
Definition: Dbn3D.h:279
double sumWXY() const
The sum of x*y*weight.
Definition: Dbn3D.h:284
double sumWXZ() const
The sum of x*z*weight.
Definition: Dbn3D.h:289
double sumW2() const
The sum of weights squared.
Definition: Dbn3D.h:249
double sumWX() const
The sum of x*weight.
Definition: Dbn3D.h:254
double sumW() const
The sum of weights.
Definition: Dbn3D.h:244
double sumWX2() const
The sum of x^2*weight.
Definition: Dbn3D.h:259
double sumWZ() const
The sum of z*weight.
Definition: Dbn3D.h:274
double sumWY() const
The sum of y*weight.
Definition: Dbn3D.h:264
unsigned long numEntries() const
Number of entries (number of times fill was called, ignoring weights)
Definition: Dbn3D.h:234
YODA::Dbn3D::Dbn3D ( const Dbn3D toCopy)
inline

Copy constructor

Sets all the parameters using the ones provided from an existing Dbn3D.

Definition at line 47 of file Dbn3D.h.

47  {
48  _dbnX = toCopy._dbnX;
49  _dbnY = toCopy._dbnY;
50  _dbnZ = toCopy._dbnZ;
51  _sumWXY = toCopy._sumWXY;
52  _sumWXZ = toCopy._sumWXZ;
53  _sumWYZ = toCopy._sumWYZ;
54  }

Member Function Documentation

Dbn3D& YODA::Dbn3D::add ( const Dbn3D d)
inlineprotected

Add two dbns (internal, explicitly named version)

Definition at line 370 of file Dbn3D.h.

Referenced by operator+=().

370  {
371  _dbnX += d._dbnX;
372  _dbnY += d._dbnY;
373  _dbnZ += d._dbnZ;
374  _sumWXY += d._sumWXY;
375  _sumWXZ += d._sumWXZ;
376  _sumWYZ += d._sumWYZ;
377  return *this;
378  }
double YODA::Dbn3D::effNumEntries ( ) const
inline

Effective number of entries $ = (\sum w)^2 / \sum w^2 $.

Definition at line 239 of file Dbn3D.h.

Referenced by YODA::Profile2D::effNumEntries().

239  {
240  return _dbnX.effNumEntries();
241  }
double YODA::Dbn3D::errW ( ) const
inline

The absolute error on sumW.

Definition at line 177 of file Dbn3D.h.

177 { return _dbnX.errW(); }
void YODA::Dbn3D::fill ( double  valX,
double  valY,
double  valZ,
double  weight = 1.0 
)
inline

Fill, providing the fill coordinates as three different numbers.

Definition at line 77 of file Dbn3D.h.

Referenced by fill().

77  {
78  _dbnX.fill(valX, weight);
79  _dbnY.fill(valY, weight);
80  _dbnZ.fill(valZ, weight);
81  _sumWXY += weight*valX*valY;
82  _sumWXZ += weight*valX*valZ;
83  _sumWYZ += weight*valY*valZ;
84  }
void YODA::Dbn3D::fill ( std::vector< double >  val,
double  weight = 1.0 
)
inline

Fill, providing the fill coordinates as a vector.

Definition at line 88 of file Dbn3D.h.

References fill().

88  {
89  assert (val.size() == 3);
90  fill(val[0], val[1], val[2], weight);
91  }
void fill(double valX, double valY, double valZ, double weight=1.0)
Fill, providing the fill coordinates as three different numbers.
Definition: Dbn3D.h:77
void YODA::Dbn3D::flipXY ( )
inline

Interchange X and Y subdistributions.

Mostly used for operations on total distribution of an Axis

Definition at line 317 of file Dbn3D.h.

317  {
318  Dbn1D temp(_dbnX);
319  _dbnX = _dbnY;
320  _dbnY = temp;
321  }
void YODA::Dbn3D::flipXZ ( )
inline

Interchange X and Z subdistributions.

Mostly used for operations on total distribution of an Axis

Definition at line 326 of file Dbn3D.h.

326  {
327  Dbn1D temp(_dbnX);
328  _dbnX = _dbnZ;
329  _dbnZ = temp;
330  }
void YODA::Dbn3D::flipYZ ( )
inline

Interchange Y and Z subdistributions.

Mostly used for operations on total distribution of an Axis

Definition at line 335 of file Dbn3D.h.

335  {
336  Dbn1D temp(_dbnY);
337  _dbnY = _dbnZ;
338  _dbnZ = temp;
339  }
unsigned long YODA::Dbn3D::numEntries ( ) const
inline

Number of entries (number of times fill was called, ignoring weights)

Definition at line 234 of file Dbn3D.h.

Referenced by YODA::Profile2D::numEntries(), and YODA::WriterYODA::writeProfile2D().

234  {
235  return _dbnX.numEntries();
236  }
Dbn3D& YODA::Dbn3D::operator+= ( const Dbn3D d)
inline

Add two dbns.

Definition at line 305 of file Dbn3D.h.

References add().

305  {
306  return add(d);
307  }
Dbn3D & add(const Dbn3D &d)
Add two dbns (internal, explicitly named version)
Definition: Dbn3D.h:370
Dbn3D& YODA::Dbn3D::operator-= ( const Dbn3D d)
inline

Subtract one dbn from another.

Definition at line 310 of file Dbn3D.h.

References subtract().

310  {
311  return subtract(d);
312  }
Dbn3D & subtract(const Dbn3D &d)
Subtract one dbn from another (internal, explicitly named version)
Definition: Dbn3D.h:381
Dbn3D& YODA::Dbn3D::operator= ( const Dbn3D toCopy)
inline

Copy assignment

Sets all the parameters using the ones provided from an existing Dbn3D.

Definition at line 60 of file Dbn3D.h.

60  {
61  _dbnX = toCopy._dbnX;
62  _dbnY = toCopy._dbnY;
63  _dbnZ = toCopy._dbnZ;
64  _sumWXY = toCopy._sumWXY;
65  _sumWXZ = toCopy._sumWXZ;
66  _sumWYZ = toCopy._sumWYZ;
67  return *this;
68  }
double YODA::Dbn3D::relErrW ( ) const
inline

The relative error on sumW.

Definition at line 180 of file Dbn3D.h.

180 { return _dbnX.relErrW(); }
void YODA::Dbn3D::reset ( )
inline

Reset the distribution to an unfilled state.

Definition at line 95 of file Dbn3D.h.

Referenced by Dbn3D().

95  {
96  _dbnX.reset();
97  _dbnY.reset();
98  _dbnZ.reset();
99  _sumWXY = 0;
100  _sumWXZ = 0;
101  _sumWYZ = 0;
102  }
void YODA::Dbn3D::scaleW ( double  scalefactor)
inline

Rescale as if all fill weights had been different by factor scalefactor.

Definition at line 106 of file Dbn3D.h.

106  {
107  _dbnX.scaleW(scalefactor);
108  _dbnY.scaleW(scalefactor);
109  _dbnZ.scaleW(scalefactor);
110  _sumWXY *= scalefactor;
111  _sumWXZ *= scalefactor;
112  _sumWYZ *= scalefactor;
113  }
void YODA::Dbn3D::scaleX ( double  xscale)
inline

Rescale x: needed if x histo bin edges are rescaled.

Definition at line 117 of file Dbn3D.h.

Referenced by scaleXYZ().

117  {
118  _dbnX.scaleX(xscale);
119  _sumWXY *= xscale;
120  _sumWXZ *= xscale;
121  }
void YODA::Dbn3D::scaleXYZ ( double  xscale,
double  yscale,
double  zscale 
)
inline

Rescale x, y and z: needed if histo bin edges are rescaled.

Definition at line 162 of file Dbn3D.h.

References scaleX(), scaleY(), and scaleZ().

162  {
163  scaleX(xscale);
164  scaleY(yscale);
165  scaleZ(zscale);
166  }
void scaleY(double yscale)
Rescale y: needed if y histo bin edges are rescaled.
Definition: Dbn3D.h:125
void scaleX(double xscale)
Rescale x: needed if x histo bin edges are rescaled.
Definition: Dbn3D.h:117
void scaleZ(double zscale)
Rescale z: needed if z histo bin edges are rescaled.
Definition: Dbn3D.h:133
void YODA::Dbn3D::scaleY ( double  yscale)
inline

Rescale y: needed if y histo bin edges are rescaled.

Definition at line 125 of file Dbn3D.h.

Referenced by scaleXYZ().

125  {
126  _dbnY.scaleX(yscale);
127  _sumWXY *= yscale;
128  _sumWYZ *= yscale;
129  }
void YODA::Dbn3D::scaleZ ( double  zscale)
inline

Rescale z: needed if z histo bin edges are rescaled.

Definition at line 133 of file Dbn3D.h.

Referenced by scaleXYZ().

133  {
134  _dbnZ.scaleX(zscale);
135  _sumWXZ *= zscale;
136  _sumWYZ *= zscale;
137  }
Dbn3D& YODA::Dbn3D::subtract ( const Dbn3D d)
inlineprotected

Subtract one dbn from another (internal, explicitly named version)

Definition at line 381 of file Dbn3D.h.

Referenced by operator-=().

381  {
382  _dbnX -= d._dbnX;
383  _dbnY -= d._dbnY;
384  _dbnZ -= d._dbnZ;
385  _sumWXY -= d._sumWXY;
386  _sumWXZ -= d._sumWXZ;
387  _sumWYZ -= d._sumWYZ;
388  return *this;
389  }
double YODA::Dbn3D::sumW ( ) const
inline

The sum of weights.

Definition at line 244 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

244  {
245  return _dbnX.sumW();
246  }
double YODA::Dbn3D::sumW2 ( ) const
inline

The sum of weights squared.

Definition at line 249 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

249  {
250  return _dbnX.sumW2();
251  }
double YODA::Dbn3D::sumWX ( ) const
inline

The sum of x*weight.

Definition at line 254 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

254  {
255  return _dbnX.sumWX();
256  }
double YODA::Dbn3D::sumWX2 ( ) const
inline

The sum of x^2*weight.

Definition at line 259 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

259  {
260  return _dbnX.sumWX2();
261  }
double YODA::Dbn3D::sumWXY ( ) const
inline

The sum of x*y*weight.

Definition at line 284 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

284  {
285  return _sumWXY;
286  }
double YODA::Dbn3D::sumWXZ ( ) const
inline

The sum of x*z*weight.

Definition at line 289 of file Dbn3D.h.

289  {
290  return _sumWXZ;
291  }
double YODA::Dbn3D::sumWY ( ) const
inline

The sum of y*weight.

Definition at line 264 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

264  {
265  return _dbnY.sumWX();
266  }
double YODA::Dbn3D::sumWY2 ( ) const
inline

The sum of y^2*weight.

Definition at line 269 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

269  {
270  return _dbnY.sumWX2();
271  }
double YODA::Dbn3D::sumWYZ ( ) const
inline

The sum of y*z*weight.

Definition at line 294 of file Dbn3D.h.

294  {
295  return _sumWXZ;
296  }
double YODA::Dbn3D::sumWZ ( ) const
inline

The sum of z*weight.

Definition at line 274 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

274  {
275  return _dbnZ.sumWX();
276  }
double YODA::Dbn3D::sumWZ2 ( ) const
inline

The sum of z^2*weight.

Definition at line 279 of file Dbn3D.h.

Referenced by YODA::WriterYODA::writeProfile2D().

279  {
280  return _dbnZ.sumWX2();
281  }
Dbn1D YODA::Dbn3D::transformX ( )
inline

Transform into a Dbn1D parallel to X axis (dropping Y and Z terms)

Todo:
Rename

Definition at line 344 of file Dbn3D.h.

344  {
345  Dbn1D ret(_dbnX);
346  return ret;
347  }
Dbn1D YODA::Dbn3D::transformY ( )
inline

Transform into a Dbn1D parallel to Y axis (dropping X and Z terms)

Todo:
Rename

Definition at line 352 of file Dbn3D.h.

352  {
353  Dbn1D ret(_dbnY);
354  return ret;
355  }
Dbn1D YODA::Dbn3D::transformZ ( )
inline

Transform into a Dbn1D parallel to Z axis (dropping X and Y terms)

Todo:
Rename

Definition at line 360 of file Dbn3D.h.

360  {
361  Dbn1D ret(_dbnZ);
362  return ret;
363  }
double YODA::Dbn3D::xMean ( ) const
inline

Weighted mean, $ \bar{x} $, of distribution.

Definition at line 183 of file Dbn3D.h.

183 { return _dbnX.xMean(); }
double YODA::Dbn3D::xRMS ( ) const
inline

Weighted RMS, $ \sqrt{ \sum{w x^2}/\sum{w} } $, of distribution.

Definition at line 219 of file Dbn3D.h.

219 { return _dbnX.xRMS(); }
double YODA::Dbn3D::xStdDev ( ) const
inline

Weighted $ x $ standard deviation, $ \sigma_x $, of distribution.

Definition at line 201 of file Dbn3D.h.

201 { return _dbnX.xStdDev(); }
double YODA::Dbn3D::xStdErr ( ) const
inline

Weighted standard error on the $ x $ mean, $ \sim \sigma_x/\sqrt{N-1} $, of distribution.

Definition at line 210 of file Dbn3D.h.

210 { return _dbnX.xStdErr(); }
double YODA::Dbn3D::xVariance ( ) const
inline

Weighted $ x $ variance, $ \sigma_x^2 $, of distribution.

Definition at line 192 of file Dbn3D.h.

192 { return _dbnX.xVariance(); }
double YODA::Dbn3D::yMean ( ) const
inline

Weighted mean, $ \bar{y} $, of distribution.

Definition at line 186 of file Dbn3D.h.

186 { return _dbnY.xMean(); }
double YODA::Dbn3D::yRMS ( ) const
inline

Weighted RMS, $ \sqrt{ \sum{w y^2}/\sum{w} } $, of distribution.

Definition at line 222 of file Dbn3D.h.

222 { return _dbnY.xRMS(); }
double YODA::Dbn3D::yStdDev ( ) const
inline

Weighted $ y $ standard deviation, $ \sigma_y $, of distribution.

Definition at line 204 of file Dbn3D.h.

204 { return _dbnY.xStdDev(); }
double YODA::Dbn3D::yStdErr ( ) const
inline

Weighted standard error on the $ y $ mean, $ \sim \sigma_y/\sqrt{N-1} $, of distribution.

Definition at line 213 of file Dbn3D.h.

213 { return _dbnY.xStdErr(); }
double YODA::Dbn3D::yVariance ( ) const
inline

Weighted $ y $ variance, $ \sigma_y^2 $, of distribution.

Definition at line 195 of file Dbn3D.h.

195 { return _dbnY.xVariance(); }
double YODA::Dbn3D::zMean ( ) const
inline

Weighted mean, $ \bar{z} $, of distribution.

Definition at line 189 of file Dbn3D.h.

189 { return _dbnZ.xMean(); }
double YODA::Dbn3D::zRMS ( ) const
inline

Weighted RMS, $ \sqrt{ \sum{w z^2}/\sum{w} } $, of distribution.

Definition at line 225 of file Dbn3D.h.

225 { return _dbnZ.xRMS(); }
double YODA::Dbn3D::zStdDev ( ) const
inline

Weighted $ z $ standard deviation, $ \sigma_z $, of distribution.

Definition at line 207 of file Dbn3D.h.

207 { return _dbnZ.xStdDev(); }
double YODA::Dbn3D::zStdErr ( ) const
inline

Weighted standard error on the $ z $ mean, $ \sim \sigma_z/\sqrt{N-1} $, of distribution.

Definition at line 216 of file Dbn3D.h.

216 { return _dbnZ.xStdErr(); }
double YODA::Dbn3D::zVariance ( ) const
inline

Weighted $ z $ variance, $ \sigma_z^2 $, of distribution.

Definition at line 198 of file Dbn3D.h.

198 { return _dbnZ.xVariance(); }

The documentation for this class was generated from the following file: