[Rivet-svn] r1752 - in trunk: include/LWH src/Analyses

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Aug 11 11:52:42 BST 2009


Author: fsiegert
Date: Tue Aug 11 11:52:41 2009
New Revision: 1752

Log:
Fixes for D0_2008_S7719523:
Cross section ratios have to take different delta_y bins into account.
Use generator cross section for the non-ratio histograms.

Modified:
   trunk/include/LWH/AIDataPointSet.h
   trunk/include/LWH/DataPointSet.h
   trunk/include/LWH/HistogramFactory.h
   trunk/src/Analyses/D0_2008_S7719523.cc

Modified: trunk/include/LWH/AIDataPointSet.h
==============================================================================
--- trunk/include/LWH/AIDataPointSet.h	Mon Aug 10 17:17:28 2009	(r1751)
+++ trunk/include/LWH/AIDataPointSet.h	Tue Aug 11 11:52:41 2009	(r1752)
@@ -40,6 +40,7 @@
     virtual double lowerExtent(int coord) const = 0;
     virtual double upperExtent(int coord) const = 0;
     virtual bool scale(double scaleFactor) = 0;
+    virtual bool scale(double scaleFactor, int coord) = 0;
     virtual bool scaleValues(double scaleFactor) = 0;
     virtual bool scaleErrors(double scaleFactor) = 0;
     virtual void * cast(const std::string & className) const = 0;

Modified: trunk/include/LWH/DataPointSet.h
==============================================================================
--- trunk/include/LWH/DataPointSet.h	Mon Aug 10 17:17:28 2009	(r1751)
+++ trunk/include/LWH/DataPointSet.h	Tue Aug 11 11:52:41 2009	(r1752)
@@ -262,6 +262,26 @@
       }
     return true;
   }
+
+  /**
+   * Scales the values and the errors of the measurements in a given
+   * coordinate of each point by a given factor.
+   * @param scale The scale factor.
+   * @param coord The coordinate
+   * @return false If an illegal scaleFactor is provided.
+   */
+  bool scale(double scale, int coord) {
+    for ( int i = 0, N = dset.size(); i < N; ++i ) {
+      if ( coord >= dset[i].dimension() ) {
+        throw std::runtime_error("Trying to scale non-existent dimension.");
+      }
+      IMeasurement * m = dset[i].coordinate(coord);
+      m->setValue(m->value()*scale);
+      m->setErrorPlus(m->errorPlus()*scale);
+      m->setErrorMinus(m->errorPlus()*scale);
+    }
+    return true;
+  }
 	
   /**
    * Scales the values of all the measurements

Modified: trunk/include/LWH/HistogramFactory.h
==============================================================================
--- trunk/include/LWH/HistogramFactory.h	Mon Aug 10 17:17:28 2009	(r1751)
+++ trunk/include/LWH/HistogramFactory.h	Tue Aug 11 11:52:41 2009	(r1752)
@@ -643,7 +643,7 @@
       x->setErrorMinus(binwidth/2.0);
         
       double yval(0), yerrup(0), yerrdown(0);
-      if ( h2.binHeight(j) == 0 ) {
+      if ( h1.binHeight(j) == 0 || h2.binHeight(j) == 0 ) {
         /// @todo Bad way of handling div by zero!
         yval = 0.0;
         yerrup = 0.0;

Modified: trunk/src/Analyses/D0_2008_S7719523.cc
==============================================================================
--- trunk/src/Analyses/D0_2008_S7719523.cc	Mon Aug 10 17:17:28 2009	(r1751)
+++ trunk/src/Analyses/D0_2008_S7719523.cc	Tue Aug 11 11:52:41 2009	(r1752)
@@ -140,6 +140,11 @@
 
   // Finalize
   void D0_2008_S7719523::finalize() {
+    const double lumi_gen = sumOfWeights()/crossSection();
+    const double dy_photon = 2.0;
+    const double dy_jet_central = 1.6;
+    const double dy_jet_forward = 2.0;
+
     // Cross-section ratios (6 plots)
     // Central/central and forward/forward ratios
     AIDA::IHistogramFactory& hf = histogramFactory();
@@ -147,29 +152,22 @@
 
     hf.divide(dir + "/d05-x01-y01", *_h_central_opp_cross_section, *_h_central_same_cross_section);
     hf.divide(dir + "/d08-x01-y01", *_h_forward_opp_cross_section, *_h_forward_same_cross_section);
+
     // Central/forward ratio combinations
-    hf.divide(dir + "/d06-x01-y01", *_h_central_same_cross_section, *_h_forward_same_cross_section);
-    hf.divide(dir + "/d07-x01-y01", *_h_central_opp_cross_section,  *_h_forward_same_cross_section);
-    hf.divide(dir + "/d09-x01-y01", *_h_central_same_cross_section, *_h_forward_opp_cross_section);
-    hf.divide(dir + "/d10-x01-y01", *_h_central_opp_cross_section,  *_h_forward_opp_cross_section);
-
-    // Must happen *after* the divs, since otherwise the pointers are null!
-    normalize(_h_central_same_cross_section, 347.4);
-    normalize(_h_central_opp_cross_section,  281.8);
-    normalize(_h_forward_same_cross_section, 164.8);
-    normalize(_h_forward_opp_cross_section,   81.5);
-    // @todo test using gen cross section
-    /*
-    const double lumi_gen = sumOfWeights()/crossSection();
-    const double dy_photon = 2.0;
-    const double dy_jet_central = 1.6;
-    const double dy_jet_forward = 2.0;
+    hf.divide(dir + "/d06-x01-y01", *_h_central_same_cross_section,
+              *_h_forward_same_cross_section)->scale(dy_jet_forward/dy_jet_central, 1);
+    hf.divide(dir + "/d07-x01-y01", *_h_central_opp_cross_section,
+              *_h_forward_same_cross_section)->scale(dy_jet_forward/dy_jet_central, 1);
+    hf.divide(dir + "/d09-x01-y01", *_h_central_same_cross_section,
+              *_h_forward_opp_cross_section)->scale(dy_jet_forward/dy_jet_central, 1);
+    hf.divide(dir + "/d10-x01-y01", *_h_central_opp_cross_section,
+              *_h_forward_opp_cross_section)->scale(dy_jet_forward/dy_jet_central, 1);
 
+    // Use generator cross section for remaining histograms
     scale(_h_central_same_cross_section, 1.0/lumi_gen * 1.0/dy_photon * 1.0/dy_jet_central);
     scale(_h_central_opp_cross_section, 1.0/lumi_gen * 1.0/dy_photon * 1.0/dy_jet_central);
     scale(_h_forward_same_cross_section, 1.0/lumi_gen * 1.0/dy_photon * 1.0/dy_jet_forward);
     scale(_h_forward_opp_cross_section, 1.0/lumi_gen * 1.0/dy_photon * 1.0/dy_jet_forward);
-    */
   }
 
 


More information about the Rivet-svn mailing list