|
[yoda-svn] r407 - in trunk: . include/YODA srcblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Dec 6 15:44:35 GMT 2011
Author: buckley Date: Tue Dec 6 15:44:34 2011 New Revision: 407 Log: Extending weighted RMS calculating methods to Dbn1D, Dbn2D and Bin1D/2D. Modified: trunk/ChangeLog trunk/include/YODA/Bin1D.h trunk/include/YODA/Bin2D.h trunk/include/YODA/Dbn1D.h trunk/include/YODA/Dbn2D.h trunk/src/Dbn1D.cc Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Tue Dec 6 15:26:05 2011 (r406) +++ trunk/ChangeLog Tue Dec 6 15:44:34 2011 (r407) @@ -1,6 +1,7 @@ 2011-12-06 Andy Buckley <andy.buckley at cern.ch> - * Adding a (weighted) RMS calculating method to Dbn1D. + * Adding weighted RMS calculating methods to Dbn1D, Dbn2D and + Bin1D/2D. 2011-09-03 Dave Mallows <dave.mallows at gmail.com> Modified: trunk/include/YODA/Bin1D.h ============================================================================== --- trunk/include/YODA/Bin1D.h Tue Dec 6 15:26:05 2011 (r406) +++ trunk/include/YODA/Bin1D.h Tue Dec 6 15:44:34 2011 (r407) @@ -175,6 +175,11 @@ return _dbn.xStdErr(); } + /// The x RMS in the bin. + double xRMS() const { + return _dbn.xRMS(); + } + //@} Modified: trunk/include/YODA/Bin2D.h ============================================================================== --- trunk/include/YODA/Bin2D.h Tue Dec 6 15:26:05 2011 (r406) +++ trunk/include/YODA/Bin2D.h Tue Dec 6 15:44:34 2011 (r407) @@ -103,7 +103,7 @@ _dbn.scaleXY(scaleX, scaleY); } - + void scaleW(double scalefactor) { _dbn.scaleW(scalefactor); } @@ -209,6 +209,16 @@ return _dbn.yStdErr(); } + /// RMS of x values + double xRMS() const { + return _dbn.xRMS(); + } + + /// RMS of y values + double yRMS() const { + return _dbn.yRMS(); + } + //@} Modified: trunk/include/YODA/Dbn1D.h ============================================================================== --- trunk/include/YODA/Dbn1D.h Tue Dec 6 15:26:05 2011 (r406) +++ trunk/include/YODA/Dbn1D.h Tue Dec 6 15:44:34 2011 (r407) @@ -135,10 +135,10 @@ double xStdErr() const { return stdErr(); } - /// Weighted RMS, \f$ \sqrt{ 1/N_\text{eff} \sum_i w_i x^2_i } \f$, of distribution. + /// Weighted RMS, \f$ \sqrt{ \sum{w x^2}/\sum{w} } \f$, of distribution. double rms() const; /// Synonym for interface compatibility with Dbn2D - double xRms() const { return rms(); } + double xRMS() const { return rms(); } //@} Modified: trunk/include/YODA/Dbn2D.h ============================================================================== --- trunk/include/YODA/Dbn2D.h Tue Dec 6 15:26:05 2011 (r406) +++ trunk/include/YODA/Dbn2D.h Tue Dec 6 15:44:34 2011 (r407) @@ -142,6 +142,16 @@ return _dbnY.stdDev(); } + /// Weighted RMS, \f$ \sqrt{ \sum{w x^2}/\sum{w} } \f$, of distribution. + double xRMS() const { + return _dbnX.rms(); + } + + /// Weighted RMS, \f$ \sqrt{ \sum{w y^2}/\sum{w} } \f$, of distribution. + double yRMS() const { + return _dbnY.rms(); + } + //@} Modified: trunk/src/Dbn1D.cc ============================================================================== --- trunk/src/Dbn1D.cc Tue Dec 6 15:26:05 2011 (r406) +++ trunk/src/Dbn1D.cc Tue Dec 6 15:44:34 2011 (r407) @@ -65,11 +65,11 @@ double Dbn1D::rms() const { // Weighted RMS defined as - // rms = \sqrt{ 1/N_eff \sum_i w_i x^2_i } + // rms = sqrt(sum{w x^2} / sum{w}) if (effNumEntries() == 0) { throw LowStatsError("Requested RMS of a distribution with no net fill weights"); } - const double meansq = sumWX2() / effNumEntries(); + const double meansq = sumWX2() / sumW(); return std::sqrt(meansq); }
More information about the yoda-svn mailing list |