Fix histogram resampling output bin positions
[alexxy/gromacs.git] / src / gromacs / analysisdata / modules / histogram.h
index fe47fe0840a1363049ead744ab0226a60035b997..dff0fd7ba26fcd3b319b196511445f7dedfc7463 100644 (file)
@@ -255,6 +255,8 @@ typedef boost::shared_ptr<AbstractAverageHistogram>
  *
  * This class can represent multiple histograms in one object: each column in
  * the data is an independent histogram.
+ * The X values correspond to center of the bins, except for a cumulative
+ * histogram made with makeCumulative().
  *
  * \inpublicapi
  * \ingroup module_analysisdata
@@ -270,6 +272,9 @@ class AbstractAverageHistogram : public AbstractAnalysisArrayData
         /*! \brief
          * Creates a copy of the histogram with double the bin width.
          *
+         * \param[in] bIntegerBins If `true`, the first bin in the result will
+         *     cover the first bin from the source. Otherwise, the first bin
+         *     will cover first two bins from the source.
          * \throws std::bad_alloc if out of memory.
          *
          * The caller is responsible of deleting the returned object.
@@ -289,6 +294,14 @@ class AbstractAverageHistogram : public AbstractAnalysisArrayData
         AverageHistogramPointer clone() const;
         //! Normalizes the histogram such that the integral over it is one.
         void normalizeProbability();
+        /*! \brief
+         * Makes the histograms cumulative by summing up each bin to all bins
+         * after it.
+         *
+         * The X values in the data are adjusted such that they match the right
+         * edges of bins instead of bin centers.
+         */
+        void makeCumulative();
         //! Scales a single histogram by a uniform scaling factor.
         void scaleSingle(int index, real factor);
         //! Scales all histograms by a uniform scaling factor.