[Rivet-svn] r2371 - in trunk: data/anainfo data/plotinfo include/Rivet/Tools src/Analyses src/Tools

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Apr 1 15:53:01 BST 2010


Author: fsiegert
Date: Thu Apr  1 15:52:58 2010
New Revision: 2371

Log:
Simplify many analyses which use BinnedHistograms by introducing a
centralised place for scaling them with taking into account their
"external" binwidths.
Hugely simplify CDF_2007_S7057202 and also use the new functionality
there. This analysis is validated now.

Modified:
   trunk/data/anainfo/CDF_2007_S7057202.info
   trunk/data/plotinfo/CDF_2007_S7057202.plot
   trunk/include/Rivet/Tools/BinnedHistogram.hh
   trunk/src/Analyses/CDF_2001_S4517016.cc
   trunk/src/Analyses/CDF_2007_S7057202.cc
   trunk/src/Analyses/CDF_2008_S7828950.cc
   trunk/src/Analyses/CDF_2008_S8093652.cc
   trunk/src/Analyses/D0_2010_S8566488.cc
   trunk/src/Analyses/D0_2010_S8570965.cc
   trunk/src/Analyses/Makefile.am
   trunk/src/Tools/BinnedHistogram.cc

Modified: trunk/data/anainfo/CDF_2007_S7057202.info
==============================================================================
--- trunk/data/anainfo/CDF_2007_S7057202.info	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/data/anainfo/CDF_2007_S7057202.info	Thu Apr  1 15:52:58 2010	(r2371)
@@ -4,10 +4,10 @@
 Experiment: CDF
 Collider: Tevatron Run 2
 SpiresID: 7057202
-Status: UNVALIDATED
+Status: VALIDATED
 Authors:
  - David Voong
- - James Monk <jmonk at hep.ucl.ac.uk>
+ - Frank Siegert <frank.siegert at durham.ac.uk>
 References:
  - Phys.Rev.D75:092006,2007
  - Erratum-ibid.D75:119901,2007

Modified: trunk/data/plotinfo/CDF_2007_S7057202.plot
==============================================================================
--- trunk/data/plotinfo/CDF_2007_S7057202.plot	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/data/plotinfo/CDF_2007_S7057202.plot	Thu Apr  1 15:52:58 2010	(r2371)
@@ -1,49 +1,49 @@
 # BEGIN PLOT /CDF_2007_S7057202/d01-x01-y01
 Title=Inclusive jet cross-section vs $p_T$ for $|\eta| < 0.1, D=0.7$
 XLabel=Jet $p_T$ [GeV]
-YLabel=$d\sigma/dp_T$ [$nb^-1 GeV^-1$]
+YLabel=$\mathrm{d}^2\sigma/\mathrm{d}p_T\mathrm{d}y$ [nb/GeV]
 LogX=1
 # END PLOT
 
 # BEGIN PLOT /CDF_2007_S7057202/d02-x01-y01
 Title=Inclusive jet cross-section vs $p_T$ for $0.1 < |\eta| < 0.7, D=0.7$
 XLabel=Jet $p_T$ [GeV]
-YLabel=$d\sigma/dp_T$ [$nb^-1 GeV^-1$]
+YLabel=$\mathrm{d}^2\sigma/\mathrm{d}p_T\mathrm{d}y$ [nb/GeV]
 LogX=1
 # END PLOT
 
 # BEGIN PLOT /CDF_2007_S7057202/d03-x01-y01
 Title=Inclusive jet cross-section vs $p_T$ for $0.7 < |\eta| < 1.1, D=0.7$
 XLabel=Jet $p_T$ [GeV]
-YLabel=$d\sigma/dp_T$ [$nb^-1 GeV^-1$]
+YLabel=$\mathrm{d}^2\sigma/\mathrm{d}p_T\mathrm{d}y$ [nb/GeV]
 LogX=1
 # END PLOT
 
 # BEGIN PLOT /CDF_2007_S7057202/d04-x01-y01
 Title=Inclusive jet cross-section vs $p_T$ for $1.1 < |\eta| < 1.6, D=0.7$
 XLabel=Jet $p_T$ [GeV]
-YLabel=$d\sigma/dp_T$ [$nb^-1 GeV^-1$]
+YLabel=$\mathrm{d}^2\sigma/\mathrm{d}p_T\mathrm{d}y$ [nb/GeV]
 LogX=1
 # END PLOT
 
 # BEGIN PLOT /CDF_2007_S7057202/d05-x01-y01
 Title=Inclusive jet cross-section vs $p_T$ for $1.6 < |\eta| < 2.1, D=0.7$
 XLabel=Jet $p_T$ [GeV]
-YLabel=$d\sigma/dp_T$ [$nb^-1 GeV^-1$]
+YLabel=$\mathrm{d}^2\sigma/\mathrm{d}p_T\mathrm{d}y$ [nb/GeV]
 LogX=1
 # END PLOT
 
 # BEGIN PLOT /CDF_2007_S7057202/d06-x01-y01
 Title=Inclusive jet cross-section vs $p_T$ for $0.1 < |\eta| < 0.7, D=0.5$
 XLabel=Jet $p_T$ [GeV]
-YLabel=$d\sigma/dp_T$ [$nb^-1 GeV^-1$]
+YLabel=$\mathrm{d}^2\sigma/\mathrm{d}p_T\mathrm{d}y$ [nb/GeV]
 LogX=1
 # END PLOT
 
 # BEGIN PLOT /CDF_2007_S7057202/d07-x01-y01
 Title=Inclusive jet cross-section vs $p_T$ for $0.1 < |\eta| < 0.7, D=1.0$
 XLabel=Jet $p_T$ [GeV]
-YLabel=$d\sigma/dp_T$ [$nb^-1 GeV^-1$]
+YLabel=$\mathrm{d}^2\sigma/\mathrm{d}p_T\mathrm{d}y$ [nb/GeV]
 LogX=1
 # END PLOT
 

Modified: trunk/include/Rivet/Tools/BinnedHistogram.hh
==============================================================================
--- trunk/include/Rivet/Tools/BinnedHistogram.hh	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/include/Rivet/Tools/BinnedHistogram.hh	Thu Apr  1 15:52:58 2010	(r2371)
@@ -4,6 +4,8 @@
 #include "Rivet/Rivet.hh"
 
 namespace Rivet {
+  
+  class Analysis;
 
 
   /**
@@ -33,6 +35,10 @@
                              const T& val,
                              double weight);
     
+    /// Scale histograms taking into account its "external" binwidth, i.e. by
+    /// scale/binWidth
+    void scale(const T& scale, Analysis* ana);
+    
     const vector<AIDA::IHistogram1D*>& getHistograms() const { return _histos; }
     vector<AIDA::IHistogram1D*>& getHistograms() { return _histos; }
  
@@ -42,6 +48,7 @@
     map<T, AIDA::IHistogram1D*> _histosByUpperBound;
     map<T, AIDA::IHistogram1D*> _histosByLowerBound;
     vector<AIDA::IHistogram1D*> _histos;
+    map<AIDA::IHistogram1D*, T> _binWidths;
  
   };
 

Modified: trunk/src/Analyses/CDF_2001_S4517016.cc
==============================================================================
--- trunk/src/Analyses/CDF_2001_S4517016.cc	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Analyses/CDF_2001_S4517016.cc	Thu Apr  1 15:52:58 2010	(r2371)
@@ -71,12 +71,7 @@
     /// Normalise histograms etc., after the run
     void finalize() {
       double deta1 = 1.2;
-      double deta2[4] = {1.2, 1.4, 1.4, 1.8};
-      int i=0;
-      foreach (AIDA::IHistogram1D* hist, _h_ET.getHistograms()) {
-        scale(hist, crossSection()/nanobarn/sumOfWeights()/deta2[i]/deta1);
-        ++i;
-      }
+      _h_ET.scale(crossSection()/nanobarn/sumOfWeights()/deta1 / 2.0, this);
     }
 
     //@}

Modified: trunk/src/Analyses/CDF_2007_S7057202.cc
==============================================================================
--- trunk/src/Analyses/CDF_2007_S7057202.cc	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Analyses/CDF_2007_S7057202.cc	Thu Apr  1 15:52:58 2010	(r2371)
@@ -8,26 +8,17 @@
 namespace Rivet {
 
 
-  /// @brief CDF Run II inclusive jet cross-section using the kT algorithm.
-  /// @author James Monk
   class CDF_2007_S7057202 : public Analysis {
   public:
 
-    /// Constructor
     CDF_2007_S7057202()
-      : Analysis("CDF_2007_S7057202"),
-        _minY(0.1), _maxY(0.7), _jetMinPT(54.0*GeV)
+      : Analysis("CDF_2007_S7057202")
     {
       setBeams(PROTON, ANTIPROTON);
-      //setSqrtS(1960*GeV);
       setNeedsCrossSection(true);
     }
 
  
-    /// @name Analysis methods
-    //@{
-
-    /// Book histos and set counters for number of events passed in each one
     void init() {
       // Set up projections
       const FinalState fs;
@@ -36,121 +27,49 @@
       addProjection(FastJets(fs, FastJets::KT, 1.0), "JetsD10");
 
       // Book histos
-      _histoD05 = bookHistogram1D(6, 1, 1);
-      _histoD10 = bookHistogram1D(7, 1, 1);
       _binnedHistosD07.addHistogram(  0, 0.1, bookHistogram1D(1, 1, 1));
       _binnedHistosD07.addHistogram(0.1, 0.7, bookHistogram1D(2, 1, 1));
       _binnedHistosD07.addHistogram(0.7, 1.1, bookHistogram1D(3, 1, 1));
       _binnedHistosD07.addHistogram(1.1, 1.6, bookHistogram1D(4, 1, 1));
       _binnedHistosD07.addHistogram(1.6, 2.1, bookHistogram1D(5, 1, 1));
-   
-      size_t yind = 0;
-      for (vector<AIDA::IHistogram1D*>::const_iterator histIt = _binnedHistosD07.getHistograms().begin();
-           histIt != _binnedHistosD07.getHistograms().end(); ++histIt){
-        _eventsPassed[*histIt] = 0.0;
-        _yBinWidths[*histIt] = 2.0 * (_ybins[yind+1]-_ybins[yind]);
-        ++yind;
-      }
-      _eventsPassed[_histoD05] = 0.0;
-      _yBinWidths[_histoD05] = 2.0*(-_ybins[1]+_ybins[2]);
-      _eventsPassed[_histoD10] = 0.0;
-      _yBinWidths[_histoD10] = 2.0*(-_ybins[1]+_ybins[2]);
+      _histoD05 = bookHistogram1D(6, 1, 1);
+      _histoD10 = bookHistogram1D(7, 1, 1);
     }
  
  
-    /// Do the analysis
     void analyze(const Event& event) {
       const double weight = event.weight();
    
-      const PseudoJets jetListD07 = applyProjection<FastJets>(event, "JetsD07").pseudoJets();
-      set< IHistogram1D*> passed;
-      /// @todo Use Jet interface rather than FastJet:PseudoJet
-      for (PseudoJets::const_iterator jet = jetListD07.begin(); jet != jetListD07.end(); ++jet) {
-        const double pt = jet->perp();
-        if (pt > _jetMinPT) {
-          AIDA::IHistogram1D* histo = _binnedHistosD07.fill(fabs(jet->rapidity()), pt, weight);
-          if (histo != 0) {
-            if (histo->coordToIndex(pt) != IAxis::OVERFLOW_BIN) {
-              passed.insert(histo);
-              _eventsPassed[histo] += weight;
-            }
-          }
-        }
+      foreach (const Jet& jet, applyProjection<JetAlg>(event, "JetsD07").jets(54.0*GeV)) {
+        double y = fabs(jet.momentum().rapidity());
+        _binnedHistosD07.fill(y, jet.momentum().pT(), weight);
       }
    
-      /// @todo Use Jet interface rather than FastJet:PseudoJet
-      const PseudoJets jetListD05 = applyProjection<FastJets>(event, "JetsD05").pseudoJets();
-      for (PseudoJets::const_iterator jet = jetListD05.begin(); jet != jetListD05.end(); ++jet) {
-        const double pt = jet->perp();
-        if (pt > _jetMinPT) {
-          double rap = fabs(jet->rapidity());
-          if (rap >= _minY && rap < _maxY){
-            _histoD05->fill(pt, weight);
-            if (_histoD05->coordToIndex(pt) != IAxis::OVERFLOW_BIN){
-              passed.insert(_histoD05);
-              _eventsPassed[_histoD05] += weight;
-            }
-          }
-        }
+      foreach (const Jet& jet, applyProjection<JetAlg>(event, "JetsD05").jets(54.0*GeV)) {
+        double y = fabs(jet.momentum().rapidity());
+        if (y >= 0.1 && y < 0.7) _histoD05->fill(jet.momentum().pT(), weight);
       }
    
-      /// @todo Use Jet interface rather than FastJet:PseudoJet
-      const PseudoJets jetListD10 = applyProjection<FastJets>(event, "JetsD10").pseudoJets();
-      for (PseudoJets::const_iterator jet = jetListD10.begin(); jet != jetListD10.end(); ++jet){
-        const double pt = jet->perp();
-        if (pt > _jetMinPT) {
-          double rap = fabs(jet->rapidity());
-          if (rap >= _minY && rap < _maxY){
-            _histoD10->fill(pt, weight);
-            if (_histoD10->coordToIndex(pt) != IAxis::OVERFLOW_BIN){
-              passed.insert(_histoD10);
-              _eventsPassed[_histoD10] += weight;
-            }
-          }
-        }
+      foreach (const Jet& jet, applyProjection<JetAlg>(event, "JetsD10").jets(54.0*GeV)) {
+        double y = fabs(jet.momentum().rapidity());
+        if (y >= 0.1 && y < 0.7) _histoD10->fill(jet.momentum().pT(), weight);
       }
     }
  
  
     // Normalise histograms to cross-section
     void finalize() {
-      const double xSecPerEvent = crossSectionPerEvent()/nanobarn;
-      getLog() << Log::INFO << "Cross-section = " << crossSection()/nanobarn << " nb" << endl;
-   
-      for (map<IHistogram1D*,double>::iterator histIt = _eventsPassed.begin(),
-             histJt = _yBinWidths.begin(); histIt != _eventsPassed.end(); ++histIt, ++histJt) {
-        IHistogram1D* hist = histIt->first;
-        const double xSec = xSecPerEvent * histIt->second / histJt->second;
-        normalize(hist, xSec);
-      }
+      const double xSec = crossSectionPerEvent()/nanobarn;
+      
+      scale(_histoD05, xSec);
+      scale(_histoD10, xSec);
+      // scale to xSec/yBinWidth and take into account the double yBinWidth due
+      // to the absolute value of y
+      _binnedHistosD07.scale(xSec/2.0, this);
     }
  
-        //@}
- 
   private:
 
-    /// Rapidity range of histograms for R=0.05 and R=1 kt jets
-    const double _minY, _maxY;
-     
-    /// Min jet \f$ p_T \f$ cut.
-    /// @todo Make static const and UPPERCASE?
-    const double _jetMinPT;
- 
-    /// Counter for the number of events analysed (actually the sum of weights, hence double).
-    double _eventsTried;
-
-    /// @name Histograms
-    //@{
-    /// The number of events in each histogram
-    map<AIDA::IHistogram1D*, double> _eventsPassed;
-
-    /// The y bin width of each histogram
-    map<AIDA::IHistogram1D*, double> _yBinWidths;
-
-    /// The y bin edge values
-    static const double _ybins[6];
-
-    /// Histograms in different eta regions
     BinnedHistogram<double> _binnedHistosD07;
 
     // Single histogram for the \f$R=0.5\f$ \f$k_\perp\f$ jets
@@ -163,10 +82,6 @@
   };
 
 
-  // Initialise static
-  const double CDF_2007_S7057202::_ybins[] = { 0.0, 0.1, 0.7, 1.1, 1.6, 2.1 };
-
-
   // This global object acts as a hook for the plugin system
   AnalysisBuilder<CDF_2007_S7057202> plugin_CDF_2007_S7057202;
 

Modified: trunk/src/Analyses/CDF_2008_S7828950.cc
==============================================================================
--- trunk/src/Analyses/CDF_2008_S7828950.cc	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Analyses/CDF_2008_S7828950.cc	Thu Apr  1 15:52:58 2010	(r2371)
@@ -33,18 +33,12 @@
       const FinalState fs;
       addProjection(FastJets(fs, FastJets::CDFMIDPOINT, 0.7), "JetsM07");
 
-      /// @todo What actually are these histos showing?
       _binnedHistosR07.addHistogram(  0, 0.1, bookHistogram1D(1, 1, 1));
       _binnedHistosR07.addHistogram(0.1, 0.7, bookHistogram1D(2, 1, 1));
       _binnedHistosR07.addHistogram(0.7, 1.1, bookHistogram1D(3, 1, 1));
       _binnedHistosR07.addHistogram(1.1, 1.6, bookHistogram1D(4, 1, 1));
       _binnedHistosR07.addHistogram(1.6, 2.1, bookHistogram1D(5, 1, 1));
 
-      size_t yind = 0;
-      foreach (AIDA::IHistogram1D* hist, _binnedHistosR07.getHistograms()) {
-        _yBinWidths[hist] = 2.0 * (_ybins[yind+1]-_ybins[yind]);
-        ++yind;
-      }
     }
 
 
@@ -59,9 +53,7 @@
 
     // Normalise histograms to cross-section
     void finalize() {
-      foreach (AIDA::IHistogram1D* hist, _binnedHistosR07.getHistograms()) {
-        scale(hist, crossSection()/nanobarn/sumOfWeights()/_yBinWidths[hist]);
-      }
+      _binnedHistosR07.scale(crossSection()/nanobarn/sumOfWeights()/2.0, this);
     }
 
     //@}
@@ -69,26 +61,12 @@
 
   private:
  
-    /// @name Histograms
-    //@{
-
-    /// The y bin width of each histogram
-    map<AIDA::IHistogram1D*, double> _yBinWidths;
-
-    /// The y bin edge values
-    /// @todo Yuck!
-    static const double _ybins[6];
-
     /// Histograms in different eta regions
     BinnedHistogram<double> _binnedHistosR07;
 
   };
 
 
-  // Initialise static
-  const double CDF_2008_S7828950::_ybins[] = { 0.0, 0.1, 0.7, 1.1, 1.6, 2.1 };
-
-
   // This global object acts as a hook for the plugin system
   AnalysisBuilder<CDF_2008_S7828950> plugin_CDF_2008_S7828950;
 

Modified: trunk/src/Analyses/CDF_2008_S8093652.cc
==============================================================================
--- trunk/src/Analyses/CDF_2008_S8093652.cc	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Analyses/CDF_2008_S8093652.cc	Thu Apr  1 15:52:58 2010	(r2371)
@@ -1,7 +1,6 @@
 // -*- C++ -*-
 #include "Rivet/Analysis.hh"
 #include "Rivet/RivetAIDA.hh"
-#include "Rivet/Tools/BinnedHistogram.hh"
 #include "Rivet/Tools/Logging.hh"
 #include "Rivet/Projections/FinalState.hh"
 #include "Rivet/Projections/FastJets.hh"

Modified: trunk/src/Analyses/D0_2010_S8566488.cc
==============================================================================
--- trunk/src/Analyses/D0_2010_S8566488.cc	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Analyses/D0_2010_S8566488.cc	Thu Apr  1 15:52:58 2010	(r2371)
@@ -65,10 +65,7 @@
 
     /// Normalise histograms etc., after the run
     void finalize() {
-      double dymax=0.4;
-      foreach (AIDA::IHistogram1D* hist, _h_m_dijet.getHistograms()) {
-        scale(hist, crossSection()/sumOfWeights()/dymax);
-      }
+      _h_m_dijet.scale(crossSection()/sumOfWeights(), this);
     }
 
     //@}

Modified: trunk/src/Analyses/D0_2010_S8570965.cc
==============================================================================
--- trunk/src/Analyses/D0_2010_S8570965.cc	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Analyses/D0_2010_S8570965.cc	Thu Apr  1 15:52:58 2010	(r2371)
@@ -116,6 +116,8 @@
       scale(_h_pT, crossSection()/sumOfWeights());
       scale(_h_dPhi, crossSection()/sumOfWeights());
       scale(_h_costheta, crossSection()/sumOfWeights());
+      // despite what it says in the paper, the mass bin width doesn't seem
+      // to have been taken into account for these:
       for (size_t i=0; i<3; ++i) {
         scale(_h_pT_M.getHistograms()[i], crossSection()/sumOfWeights());
         scale(_h_dPhi_M.getHistograms()[i], crossSection()/sumOfWeights());

Modified: trunk/src/Analyses/Makefile.am
==============================================================================
--- trunk/src/Analyses/Makefile.am	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Analyses/Makefile.am	Thu Apr  1 15:52:58 2010	(r2371)
@@ -17,7 +17,6 @@
     CDF_1996_S3349578.cc \
     CDF_1997_S3541940.cc \
     CDF_2006_S6653332.cc \
-    CDF_2007_S7057202.cc \
     CDF_2008_S7541902.cc \
     CDF_2008_S7782535.cc \
     CDF_2008_S8095620.cc \
@@ -59,6 +58,7 @@
     CDF_2005_S6080774.cc \
     CDF_2005_S6217184.cc \
     CDF_2006_S6450792.cc \
+    CDF_2007_S7057202.cc \
     CDF_2008_LEADINGJETS.cc \
     CDF_2008_NOTE_9351.cc \
     CDF_2008_S7540469.cc \

Modified: trunk/src/Tools/BinnedHistogram.cc
==============================================================================
--- trunk/src/Tools/BinnedHistogram.cc	Tue Mar 30 22:58:30 2010	(r2370)
+++ trunk/src/Tools/BinnedHistogram.cc	Thu Apr  1 15:52:58 2010	(r2371)
@@ -2,6 +2,7 @@
 #include "Rivet/Tools/BinnedHistogram.hh"
 #include "Rivet/RivetBoost.hh"
 #include "Rivet/RivetAIDA.hh"
+#include "Rivet/Analysis.hh"
 
 namespace Rivet {
 
@@ -26,6 +27,7 @@
     
     if (!found){
       _histos.push_back(histo);
+      _binWidths[histo]=binMax-binMin;
     }
     
     return *this;
@@ -66,6 +68,14 @@
     
     return histo;
   }
+  
+  
+  template<typename T>
+  void BinnedHistogram<T>::scale(const T& scale, Analysis* ana) {
+    foreach (AIDA::IHistogram1D* hist, getHistograms()) {
+      ana->scale(hist, scale/_binWidths[hist]);
+    }
+  }
 
 
 


More information about the Rivet-svn mailing list