[Rivet-svn] r2456 - in trunk/include: LWH Rivet

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue May 18 15:09:09 BST 2010


Author: hoeth
Date: Tue May 18 15:13:39 2010
New Revision: 2456

Log:
delete unneeded normalize() and integral() functions in RivetAIDA.hh and
Histogram1D.h. Also fix the integral() function in RivetAIDA.hh

Modified:
   trunk/include/LWH/Histogram1D.h
   trunk/include/Rivet/RivetAIDA.hh

Modified: trunk/include/LWH/Histogram1D.h
==============================================================================
--- trunk/include/LWH/Histogram1D.h	Tue May 18 14:20:54 2010	(r2455)
+++ trunk/include/LWH/Histogram1D.h	Tue May 18 15:13:39 2010	(r2456)
@@ -394,37 +394,6 @@
     }
 
     /**
-     * Scale the given histogram so that the integral over all bins
-     * (including overflow) gives \a intg. This function also corrects
-     * for the bin-widths, which means that it should only be run once
-     * for each histogram. Further rescaling must be done with the
-     * scale(double) function.
-     */
-    void normalize(double intg) {
-      double oldintg = sumAllBinHeights();
-      if ( oldintg == 0.0 ) return;
-      for ( int i = 0; i < ax->bins() + 2; ++i ) {
-        double fac = intg/oldintg;
-        if ( i >= 2 ) fac /= (ax->binUpperEdge(i - 2) - ax->binLowerEdge(i - 2));
-        sumw[i] *= fac;
-        sumxw[i] *= fac;
-        sumx2w[i] *= fac;
-        sumw2[i] *= fac*fac;
-      }
-    }
-
-    /**
-     * Return the integral over the histogram bins assuming it has been
-     * normalize()d.
-     */
-    double integral() const {
-      double intg = sumw[0] + sumw[1];
-      for ( int i = 2; i < ax->bins() + 2; ++i )
-        intg += sumw[i]*(ax->binUpperEdge(i - 2) - ax->binLowerEdge(i - 2));
-      return intg;
-    }
-
-    /**
      * Not implemented in LWH.
      * @return null pointer always.
      */

Modified: trunk/include/Rivet/RivetAIDA.hh
==============================================================================
--- trunk/include/Rivet/RivetAIDA.hh	Tue May 18 14:20:54 2010	(r2455)
+++ trunk/include/Rivet/RivetAIDA.hh	Tue May 18 15:13:39 2010	(r2456)
@@ -36,25 +36,13 @@
   /// Get the file system path to the AIDA reference file for this paper.
   const string getDataPath(string papername);
 
-  /// Normalize the histogram to @a norm .
-  inline void normalize(AIDA::IHistogram1D* histo, const double norm=1.0) {
-    assert(norm != 0.0);
-    double area = 0;
-    for (int i=0; i < histo->axis().bins(); ++i) {
-      area += histo->binHeight(i) * histo->axis().binWidth(i);
-    }
-    if (area != 0) {
-      histo->scale(norm/area);
-    }
-  }
-
-
   /// Return the integral over the histogram bins assuming it has been
   // normalize()d.
   inline double integral(AIDA::IHistogram1D* histo) {
     double intg = 0.;
     for ( int i = 0; i < histo->axis().bins(); ++i )
-      intg += histo->binHeight(i) * histo->axis().binWidth(i);
+      // Don't multiply with binWidth -- it's already included in binHeight
+      intg += histo->binHeight(i); // * histo->axis().binWidth(i);
     return intg;
   }
 


More information about the Rivet-svn mailing list