|
[yoda-svn] r530 - in trunk: include/YODA srcblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Sep 25 10:24:23 BST 2012
Author: dgrell Date: Tue Sep 25 10:24:23 2012 New Revision: 530 Log: Histo and Profile throw RangeError on fill with Inf or NaN Modified: trunk/include/YODA/HistoBin1D.h trunk/src/Histo1D.cc trunk/src/Histo2D.cc trunk/src/Profile1D.cc trunk/src/Profile2D.cc Modified: trunk/include/YODA/HistoBin1D.h ============================================================================== --- trunk/include/YODA/HistoBin1D.h Mon Sep 24 16:13:20 2012 (r529) +++ trunk/include/YODA/HistoBin1D.h Tue Sep 25 10:24:23 2012 (r530) @@ -66,7 +66,7 @@ /// @name Modifiers //@{ - /// @brief Fill this bin with weight @a weight at position @a coord. + /// @brief Fill this bin with weight @a weight at position @a x. void fill(double x, double weight=1.0) { assert( _edges.first < _edges.second ); assert( x >= _edges.first && x < _edges.second ); Modified: trunk/src/Histo1D.cc ============================================================================== --- trunk/src/Histo1D.cc Mon Sep 24 16:13:20 2012 (r529) +++ trunk/src/Histo1D.cc Tue Sep 25 10:24:23 2012 (r530) @@ -15,6 +15,8 @@ void Histo1D::fill(double x, double weight) { + if ( isnan(x) ) throw RangeError("X is NaN"); + if ( isinf(x) ) throw RangeError("X is Inf"); // Fill the overall distribution _axis.totalDbn().fill(x, weight); // Fill the bins and overflows Modified: trunk/src/Histo2D.cc ============================================================================== --- trunk/src/Histo2D.cc Mon Sep 24 16:13:20 2012 (r529) +++ trunk/src/Histo2D.cc Tue Sep 25 10:24:23 2012 (r530) @@ -13,6 +13,10 @@ void Histo2D::fill(double x, double y, double weight) { + if ( isnan(x) ) throw RangeError("X is NaN"); + if ( isinf(x) ) throw RangeError("X is Inf"); + if ( isnan(y) ) throw RangeError("Y is NaN"); + if ( isinf(y) ) throw RangeError("Y is Inf"); // Fill the overall distribution _axis.totalDbn().fill(x, y, weight); // Fill the bins and overflows Modified: trunk/src/Profile1D.cc ============================================================================== --- trunk/src/Profile1D.cc Mon Sep 24 16:13:20 2012 (r529) +++ trunk/src/Profile1D.cc Tue Sep 25 10:24:23 2012 (r530) @@ -14,6 +14,10 @@ void Profile1D::fill(double x, double y, double weight) { + if ( isnan(x) ) throw RangeError("X is NaN"); + if ( isinf(x) ) throw RangeError("X is Inf"); + if ( isnan(y) ) throw RangeError("Y is NaN"); + if ( isinf(y) ) throw RangeError("Y is Inf"); // Fill the overall distribution _axis.totalDbn().fill(x, y, weight); // Fill the bins and overflows Modified: trunk/src/Profile2D.cc ============================================================================== --- trunk/src/Profile2D.cc Mon Sep 24 16:13:20 2012 (r529) +++ trunk/src/Profile2D.cc Tue Sep 25 10:24:23 2012 (r530) @@ -13,6 +13,12 @@ void Profile2D::fill(double x, double y, double z, double weight) { + if ( isnan(x) ) throw RangeError("X is NaN"); + if ( isinf(x) ) throw RangeError("X is Inf"); + if ( isnan(y) ) throw RangeError("Y is NaN"); + if ( isinf(y) ) throw RangeError("Y is Inf"); + if ( isnan(z) ) throw RangeError("Z is NaN"); + if ( isinf(z) ) throw RangeError("Z is Inf"); // Fill the overall distribution _axis.totalDbn().fill(x, y, z, weight); // Fill the bins and overflows
More information about the yoda-svn mailing list |