[Rivet-svn] r4130 - in branches/2012-06-aidarivet: include/Rivet src/Core

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Feb 7 22:16:59 GMT 2013


Author: fsiegert
Date: Thu Feb  7 22:16:59 2013
New Revision: 4130

Log:
introduce the includeoverflows option for normalise also on aida branch.

Modified:
   branches/2012-06-aidarivet/include/Rivet/Analysis.hh
   branches/2012-06-aidarivet/src/Core/Analysis.cc

Modified: branches/2012-06-aidarivet/include/Rivet/Analysis.hh
==============================================================================
--- branches/2012-06-aidarivet/include/Rivet/Analysis.hh	Tue Feb  5 16:32:34 2013	(r4129)
+++ branches/2012-06-aidarivet/include/Rivet/Analysis.hh	Thu Feb  7 22:16:59 2013	(r4130)
@@ -302,7 +302,7 @@
     /// @param histo The histogram to be normalised.
     /// @param norm The new area of the histogram.
     /// @warning The old histogram will be deleted, and its pointer set to zero.
-    void normalize(AIDA::IHistogram1D*& histo, double norm=1.0);
+    void normalize(AIDA::IHistogram1D*& histo, double norm=1.0, bool includeoverflows=true);
 
     /// Multiplicatively scale the given histogram, @a histo. After this call the
     /// histogram will have been transformed to a DataPointSet with the same name and path.

Modified: branches/2012-06-aidarivet/src/Core/Analysis.cc
==============================================================================
--- branches/2012-06-aidarivet/src/Core/Analysis.cc	Tue Feb  5 16:32:34 2013	(r4129)
+++ branches/2012-06-aidarivet/src/Core/Analysis.cc	Thu Feb  7 22:16:59 2013	(r4130)
@@ -476,7 +476,7 @@
   }
 
 
-  void Analysis::normalize(AIDA::IHistogram1D*& histo, double norm) {
+  void Analysis::normalize(AIDA::IHistogram1D*& histo, double norm, bool includeoverflows) {
     if (!histo) {
       MSG_ERROR("Failed to normalize histo=NULL in analysis "
                 << name() << " (norm=" << norm << ")");
@@ -492,10 +492,11 @@
       // Leaving out factor of binWidth because AIDA's "height" already includes a width factor.
       oldintg += histo->binHeight(iBin); // * histo->axis().binWidth(iBin);
     }
-    // Include overflow bins in the integral
-    oldintg += histo->binHeight(AIDA::IAxis::UNDERFLOW_BIN);
-    oldintg += histo->binHeight(AIDA::IAxis::OVERFLOW_BIN);
-
+    if (includeoverflows) {
+      // Include overflow bins in the integral
+      oldintg += histo->binHeight(AIDA::IAxis::UNDERFLOW_BIN);
+      oldintg += histo->binHeight(AIDA::IAxis::OVERFLOW_BIN);
+    }
     // Sanity check
     if (oldintg == 0.0) {
       MSG_WARNING("Histo " << hpath << " has null integral during normalization");


More information about the Rivet-svn mailing list