|
[yoda-svn] r522 - in trunk: . include/YODA src tests/Scatter2Dblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Aug 6 14:49:55 BST 2012
Author: dgrell Date: Mon Aug 6 14:49:55 2012 New Revision: 522 Log: Lots of bug fixes and const cleanup. Modified: trunk/configure.ac trunk/include/YODA/Axis2D.h trunk/include/YODA/Bin2D.h trunk/include/YODA/Histo2D.h trunk/include/YODA/HistoBin2D.h trunk/include/YODA/Point2D.h trunk/include/YODA/Point3D.h trunk/include/YODA/Profile2D.h trunk/include/YODA/ProfileBin1D.h trunk/include/YODA/ProfileBin2D.h trunk/include/YODA/Scatter3D.h trunk/include/YODA/Weights.h trunk/src/Profile2D.cc trunk/src/Scatter3D.cc trunk/src/WriterAIDA.cc trunk/tests/Scatter2D/S2DCreate.cc Modified: trunk/configure.ac ============================================================================== --- trunk/configure.ac Mon Aug 6 14:45:18 2012 (r521) +++ trunk/configure.ac Mon Aug 6 14:49:55 2012 (r522) @@ -119,7 +119,8 @@ AM_CPPFLAGS="$AM_CPPFLAGS -I\$(BOOSTINCPATH) \$(BOOST_CPPFLAGS)" AC_CEDAR_CHECKCXXFLAG([-pedantic], [AM_CXXFLAGS="$AM_CXXFLAGS -pedantic "]) -AC_CEDAR_CHECKCXXFLAG([-ansi], [AM_CXXFLAGS="$AM_CXXFLAGS -ansi "]) +dnl ansi is implied by std=c++, listing it confuses clang +dnl AC_CEDAR_CHECKCXXFLAG([-ansi], [AM_CXXFLAGS="$AM_CXXFLAGS -ansi "]) AC_CEDAR_CHECKCXXFLAG([-Wall], [AM_CXXFLAGS="$AM_CXXFLAGS -Wall -Wno-format"]) dnl AC_CEDAR_CHECKCXXFLAG([-Wno-long-long], [AM_CXXFLAGS="$AM_CXXFLAGS -Wno-long-long "]) dnl Need to be C++98! Modified: trunk/include/YODA/Axis2D.h ============================================================================== --- trunk/include/YODA/Axis2D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Axis2D.h Mon Aug 6 14:49:55 2012 (r522) @@ -112,7 +112,8 @@ /// /// This operator is supplied with the extremal coordinates of just a new /// bin, which is then constructed and added as usual. - void addBin(double lowX, double lowY, double highX, double highY) { + // void addBin(double lowX, double lowY, double highX, double highY) { + void addBin(double, double, double, double) { /// @todo TODO /// @todo Check for overlaps and whether axis is locked @@ -261,23 +262,23 @@ /// Get the total number of bins /// @todo Can't this just be numBins? - const size_t numBins() const { + size_t numBins() const { return _bins.size(); } /// Get the number of bins along X axis - const size_t numBinsX() const { + size_t numBinsX() const { return (numBins() > 0) ? _binhash.size() : 0; } /// Get the number of bins along Y axis - const size_t numBinsY() const { + size_t numBinsY() const { return (numBins() > 0) ? _binhash.begin()->second.size() : 0; } /// Get the value of the lowest x-edge on the axis - const double lowEdgeX() const { + double lowEdgeX() const { if (numBins() == 0) throw RangeError("This axis contains no bins and so has no defined range"); return _binhash.begin()->first; } @@ -285,7 +286,7 @@ double xMin() const { return lowEdgeX();} /// Get the value of the highest x-edge on the axis - const double highEdgeX() const { + double highEdgeX() const { if (numBins() == 0) throw RangeError("This axis contains no bins and so has no defined range"); return (--_binhash.end())->first; } @@ -293,7 +294,7 @@ double xMax() const { return highEdgeX();} /// Get the value of the lowest y-edge on the axis - const double lowEdgeY() const { + double lowEdgeY() const { if (numBins() == 0) throw RangeError("This axis contains no bins and so has no defined range"); return _binhash.begin()->second.begin()->first; } @@ -301,7 +302,7 @@ double yMin() const { return lowEdgeY();} /// Get the value of the highest y-edge on the axis - const double highEdgeY() const { + double highEdgeY() const { if (numBins() == 0) throw RangeError("This axis contains no bins and so has no defined range"); return (--_binhash.begin()->second.end())->first; } @@ -397,7 +398,7 @@ /// /// Looks through all the bins to see which one contains the point of /// interest. - const long getBinIndex(double coordX, double coordY) const { + long getBinIndex(double coordX, double coordY) const { // First check that we are within the axis bounds at all if (coordX < lowEdgeX() || coordX >= highEdgeX()) return -1; if (coordY < lowEdgeY() || coordY >= highEdgeY()) return -1; @@ -412,7 +413,7 @@ // /// Fast column number searcher - // const size_t getBinColumn(size_t index) const { + // size_t getBinColumn(size_t index) const { // // Check if assumptions are reasonable // if (!_isGrid) throw GridError("This operation can only be performed when an array is a grid!"); // if (index >= _bins.size()) throw RangeError("Index is bigger than the size of bins vector!"); @@ -424,7 +425,7 @@ // /// Fast row number searcher - // const size_t getBinRow(size_t index) const { + // size_t getBinRow(size_t index) const { // // Check if assumptions are reasonable // if (!_isGrid) throw GridError("This operation can only be performed when an array is a grid!"); // if (index >= _bins.size()) throw RangeError("Index is bigger than the size of bins vector!"); @@ -495,7 +496,7 @@ //@{ /// Equality operator (on binning only) - bool operator == (const Axis2D& other) const { + bool operator == (const Axis2D& ) const { /// @todo TODO return true; } Modified: trunk/include/YODA/Bin2D.h ============================================================================== --- trunk/include/YODA/Bin2D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Bin2D.h Mon Aug 6 14:49:55 2012 (r522) @@ -395,7 +395,7 @@ template <class DBN> inline Bin2D<DBN> operator - (const Bin2D<DBN>& a, const Bin2D<DBN>& b) { Bin2D<DBN> rtn = a; - rtn -= a; + rtn -= b; return rtn; } Modified: trunk/include/YODA/Histo2D.h ============================================================================== --- trunk/include/YODA/Histo2D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Histo2D.h Mon Aug 6 14:49:55 2012 (r522) @@ -253,23 +253,23 @@ } /// Return bin index (const version) - const int findBinIndex(double coordX, double coordY) const { + int findBinIndex(double coordX, double coordY) const { return _axis.getBinIndex(coordX, coordY); } /// Number of bins - const size_t numBins() const { + size_t numBins() const { return _axis.numBins(); } /// Number of bins along the x axis - const size_t numBinsX() const { + size_t numBinsX() const { return _axis.numBinsX(); } /// Number of bins along the y axis - const size_t numBinsY() const{ + size_t numBinsY() const{ return _axis.numBinsY(); } Modified: trunk/include/YODA/HistoBin2D.h ============================================================================== --- trunk/include/YODA/HistoBin2D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/HistoBin2D.h Mon Aug 6 14:49:55 2012 (r522) @@ -133,7 +133,7 @@ /// Bin addition operator inline HistoBin2D operator + (const HistoBin2D& a, const HistoBin2D& b) { HistoBin2D rtn(a); - rtn += a; + rtn += b; return rtn; } @@ -141,7 +141,7 @@ /// Bin subtraction operator inline HistoBin2D operator - (const HistoBin2D& a, const HistoBin2D& b) { HistoBin2D rtn(a); - rtn -= a; + rtn -= b; return rtn; } Modified: trunk/include/YODA/Point2D.h ============================================================================== --- trunk/include/YODA/Point2D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Point2D.h Mon Aug 6 14:49:55 2012 (r522) @@ -119,12 +119,12 @@ } /// Get negative x-error value - const double xErrMinus() const { + double xErrMinus() const { return _ex.first; } /// Get positive x-error value - const double xErrPlus() const { + double xErrPlus() const { return _ex.second; } @@ -151,12 +151,12 @@ } /// Get value minus negative x-error - const double xMin() const { + double xMin() const { return _x - _ex.first; } /// Get value plus positive x-error - const double xMax() const { + double xMax() const { return _x + _ex.second; } @@ -172,12 +172,12 @@ } /// Get negative y-error value - const double yErrMinus() const { + double yErrMinus() const { return _ey.first; } /// Get positive y-error value - const double yErrPlus() const { + double yErrPlus() const { return _ey.second; } @@ -204,12 +204,12 @@ } /// Get value minus negative y-error - const double yMin() const { + double yMin() const { return _y - _ey.first; } /// Get value plus positive y-error - const double yMax() const { + double yMax() const { return _y + _ey.second; } Modified: trunk/include/YODA/Point3D.h ============================================================================== --- trunk/include/YODA/Point3D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Point3D.h Mon Aug 6 14:49:55 2012 (r522) @@ -53,9 +53,7 @@ } /// Constructor from asymmetric errors given as vectors - Point3D(const double& x, - const double& y, - const double& z, + Point3D(double x, double y, double z, const std::pair<double,double>& ex, const std::pair<double,double>& ey, const std::pair<double,double>& ez) @@ -121,12 +119,12 @@ } /// Get negative x-error value - const double xErrMinus() const { + double xErrMinus() const { return _ex.first; } /// Get positive x-error value - const double xErrPlus() const { + double xErrPlus() const { return _ex.second; } @@ -153,12 +151,12 @@ } /// Get value minus negative x-error - const double xMin() const { + double xMin() const { return _x - _ex.first; } /// Get value plus positive x-error - const double xMax() const { + double xMax() const { return _x + _ex.second; } @@ -174,12 +172,12 @@ } /// Get negative y-error value - const double yErrMinus() const { + double yErrMinus() const { return _ey.first; } /// Get positive y-error value - const double yErrPlus() const { + double yErrPlus() const { return _ey.second; } @@ -206,12 +204,12 @@ } /// Get value minus negative y-error - const double yMin() const { + double yMin() const { return _y - _ey.first; } /// Get value plus positive y-error - const double yMax() const { + double yMax() const { return _y + _ey.second; } @@ -227,12 +225,12 @@ } /// Get negative z-error value - const double zErrMinus() const { + double zErrMinus() const { return _ez.first; } /// Get positive z-error value - const double zErrPlus() const { + double zErrPlus() const { return _ez.second; } @@ -259,12 +257,12 @@ } /// Get value minus negative z-error - const double zMin() const { + double zMin() const { return _z - _ez.first; } /// Get value plus positive z-error - const double zMax() const { + double zMax() const { return _z + _ez.second; } Modified: trunk/include/YODA/Profile2D.h ============================================================================== --- trunk/include/YODA/Profile2D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Profile2D.h Mon Aug 6 14:49:55 2012 (r522) @@ -249,7 +249,7 @@ } /// Return bin index (const version) - const int findBinIndex(double coordX, double coordY) const { + int findBinIndex(double coordX, double coordY) const { return _axis.getBinIndex(coordX, coordY); } @@ -260,12 +260,12 @@ } /// Number of bins along the x axis - const size_t numBinsX() const { + size_t numBinsX() const { return _axis.numBinsX(); } /// Number of bins along the y axis - const size_t numBinsY() const{ + size_t numBinsY() const{ return _axis.numBinsY(); } Modified: trunk/include/YODA/ProfileBin1D.h ============================================================================== --- trunk/include/YODA/ProfileBin1D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/ProfileBin1D.h Mon Aug 6 14:49:55 2012 (r522) @@ -155,13 +155,13 @@ inline ProfileBin1D operator + (const ProfileBin1D& a, const ProfileBin1D& b) { ProfileBin1D rtn(a); - rtn += a; + rtn += b; return rtn; } inline ProfileBin1D operator - (const ProfileBin1D& a, const ProfileBin1D& b) { ProfileBin1D rtn(a); - rtn -= a; + rtn -= b; return rtn; } Modified: trunk/include/YODA/ProfileBin2D.h ============================================================================== --- trunk/include/YODA/ProfileBin2D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/ProfileBin2D.h Mon Aug 6 14:49:55 2012 (r522) @@ -158,7 +158,7 @@ /// Bin addition operator inline ProfileBin2D operator + (const ProfileBin2D& a, const ProfileBin2D& b) { ProfileBin2D rtn(a); - rtn += a; + rtn += b; return rtn; } @@ -166,7 +166,7 @@ /// Bin subtraction operator inline ProfileBin2D operator - (const ProfileBin2D& a, const ProfileBin2D& b) { ProfileBin2D rtn(a); - rtn -= a; + rtn -= b; return rtn; } Modified: trunk/include/YODA/Scatter3D.h ============================================================================== --- trunk/include/YODA/Scatter3D.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Scatter3D.h Mon Aug 6 14:49:55 2012 (r522) @@ -46,8 +46,12 @@ /// Constructor from vectors of values with no errors - Scatter3D(const std::vector<double>& x, const std::vector<double>& y, const std::vector<double>& z, - const std::string& path="", const std::string& title="") + Scatter3D(const std::vector<double>& x, + const std::vector<double>& y, + const std::vector<double>& z, + const std::string& path="", + const std::string& title="") + : AnalysisObject("Scatter3D", path, title) { if (x.size() != y.size() || y.size() != z.size()) { throw RangeError("There are different numbers of x, y, and z values in the provided vectors."); Modified: trunk/include/YODA/Weights.h ============================================================================== --- trunk/include/YODA/Weights.h Mon Aug 6 14:45:18 2012 (r521) +++ trunk/include/YODA/Weights.h Mon Aug 6 14:49:55 2012 (r522) @@ -300,7 +300,7 @@ /// Divide a double by a Weights /// @todo Is this really needed? inline Weights operator / (double a, const Weights& w) { - Weights tmp(w.keys(), 1.0); + Weights tmp(w.keys(), a); tmp /= w; return tmp; } Modified: trunk/src/Profile2D.cc ============================================================================== --- trunk/src/Profile2D.cc Mon Aug 6 14:45:18 2012 (r521) +++ trunk/src/Profile2D.cc Mon Aug 6 14:49:55 2012 (r522) @@ -120,13 +120,18 @@ /// A copy constructor with optional new path Profile2D::Profile2D(const Profile2D& p, const std::string& path) - : AnalysisObject("Profile2D", p.path(), p, p.title()), _axis(p._axis) + : AnalysisObject("Profile2D", + (path.size() == 0) ? p.path() : path, + p, p.title()), + _axis(p._axis) { } /// Constructor from a Scatter3D's binning, with optional new path Profile2D::Profile2D(const Scatter3D& s, const std::string& path) - : AnalysisObject("Profile2D", (path.size() == 0) ? s.path() : path, s, s.title()) + : AnalysisObject("Profile2D", + (path.size() == 0) ? s.path() : path, + s, s.title()) { Bins bins; foreach (const Scatter3D::Point& p, s.points()) { @@ -149,7 +154,7 @@ /// Divide two profile histograms - Scatter3D divide(const Profile2D& numer, const Profile2D& denom) { + Scatter3D divide(const Profile2D& , const Profile2D& ) { /// @todo TODO -- implement! /// @todo Check that bins match Modified: trunk/src/Scatter3D.cc ============================================================================== --- trunk/src/Scatter3D.cc Mon Aug 6 14:45:18 2012 (r521) +++ trunk/src/Scatter3D.cc Mon Aug 6 14:49:55 2012 (r522) @@ -6,7 +6,7 @@ // Add two scatters - Scatter3D add(const Scatter3D& first, const Scatter3D& second) { + Scatter3D add(const Scatter3D& , const Scatter3D& ) { /// @todo Implement throw Exception("Implement me!"); Scatter3D tmp; @@ -15,7 +15,7 @@ // Subtract two scatters - Scatter3D subtract(const Scatter3D& first, const Scatter3D& second) { + Scatter3D subtract(const Scatter3D& , const Scatter3D& ) { /// @todo Implement throw Exception("Implement me!"); Scatter3D tmp; Modified: trunk/src/WriterAIDA.cc ============================================================================== --- trunk/src/WriterAIDA.cc Mon Aug 6 14:45:18 2012 (r521) +++ trunk/src/WriterAIDA.cc Mon Aug 6 14:49:55 2012 (r522) @@ -33,8 +33,8 @@ } - void WriterAIDA::writePlot(std::ostream& os, const Plot& p) { - os << flush; + void WriterAIDA::writePlot(std::ostream& os, const Plot&) { + os << "\n<!-- PLOT WRITING TO AIDA IS UNSUPPORTED! -->\n" << endl; } @@ -45,7 +45,7 @@ } - void WriterAIDA::writeHisto2D(std::ostream& os, const Histo2D& h) { + void WriterAIDA::writeHisto2D(std::ostream& os, const Histo2D&) { os << endl << "<!-- HISTO2D WRITING TO AIDA IS CURRENTLY UNSUPPORTED! -->" << endl << endl; // Scatter3D tmp = mkScatter(h); // tmp.setAnnotation("Type", "Histo2D"); Modified: trunk/tests/Scatter2D/S2DCreate.cc ============================================================================== --- trunk/tests/Scatter2D/S2DCreate.cc Mon Aug 6 14:45:18 2012 (r521) +++ trunk/tests/Scatter2D/S2DCreate.cc Mon Aug 6 14:49:55 2012 (r522) @@ -9,7 +9,7 @@ MSG_(PAD(70) << "Constructing a scatter (empty const): "); - Scatter2D s1(); + Scatter2D s1; MSG_GREEN("PASS"); MSG_(PAD(70) << "Constructing a scatter (vector of points)");
More information about the yoda-svn mailing list |