[Rivet-svn] r1786 - in trunk: . src/Analyses

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Aug 31 11:18:13 BST 2009


Author: buckley
Date: Mon Aug 31 11:18:12 2009
New Revision: 1786

Log:
Cleaning up and removing headers from UA1 & UA5 analyses

Modified:
   trunk/ChangeLog
   trunk/src/Analyses/CDF_1988_S1865951.cc
   trunk/src/Analyses/CDF_1990_S2089246.cc
   trunk/src/Analyses/UA1_1990_S2044935.cc
   trunk/src/Analyses/UA5_1982_S875503.cc
   trunk/src/Analyses/UA5_1986_S1583476.cc
   trunk/src/Analyses/UA5_1988_S1867512.cc
   trunk/src/Analyses/UA5_1989_S1926373.cc

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/ChangeLog	Mon Aug 31 11:18:12 2009	(r1786)
@@ -1,5 +1,7 @@
 2009-08-31  Andy Buckley  <andy at insectnation.org>
 
+	* Cleaning and removing headers from UA1 and UA5 analyses.
+
 	* Removing headers for D0 analyses.
 
 	* Exit with an error message if addProjection is used twice from

Modified: trunk/src/Analyses/CDF_1988_S1865951.cc
==============================================================================
--- trunk/src/Analyses/CDF_1988_S1865951.cc	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/src/Analyses/CDF_1988_S1865951.cc	Mon Aug 31 11:18:12 2009	(r1786)
@@ -67,12 +67,12 @@
       }
       
       // Require at least one coincidence hit in both BBC counters
-      if (!n_trig_1 || !n_trig_2) vetoEvent; 
+      if (n_trig_1 == 0 || n_trig_2 == 0) vetoEvent; 
       getLog() << Log::DEBUG << "Trigger 1: " << n_trig_1 << " Trigger 2: " << n_trig_2 << endl;
       
       // Further event selection cut
-      if ( (n_backward+n_forward < 4) || (n_backward*n_forward < 1) ) vetoEvent;
-      getLog() << Log::DEBUG << " Num. forward: " << n_forward  << " Num. backward: " << n_backward << endl;
+      if (n_backward + n_forward < 4 || n_backward == 0 || n_forward == 0) vetoEvent;
+      getLog() << Log::DEBUG << " Num. forward: " << n_forward  << ", Num. backward: " << n_backward << endl;
       
       foreach (Particle p, fs.particles()) {
         const double pt = p.momentum().pT();

Modified: trunk/src/Analyses/CDF_1990_S2089246.cc
==============================================================================
--- trunk/src/Analyses/CDF_1990_S2089246.cc	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/src/Analyses/CDF_1990_S2089246.cc	Mon Aug 31 11:18:12 2009	(r1786)
@@ -69,12 +69,12 @@
       }
       
       // Require at least one coincidence hit in both BBC counters
-      if (!n_trig_1 || !n_trig_2) vetoEvent; 
+      if (n_trig_1 == 0 || n_trig_2 == 0) vetoEvent; 
       getLog() << Log::DEBUG << "Trigger 1: " << n_trig_1 << " Trigger 2: " << n_trig_2 << endl;
       
       // Further event selection cut
-      if ( (n_backward+n_forward < 4) || (n_backward*n_forward < 1) ) vetoEvent;
-      getLog() << Log::DEBUG << " Num. forward: " << n_forward  << " Num. backward: " << n_backward << endl;
+      if (n_backward + n_forward < 4 || n_backward == 0 || n_forward == 0) vetoEvent;
+      getLog() << Log::DEBUG << " Num. forward: " << n_forward  << ", Num. backward: " << n_backward << endl;
       
       // Loop over final state charged particles 
       const FinalState& fs = applyProjection<FinalState>(event, "FS");

Modified: trunk/src/Analyses/UA1_1990_S2044935.cc
==============================================================================
--- trunk/src/Analyses/UA1_1990_S2044935.cc	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/src/Analyses/UA1_1990_S2044935.cc	Mon Aug 31 11:18:12 2009	(r1786)
@@ -1,5 +1,5 @@
+// -*- C++ -*-
 #include "Rivet/Analysis.hh"
-#include "Rivet/AnalysisLoader.hh"
 #include "Rivet/RivetAIDA.hh"
 #include "Rivet/Tools/ParticleIDMethods.hh"
 #include "Rivet/Projections/FinalState.hh"
@@ -7,15 +7,17 @@
 #include "Rivet/Projections/Beam.hh"
 #include "Rivet/Projections/PVertex.hh"
 #include "Rivet/Projections/TotalVisibleMomentum.hh"
-#include "Rivet/Analyses/UA1_1990_S2044935.hh"
 
 namespace Rivet {
 
 
+  class UA1_1990_S2044935 : public Analysis {
+  public:
+
     /// Default constructor
-    UA1_1990_S2044935::UA1_1990_S2044935() 
-    : Analysis("UA1_1990_S2044935")
-   {
+    UA1_1990_S2044935() 
+      : Analysis("UA1_1990_S2044935")
+    {
       setBeams(PROTON, ANTIPROTON);
       const ChargedFinalState cfs(-2.5, 2.5);
       const FinalState fs2(-6., 6.);
@@ -26,163 +28,144 @@
       addProjection(Beam(), "Beam");
       addProjection(TotalVisibleMomentum(fs), "Mom");
     }
+    
 
     /// @name Analysis methods
     //@{
-    //book histograms
-    void UA1_1990_S2044935::init() { 
 
-      _hist_sigma200 =
-        bookHistogram1D(1,1,1);
-      _hist_sigma500 =
-        bookHistogram1D(1,1,2);
-      _hist_sigma900 =
-        bookHistogram1D(1,1,3);
-      _hist_Esigma200 =
-        bookHistogram1D(2,1,1);
-      _hist_Esigma500 =
-        bookHistogram1D(2,1,2);
-      _hist_Esigma900 =
-        bookHistogram1D(2,1,3);
-      _hist_Esigmapoint8 =
-        bookHistogram1D(3,1,1);
-      _hist_Esigma4 =
-        bookHistogram1D(4,1,1);
-      _hist_Esigma8 =
-        bookHistogram1D(5,1,1);
-      _hist_Et200 =
-        bookHistogram1D(9,1,1);
-      _hist_Et500 =
-        bookHistogram1D(10,1,1);
-      _hist_Et900 =
-        bookHistogram1D(11,1,1);
-      _hist_Pt63 =
-        bookProfile1D(8,1,1);
-      _hist_Pt200 =
-        bookProfile1D(6,1,1);
-      _hist_Pt900 =
-        bookProfile1D(7,1,1);
-      _hist_Etavg200 =
-        bookProfile1D(12,1,1); 
-      _hist_Etavg500 =
-        bookProfile1D(12,1,2); 
-      _hist_Etavg900 =
-        bookProfile1D(12,1,3);
+    /// Book histograms
+    void init() { 
+      _hist_sigma200 = bookHistogram1D(1,1,1);
+      _hist_sigma500 = bookHistogram1D(1,1,2);
+      _hist_sigma900 = bookHistogram1D(1,1,3);
+      _hist_Esigma200 = bookHistogram1D(2,1,1);
+      _hist_Esigma500 = bookHistogram1D(2,1,2);
+      _hist_Esigma900 = bookHistogram1D(2,1,3);
+      _hist_Esigmapoint8 = bookHistogram1D(3,1,1);
+      _hist_Esigma4 = bookHistogram1D(4,1,1);
+      _hist_Esigma8 = bookHistogram1D(5,1,1);
+      _hist_Et200 = bookHistogram1D(9,1,1);
+      _hist_Et500 = bookHistogram1D(10,1,1);
+      _hist_Et900 = bookHistogram1D(11,1,1);
+      _hist_Pt63 = bookProfile1D(8,1,1);
+      _hist_Pt200 = bookProfile1D(6,1,1);
+      _hist_Pt900 = bookProfile1D(7,1,1);
+      _hist_Etavg200 = bookProfile1D(12,1,1); 
+      _hist_Etavg500 = bookProfile1D(12,1,2); 
+      _hist_Etavg900 = bookProfile1D(12,1,3);
     }
     
-    void UA1_1990_S2044935::analyze(const Event& event) 
-    {
+
+    void analyze(const Event& event) {
       const double sqrtS = applyProjection<Beam>(event, "Beam").sqrtS();
       const double weight = event.weight();
       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
       const FinalState& fs = applyProjection<FinalState>(event, "FS");
       double multi = cfs.particles().size();
 
-	if (fuzzyEquals(sqrtS/GeV, 200, 1E-4)) 
-	{
-	  _hist_sigma200->fill(multi, weight);
-	} 
-	else if (fuzzyEquals(sqrtS/GeV, 500)) 
-	{
-	  _hist_sigma500->fill(multi, weight);
-	}
-	else if (fuzzyEquals(sqrtS/GeV, 900)) 
-	{
+      if (fuzzyEquals(sqrtS/GeV, 200, 1E-4)) {
+        _hist_sigma200->fill(multi, weight);
+      } else if (fuzzyEquals(sqrtS/GeV, 500)) {
+        _hist_sigma500->fill(multi, weight);
+      }	else if (fuzzyEquals(sqrtS/GeV, 900)) {
 	  _hist_sigma900->fill(multi, weight);
-	}
-      foreach (const Particle& p, fs.particles())
-      {
-///@todo figure out where the extra factor of 0.5 comes from in the weight factor (eta range?).
+      }
+      foreach (const Particle& p, fs.particles()) {
+        /// @todo Figure out where the extra factor of 0.5 comes from in the weight factor: eta range?
         double pt = p.momentum().pT();
-        if (fuzzyEquals(sqrtS/GeV, 200, 1E-4))
-        {
+        if (fuzzyEquals(sqrtS/GeV, 200, 1E-4)) {
           _hist_Esigma200->fill(pt, weight/(2.*10.*M_PI*pt));
         }
-        if (fuzzyEquals(sqrtS/GeV, 500))
-        {
+        if (fuzzyEquals(sqrtS/GeV, 500)) {
           _hist_Esigma500->fill(pt, weight/(2.*10.*M_PI*pt));
         }
-        if (fuzzyEquals(sqrtS/GeV, 900))
-        {
+        if (fuzzyEquals(sqrtS/GeV, 900)) {
           _hist_Esigma900->fill(pt, weight/(2.*10.*M_PI*pt));
           const double dnch_deta = multi/5.0;
-          if (dnch_deta >= 0.8 && dnch_deta <= 4)
-          {
+          if (inRange(dnch_deta, 0.8, 4)) {
             _hist_Esigmapoint8->fill(pt, weight/(10.*M_PI*pt));
-          }
-          else if (dnch_deta > 4 && dnch_deta <= 8)
-          {
+          } else if (dnch_deta > 4 && dnch_deta <= 8) {
             _hist_Esigma4->fill(pt, weight/(10.*M_PI*pt));
-          }
-          else if(dnch_deta > 8)
-          {
+          } else if(dnch_deta > 8) {
             _hist_Esigma8->fill(pt, weight/(10.*M_PI*pt));
           }
         }                
       }
-
+      
       const double Et = applyProjection<TotalVisibleMomentum>(event, "Mom").scalarET();
+      if (fuzzyEquals(sqrtS, 200, 1E-4)) {
+        _hist_Et200->fill(Et, weight);
+      } else if (fuzzyEquals(sqrtS, 500)) {
+        _hist_Et500->fill(Et, weight);
+      } else if (fuzzyEquals(sqrtS, 900)) {
+        _hist_Et900->fill(Et, weight);
+      }
 
-	if (fuzzyEquals(sqrtS, 200, 1E-4)) 
-	{
-	  _hist_Et200->fill(Et, weight);
-	} 
-	else if (fuzzyEquals(sqrtS, 500)) 
-	{
-	  _hist_Et500->fill(Et, weight);
-	}
-	else if (fuzzyEquals(sqrtS, 900)) 
-	{
-	  _hist_Et900->fill(Et, weight);
-	}
-
-      foreach (const Particle& p, cfs.particles())
-      {
-        {
-      	if (fuzzyEquals(sqrtS, 63, 1E-3)) 
-	{
-	  _hist_Pt63->fill(multi, p.momentum().pT(), weight);
-	} 
-	else if (fuzzyEquals(sqrtS, 200, 1E-4)) 
-	{
-	  _hist_Pt200->fill(multi, p.momentum().pT(), weight);
-	  _hist_Etavg200->fill(multi, Et, weight);
-	}
-	else if (fuzzyEquals(sqrtS, 500))
-	{
-	  _hist_Etavg500->fill(multi, Et, weight);
-	}
-	else if (fuzzyEquals(sqrtS, 900)) 
-	{
-	  _hist_Pt900->fill(multi, p.momentum().pT(), weight);
-	  _hist_Etavg900->fill(multi, Et, weight);
-	}
+      foreach (const Particle& p, cfs.particles()) {
+        if (fuzzyEquals(sqrtS, 63, 1E-3)) {
+          _hist_Pt63->fill(multi, p.momentum().pT(), weight);
+        } else if (fuzzyEquals(sqrtS, 200, 1E-4)) {
+          _hist_Pt200->fill(multi, p.momentum().pT(), weight);
+          _hist_Etavg200->fill(multi, Et, weight);
+        } else if (fuzzyEquals(sqrtS, 500)) {
+          _hist_Etavg500->fill(multi, Et, weight);
+        } else if (fuzzyEquals(sqrtS, 900)) {
+          _hist_Pt900->fill(multi, p.momentum().pT(), weight);
+          _hist_Etavg900->fill(multi, Et, weight);
+        }
       }
     }
-    }
-
-
     
-    void UA1_1990_S2044935::finalize() {
-    ///@todo: get the total cross-sections from the generator
-    ///@todo: check if the scaling for Esigmpoint8, Esigma4 and Esigma8 are correct.
-       normalize(_hist_sigma200, 27.9);
+    
+    void finalize() {
+      ///@todo: get the total cross-sections from the generator
+      ///@todo: check if the scaling for Esigmpoint8, Esigma4 and Esigma8 are correct.
+      normalize(_hist_sigma200, 27.9);
       normalize(_hist_sigma500, 31.5);
       normalize(_hist_sigma900, 34.4);
-       scale(_hist_Esigma200, 27.9/sumOfWeights());
-     scale(_hist_Esigma500, 31.5/sumOfWeights());
+      scale(_hist_Esigma200, 27.9/sumOfWeights());
+      scale(_hist_Esigma500, 31.5/sumOfWeights());
       scale(_hist_Esigma900, 34.4/sumOfWeights());
       scale(_hist_Esigmapoint8, 34400./sumOfWeights());
       scale(_hist_Esigma4, 3440./sumOfWeights());
       scale(_hist_Esigma8, 344./sumOfWeights());
-            normalize(_hist_Et200, 27.9);
+      normalize(_hist_Et200, 27.9);
       normalize(_hist_Et500, 31.5);
       normalize(_hist_Et900, 34.4);
     }
+    
+    //@}
 
-
-
+    
+  private:
+    
+    /// @name Histogram collections
+    //@{
+    AIDA::IHistogram1D* _hist_sigma200;
+    AIDA::IHistogram1D* _hist_sigma500;
+    AIDA::IHistogram1D* _hist_sigma900;
+    AIDA::IHistogram1D* _hist_Esigma200;
+    AIDA::IHistogram1D* _hist_Esigma500;
+    AIDA::IHistogram1D* _hist_Esigma900;
+    AIDA::IHistogram1D* _hist_Esigmapoint8;
+    AIDA::IHistogram1D* _hist_Esigma4;
+    AIDA::IHistogram1D* _hist_Esigma8;
+    AIDA::IProfile1D* _hist_Pt63;
+    AIDA::IProfile1D* _hist_Pt200;
+    AIDA::IProfile1D* _hist_Pt900;
+    AIDA::IProfile1D* _hist_Etavg200;
+    AIDA::IProfile1D* _hist_Etavg500;
+    AIDA::IProfile1D* _hist_Etavg900;
+    AIDA::IHistogram1D* _hist_Et200;
+    AIDA::IHistogram1D* _hist_Et500;
+    AIDA::IHistogram1D* _hist_Et900;
+    //@}
+    
+  };
+  
+  
+  
   // This global object acts as a hook for the plugin system
   AnalysisBuilder<UA1_1990_S2044935> plugin_UA1_1990_S2044935;
-
+  
 }

Modified: trunk/src/Analyses/UA5_1982_S875503.cc
==============================================================================
--- trunk/src/Analyses/UA5_1982_S875503.cc	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/src/Analyses/UA5_1982_S875503.cc	Mon Aug 31 11:18:12 2009	(r1786)
@@ -1,91 +1,108 @@
-#include "Rivet/RivetAIDA.hh"
+// -*- C++ -*-
 #include "Rivet/Analysis.hh"
+#include "Rivet/RivetAIDA.hh"
+#include "Rivet/Tools/ParticleIDMethods.hh"
 #include "Rivet/Projections/Beam.hh"
 #include "Rivet/Projections/ChargedFinalState.hh"
-#include "Rivet/AnalysisLoader.hh"
-#include "Rivet/Tools/ParticleIDMethods.hh"
-#include "Rivet/Analyses/UA5_1982_S875503.hh"
 
 namespace Rivet {
+
+  class UA5_1982_S875503 : public Analysis {
+  public:
     
     /// Default constructor
-    UA5_1982_S875503::UA5_1982_S875503()
-   : Analysis("UA5_1982_S875503") {
+    UA5_1982_S875503()
+      : Analysis("UA5_1982_S875503") 
+    {
       const ChargedFinalState cfs(-3.5, 3.5);
       addProjection(Beam(), "Beam");
       addProjection(cfs, "CFS");
     }
- 
+  
+
     /// @name Analysis methods
     //@{
-    void UA5_1982_S875503::init() 
+
+    void init() 
     { 
-    _hist_nch_pp    = bookHistogram1D(2,1,1);
-    _hist_nch_ppbar = bookHistogram1D(2,1,2);
-    _hist_eta_pp    = bookHistogram1D(3,1,1);
-    _hist_eta_ppbar = bookHistogram1D(4,1,1);
+      _hist_nch_pp    = bookHistogram1D(2,1,1);
+      _hist_nch_ppbar = bookHistogram1D(2,1,2);
+      _hist_eta_pp    = bookHistogram1D(3,1,1);
+      _hist_eta_ppbar = bookHistogram1D(4,1,1);
     }
     
-    void UA5_1982_S875503::analyze(const Event& event) {
+    
+    void analyze(const Event& event) {
       const Beam b = applyProjection<Beam>(event, "Beam");
       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
       const double weight = event.weight();
-      int b_pdg = b.beams().first.pdgId() * b.beams().second.pdgId();
-
+      
       // Different trigger implementations for ppbar and pp!
-      int n_trig_1 = 0;
-      int n_trig_2 = 0;
-
+      int n_trig_1(0), n_trig_2(0);
       foreach (const Particle& p, cfs.particles()) {
-           double eta = p.momentum().pseudorapidity();
-           if ( ( -5.6 < eta ) && ( eta < -2.0 ) ) n_trig_1++;
-           else if ( ( 2.0 < eta ) && ( eta < 5.6 ) ) n_trig_2++;
-      }
-      // PP first
-      if ( ( b_pdg > 0. ) && ( n_trig_1* n_trig_2 < 1. ) ) {
-          vetoEvent; 
+        double eta = p.momentum().pseudorapidity();
+        if (inRange(eta, -5.6, -2.0)) n_trig_1 += 1;
+        else if (inRange(eta, 2.0, 5.6)) n_trig_2 += 1;
+      }
+      
+      // Trigger requirements
+      const bool samebeam = (b.beams().first.pdgId() == b.beams().second.pdgId());
+      if (samebeam) {
+        // PP
+        if (n_trig_1 == 0 || n_trig_2 == 0) vetoEvent; 
+      } else {
+        // PPbar
+        /// @todo Is this actually the exact trigger requirement?
+        if (n_trig_1 * n_trig_2 < 4) vetoEvent;
       }
-      // PPbar trigger requirements
-      else if ( ( b_pdg < 0. ) && ( n_trig_1* n_trig_2 < 4. ) ) {
-          vetoEvent;
-      }
-
-
+      
       // Iterate over all FS particles and fill histograms
       foreach (const Particle& p, cfs.particles()) {
-        // PP collision
-        if ( b.beams().first.pdgId() == b.beams().second.pdgId()) {
-            _hist_eta_pp->fill(fabs(p.momentum().pseudorapidity()), weight);
-            }
-        // PPbar collision
-        else if ( b.beams().first.pdgId() != b.beams().second.pdgId()) {
-            _hist_eta_ppbar->fill(fabs(p.momentum().pseudorapidity()), weight);
-            }
+        if (samebeam) {
+          // PP collision
+          _hist_eta_pp->fill(fabs(p.momentum().pseudorapidity()), weight);
+        } else {
+          // PPbar collision
+          _hist_eta_ppbar->fill(fabs(p.momentum().pseudorapidity()), weight);
+        }
       }
-
+      
       // Fill mean charged multiplicity histos
-      // PP first
-      if ( b_pdg > 0. ) {
-          _hist_nch_pp->fill(_hist_nch_pp->binMean(0), cfs.particles().size());
-      }
-      // PPbar 
-      else if ( b_pdg < 0. ) {
-          _hist_nch_ppbar->fill(_hist_nch_ppbar->binMean(0), cfs.particles().size());
+      if (samebeam) {
+        // PP
+        _hist_nch_pp->fill(_hist_nch_pp->binMean(0), cfs.particles().size());
+      } else {
+        // PPbar 
+        _hist_nch_ppbar->fill(_hist_nch_ppbar->binMean(0), cfs.particles().size());
       }
-
+      
     }
     
-    void UA5_1982_S875503::finalize() {
+    
+    void finalize() {
       scale(_hist_nch_pp,    1./sumOfWeights());
       scale(_hist_nch_ppbar, 1./sumOfWeights());
       normalize(_hist_eta_pp,    5.28);
       normalize(_hist_eta_ppbar, 5.29);
     }
     //@}
-
-
-
+    
+  
+  private:
+    
+    /// @name Histogram collections
+    //@{
+    AIDA::IHistogram1D* _hist_nch_pp;
+    AIDA::IHistogram1D* _hist_nch_ppbar;
+    AIDA::IHistogram1D* _hist_eta_pp;
+    AIDA::IHistogram1D* _hist_eta_ppbar;
+    //@}
+    
+  };
+  
+  
+  
   // This global object acts as a hook for the plugin system
   AnalysisBuilder<UA5_1982_S875503> plugin_UA5_1982_S875503;
-
+  
 }

Modified: trunk/src/Analyses/UA5_1986_S1583476.cc
==============================================================================
--- trunk/src/Analyses/UA5_1986_S1583476.cc	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/src/Analyses/UA5_1986_S1583476.cc	Mon Aug 31 11:18:12 2009	(r1786)
@@ -1,42 +1,48 @@
 // -*- C++ -*-
-#include "Rivet/Rivet.hh"
+#include "Rivet/Analysis.hh"
 #include "Rivet/RivetAIDA.hh"
 #include "Rivet/Tools/Logging.hh"
-#include "Rivet/Analyses/UA5_1986_S1583476.hh"
 #include "Rivet/Projections/ChargedFinalState.hh"
 #include "Rivet/Projections/Beam.hh"
-#include "Rivet/AnalysisLoader.hh"
 
 namespace Rivet {
 
+  class UA5_1986_S1583476 : public Analysis {
+  public:
 
-  UA5_1986_S1583476::UA5_1986_S1583476() : Analysis("UA5_1986_S1583476") {
-    /// @todo Set approriate for your analysis
-    setBeams(PROTON, ANTIPROTON);
-    addProjection(Beam(), "Beams");
+    /// Constructor
+    UA5_1986_S1583476() 
+      : Analysis("UA5_1986_S1583476") 
+    {
+      setBeams(PROTON, ANTIPROTON);
+      addProjection(Beam(), "Beams");
+      
+      // All charged final state particles, needed for triggers
+      const ChargedFinalState cfs;
+      addProjection(cfs, "CFSAll");
+      // Charged particles in |eta| < 5.0 
+      const ChargedFinalState cfs50(-5.0, 5.0);
+      addProjection(cfs50, "CFS50");
+    }
     
-    // All charged final state particles, needed for triggers
-    const ChargedFinalState cfs;
-    addProjection(cfs,   "CFSAll");
-    // charged particles in |eta| < 5.0 
-    const ChargedFinalState cfs50(-5.0, 5.0);
-    addProjection(cfs50,   "CFS50");
-  }
 
 
-  void UA5_1986_S1583476::init() {
+    /// @name Analysis methods
+    //@{
+    
+    void init() {
       _hist_eta_nsd_200      = bookHistogram1D(1,1,1);
       _hist_eta_inelastic_200  = bookHistogram1D(1,1,2);
       _hist_eta_nsd_900      = bookHistogram1D(1,1,3);
       _hist_eta_inelastic_900  = bookHistogram1D(1,1,4);
-                              
+      
       _hist_eta_nsd_n_2_200  = bookHistogram1D(2,1,1);
       _hist_eta_nsd_n_12_200 = bookHistogram1D(2,1,2);
       _hist_eta_nsd_n_22_200 = bookHistogram1D(2,1,3);
       _hist_eta_nsd_n_32_200 = bookHistogram1D(2,1,4);
       _hist_eta_nsd_n_42_200 = bookHistogram1D(2,1,5);
       _hist_eta_nsd_n_52_200 = bookHistogram1D(2,1,6);
-                              
+      
       _hist_eta_nsd_n_2_900  = bookHistogram1D(3,1,1);
       _hist_eta_nsd_n_12_900 = bookHistogram1D(3,1,2);
       _hist_eta_nsd_n_22_900 = bookHistogram1D(3,1,3);
@@ -46,32 +52,28 @@
       _hist_eta_nsd_n_62_900 = bookHistogram1D(3,1,7);
       _hist_eta_nsd_n_72_900 = bookHistogram1D(3,1,8);
       _hist_eta_nsd_n_82_900 = bookHistogram1D(3,1,9);
-  }
-
-
-  void UA5_1986_S1583476::analyze(const Event& event) {
-      Log log = getLog();
-
+    }
+    
+    
+    void analyze(const Event& event) {
       const double sqrtS = applyProjection<Beam>(event, "Beams").sqrtS();
       const double weight = event.weight();
-
-      // Trigger requirements from the hodoscopes (1 arm (elastic) and 2 arms (NSD))
-      int n_trig_1 = 0;
-      int n_trig_2 = 0;
-      bool isNSD = true;
       
+      // Trigger requirements from the hodoscopes (1 arm (elastic) and 2 arms (NSD))
+      int n_trig_1(0), n_trig_2(0);
       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFSAll");
       foreach (const Particle& p, cfs.particles()) {
-           double eta = p.momentum().pseudorapidity();
-           if ( ( -5.6 < eta ) && ( eta < -2.0 ) ) n_trig_1++;
-           else if ( (  2.0 < eta ) && ( eta <  5.6 ) ) n_trig_2++;
+        double eta = p.momentum().pseudorapidity();
+        if (inRange(eta, -5.6, -2.0)) n_trig_1 += 1;
+        else if (inRange(eta, 2.0, 5.6)) n_trig_2 += 1;
       }
-      getLog() << Log::DEBUG << "Trigger 1: " << n_trig_1 << " Trigger 2: " << n_trig_2 << endl;
+      getLog() << Log::DEBUG << "Trigger -: " << n_trig_1 << ", Trigger +: " << n_trig_2 << endl;
       
       // Check if we have a coincidence hit in hodoscopes == NSD
-      if ( ( n_trig_1 == 0 ) && ( n_trig_2 == 0 ) ) vetoEvent
+      if (n_trig_1 == 0 && n_trig_2 == 0) vetoEvent
       // Require at least one hit in trigger hodoscopes
-      else if ( ( n_trig_1*n_trig_2 < 1.) ) isNSD=false;
+      bool isNSD = true;
+      if (n_trig_1 == 0 || n_trig_2 == 0) isNSD = false;
       
       // Declare final state for |eta| < 5.0
       const ChargedFinalState& cfs50 = applyProjection<ChargedFinalState>(event, "CFS50");
@@ -80,80 +82,107 @@
 
       // Iterate over particles in |eta| < 5.0 and fill histos with |eta| 
       foreach (const Particle& p, cfs.particles()) {
-          double eta = fabs(p.momentum().pseudorapidity());
-
-          // Fill 200 GeV histos
-          if (fuzzyEquals(sqrtS, 200.0, 1E-4)) {
-              // Fill histos that don't require a certain multiplicity
-              _hist_eta_inelastic_200->fill(eta, weight);
-              if ( isNSD ) {
-                  // Fill histos that require a certain multiplicity
-                  _hist_eta_nsd_200->fill(eta, weight);
-                  if ( ( 2 <= numP ) && ( numP <= 10 ) ) _hist_eta_nsd_n_2_200->fill(eta, weight);
-                  else if ( ( 12 <= numP ) && ( numP <= 20 ) ) _hist_eta_nsd_n_12_200->fill(eta, weight);
-                  else if ( ( 22 <= numP ) && ( numP <= 30 ) ) _hist_eta_nsd_n_22_200->fill(eta, weight);
-                  else if ( ( 32 <= numP ) && ( numP <= 40 ) ) _hist_eta_nsd_n_32_200->fill(eta, weight);
-                  else if ( ( 42 <= numP ) && ( numP <= 50 ) ) _hist_eta_nsd_n_42_200->fill(eta, weight);
-                  else if ( numP >= 52 ) _hist_eta_nsd_n_52_200->fill(eta, weight);
-                  }
+        double eta = fabs(p.momentum().pseudorapidity());
+        
+        // Fill 200 GeV histos
+        if (fuzzyEquals(sqrtS, 200.0, 1E-4)) {
+          // Fill histos that don't require a certain multiplicity
+          _hist_eta_inelastic_200->fill(eta, weight);
+          if ( isNSD ) {
+            // Fill histos that require a certain multiplicity
+            _hist_eta_nsd_200->fill(eta, weight);
+            if ( ( 2 <= numP ) && ( numP <= 10 ) ) _hist_eta_nsd_n_2_200->fill(eta, weight);
+            else if ( ( 12 <= numP ) && ( numP <= 20 ) ) _hist_eta_nsd_n_12_200->fill(eta, weight);
+            else if ( ( 22 <= numP ) && ( numP <= 30 ) ) _hist_eta_nsd_n_22_200->fill(eta, weight);
+            else if ( ( 32 <= numP ) && ( numP <= 40 ) ) _hist_eta_nsd_n_32_200->fill(eta, weight);
+            else if ( ( 42 <= numP ) && ( numP <= 50 ) ) _hist_eta_nsd_n_42_200->fill(eta, weight);
+            else if ( numP >= 52 ) _hist_eta_nsd_n_52_200->fill(eta, weight);
           }
-
-          // Fill 900 GeV histos
-          else if (fuzzyEquals(sqrtS, 900.0, 1E-4)) {
-              // Fill histos that don't require a certain multiplicity
-              _hist_eta_inelastic_900->fill(eta, weight);
-              if ( isNSD ) {
-                  // Fill histos that require a certain multiplicity
-                  _hist_eta_nsd_900->fill(eta, weight);
-                  if ( ( 2 <= numP ) && ( numP <= 10 ) ) _hist_eta_nsd_n_2_900->fill(eta, weight);
-                  else if ( ( 12 <= numP ) && ( numP <= 20 ) ) _hist_eta_nsd_n_12_900->fill(eta, weight);
-                  else if ( ( 22 <= numP ) && ( numP <= 30 ) ) _hist_eta_nsd_n_22_900->fill(eta, weight);
-                  else if ( ( 32 <= numP ) && ( numP <= 40 ) ) _hist_eta_nsd_n_32_900->fill(eta, weight);
-                  else if ( ( 42 <= numP ) && ( numP <= 50 ) ) _hist_eta_nsd_n_42_900->fill(eta, weight);
-                  else if ( ( 52 <= numP ) && ( numP <= 60 ) ) _hist_eta_nsd_n_52_900->fill(eta, weight);
-                  else if ( ( 62 <= numP ) && ( numP <= 70 ) ) _hist_eta_nsd_n_62_900->fill(eta, weight);
-                  else if ( ( 72 <= numP ) && ( numP <= 80 ) ) _hist_eta_nsd_n_72_900->fill(eta, weight);
-                  else if ( numP >= 82 ) _hist_eta_nsd_n_82_900->fill(eta, weight);
-                  }
+        }
+        
+        // Fill 900 GeV histos
+        else if (fuzzyEquals(sqrtS, 900.0, 1E-4)) {
+          // Fill histos that don't require a certain multiplicity
+          _hist_eta_inelastic_900->fill(eta, weight);
+          if ( isNSD ) {
+            // Fill histos that require a certain multiplicity
+            _hist_eta_nsd_900->fill(eta, weight);
+            if ( ( 2 <= numP ) && ( numP <= 10 ) ) _hist_eta_nsd_n_2_900->fill(eta, weight);
+            else if ( ( 12 <= numP ) && ( numP <= 20 ) ) _hist_eta_nsd_n_12_900->fill(eta, weight);
+            else if ( ( 22 <= numP ) && ( numP <= 30 ) ) _hist_eta_nsd_n_22_900->fill(eta, weight);
+            else if ( ( 32 <= numP ) && ( numP <= 40 ) ) _hist_eta_nsd_n_32_900->fill(eta, weight);
+            else if ( ( 42 <= numP ) && ( numP <= 50 ) ) _hist_eta_nsd_n_42_900->fill(eta, weight);
+            else if ( ( 52 <= numP ) && ( numP <= 60 ) ) _hist_eta_nsd_n_52_900->fill(eta, weight);
+            else if ( ( 62 <= numP ) && ( numP <= 70 ) ) _hist_eta_nsd_n_62_900->fill(eta, weight);
+            else if ( ( 72 <= numP ) && ( numP <= 80 ) ) _hist_eta_nsd_n_72_900->fill(eta, weight);
+            else if ( numP >= 82 ) _hist_eta_nsd_n_82_900->fill(eta, weight);
           }
-
-      }
-
-
-
-
+        } 
+      }        
   }
-
-
-  void UA5_1986_S1583476::finalize() {
-
+  
+  
+    void finalize() {
       // Scale histos to the area of the corresponding reference histos
-      normalize(_hist_eta_nsd_200      , 10.2225);    
-      normalize(_hist_eta_inelastic_200, 9.255  );
-      normalize(_hist_eta_nsd_900      , 15.285 );
+      normalize(_hist_eta_nsd_200, 10.2225);    
+      normalize(_hist_eta_inelastic_200, 9.255);
+      normalize(_hist_eta_nsd_900, 15.285);
       normalize(_hist_eta_inelastic_900, 13.9725);
+      
+      normalize(_hist_eta_nsd_n_2_200, 3.285);
+      normalize(_hist_eta_nsd_n_12_200, 7.34);
+      normalize(_hist_eta_nsd_n_22_200, 12.02);
+      normalize(_hist_eta_nsd_n_32_200, 17.2);
+      normalize(_hist_eta_nsd_n_42_200, 21.99);
+      normalize(_hist_eta_nsd_n_52_200, 27.8);
+      
+      normalize(_hist_eta_nsd_n_2_900, 2.7);
+      normalize(_hist_eta_nsd_n_12_900, 6.425);
+      normalize(_hist_eta_nsd_n_22_900, 10.54);
+      normalize(_hist_eta_nsd_n_32_900, 15.225);
+      normalize(_hist_eta_nsd_n_42_900, 19.885);
+      normalize(_hist_eta_nsd_n_52_900, 25.13);
+      normalize(_hist_eta_nsd_n_62_900, 29.235);
+      normalize(_hist_eta_nsd_n_72_900, 33.81);
+      normalize(_hist_eta_nsd_n_82_900, 41.75);      
+    }
+    
 
-      normalize(_hist_eta_nsd_n_2_200  , 3.285);
-      normalize(_hist_eta_nsd_n_12_200 , 7.34 );
-      normalize(_hist_eta_nsd_n_22_200 , 12.02);
-      normalize(_hist_eta_nsd_n_32_200 , 17.2 );
-      normalize(_hist_eta_nsd_n_42_200 , 21.99);
-      normalize(_hist_eta_nsd_n_52_200 , 27.8 );
-
-      normalize(_hist_eta_nsd_n_2_900  , 2.7   );
-      normalize(_hist_eta_nsd_n_12_900 , 6.425 );
-      normalize(_hist_eta_nsd_n_22_900 , 10.54 );
-      normalize(_hist_eta_nsd_n_32_900 , 15.225);
-      normalize(_hist_eta_nsd_n_42_900 , 19.885);
-      normalize(_hist_eta_nsd_n_52_900 , 25.13 );
-      normalize(_hist_eta_nsd_n_62_900 , 29.235);
-      normalize(_hist_eta_nsd_n_72_900 , 33.81 );
-      normalize(_hist_eta_nsd_n_82_900 , 41.75 );
+  private:
 
-  }
+    /// @name Histograms
+    //@{
+    // Histos of Figure 1 (HepData Table 1)
+    AIDA::IHistogram1D *_hist_eta_nsd_200;
+    AIDA::IHistogram1D *_hist_eta_inelastic_200;
+    AIDA::IHistogram1D *_hist_eta_nsd_900;
+    AIDA::IHistogram1D *_hist_eta_inelastic_900;
+
+    // Histos of Figure 3a (HepData Table 2)
+    AIDA::IHistogram1D *_hist_eta_nsd_n_2_200;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_12_200;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_22_200;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_32_200;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_42_200;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_52_200;
+
+    // Histos of Figure 3b (HepData Table 3)
+    AIDA::IHistogram1D *_hist_eta_nsd_n_2_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_12_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_22_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_32_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_42_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_52_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_62_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_72_900;
+    AIDA::IHistogram1D *_hist_eta_nsd_n_82_900;
+    //@}
 
+  };
+ 
 
+  
   // This global object acts as a hook for the plugin system
   AnalysisBuilder<UA5_1986_S1583476> plugin_UA5_1986_S1583476;
-
+  
 }

Modified: trunk/src/Analyses/UA5_1988_S1867512.cc
==============================================================================
--- trunk/src/Analyses/UA5_1988_S1867512.cc	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/src/Analyses/UA5_1988_S1867512.cc	Mon Aug 31 11:18:12 2009	(r1786)
@@ -1,212 +1,204 @@
 // -*- C++ -*-
-#include "Rivet/Rivet.hh"
+#include "Rivet/Analysis.hh"
 #include "Rivet/RivetAIDA.hh"
 #include "Rivet/Tools/Logging.hh"
-#include "Rivet/Analyses/UA5_1988_S1867512.hh"
 #include "Rivet/Projections/ChargedFinalState.hh"
 #include "Rivet/Projections/Beam.hh"
-#include "Rivet/AnalysisLoader.hh"
 
 namespace Rivet {
 
+  /// @todo Move these into the MathUtils header.
 
-  UA5_1988_S1867512::UA5_1988_S1867512()
-      : Analysis("UA5_1988_S1867512")
-  {
-    /// @todo Set approriate for your analysis
-    setBeams(PROTON, ANTIPROTON);
-    addProjection(Beam(), "Beams");
-   
-    // All charged final state particles, needed for trigger implementation only
-    const ChargedFinalState cfs;
-    addProjection(cfs,   "CFSAll");
-    
-    // Symmetric intervals first
-    // Maybe its possible to define symmetric eta intervals with gaps
-    // Forward eta intervals
-    const ChargedFinalState cfs10f(0.0, 1.0);
-    const ChargedFinalState cfs15f(0.5, 1.5);
-    const ChargedFinalState cfs20f(1.0, 2.0);
-    const ChargedFinalState cfs25f(1.5, 2.5);
-    const ChargedFinalState cfs30f(2.0, 3.0);
-    const ChargedFinalState cfs35f(2.5, 3.5);
-    const ChargedFinalState cfs40f(3.0, 4.0);
-      
-    // Backward eta intervals
-    const ChargedFinalState cfs10b(-1.0,  0.0);
-    const ChargedFinalState cfs15b(-1.5, -0.5);
-    const ChargedFinalState cfs20b(-2.0, -1.0);
-    const ChargedFinalState cfs25b(-2.5, -1.5);
-    const ChargedFinalState cfs30b(-3.0, -2.0);
-    const ChargedFinalState cfs35b(-3.5, -2.5);
-    const ChargedFinalState cfs40b(-4.0, -3.0);
-
-    // Symmetric eta interval
-    const ChargedFinalState cfs05(-0.5,  0.5);
-
-    addProjection(cfs10f, "CFS10F");
-    addProjection(cfs15f, "CFS15F");
-    addProjection(cfs20f, "CFS20F");
-    addProjection(cfs25f, "CFS25F");
-    addProjection(cfs30f, "CFS30F");
-    addProjection(cfs35f, "CFS35F");
-    addProjection(cfs40f, "CFS40F");
-
-    addProjection(cfs10b, "CFS10B");
-    addProjection(cfs15b, "CFS15B");
-    addProjection(cfs20b, "CFS20B");
-    addProjection(cfs25b, "CFS25B");
-    addProjection(cfs30b, "CFS30B");
-    addProjection(cfs35b, "CFS35B");
-    addProjection(cfs40b, "CFS40B");
-
-    addProjection(cfs05, "CFS05");
+  // A simple function to calculate the mean of a sample
+  double mean(const vector<int>& sample) {
+    double mean = 0.0;
+    foreach (const int& i, sample) {
+      mean += i;
+    }
+    return mean/sample.size();
+  }
+  
+  
+  // Calculate the covariance (variance) between two samples  
+  double covariance(const vector<int>& sample1, const vector<int>& sample2) {
+    double mean1 = mean(sample1);
+    double mean2 = mean(sample2);
+    int N = sample1.size();
+    double cov = 0.0;
+    for (int i = 0; i < N; i++) {
+      double cov_i = (sample1[i] - mean1)*(sample2[i] - mean2);
+      cov += cov_i;
+    }
+    if (N > 1) return cov/(N-1);
+    else return 0.0;
+  }
+  
+  
+  // Calculate the correlation strength between two samples
+  double correlation(const vector<int>& sample1, const vector<int>& sample2) {
+    const double cov = covariance(sample1, sample2);
+    const double var1 = covariance(sample1, sample1);
+    const double var2 = covariance(sample2, sample2);
+    const double correlation = cov/sqrt(var1*var2);
+    const double corr_strength = correlation*sqrt(var2/var1);
+    return corr_strength;
   }
 
+}
 
-  void UA5_1988_S1867512::init() {
-    // Histogram booking, we have sqrt(s) = 200, 546 and 900 GeV
-    _hist_correl_10_200 = bookHistogram1D(1, 1, 1);
-    _hist_correl_10_546 = bookHistogram1D(1, 1, 2);
-    _hist_correl_10_900 = bookHistogram1D(1, 1, 3);
-
-    _hist_correl_15_200 = bookHistogram1D(2, 1, 1);
-    _hist_correl_15_546 = bookHistogram1D(2, 1, 2);
-    _hist_correl_15_900 = bookHistogram1D(2, 1, 3);
-
-    _hist_correl_20_200 = bookHistogram1D(3, 1, 1);
-    _hist_correl_20_546 = bookHistogram1D(3, 1, 2);
-    _hist_correl_20_900 = bookHistogram1D(3, 1, 3);
-    
-    _hist_correl_25_200 = bookHistogram1D(4, 1, 1);
-    _hist_correl_25_546 = bookHistogram1D(4, 1, 2);
-    _hist_correl_25_900 = bookHistogram1D(4, 1, 3);
-
-    _hist_correl_30_200 = bookHistogram1D(5, 1, 1);
-    _hist_correl_30_546 = bookHistogram1D(5, 1, 2);
-    _hist_correl_30_900 = bookHistogram1D(5, 1, 3);
-    
-    _hist_correl_35_200 = bookHistogram1D(6, 1, 1);
-    _hist_correl_35_546 = bookHistogram1D(6, 1, 2);
-    _hist_correl_35_900 = bookHistogram1D(6, 1, 3);
-    
-    _hist_correl_40_200 = bookHistogram1D(7, 1, 1);
-    _hist_correl_40_546 = bookHistogram1D(7, 1, 2);
-    _hist_correl_40_900 = bookHistogram1D(7, 1, 3);
-
-    _hist_correl_asym_15_200 = bookHistogram1D(8, 1, 1);
-    _hist_correl_asym_15_546 = bookHistogram1D(8, 1, 2);
-    _hist_correl_asym_15_900 = bookHistogram1D(8, 1, 3);
-                  
-    _hist_correl_asym_20_200 = bookHistogram1D(9, 1, 1);
-    _hist_correl_asym_20_546 = bookHistogram1D(9, 1, 2);
-    _hist_correl_asym_20_900 = bookHistogram1D(9, 1, 3);
-                  
-    _hist_correl_asym_25_200 = bookHistogram1D(10, 1, 1);
-    _hist_correl_asym_25_546 = bookHistogram1D(10, 1, 2);
-    _hist_correl_asym_25_900 = bookHistogram1D(10, 1, 3);
-                  
-    _hist_correl_asym_30_200 = bookHistogram1D(11, 1, 1);
-    _hist_correl_asym_30_546 = bookHistogram1D(11, 1, 2);
-    _hist_correl_asym_30_900 = bookHistogram1D(11, 1, 3);
-  }
 
-  double UA5_1988_S1867512::calc_mean(std::vector<int> sample) {
-      // A simple function to calculate the mean of a sample
-      double mean = 0.0;
-      foreach (const int& i, sample) {
-          mean += i;
-      }
-      return mean/sample.size();
-  }
+namespace Rivet {
   
-  double UA5_1988_S1867512::calc_covariance(std::vector<int> sample1, std::vector<int> sample2) {
-      // A function to calculate the covariance (variance) of one quality (n_particles)
-      // between two samples
-      double mean1 = UA5_1988_S1867512::calc_mean(sample1);
-      double mean2 = UA5_1988_S1867512::calc_mean(sample2);
-      int N = sample1.size();
-      double cov = 0.0;
-      for (int i = 0; i < N; i++) {
-          double cov_i = (sample1[i] - mean1)*(sample2[i] - mean2);
-            cov += cov_i;
-            }
-      if ( N > 1 ) return cov/(N-1);
-      else return 0.0;
-  }
 
-  double UA5_1988_S1867512::calc_correlation(std::vector<int> sample1, std::vector<int> sample2) {
-      // A function to calculate the correlation strength of one quality
-      // (n_particles) between two samples
-      double cov = UA5_1988_S1867512::calc_covariance(sample1, sample2);
-      double var1 = UA5_1988_S1867512::calc_covariance(sample1, sample1);
-      double var2 = UA5_1988_S1867512::calc_covariance(sample2, sample2);
-      double correlation = cov/sqrt(var1*var2);
-      double corr_strength = correlation*sqrt(var2/var1);
-      return corr_strength;
-  }
+  class UA5_1988_S1867512 : public Analysis {
+  public:
 
+    UA5_1988_S1867512()
+      : Analysis("UA5_1988_S1867512")
+    {
+      /// @todo Set approriate for your analysis
+      setBeams(PROTON, ANTIPROTON);
+      addProjection(Beam(), "Beams");
+      
+      // All charged final state particles, needed for trigger implementation only
+      const ChargedFinalState cfs;
+      addProjection(cfs,   "CFSAll");
+      
+      // Symmetric intervals first
+      // Maybe its possible to define symmetric eta intervals with gaps
+      // Forward eta intervals
+      const ChargedFinalState cfs10f(0.0, 1.0);
+      const ChargedFinalState cfs15f(0.5, 1.5);
+      const ChargedFinalState cfs20f(1.0, 2.0);
+      const ChargedFinalState cfs25f(1.5, 2.5);
+      const ChargedFinalState cfs30f(2.0, 3.0);
+      const ChargedFinalState cfs35f(2.5, 3.5);
+      const ChargedFinalState cfs40f(3.0, 4.0);
+      
+      // Backward eta intervals
+      const ChargedFinalState cfs10b(-1.0,  0.0);
+      const ChargedFinalState cfs15b(-1.5, -0.5);
+      const ChargedFinalState cfs20b(-2.0, -1.0);
+      const ChargedFinalState cfs25b(-2.5, -1.5);
+      const ChargedFinalState cfs30b(-3.0, -2.0);
+      const ChargedFinalState cfs35b(-3.5, -2.5);
+      const ChargedFinalState cfs40b(-4.0, -3.0);
+      
+      // Symmetric eta interval
+      const ChargedFinalState cfs05(-0.5,  0.5);
+      
+      addProjection(cfs10f, "CFS10F");
+      addProjection(cfs15f, "CFS15F");
+      addProjection(cfs20f, "CFS20F");
+      addProjection(cfs25f, "CFS25F");
+      addProjection(cfs30f, "CFS30F");
+      addProjection(cfs35f, "CFS35F");
+      addProjection(cfs40f, "CFS40F");
+      
+      addProjection(cfs10b, "CFS10B");
+      addProjection(cfs15b, "CFS15B");
+      addProjection(cfs20b, "CFS20B");
+      addProjection(cfs25b, "CFS25B");
+      addProjection(cfs30b, "CFS30B");
+      addProjection(cfs35b, "CFS35B");
+      addProjection(cfs40b, "CFS40B");
+      
+      addProjection(cfs05, "CFS05");
+    }
+    
+    
+    /// @name Analysis methods
+    //@{
 
-  void UA5_1988_S1867512::analyze(const Event& event) {
-      Log log = getLog();
+    void init() {
+      // Histogram booking, we have sqrt(s) = 200, 546 and 900 GeV
+      _hist_correl_10_200 = bookHistogram1D(1, 1, 1);
+      _hist_correl_10_546 = bookHistogram1D(1, 1, 2);
+      _hist_correl_10_900 = bookHistogram1D(1, 1, 3);
+      
+      _hist_correl_15_200 = bookHistogram1D(2, 1, 1);
+      _hist_correl_15_546 = bookHistogram1D(2, 1, 2);
+      _hist_correl_15_900 = bookHistogram1D(2, 1, 3);
+      
+      _hist_correl_20_200 = bookHistogram1D(3, 1, 1);
+      _hist_correl_20_546 = bookHistogram1D(3, 1, 2);
+      _hist_correl_20_900 = bookHistogram1D(3, 1, 3);
+      
+      _hist_correl_25_200 = bookHistogram1D(4, 1, 1);
+      _hist_correl_25_546 = bookHistogram1D(4, 1, 2);
+      _hist_correl_25_900 = bookHistogram1D(4, 1, 3);
+      
+      _hist_correl_30_200 = bookHistogram1D(5, 1, 1);
+      _hist_correl_30_546 = bookHistogram1D(5, 1, 2);
+      _hist_correl_30_900 = bookHistogram1D(5, 1, 3);
+      
+      _hist_correl_35_200 = bookHistogram1D(6, 1, 1);
+      _hist_correl_35_546 = bookHistogram1D(6, 1, 2);
+      _hist_correl_35_900 = bookHistogram1D(6, 1, 3);
+      
+      _hist_correl_40_200 = bookHistogram1D(7, 1, 1);
+      _hist_correl_40_546 = bookHistogram1D(7, 1, 2);
+      _hist_correl_40_900 = bookHistogram1D(7, 1, 3);
+      
+      _hist_correl_asym_15_200 = bookHistogram1D(8, 1, 1);
+      _hist_correl_asym_15_546 = bookHistogram1D(8, 1, 2);
+      _hist_correl_asym_15_900 = bookHistogram1D(8, 1, 3);
+      
+      _hist_correl_asym_20_200 = bookHistogram1D(9, 1, 1);
+      _hist_correl_asym_20_546 = bookHistogram1D(9, 1, 2);
+      _hist_correl_asym_20_900 = bookHistogram1D(9, 1, 3);
+      
+      _hist_correl_asym_25_200 = bookHistogram1D(10, 1, 1);
+      _hist_correl_asym_25_546 = bookHistogram1D(10, 1, 2);
+      _hist_correl_asym_25_900 = bookHistogram1D(10, 1, 3);
+      
+      _hist_correl_asym_30_200 = bookHistogram1D(11, 1, 1);
+      _hist_correl_asym_30_546 = bookHistogram1D(11, 1, 2);
+      _hist_correl_asym_30_900 = bookHistogram1D(11, 1, 3);
+    }
+    
+    
 
+    void analyze(const Event& event) {
       const double sqrtS = applyProjection<Beam>(event, "Beams").sqrtS();
       const double weight = event.weight();
-
+      
       // Minimum Bias trigger requirements from the hodoscopes
       int n_trig_1 = 0;
       int n_trig_2 = 0;
       
       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFSAll");
       foreach (const Particle& p, cfs.particles()) {
-           double eta = p.momentum().pseudorapidity();
-           if ( ( -5.6 < eta ) && ( eta < -2.0 ) ) n_trig_1++;
-           else if ( ( 2.0 < eta ) && ( eta < 5.6 ) ) n_trig_2++;
+        double eta = p.momentum().pseudorapidity();
+        if (inRange(eta, -5.6, -2.0)) n_trig_1++;
+        else if (inRange(eta, 2.0, 5.6)) n_trig_2++;
       }
       
       // Require at least one coincidence hit in trigger hodoscopes
-      if ( n_trig_1* n_trig_2 < 1. ) vetoEvent; 
+      if (n_trig_1 == 0 || n_trig_2 == 0) vetoEvent;
       getLog() << Log::DEBUG << "Trigger 1: " << n_trig_1 << " Trigger 2: " << n_trig_2 << endl;
       
-      // Declare final states in several eta regions
-      const ChargedFinalState& cfs10f = applyProjection<ChargedFinalState>(event, "CFS10F");
-      const ChargedFinalState& cfs15f = applyProjection<ChargedFinalState>(event, "CFS15F");
-      const ChargedFinalState& cfs20f = applyProjection<ChargedFinalState>(event, "CFS20F");
-      const ChargedFinalState& cfs25f = applyProjection<ChargedFinalState>(event, "CFS25F");
-      const ChargedFinalState& cfs30f = applyProjection<ChargedFinalState>(event, "CFS30F");
-      const ChargedFinalState& cfs35f = applyProjection<ChargedFinalState>(event, "CFS35F");
-      const ChargedFinalState& cfs40f = applyProjection<ChargedFinalState>(event, "CFS40F");
-      
-      const ChargedFinalState& cfs10b = applyProjection<ChargedFinalState>(event, "CFS10B");
-      const ChargedFinalState& cfs15b = applyProjection<ChargedFinalState>(event, "CFS15B");
-      const ChargedFinalState& cfs20b = applyProjection<ChargedFinalState>(event, "CFS20B");
-      const ChargedFinalState& cfs25b = applyProjection<ChargedFinalState>(event, "CFS25B");
-      const ChargedFinalState& cfs30b = applyProjection<ChargedFinalState>(event, "CFS30B");
-      const ChargedFinalState& cfs35b = applyProjection<ChargedFinalState>(event, "CFS35B");
-      const ChargedFinalState& cfs40b = applyProjection<ChargedFinalState>(event, "CFS40B");
-
-      const ChargedFinalState& cfs05 = applyProjection<ChargedFinalState>(event, "CFS05");
-      // Push back the number of particles in the different regions
-      n_10f.push_back(cfs10f.particles().size());
-      n_15f.push_back(cfs15f.particles().size());
-      n_20f.push_back(cfs20f.particles().size());
-      n_25f.push_back(cfs25f.particles().size());
-      n_30f.push_back(cfs30f.particles().size());
-      n_35f.push_back(cfs35f.particles().size());
-      n_40f.push_back(cfs40f.particles().size());
-                            
-      n_10b.push_back(cfs10b.particles().size());
-      n_15b.push_back(cfs15b.particles().size());
-      n_20b.push_back(cfs20b.particles().size());
-      n_25b.push_back(cfs25b.particles().size());
-      n_30b.push_back(cfs30b.particles().size());
-      n_35b.push_back(cfs35b.particles().size());
-      n_40b.push_back(cfs40b.particles().size());
-
-      n_05.push_back(cfs05.particles().size());
-
-    // Dummy fill
-    if (fuzzyEquals(sqrtS, 200.0, 1E-4)) {
+      // Count forward/backward rates
+      n_10f += applyProjection<ChargedFinalState>(event, "CFS10F").size();
+      n_15f += applyProjection<ChargedFinalState>(event, "CFS15F").size();
+      n_20f += applyProjection<ChargedFinalState>(event, "CFS20F").size();
+      n_25f += applyProjection<ChargedFinalState>(event, "CFS25F").size();
+      n_30f += applyProjection<ChargedFinalState>(event, "CFS30F").size();
+      n_35f += applyProjection<ChargedFinalState>(event, "CFS35F").size();
+      n_40f += applyProjection<ChargedFinalState>(event, "CFS40F").size();
+      //
+      n_10b += applyProjection<ChargedFinalState>(event, "CFS10B").size();
+      n_15b += applyProjection<ChargedFinalState>(event, "CFS15B").size();
+      n_20b += applyProjection<ChargedFinalState>(event, "CFS20B").size();
+      n_25b += applyProjection<ChargedFinalState>(event, "CFS25B").size();
+      n_30b += applyProjection<ChargedFinalState>(event, "CFS30B").size();
+      n_35b += applyProjection<ChargedFinalState>(event, "CFS35B").size();
+      n_40b += applyProjection<ChargedFinalState>(event, "CFS40B").size();
+      //
+      n_05 += applyProjection<ChargedFinalState>(event, "CFS05").size();
+      
+      // Dummy fill
+      if (fuzzyEquals(sqrtS, 200.0, 1E-4)) {
         _hist_correl_10_200->fill(_hist_correl_10_200->binMean(0), weight);
         _hist_correl_15_200->fill(_hist_correl_15_200->binMean(0), weight);
         _hist_correl_20_200->fill(_hist_correl_20_200->binMean(0), weight);
@@ -218,9 +210,9 @@
         _hist_correl_asym_20_200->fill(_hist_correl_asym_20_200->binMean(0), weight);
         _hist_correl_asym_25_200->fill(_hist_correl_asym_25_200->binMean(0), weight);
         _hist_correl_asym_30_200->fill(_hist_correl_asym_30_200->binMean(0), weight);
-        }
-
-    else if (fuzzyEquals(sqrtS, 546.0, 1E-4)) {
+      }
+      
+      else if (fuzzyEquals(sqrtS, 546.0, 1E-4)) {
         _hist_correl_10_546->fill(_hist_correl_10_546->binMean(0), weight);
         _hist_correl_15_546->fill(_hist_correl_15_546->binMean(0), weight);
         _hist_correl_20_546->fill(_hist_correl_20_546->binMean(0), weight);
@@ -232,9 +224,9 @@
         _hist_correl_asym_20_546->fill(_hist_correl_asym_20_546->binMean(0), weight);
         _hist_correl_asym_25_546->fill(_hist_correl_asym_25_546->binMean(0), weight);
         _hist_correl_asym_30_546->fill(_hist_correl_asym_30_546->binMean(0), weight);
-        }
-
-    else if (fuzzyEquals(sqrtS, 900.0, 1E-4)) {
+      }
+      
+      else if (fuzzyEquals(sqrtS, 900.0, 1E-4)) {
         _hist_correl_10_900->fill(_hist_correl_10_900->binMean(0), weight);
         _hist_correl_15_900->fill(_hist_correl_15_900->binMean(0), weight);
         _hist_correl_20_900->fill(_hist_correl_20_900->binMean(0), weight);
@@ -246,79 +238,161 @@
         _hist_correl_asym_20_900->fill(_hist_correl_asym_20_900->binMean(0), weight);
         _hist_correl_asym_25_900->fill(_hist_correl_asym_25_900->binMean(0), weight);
         _hist_correl_asym_30_900->fill(_hist_correl_asym_30_900->binMean(0), weight);
-        }
-  }
-
-
-  void UA5_1988_S1867512::finalize() {
+      }
+    }
+    
+    
+    void finalize() {
       // Get the correlation coefficients
       //
       // Symmetric eta intervals first
-      double correlation_cfs10 = UA5_1988_S1867512::calc_correlation(n_10f, n_10b);
-      double correlation_cfs15 = UA5_1988_S1867512::calc_correlation(n_15f, n_15b);
-      double correlation_cfs20 = UA5_1988_S1867512::calc_correlation(n_20f, n_20b);
-      double correlation_cfs25 = UA5_1988_S1867512::calc_correlation(n_25f, n_25b);
-      double correlation_cfs30 = UA5_1988_S1867512::calc_correlation(n_30f, n_30b);
-      double correlation_cfs35 = UA5_1988_S1867512::calc_correlation(n_35f, n_35b);
-      double correlation_cfs40 = UA5_1988_S1867512::calc_correlation(n_40f, n_40b);
+      double correlation_cfs10 = correlation(n_10f, n_10b);
+      double correlation_cfs15 = correlation(n_15f, n_15b);
+      double correlation_cfs20 = correlation(n_20f, n_20b);
+      double correlation_cfs25 = correlation(n_25f, n_25b);
+      double correlation_cfs30 = correlation(n_30f, n_30b);
+      double correlation_cfs35 = correlation(n_35f, n_35b);
+      double correlation_cfs40 = correlation(n_40f, n_40b);
 
       // Assymetric eta intervals
       //  1.5 ... 2.5 & -1.5 ... -0.5
-      double correlation_as_cfs15 = UA5_1988_S1867512::calc_correlation(n_25f, n_15b);
+      double correlation_as_cfs15 = correlation(n_25f, n_15b);
       //  2.0 ... 3.0 & -1.0 ...  0.0
-      double correlation_as_cfs20 = UA5_1988_S1867512::calc_correlation(n_30f, n_10b);
+      double correlation_as_cfs20 = correlation(n_30f, n_10b);
       //  2.5 ... 3.5 & -0.5 ...  0.5
-      double correlation_as_cfs25 = UA5_1988_S1867512::calc_correlation(n_35f, n_05);
+      double correlation_as_cfs25 = correlation(n_35f, n_05);
       //  3.0 ... 4.0 &  0.0 ...  1.0
-      double correlation_as_cfs30 = UA5_1988_S1867512::calc_correlation(n_40f, n_10f);
+      double correlation_as_cfs30 = correlation(n_40f, n_10f);
+
+      normalize(_hist_correl_10_200, correlation_cfs10);
+      normalize(_hist_correl_10_546, correlation_cfs10);
+      normalize(_hist_correl_10_900, correlation_cfs10);
+      
+      normalize(_hist_correl_15_200, correlation_cfs15);
+      normalize(_hist_correl_15_546, correlation_cfs15);
+      normalize(_hist_correl_15_900, correlation_cfs15);
+      
+      normalize(_hist_correl_20_200, correlation_cfs20);
+      normalize(_hist_correl_20_546, correlation_cfs20);
+      normalize(_hist_correl_20_900, correlation_cfs20);
+      
+      normalize(_hist_correl_25_200, correlation_cfs25);
+      normalize(_hist_correl_25_546, correlation_cfs25);
+      normalize(_hist_correl_25_900, correlation_cfs25);
+      
+      normalize(_hist_correl_30_200, correlation_cfs30);
+      normalize(_hist_correl_30_546, correlation_cfs30);
+      normalize(_hist_correl_30_900, correlation_cfs30);
+      
+      normalize(_hist_correl_35_200, correlation_cfs35);
+      normalize(_hist_correl_35_546, correlation_cfs35);
+      normalize(_hist_correl_35_900, correlation_cfs35);
+      
+      normalize(_hist_correl_40_200, correlation_cfs40);
+      normalize(_hist_correl_40_546, correlation_cfs40);
+      normalize(_hist_correl_40_900, correlation_cfs40);
+      
+      normalize(_hist_correl_asym_15_200, correlation_as_cfs15);
+      normalize(_hist_correl_asym_15_546, correlation_as_cfs15);
+      normalize(_hist_correl_asym_15_900, correlation_as_cfs15);
+      
+      normalize(_hist_correl_asym_20_200, correlation_as_cfs20);
+      normalize(_hist_correl_asym_20_546, correlation_as_cfs20);
+      normalize(_hist_correl_asym_20_900, correlation_as_cfs20);
+      
+      normalize(_hist_correl_asym_25_200, correlation_as_cfs25);
+      normalize(_hist_correl_asym_25_546, correlation_as_cfs25);
+      normalize(_hist_correl_asym_25_900, correlation_as_cfs25);
+      
+      normalize(_hist_correl_asym_30_200, correlation_as_cfs30);
+      normalize(_hist_correl_asym_30_546, correlation_as_cfs30);
+      normalize(_hist_correl_asym_30_900, correlation_as_cfs30);      
+    }
+    
+    //@}
+    
+    
+  private:
+    
+    /// @name Vectors for storing the number of particles in the different eta intervals per event.
+    /// @todo Is there a better way?
+    //@{
+    
+    std::vector<int> n_10f;
+    std::vector<int> n_15f;
+    std::vector<int> n_20f;
+    std::vector<int> n_25f;
+    std::vector<int> n_30f;
+    std::vector<int> n_35f;
+    std::vector<int> n_40f;
+                           
+    std::vector<int> n_10b;
+    std::vector<int> n_15b;
+    std::vector<int> n_20b;
+    std::vector<int> n_25b;
+    std::vector<int> n_30b;
+    std::vector<int> n_35b;
+    std::vector<int> n_40b;
+   
+    std::vector<int> n_05;
 
-    normalize(_hist_correl_10_200, correlation_cfs10);
-    normalize(_hist_correl_10_546, correlation_cfs10);
-    normalize(_hist_correl_10_900, correlation_cfs10);
-                       
-    normalize(_hist_correl_15_200, correlation_cfs15);
-    normalize(_hist_correl_15_546, correlation_cfs15);
-    normalize(_hist_correl_15_900, correlation_cfs15);
-                       
-    normalize(_hist_correl_20_200, correlation_cfs20);
-    normalize(_hist_correl_20_546, correlation_cfs20);
-    normalize(_hist_correl_20_900, correlation_cfs20);
-    
-    normalize(_hist_correl_25_200, correlation_cfs25);
-    normalize(_hist_correl_25_546, correlation_cfs25);
-    normalize(_hist_correl_25_900, correlation_cfs25);
-                       
-    normalize(_hist_correl_30_200, correlation_cfs30);
-    normalize(_hist_correl_30_546, correlation_cfs30);
-    normalize(_hist_correl_30_900, correlation_cfs30);
-    
-    normalize(_hist_correl_35_200, correlation_cfs35);
-    normalize(_hist_correl_35_546, correlation_cfs35);
-    normalize(_hist_correl_35_900, correlation_cfs35);
-    
-    normalize(_hist_correl_40_200, correlation_cfs40);
-    normalize(_hist_correl_40_546, correlation_cfs40);
-    normalize(_hist_correl_40_900, correlation_cfs40);
-                            
-    normalize(_hist_correl_asym_15_200, correlation_as_cfs15);
-    normalize(_hist_correl_asym_15_546, correlation_as_cfs15);
-    normalize(_hist_correl_asym_15_900, correlation_as_cfs15);
-                  
-    normalize(_hist_correl_asym_20_200, correlation_as_cfs20);
-    normalize(_hist_correl_asym_20_546, correlation_as_cfs20);
-    normalize(_hist_correl_asym_20_900, correlation_as_cfs20);
-                  
-    normalize(_hist_correl_asym_25_200, correlation_as_cfs25);
-    normalize(_hist_correl_asym_25_546, correlation_as_cfs25);
-    normalize(_hist_correl_asym_25_900, correlation_as_cfs25);
-                  
-    normalize(_hist_correl_asym_30_200, correlation_as_cfs30);
-    normalize(_hist_correl_asym_30_546, correlation_as_cfs30);
-    normalize(_hist_correl_asym_30_900, correlation_as_cfs30);
+    //@}
 
-  }
 
+    /// @name Histograms
+    //@{
 
+    // Symmetric eta intervals
+    AIDA::IHistogram1D *_hist_correl_10_200;
+    AIDA::IHistogram1D *_hist_correl_10_546;
+    AIDA::IHistogram1D *_hist_correl_10_900;
+
+    AIDA::IHistogram1D *_hist_correl_15_200;
+    AIDA::IHistogram1D *_hist_correl_15_546;
+    AIDA::IHistogram1D *_hist_correl_15_900;
+
+    AIDA::IHistogram1D *_hist_correl_20_200;
+    AIDA::IHistogram1D *_hist_correl_20_546;
+    AIDA::IHistogram1D *_hist_correl_20_900;
+    
+    AIDA::IHistogram1D *_hist_correl_25_200;
+    AIDA::IHistogram1D *_hist_correl_25_546;
+    AIDA::IHistogram1D *_hist_correl_25_900;
+    
+    AIDA::IHistogram1D *_hist_correl_30_200;
+    AIDA::IHistogram1D *_hist_correl_30_546;
+    AIDA::IHistogram1D *_hist_correl_30_900;
+
+    AIDA::IHistogram1D *_hist_correl_35_200;
+    AIDA::IHistogram1D *_hist_correl_35_900;
+    AIDA::IHistogram1D *_hist_correl_35_546;
+    
+    AIDA::IHistogram1D *_hist_correl_40_200;
+    AIDA::IHistogram1D *_hist_correl_40_546;
+    AIDA::IHistogram1D *_hist_correl_40_900;
+    
+    // For asymmetric eta intervals
+    AIDA::IHistogram1D *_hist_correl_asym_15_200;
+    AIDA::IHistogram1D *_hist_correl_asym_15_546;
+    AIDA::IHistogram1D *_hist_correl_asym_15_900;
+                                      
+    AIDA::IHistogram1D *_hist_correl_asym_20_200;
+    AIDA::IHistogram1D *_hist_correl_asym_20_546;
+    AIDA::IHistogram1D *_hist_correl_asym_20_900;
+                                      
+    AIDA::IHistogram1D *_hist_correl_asym_25_200;
+    AIDA::IHistogram1D *_hist_correl_asym_25_546;
+    AIDA::IHistogram1D *_hist_correl_asym_25_900;
+                                      
+    AIDA::IHistogram1D *_hist_correl_asym_30_200;
+    AIDA::IHistogram1D *_hist_correl_asym_30_546;
+    AIDA::IHistogram1D *_hist_correl_asym_30_900;
+    //@}
+
+  };
+
+
+  
   // This global object acts as a hook for the plugin system
   AnalysisBuilder<UA5_1988_S1867512> plugin_UA5_1988_S1867512;
 

Modified: trunk/src/Analyses/UA5_1989_S1926373.cc
==============================================================================
--- trunk/src/Analyses/UA5_1989_S1926373.cc	Mon Aug 31 09:50:19 2009	(r1785)
+++ trunk/src/Analyses/UA5_1989_S1926373.cc	Mon Aug 31 11:18:12 2009	(r1786)
@@ -1,124 +1,149 @@
 // -*- C++ -*-
-#include "Rivet/Rivet.hh"
+#include "Rivet/Analysis.hh"
 #include "Rivet/RivetAIDA.hh"
 #include "Rivet/Tools/Logging.hh"
-#include "Rivet/Analyses/UA5_1989_S1926373.hh"
 #include "Rivet/Projections/Beam.hh"
 #include "Rivet/Projections/ChargedFinalState.hh"
 
 namespace Rivet {
 
 
-
-  UA5_1989_S1926373::UA5_1989_S1926373()
-    : Analysis("UA5_1989_S1926373")
-  { 
-    setBeams(PROTON, ANTIPROTON);
-    addProjection(Beam(), "Beams");
-    addProjection(ChargedFinalState(), "CFSAll");
-    addProjection(ChargedFinalState(-0.5, 0.5), "CFS05");
-    addProjection(ChargedFinalState(-1.5, 1.5), "CFS15");
-    addProjection(ChargedFinalState(-3.0, 3.0), "CFS30");
-    addProjection(ChargedFinalState(-5.0, 5.0), "CFS50");
-    n_vetoed = 0;
-  }
+  class UA5_1989_S1926373 : public Analysis {
+  public:
+    
+    /// Constructor
+    UA5_1989_S1926373()
+      : Analysis("UA5_1989_S1926373")
+    { 
+      setBeams(PROTON, ANTIPROTON);
+      addProjection(Beam(), "Beams");
+      addProjection(ChargedFinalState(), "CFSAll");
+      addProjection(ChargedFinalState(-0.5, 0.5), "CFS05");
+      addProjection(ChargedFinalState(-1.5, 1.5), "CFS15");
+      addProjection(ChargedFinalState(-3.0, 3.0), "CFS30");
+      addProjection(ChargedFinalState(-5.0, 5.0), "CFS50");
+      _numVetoed = 0;
+    }
 
 
+    /// @name Analysis methods
+    //@{
 
-  // Book histograms
-  void UA5_1989_S1926373::init() {
+    /// Book histograms
+    void init() {
       // NB. _hist_nch{200,900} and _hist_nch{200,900}eta50 use the same data but different binning
-     _hist_nch200       = bookHistogram1D(1,1,1); 
-     _hist_nch900       = bookHistogram1D(2,1,1);
-     _hist_nch200eta05  = bookHistogram1D(3,1,1);
-     _hist_nch200eta15  = bookHistogram1D(4,1,1);
-     _hist_nch200eta30  = bookHistogram1D(5,1,1);
-     _hist_nch200eta50  = bookHistogram1D(6,1,1);
-     _hist_nch900eta05  = bookHistogram1D(7,1,1);
-     _hist_nch900eta15  = bookHistogram1D(8,1,1);
-     _hist_nch900eta30  = bookHistogram1D(9,1,1);
-     _hist_nch900eta50  = bookHistogram1D(10,1,1);
-     _hist_mean_nch_200 = bookHistogram1D(11,1,1); 
-     _hist_mean_nch_900 = bookHistogram1D(12,1,1);
-  } 
-
-
-
-  // Do the analysis
-  void UA5_1989_S1926373::analyze(const Event& event) {
-    const double sqrtS = applyProjection<Beam>(event, "Beams").sqrtS();
-    const double weight = event.weight();
-    
-    // Minimum Bias trigger requirements from the hodoscopes
-    int n_trig_1(0), n_trig_2(0);
-    /// @todo Use CFS in +,- eta ranges as below, to cache this loop between UA5 analyses
-    const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFSAll");
-    foreach (const Particle& p, cfs.particles()) {
-      const double eta = p.momentum().pseudorapidity();
-      if (inRange(eta, -5.6, -2.0)) n_trig_1 += 1;
-      else if (inRange(eta, 2.0, 5.6)) n_trig_2 += 1;
-    }
+      _hist_nch200       = bookHistogram1D(1,1,1); 
+      _hist_nch900       = bookHistogram1D(2,1,1);
+      _hist_nch200eta05  = bookHistogram1D(3,1,1);
+      _hist_nch200eta15  = bookHistogram1D(4,1,1);
+      _hist_nch200eta30  = bookHistogram1D(5,1,1);
+      _hist_nch200eta50  = bookHistogram1D(6,1,1);
+      _hist_nch900eta05  = bookHistogram1D(7,1,1);
+      _hist_nch900eta15  = bookHistogram1D(8,1,1);
+      _hist_nch900eta30  = bookHistogram1D(9,1,1);
+      _hist_nch900eta50  = bookHistogram1D(10,1,1);
+      _hist_mean_nch_200 = bookHistogram1D(11,1,1); 
+      _hist_mean_nch_900 = bookHistogram1D(12,1,1);
+    } 
+    
     
-    // Require at least one coincidence hit in trigger hodoscopes
-    getLog() << Log::DEBUG << "Trigger -: " << n_trig_1 << ", Trigger +: " << n_trig_2 << endl;
-    //if (!n_trig_1 || !n_trig_2) { //FIXME: This line doesn't work
-    if (n_trig_1 == 0 || n_trig_2 == 0) {
-        n_vetoed +=1;
+    /// Do the analysis
+    void analyze(const Event& event) {
+      const double sqrtS = applyProjection<Beam>(event, "Beams").sqrtS();
+      const double weight = event.weight();
+      
+      // Minimum Bias trigger requirements from the hodoscopes
+      int n_trig_1(0), n_trig_2(0);
+      /// @todo Use CFS in +,- eta ranges as below, to cache this loop between UA5 analyses
+      const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFSAll");
+      foreach (const Particle& p, cfs.particles()) {
+        const double eta = p.momentum().pseudorapidity();
+        if (inRange(eta, -5.6, -2.0)) n_trig_1 += 1;
+        else if (inRange(eta, 2.0, 5.6)) n_trig_2 += 1;
+      }
+      
+      // Require at least one coincidence hit in trigger hodoscopes
+      getLog() << Log::DEBUG << "Trigger -: " << n_trig_1 << ", Trigger +: " << n_trig_2 << endl;
+      if (n_trig_1 == 0 || n_trig_2 == 0) {
+        _numVetoed +=1;
         vetoEvent;
+      }
+      
+      // Count final state particles in several eta regions
+      const int numP05 = applyProjection<ChargedFinalState>(event, "CFS05").size();
+      const int numP15 = applyProjection<ChargedFinalState>(event, "CFS15").size();
+      const int numP30 = applyProjection<ChargedFinalState>(event, "CFS30").size();
+      const int numP50 = applyProjection<ChargedFinalState>(event, "CFS50").size();
+      
+      // Fill histograms
+      if (fuzzyEquals(sqrtS, 200.0, 1E-4)) {
+        _hist_nch200->fill(numP50, weight);
+        _hist_nch200eta05->fill(numP05, weight);
+        _hist_nch200eta15->fill(numP15, weight);
+        _hist_nch200eta30->fill(numP30, weight);
+        _hist_nch200eta50->fill(numP50, weight);
+        _hist_mean_nch_200->fill(_hist_mean_nch_200->binMean(0), numP50);
+      }
+      else if (fuzzyEquals(sqrtS, 900.0, 1E-4)) {
+        _hist_nch900->fill(numP50, weight);
+        _hist_nch900eta05->fill(numP05, weight);
+        _hist_nch900eta15->fill(numP15, weight);
+        _hist_nch900eta30->fill(numP30, weight);
+        _hist_nch900eta50->fill(numP50, weight);
+        _hist_mean_nch_900->fill(_hist_mean_nch_900->binMean(0), numP50);
+      }
     }
-
-    // Count  final state particles in several eta regions
-    const int numP05 = applyProjection<ChargedFinalState>(event, "CFS05").size();
-    const int numP15 = applyProjection<ChargedFinalState>(event, "CFS15").size();
-    const int numP30 = applyProjection<ChargedFinalState>(event, "CFS30").size();
-    const int numP50 = applyProjection<ChargedFinalState>(event, "CFS50").size();
-        
-    // Fill histograms
-    if (fuzzyEquals(sqrtS, 200.0, 1E-4)) {
-      _hist_nch200->fill(numP50, weight);
-      _hist_nch200eta05->fill(numP05, weight);
-      _hist_nch200eta15->fill(numP15, weight);
-      _hist_nch200eta30->fill(numP30, weight);
-      _hist_nch200eta50->fill(numP50, weight);
-      _hist_mean_nch_200->fill(_hist_mean_nch_200->binMean(0), numP50);
-    }
-    else if (fuzzyEquals(sqrtS, 900.0, 1E-4)) {
-      _hist_nch900->fill(numP50, weight);
-      _hist_nch900eta05->fill(numP05, weight);
-      _hist_nch900eta15->fill(numP15, weight);
-      _hist_nch900eta30->fill(numP30, weight);
-      _hist_nch900eta50->fill(numP50, weight);
-      _hist_mean_nch_900->fill(_hist_mean_nch_900->binMean(0), numP50);
+    
+    
+    
+    void finalize() {
+      // Normalise to area of refhistos
+      /// @todo Use generator cross-sections
+      normalize(_hist_nch200, 2.011);
+      normalize(_hist_nch900, 2.0434);
+      normalize(_hist_nch200eta05, 1.01255);
+      normalize(_hist_nch200eta15, 1.0191);
+      normalize(_hist_nch200eta30, 1.02615);
+      normalize(_hist_nch200eta50, 1.03475);
+      normalize(_hist_nch900eta05, 1.0035);
+      normalize(_hist_nch900eta15, 1.01405);
+      normalize(_hist_nch900eta30, 1.03055);
+      normalize(_hist_nch900eta50, 1.02791);
+      // Scale to total number of weights
+      scale(_hist_mean_nch_200, 1.0/sumOfWeights());
+      scale(_hist_mean_nch_900, 1.0/sumOfWeights());
+      
+      // Print trigger statistics
+      getLog() << Log::INFO << "No. events vetoed: " << _numVetoed << endl;
+      getLog() << Log::INFO << "No. events accepted: " << sumOfWeights() - _numVetoed << endl;
+      getLog() << Log::INFO << "Relative trigger rate: " << 100.0*(sumOfWeights() - _numVetoed)/sumOfWeights() << "%" << endl;
     }
-  }
-  
 
+    //@}
 
-  void UA5_1989_S1926373::finalize() {
-    // Normalise to area of refhistos
-    /// @todo Use generator cross-sections
-    normalize(_hist_nch200, 2.011);
-    normalize(_hist_nch900, 2.0434);
-    normalize(_hist_nch200eta05, 1.01255);
-    normalize(_hist_nch200eta15, 1.0191);
-    normalize(_hist_nch200eta30, 1.02615);
-    normalize(_hist_nch200eta50, 1.03475);
-    normalize(_hist_nch900eta05, 1.0035);
-    normalize(_hist_nch900eta15, 1.01405);
-    normalize(_hist_nch900eta30, 1.03055);
-    normalize(_hist_nch900eta50, 1.02791);
-    // Scale to total number of weights
-    scale(_hist_mean_nch_200, 1.0/sumOfWeights());
-    scale(_hist_mean_nch_900, 1.0/sumOfWeights());
-
-    getLog() << Log::INFO << "=== Trigger statistics ===" << endl;
-    getLog() << Log::INFO << "No. events vetoed: " << n_vetoed << endl;
-    getLog() << Log::INFO << "No. events accepted: " << sumOfWeights() - n_vetoed << endl;
-    getLog() << Log::INFO << "Relative trigger rate: " << 100.0*(sumOfWeights() - n_vetoed)/sumOfWeights() << " pct." << endl;
 
-  }
+  private:
+    
+    //@{
+    /// Histograms
+    AIDA::IHistogram1D* _hist_nch200;
+    AIDA::IHistogram1D* _hist_nch900;
+    AIDA::IHistogram1D* _hist_nch200eta05;
+    AIDA::IHistogram1D* _hist_nch200eta15;
+    AIDA::IHistogram1D* _hist_nch200eta30;
+    AIDA::IHistogram1D* _hist_nch200eta50;
+    AIDA::IHistogram1D* _hist_nch900eta05;
+    AIDA::IHistogram1D* _hist_nch900eta15;
+    AIDA::IHistogram1D* _hist_nch900eta30;
+    AIDA::IHistogram1D* _hist_nch900eta50;
+    AIDA::IHistogram1D* _hist_mean_nch_200;
+    AIDA::IHistogram1D* _hist_mean_nch_900;
+    //@}
 
+    unsigned int _numVetoed;
+  };
 
+  
 
   // This global object acts as a hook for the plugin system
   AnalysisBuilder<UA5_1989_S1926373> plugin_UA5_1989_S1926373;


More information about the Rivet-svn mailing list