[yoda-svn] r259 - trunk/include/YODA

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Aug 17 12:06:17 BST 2011


Author: mkawalec
Date: Wed Aug 17 12:06:17 2011
New Revision: 259

Log:
Added mkScatter from Histo2D.

Modified:
   trunk/include/YODA/Scatter3D.h

Modified: trunk/include/YODA/Scatter3D.h
==============================================================================
--- trunk/include/YODA/Scatter3D.h	Wed Aug 17 11:53:31 2011	(r258)
+++ trunk/include/YODA/Scatter3D.h	Wed Aug 17 12:06:17 2011	(r259)
@@ -238,8 +238,26 @@
   /// Make a Scatter3D representation of a Histo2D
   /// @todo Implement!
   inline Scatter3D mkScatter(const Histo2D& h) {
-    throw Exception("Not Implemented!");
-    return Scatter3D();
+    Scatter3D ret;
+    for(size_t i = 0; i < h.numBinsTotal(); ++i) {
+      const HistoBin2D& bin = h.bin(i);
+
+      const double x = bin.focus().first;
+      const double y = bin.focus().second;
+
+      const double exminus = x - bin.xMin();
+      const double explus = bin.xMax() - x;
+
+      const double eyminus = y - bin.yMin();
+      const double eyplus = bin.yMax() - y;
+
+      const double z = bin.height();
+      const double ez = bin.heightErr();
+
+      ret.addPoint(x, exminus, explus, y, eyminus, eyplus, z, ez, ez);
+    }
+    
+    return ret;
   }
 
   /// Make a Scatter3D representation of a Profile2D


More information about the yoda-svn mailing list