[yoda-svn] yoda: Add xEdges() methods to Axis1D and the Histo1D and Profile...

YODA Mercurial yoda at projects.hepforge.org
Tue Dec 15 21:00:01 GMT 2015


details:   https://yoda.hepforge.org/hg/yoda/rev/2b49c4a77ccc
branches:  
changeset: 1199:2b49c4a77ccc
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Dec 15 20:45:56 2015 +0000
description:
Add xEdges() methods to Axis1D and the Histo1D and Profile1D that use it.

diffs (truncated from 116 to 50 lines):

--- a/ChangeLog	Sun Dec 13 14:14:57 2015 +0000
+++ b/ChangeLog	Tue Dec 15 20:45:56 2015 +0000
@@ -1,3 +1,10 @@
+2015-12-15  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Add xEdges() methods to Axis1D and the Histo1D and Profile1D
+	that use it. The returned edge lists are finite only, i.e. they do
+	not contain the +-inf values on the ends of the internal
+	BinSearcher edges.
+
 2015-12-13  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Version 1.5.7!
--- a/include/YODA/Axis1D.h	Sun Dec 13 14:14:57 2015 +0000
+++ b/include/YODA/Axis1D.h	Tue Dec 15 20:45:56 2015 +0000
@@ -110,6 +110,15 @@
       return bins().back().xMax();
     }
 
+    /// Return all the Nbin+1 bin edges on the axis
+    ///
+    /// @note This only returns the finite edges, i.e. -inf and +inf are removed
+    /// @todo Make the +-inf stripping controllable by a default-valued bool arg
+    std::vector<double> xEdges() const {
+      std::vector<double> rtn(_binsearcher.edges().begin()+1, _binsearcher.edges().end()-1);
+      return rtn;
+    }
+
     /// Return a bin at a given index (non-const)
     BIN1D& bin(size_t index) {
       if (index >= numBins()) throw RangeError("YODA::Histo1D: index out of range!");
--- a/include/YODA/Histo1D.h	Sun Dec 13 14:14:57 2015 +0000
+++ b/include/YODA/Histo1D.h	Tue Dec 15 20:45:56 2015 +0000
@@ -198,6 +198,12 @@
     /// High edge of this histo's axis
     double xMax() const { return _axis.xMax(); }
 
+    /// All bin edges on this histo's axis
+    ///
+    /// @note This only returns the finite edges, i.e. -inf and +inf are removed
+    /// @todo Make the +-inf stripping controllable by a default-valued bool arg
+    const std::vector<double> xEdges() const { return _axis.xEdges(); }
+
 
     /// Access the bin vector
     std::vector<YODA::HistoBin1D>& bins() { return _axis.bins(); }
--- a/include/YODA/Profile1D.h	Sun Dec 13 14:14:57 2015 +0000
+++ b/include/YODA/Profile1D.h	Tue Dec 15 20:45:56 2015 +0000
@@ -216,6 +216,12 @@
     /// High edge of this histo's axis


More information about the yoda-svn mailing list