[yoda-svn] r225 - in trunk: include/YODA src

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Aug 8 18:47:53 BST 2011


Author: mkawalec
Date: Mon Aug  8 18:47:52 2011
New Revision: 225

Log:
Fixes to 2D.

Modified:
   trunk/include/YODA/Axis2D.h
   trunk/src/Histo2D.cc

Modified: trunk/include/YODA/Axis2D.h
==============================================================================
--- trunk/include/YODA/Axis2D.h	Sun Aug  7 22:05:06 2011	(r224)
+++ trunk/include/YODA/Axis2D.h	Mon Aug  8 18:47:52 2011	(r225)
@@ -671,7 +671,7 @@
         BIN& bin(size_t index)
         {
           /// @todo WTF?! Don't just copy and paste exception warnings. This one is totally misleading: are there more?
-            if(index >= _bins.size()) throw RangeError("YODA::Histo2D: index out of range");
+            if(index >= _bins.size()) throw RangeError("Bin index out of range.");
             return _bins[index];
         }
 
@@ -679,7 +679,7 @@
         const BIN& bin(size_t index) const
         {
           /// @todo WTF?! Don't just copy and paste exception warnings. This one is totally misleading: are there more?
-            if(index >= _bins.size()) throw RangeError("YODA::Histo2D: index out of range");
+            if(index >= _bins.size()) throw RangeError("Bin index out of range.");
             return _bins[index];
         }
 
@@ -861,7 +861,6 @@
         Axis2D<BIN>& operator += (const Axis2D<BIN>& toAdd)
         {
             if (*this != toAdd) {
-              /// @todo WTF?! Don't just copy and paste exception warnings. This one is totally misleading: are there more?
                 throw LogicError("YODA::Histo1D: Cannot add axes with different binnings.");
             }
             for (unsigned int i=0; i < bins().size(); i++) bins().at(i) += toAdd.bins().at(i);
@@ -876,14 +875,13 @@
         Axis2D<BIN>& operator -= (const Axis2D<BIN>& toSubtract)
         {
             if (*this != toSubtract) {
-              /// @todo WTF?! Don't just copy and paste exception warnings. This one is totally misleading: are there more?
                 throw LogicError("YODA::Histo1D: Cannot add axes with different binnings.");
             }
-            for (unsigned int i=0; i < bins().size(); i++) bins().at(i) -= toSubstract.bins().at(i);
+            for (unsigned int i=0; i < bins().size(); i++) bins().at(i) -= toSubtract.bins().at(i);
 
-            _dbn -= toSubstract._dbn;
-            _underflow -= toSubstract._underflow;
-            _overflow -= toSubstract._overflow;
+            _dbn -= toSubtract._dbn;
+            _underflow -= toSubtract._underflow;
+            _overflow -= toSubtract._overflow;
             return *this;
         }
         //@}

Modified: trunk/src/Histo2D.cc
==============================================================================
--- trunk/src/Histo2D.cc	Sun Aug  7 22:05:06 2011	(r224)
+++ trunk/src/Histo2D.cc	Mon Aug  8 18:47:52 2011	(r225)
@@ -116,7 +116,7 @@
 
   /// Divide two histograms
   Scatter3D operator / (const Histo2D& numer, const Histo2D& denom) {
-    assert(numer.getHash() == denom.getHash());
+    if(numer.getHash() != denom.getHash()) throw GridError("The two Histos are not the same!");
     Scatter3D tmp;
     for (size_t i = 0; i < numer.numBinsTotal(); ++i) {
       const HistoBin2D& b1 = numer.bin(i);


More information about the yoda-svn mailing list