|
[yoda-svn] r312 - in trunk: include/YODA srcblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Aug 22 11:30:34 BST 2011
Author: buckley Date: Mon Aug 22 11:30:34 2011 New Revision: 312 Log: Providing named AO division functions... to be used to implement correlated Histo division Modified: trunk/include/YODA/Exceptions.h trunk/include/YODA/Histo1D.h trunk/include/YODA/Profile1D.h trunk/include/YODA/Scatter2D.h trunk/include/YODA/Scatter3D.h trunk/src/Histo1D.cc trunk/src/Profile1D.cc trunk/src/Scatter2D.cc trunk/src/Scatter3D.cc Modified: trunk/include/YODA/Exceptions.h ============================================================================== --- trunk/include/YODA/Exceptions.h Mon Aug 22 11:16:55 2011 (r311) +++ trunk/include/YODA/Exceptions.h Mon Aug 22 11:30:34 2011 (r312) @@ -29,6 +29,7 @@ RangeError(const std::string& what) : Exception(what) {} }; + /// Error to throw when a slicing is requested on a non-slicable state of an object. class GridError : public Exception { public: Modified: trunk/include/YODA/Histo1D.h ============================================================================== --- trunk/include/YODA/Histo1D.h Mon Aug 22 11:16:55 2011 (r311) +++ trunk/include/YODA/Histo1D.h Mon Aug 22 11:30:34 2011 (r312) @@ -263,6 +263,9 @@ /// @name Combining histos: global operators //@{ + /// @todo More named operators. + + /// Add two histograms inline Histo1D operator + (const Histo1D& first, const Histo1D& second) { Histo1D tmp = first; @@ -270,6 +273,7 @@ return tmp; } + /// Subtract two histograms inline Histo1D operator - (const Histo1D& first, const Histo1D& second) { Histo1D tmp = first; @@ -277,8 +281,15 @@ return tmp; } + /// Divide two histograms - Scatter2D operator / (const Histo1D& numer, const Histo1D& denom); + Scatter2D divide(const Histo1D& numer, const Histo1D& denom); + + + /// Divide two histograms + inline Scatter2D operator / (const Histo1D& numer, const Histo1D& denom) { + return divide(numer, denom); + } //@} Modified: trunk/include/YODA/Profile1D.h ============================================================================== --- trunk/include/YODA/Profile1D.h Mon Aug 22 11:16:55 2011 (r311) +++ trunk/include/YODA/Profile1D.h Mon Aug 22 11:30:34 2011 (r312) @@ -8,6 +8,7 @@ #include "YODA/AnalysisObject.h" #include "YODA/ProfileBin1D.h" +#include "YODA/Scatter2D.h" #include "YODA/Dbn2D.h" #include "YODA/Axis1D.h" #include "YODA/Exceptions.h" @@ -17,6 +18,7 @@ namespace YODA { + // Forward declarations class Histo1D; class Scatter2D; @@ -237,6 +239,9 @@ /// @name Combining profile histos: global operators //@{ + /// @todo More named operators. + + /// Add two profile histograms inline Profile1D operator + (const Profile1D& first, const Profile1D& second) { Profile1D tmp = first; @@ -244,6 +249,7 @@ return tmp; } + /// Subtract two profile histograms inline Profile1D operator - (const Profile1D& first, const Profile1D& second) { Profile1D tmp = first; @@ -251,8 +257,15 @@ return tmp; } + /// Divide two profile histograms - Scatter2D operator / (const Profile1D& numer, const Profile1D& denom); + Scatter2D divide(const Profile1D& numer, const Profile1D& denom); + + + /// Divide two profile histograms + inline Scatter2D operator / (const Profile1D& numer, const Profile1D& denom) { + return divide(numer, denom); + } //@} Modified: trunk/include/YODA/Scatter2D.h ============================================================================== --- trunk/include/YODA/Scatter2D.h Mon Aug 22 11:16:55 2011 (r311) +++ trunk/include/YODA/Scatter2D.h Mon Aug 22 11:30:34 2011 (r312) @@ -332,14 +332,25 @@ /// @name Combining scatters: global operators, assuming aligned points //@{ + /// @todo More named operators + + /// Add two scatters Scatter2D operator + (const Scatter2D& first, const Scatter2D& second); + /// Subtract two scatters Scatter2D operator - (const Scatter2D& first, const Scatter2D& second); + + /// Divide two scatters + Scatter2D divide(const Scatter2D& numer, const Scatter2D& denom); + + /// Divide two scatters - Scatter2D operator / (const Scatter2D& numer, const Scatter2D& denom); + inline Scatter2D operator / (const Scatter2D& numer, const Scatter2D& denom) { + return divide(numer, denom); + } //@} Modified: trunk/include/YODA/Scatter3D.h ============================================================================== --- trunk/include/YODA/Scatter3D.h Mon Aug 22 11:16:55 2011 (r311) +++ trunk/include/YODA/Scatter3D.h Mon Aug 22 11:30:34 2011 (r312) @@ -299,7 +299,12 @@ Scatter3D operator - (const Scatter3D& first, const Scatter3D& second); /// Divide two scatters - Scatter3D operator / (const Scatter3D& numer, const Scatter3D& denom); + Scatter3D divide(const Scatter3D& numer, const Scatter3D& denom); + + /// Divide two scatters + inline Scatter3D operator / (const Scatter3D& numer, const Scatter3D& denom) { + return divide(numer, denom); + } //@} Modified: trunk/src/Histo1D.cc ============================================================================== --- trunk/src/Histo1D.cc Mon Aug 22 11:16:55 2011 (r311) +++ trunk/src/Histo1D.cc Mon Aug 22 11:30:34 2011 (r312) @@ -114,7 +114,7 @@ /// /// @todo Add QUAD, BINOMIAL enum for error treatment /// @todo Add named operator - Scatter2D operator / (const Histo1D& numer, const Histo1D& denom) { + Scatter2D divide(const Histo1D& numer, const Histo1D& denom) { //assert(numer._axis == denom._axis); Scatter2D tmp; for (size_t i = 0; i < numer.numBins(); ++i) { Modified: trunk/src/Profile1D.cc ============================================================================== --- trunk/src/Profile1D.cc Mon Aug 22 11:16:55 2011 (r311) +++ trunk/src/Profile1D.cc Mon Aug 22 11:30:34 2011 (r312) @@ -85,7 +85,7 @@ /// Divide two profile histograms - Scatter2D operator / (const Profile1D& numer, const Profile1D& denom) { + Scatter2D divide(const Profile1D& numer, const Profile1D& denom) { //assert(numer._axis == denom._axis); Scatter2D tmp; for (size_t i = 0; i < numer.numBins(); ++i) { Modified: trunk/src/Scatter2D.cc ============================================================================== --- trunk/src/Scatter2D.cc Mon Aug 22 11:16:55 2011 (r311) +++ trunk/src/Scatter2D.cc Mon Aug 22 11:30:34 2011 (r312) @@ -50,7 +50,8 @@ /// C++ way to do it better, since functors for value and error combination are *so* heavy. - /// Subtract two scatters + // Add two scatters + /// @todo Implementation in a named add() function Scatter2D operator + (const Scatter2D& first, const Scatter2D& second) { Scatter2D tmp; for (size_t i = 0; i < first.numPoints(); ++i) { @@ -70,7 +71,8 @@ } - /// Subtract two scatters + // Subtract two scatters + /// @todo Implementation in a named subtract() function Scatter2D operator - (const Scatter2D& first, const Scatter2D& second) { Scatter2D tmp; for (size_t i = 0; i < first.numPoints(); ++i) { @@ -90,8 +92,8 @@ } - /// Divide two scatters - Scatter2D operator / (const Scatter2D& numer, const Scatter2D& denom) { + // Divide two scatters + Scatter2D divide(const Scatter2D& numer, const Scatter2D& denom) { Scatter2D tmp; for (size_t i = 0; i < numer.numPoints(); ++i) { const Point2D& p1 = numer.point(i); Modified: trunk/src/Scatter3D.cc ============================================================================== --- trunk/src/Scatter3D.cc Mon Aug 22 11:16:55 2011 (r311) +++ trunk/src/Scatter3D.cc Mon Aug 22 11:30:34 2011 (r312) @@ -1,27 +1,32 @@ #include "YODA/Scatter3D.h" #include "YODA/Histo2D.h" +#include "YODA/Exceptions.h" namespace YODA { - /// Subtract two scatters + // Add two scatters + /// @todo Implementation in a named add() function Scatter3D operator + (const Scatter3D& first, const Scatter3D& second) { /// @todo Implement + throw Exception("Implement me!"); Scatter3D tmp; return tmp; } - /// Subtract two scatters + // Subtract two scatters + /// @todo Implementation in a named subtract() function Scatter3D operator - (const Scatter3D& first, const Scatter3D& second) { /// @todo Implement + throw Exception("Implement me!"); Scatter3D tmp; return tmp; } /// Divide two scatters - Scatter3D operator / (const Scatter3D& numer, const Scatter3D& denom) { + Scatter3D divide(const Scatter3D& numer, const Scatter3D& denom) { Scatter3D tmp; for (size_t i = 0; i < numer.numPoints(); ++i) { const Point3D& p1 = numer.point(i);
More information about the yoda-svn mailing list |