[Rivet-svn] r2353 - in trunk: . doc include/Rivet include/Rivet/Math include/Rivet/Projections include/Rivet/Tools src/Core src/Projections src/Tools

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Mar 22 21:59:07 GMT 2010


Author: buckley
Date: Mon Mar 22 21:59:06 2010
New Revision: 2353

Log:
Lots of fixes to make Rivet behave itself with -Wextra warnings turned on, and a couple of more substantial fixes in FastJets and FoxWolframMoments. Version number set to 1.2.1

Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/doc/analyses.bib
   trunk/doc/analyses.tex
   trunk/include/Rivet/Math/MathUtils.hh
   trunk/include/Rivet/Projections/Beam.hh
   trunk/include/Rivet/Projections/FastJets.hh
   trunk/include/Rivet/Projections/FinalState.hh
   trunk/include/Rivet/Projections/FoxWolframMoments.hh
   trunk/include/Rivet/Projections/InitialQuarks.hh
   trunk/include/Rivet/Projections/MissingMomentum.hh
   trunk/include/Rivet/Projections/Multiplicity.hh
   trunk/include/Rivet/Projections/PVertex.hh
   trunk/include/Rivet/Projections/ParisiTensor.hh
   trunk/include/Rivet/Projections/Sphericity.hh
   trunk/include/Rivet/Projections/Thrust.hh
   trunk/include/Rivet/Projections/TotalVisibleMomentum.hh
   trunk/include/Rivet/Projections/TriggerCDFRun0Run1.hh
   trunk/include/Rivet/Projections/TriggerUA5.hh
   trunk/include/Rivet/Projections/UnstableFinalState.hh
   trunk/include/Rivet/Projections/WFinder.hh
   trunk/include/Rivet/Rivet.hh
   trunk/include/Rivet/Tools/BinnedHistogram.hh
   trunk/src/Core/ProjectionHandler.cc
   trunk/src/Projections/FastJets.cc
   trunk/src/Projections/ParisiTensor.cc
   trunk/src/Projections/WFinder.cc
   trunk/src/Tools/BinnedHistogram.cc

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/ChangeLog	Mon Mar 22 21:59:06 2010	(r2353)
@@ -1,3 +1,19 @@
+2010-03-22  Andy Buckley  <andy at insectnation.org>
+
+	* Tag as pach release 1.2.1.
+
+	* General tidying of return arguments and intentionally unused
+	parameters to keep -Wextra happy (some complaints remain from
+	TinyXML, FastJet, and HepMC).
+
+	* Some extra bug fixes: in FastJets projection with explicit
+	plugin argument, removing muon veto cut on FoxWolframMoments.
+
+	* Adding UNUSED macro to help with places where compiler warnings
+	can't be helped.
+
+	* Turning on -Wextra warnings, and fixing some violations.
+
 2010-03-21  Andy Buckley  <andy at insectnation.org>
 
 	* Adding MissingMomentum projection, as replacement for ~all uses

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/configure.ac	Mon Mar 22 21:59:06 2010	(r2353)
@@ -1,7 +1,7 @@
 ## Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([Rivet],[1.2.0],[rivet at projects.hepforge.org],[Rivet])
+AC_INIT([Rivet],[1.2.1],[rivet at projects.hepforge.org],[Rivet])
 AC_CONFIG_SRCDIR([src/Core/Analysis.cc])
 AC_CONFIG_HEADERS([include/Rivet/Config/DummyConfig.hh include/Rivet/Config/RivetConfig.hh include/Rivet/Config/BuildOptions.hh])
 AM_INIT_AUTOMAKE(dist-bzip2)
@@ -261,6 +261,14 @@
 fi
 
 
+## Extra warnings flag (default=none)
+AC_ARG_ENABLE([extra-warnings], [AC_HELP_STRING(--enable-extra-warnings, 
+  [build with extra compiler warnings (recommended for developers)  @<:@default=no@:>@])], [], [enable_extra_warnings=no])
+if test x$enable_extra_warnings == xyes; then
+   AC_CEDAR_CHECKCXXFLAG([-Wextra], [AM_CXXFLAGS="$AM_CXXFLAGS -Wextra "])
+fi
+
+
 AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(AM_CXXFLAGS)
 

Modified: trunk/doc/analyses.bib
==============================================================================
--- trunk/doc/analyses.bib	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/doc/analyses.bib	Mon Mar 22 21:59:06 2010	(r2353)
@@ -80,6 +80,24 @@
      SLACcitation  = "%%CITATION = 0903.1748;%%"
 }
 
+% Abazov:2009pp
+ at Article{Abazov:2009pp,
+     author    = "Abazov, Victor Mukhamedovich and others",
+ collaboration = "D0",
+     title     = "{Measurement of $Z / \gamma^\ast +jet+X$ angular
+                  distributions in $p \bar{p}$ collisions at $\sqrt{s}=1.96$
+                  TeV}",
+     journal   = "Phys. Lett.",
+     volume    = "B682",
+     year      = "2010",
+     pages     = "370-380",
+     eprint    = "0907.4286",
+     archivePrefix = "arXiv",
+     primaryClass  =  "hep-ex",
+     doi       = "10.1016/j.physletb.2009.11.012",
+     SLACcitation  = "%%CITATION = 0907.4286;%%"
+}
+
 % Pfeifenschneider:1999rz
 @Article{Pfeifenschneider:1999rz,
      author    = "Pfeifenschneider, P. and others",
@@ -685,6 +703,23 @@
      SLACcitation  = "%%CITATION = PHRVA,D65,092002;%%"
 }
 
+% Abbiendi:2004qz
+ at Article{Abbiendi:2004qz,
+     author    = "Abbiendi, G. and others",
+ collaboration = "OPAL",
+     title     = "{Measurement of event shape distributions and moments in e+
+                  e- -->  hadrons at 91-GeV - 209-GeV and a determination of
+                  alpha(s)}",
+     journal   = "Eur. Phys. J.",
+     volume    = "C40",
+     year      = "2005",
+     pages     = "287-316",
+     eprint    = "hep-ex/0503051",
+     archivePrefix = "arXiv",
+     doi       = "10.1140/epjc/s2005-02120-6",
+     SLACcitation  = "%%CITATION = HEP-EX/0503051;%%"
+}
+
 % Adams:2006nd
 @Article{Adams:2006nd,
      author    = "Adams, John and others",

Modified: trunk/doc/analyses.tex
==============================================================================
--- trunk/doc/analyses.tex	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/doc/analyses.tex	Mon Mar 22 21:59:06 2010	(r2353)
@@ -276,7 +276,7 @@
 \clearpage
 
 \typeout{Handling analysis OPAL_2004_S6132243}
-\subsection{OPAL\_2004\_S6132243}
+\subsection[OPAL\_2004\_S6132243]{OPAL\_2004\_S6132243\,\cite{Abbiendi:2004qz}}
 \textbf{Event shape distributions and moments in $e^+ e^-$ \ensuremath{\to} hadrons at 91--209 GeV}\newline
 \textbf{Experiment:} OPAL (LEP 1 \& 2) \newline
 \textbf{Spires ID:} \href{http://www.slac.stanford.edu/spires/find/hep/www?rawcmd=key+6132243}{6132243}\newline
@@ -1347,7 +1347,7 @@
 \clearpage
 
 \typeout{Handling analysis D0_2009_S8349509}
-\subsection{D0\_2009\_S8349509}
+\subsection[D0\_2009\_S8349509]{D0\_2009\_S8349509\,\cite{Abazov:2009pp}}
 \textbf{Z+jets angular distributions}\newline
 \textbf{Experiment:} D0 (Tevatron Run 2) \newline
 \textbf{Spires ID:} \href{http://www.slac.stanford.edu/spires/find/hep/www?rawcmd=key+8349509}{8349509}\newline

Modified: trunk/include/Rivet/Math/MathUtils.hh
==============================================================================
--- trunk/include/Rivet/Math/MathUtils.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Math/MathUtils.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -20,7 +20,7 @@
   /// risk of floating point error, this function just exists in
   /// case @c isZero is accidentally used on an integer type, to avoid
   /// implicit type conversion. The @a tolerance parameter is ignored.
-  inline bool isZero(long val, double tolerance=1E-8) {
+  inline bool isZero(long val, double UNUSED(tolerance)=1E-8) {
     return val == 0;
   }
 
@@ -58,7 +58,7 @@
   /// used on an integer type, to avoid implicit type conversion. The @a
   /// tolerance parameter is ignored, even if it would have an
   /// absolute magnitude greater than 1.
-  inline bool fuzzyEquals(long a, long b, double tolerance=1E-5) {
+  inline bool fuzzyEquals(long a, long b, double UNUSED(tolerance)=1E-5) {
     return a == b;
   }
 

Modified: trunk/include/Rivet/Projections/Beam.hh
==============================================================================
--- trunk/include/Rivet/Projections/Beam.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/Beam.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -75,7 +75,7 @@
   protected:
 
     /// Compare with other projections.
-    virtual int compare(const Projection& p) const {
+    virtual int compare(const Projection& UNUSED(p)) const {
       return EQUIVALENT;
     }
 

Modified: trunk/include/Rivet/Projections/FastJets.hh
==============================================================================
--- trunk/include/Rivet/Projections/FastJets.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/FastJets.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -54,7 +54,7 @@
              fastjet::RecombinationScheme recom, double rparameter);
 
     /// Explicitly pass in an externally-constructed plugin
-    FastJets(const FinalState& fsp, const fastjet::JetDefinition::Plugin& plugin);
+    FastJets(const FinalState& fsp, fastjet::JetDefinition::Plugin& plugin);
 
     // /// Explicit copy constructor.
     // FastJets(const FastJets& other);

Modified: trunk/include/Rivet/Projections/FinalState.hh
==============================================================================
--- trunk/include/Rivet/Projections/FinalState.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/FinalState.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -62,12 +62,12 @@
 
 
     /// Access the projected final-state particles.
-    virtual const size_t size() const { return _theParticles.size(); }
+    virtual size_t size() const { return _theParticles.size(); }
 
     /// Is this final state empty?
-    virtual const bool empty() const { return _theParticles.empty(); }
+    virtual bool empty() const { return _theParticles.empty(); }
     /// @deprecated Is this final state empty?
-    virtual const bool isEmpty() const { return _theParticles.empty(); }
+    virtual bool isEmpty() const { return _theParticles.empty(); }
 
 
   public:

Modified: trunk/include/Rivet/Projections/FoxWolframMoments.hh
==============================================================================
--- trunk/include/Rivet/Projections/FoxWolframMoments.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/FoxWolframMoments.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -4,9 +4,9 @@
 
 #include "Rivet/Rivet.hh"
 #include "Rivet/Projection.hh"
-#include "Rivet/Projections/VetoedFinalState.hh"
-#include "Rivet/Projections/TotalVisibleMomentum.hh"
 #include "Rivet/Projections/FinalState.hh"
+#include "Rivet/Projections/VetoedFinalState.hh"
+#include "Rivet/Projections/VisibleFinalState.hh"
 #include "Rivet/Particle.hh"
 #include "Rivet/Event.hh"
 
@@ -19,58 +19,60 @@
 
   /// Project out the total visible energy vector, allowing missing
   /// \f$ E_T \f$ etc. to be calculated.
-  class FoxWolframMoments : public Projection {
- 
+  class FoxWolframMoments : public Projection { 
   public:
- 
+    
     /// Constructor.
     FoxWolframMoments(const FinalState& fsp)
     {
-        setName("FoxWolframMoments");
-        addProjection(fsp, "FS");
-        //addProjection(TotalVisibleMomentum(fsp), "SumET");
-
-        VetoedFinalState vfs(fsp);
-        vfs
-        .addVetoPairId(NU_E)
-        .addVetoPairId(NU_MU)
-        .addVetoPairId(NU_TAU)
-        .addVetoDetail(MUON, 1.0*GeV, MAXDOUBLE);
-        addProjection(vfs, "VFS");
-
-        // initialize moments vector
-        for ( int i = 0; i < MAXMOMENT ; ++i) {
-            _fwmoments.push_back(0.0);
-        }
+      setName("FoxWolframMoments");
+      addProjection(fsp, "FS");
+      
+      /// @todo Let the user supply any projection they like?      
+      VisibleFinalState vfs(fsp);
+      addProjection(vfs, "VFS");
+      
+      // Initialize moments vector
+      for (int i = 0; i < MAXMOMENT ; ++i) {
+        _fwmoments.push_back(0.0);
+      }
     }
-
+    
+    
     /// Clone on the heap.
     virtual const Projection* clone() const {
       return new FoxWolframMoments(*this);
     }
- 
+    
+    
   public:
-
+    
     /// The projected Fox-Wolfram Moment of order l
-      const double getFoxWolframMoment(unsigned int l) const {
-        if ( l < MAXMOMENT )
-            return _fwmoments[l];
-        else return -666.0;
+    double getFoxWolframMoment(unsigned int l) const {
+      if (l < MAXMOMENT) {
+        return _fwmoments[l];
       }
-   
+      /// @todo What?!?
+      return -666.0;
+    }
+    
+    
   protected:
- 
+    
     /// Apply the projection to the event.
     void project(const Event& e);
- 
+    
     /// Compare projections.
     int compare(const Projection& p) const;
+
      
   private:
-      vector<double> _fwmoments;
+
+    vector<double> _fwmoments;
 
   };
 
+
 }
 
 

Modified: trunk/include/Rivet/Projections/InitialQuarks.hh
==============================================================================
--- trunk/include/Rivet/Projections/InitialQuarks.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/InitialQuarks.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -9,10 +9,9 @@
 namespace Rivet {
 
 
-  /// Project out quarks from the hard process in e+e- -> Z0 events
+  /// Project out quarks from the hard process in e+ e- -> Z0 events
   /// @deprecated This is a very dangerous and specific projection! Use e.g. PID::hasBottom and friends instead
-  class InitialQuarks : public Projection {
- 
+  class InitialQuarks : public Projection { 
   public:
  
     /// @name Standard constructors and destructors.
@@ -35,9 +34,10 @@
     virtual const ParticleVector& particles() const { return _theParticles; }
 
     /// Is this final state empty?
-    virtual const bool empty() const { return _theParticles.empty(); }
+    virtual bool empty() const { return _theParticles.empty(); }
     /// @deprecated Is this final state empty?
-    virtual const bool isEmpty() const { return _theParticles.empty(); }
+    virtual bool isEmpty() const { return _theParticles.empty(); }
+
 
   protected:
  
@@ -47,6 +47,7 @@
     /// Compare projections.
     virtual int compare(const Projection& p) const;
  
+
   protected:
 
     /// The final-state particles.

Modified: trunk/include/Rivet/Projections/MissingMomentum.hh
==============================================================================
--- trunk/include/Rivet/Projections/MissingMomentum.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/MissingMomentum.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -52,13 +52,10 @@
     const FourMomentum& momentum() const { return _momentum; }
 
     /// The projected scalar transverse energy
-    const double scalarET() const { return _set; }
+    double scalarET() const { return _set; }
  
 
   protected:
-
-    /// Clear the projection results.
-    void clear();
  
     /// Apply the projection to the event.
     void project(const Event& e);
@@ -67,6 +64,12 @@
     int compare(const Projection& p) const;
      
 
+  public:
+
+    /// Clear the projection results.
+    void clear();
+
+
   private:
  
     /// The total visible momentum

Modified: trunk/include/Rivet/Projections/Multiplicity.hh
==============================================================================
--- trunk/include/Rivet/Projections/Multiplicity.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/Multiplicity.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -12,7 +12,6 @@
 
   /// Count the final-state particles in an event.
   class Multiplicity : public Projection {
-
   public:
 
     /// Constructor. The provided FinalState projection must live throughout the run.
@@ -28,6 +27,7 @@
       return new Multiplicity(*this);
     }
 
+
   protected:
 
     /// Perform the projection on the Event.
@@ -36,15 +36,16 @@
     /// Compare projections.
     int compare(const Projection& p) const;
 
+
   public:
 
     /// @name Access the projected multiplicities.
     //@ {
     /// Total multiplicity
-    const unsigned int totalMultiplicity() const { return _totalMult; }
+    unsigned int totalMultiplicity() const { return _totalMult; }
 
     /// Hadron multiplicity
-    const unsigned int hadronMultiplicity() const { return _hadMult; }
+    unsigned int hadronMultiplicity() const { return _hadMult; }
     //@ }
 
   private:

Modified: trunk/include/Rivet/Projections/PVertex.hh
==============================================================================
--- trunk/include/Rivet/Projections/PVertex.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/PVertex.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -51,9 +51,10 @@
     /// Do the projection.
     void project(const Event& e);
 
+
     /// Compare projections.
-    int compare(const Projection & p) const {
-      return 0;
+    int compare(const Projection& UNUSED(p)) const {
+      return EQUIVALENT;
     }
  
 

Modified: trunk/include/Rivet/Projections/ParisiTensor.hh
==============================================================================
--- trunk/include/Rivet/Projections/ParisiTensor.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/ParisiTensor.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -38,16 +38,15 @@
      \f$r\f$ parameter set to 1.
   */
   class ParisiTensor : public Projection {
-
   public:
 
     /// Constructor. The provided FinalState projection must live throughout the run.
     ParisiTensor(const FinalState& fsp)
-      : _C(0), _D(0)
     {
       setName("ParisiTensor");
       addProjection(fsp, "FS");
       addProjection(Sphericity(fsp, 1.0), "Sphericity");
+      clear();
     }
 
     /// Clone on the heap.
@@ -55,6 +54,7 @@
       return new ParisiTensor(*this);
     }
 
+
   protected:
 
     /// Perform the projection on the Event.
@@ -63,20 +63,28 @@
     /// Compare with other projections.
     int compare(const Projection& p) const;
 
+
+  public:
+
+    /// Clear the projection.
+    void clear();
+
+
   public:
 
     /// @name Access the C and D params.
     ///@{
-    const double C() const { return _C; }
-    const double D() const { return _D; }
+    double C() const { return _C; }
+    double D() const { return _D; }
     ///@}
 
     /// @name Access the eigenvalues of \f$\theta\f$.
     ///@{
-    const double lambda1() const { return _lambda[0]; }
-    const double lambda2() const { return _lambda[1]; }
-    const double lambda3() const { return _lambda[2]; }
+    double lambda1() const { return _lambda[0]; }
+    double lambda2() const { return _lambda[1]; }
+    double lambda3() const { return _lambda[2]; }
     ///@}
+
      
   private:
  
@@ -85,8 +93,10 @@
 
     /// Eigenvalues.
     double _lambda[3];
+
   };
 
+
 }
 
 

Modified: trunk/include/Rivet/Projections/Sphericity.hh
==============================================================================
--- trunk/include/Rivet/Projections/Sphericity.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/Sphericity.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -82,13 +82,13 @@
     /// @name Access the event shapes by name
     /// @{
     /// Sphericity
-    const double sphericity() const { return 3.0 / 2.0 * (lambda2() + lambda3()); }
+    double sphericity() const { return 3.0 / 2.0 * (lambda2() + lambda3()); }
     /// Transverse Sphericity
-    const double transSphericity() const { return 2.0 * lambda2() / ( lambda1() + lambda2() ); }
+    double transSphericity() const { return 2.0 * lambda2() / ( lambda1() + lambda2() ); }
     /// Planarity
-    const double planarity() const { return 2 * (sphericity() - 2 * aplanarity()) / 3.0; }
+    double planarity() const { return 2 * (sphericity() - 2 * aplanarity()) / 3.0; }
     /// Aplanarity
-    const double aplanarity() const { return 3 / 2.0 * lambda3(); }
+    double aplanarity() const { return 3 / 2.0 * lambda3(); }
     /// @}
 
     /// @name Access the sphericity basis vectors
@@ -110,9 +110,9 @@
 
     /// @name Access the momentum tensor eigenvalues
     /// @{
-    const double lambda1() const { return _lambdas[0]; }
-    const double lambda2() const { return _lambdas[1]; }
-    const double lambda3() const { return _lambdas[2]; }
+    double lambda1() const { return _lambdas[0]; }
+    double lambda2() const { return _lambdas[1]; }
+    double lambda3() const { return _lambdas[2]; }
     /// @}
 
 

Modified: trunk/include/Rivet/Projections/Thrust.hh
==============================================================================
--- trunk/include/Rivet/Projections/Thrust.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/Thrust.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -78,13 +78,13 @@
 
     ///@{ Thrust scalar accessors
     /// The thrust scalar, \f$ T \f$, (maximum thrust).
-    const double thrust() const { return _thrusts[0]; }
+    double thrust() const { return _thrusts[0]; }
     /// The thrust major scalar, \f$ M \f$, (thrust along thrust major axis).
-    const double thrustMajor() const { return _thrusts[1]; }
+    double thrustMajor() const { return _thrusts[1]; }
     /// The thrust minor scalar, \f$ m \f$, (thrust along thrust minor axis).
-    const double thrustMinor() const { return _thrusts[2]; }
+    double thrustMinor() const { return _thrusts[2]; }
     /// The oblateness, \f$ O = M - m \f$ .
-    const double oblateness() const { return _thrusts[1] - _thrusts[2]; }
+    double oblateness() const { return _thrusts[1] - _thrusts[2]; }
     ///@}
 
     ///@{ Thrust axis accessors

Modified: trunk/include/Rivet/Projections/TotalVisibleMomentum.hh
==============================================================================
--- trunk/include/Rivet/Projections/TotalVisibleMomentum.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/TotalVisibleMomentum.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -39,7 +39,7 @@
     const FourMomentum& momentum() const { return _momentum; }
 
     /// The projected scalar transverse energy
-    const double scalarET() const { return _set; }
+    double scalarET() const { return _set; }
  
 
   protected:

Modified: trunk/include/Rivet/Projections/TriggerCDFRun0Run1.hh
==============================================================================
--- trunk/include/Rivet/Projections/TriggerCDFRun0Run1.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/TriggerCDFRun0Run1.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -30,7 +30,7 @@
   public:
 
     /// The trigger result
-    const bool minBiasDecision() const {
+    bool minBiasDecision() const {
       return _decision_mb;
     }
 
@@ -41,7 +41,7 @@
   protected:
 
     /// Compare with other projections.
-    virtual int compare(const Projection& p) const {
+    virtual int compare(const Projection& UNUSED(p)) const {
       return EQUIVALENT;
     }
 

Modified: trunk/include/Rivet/Projections/TriggerUA5.hh
==============================================================================
--- trunk/include/Rivet/Projections/TriggerUA5.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/TriggerUA5.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -26,23 +26,23 @@
   public:
 
     /// The trigger result for non-single diffractive (2 arm) trigger
-    const bool sdDecision() const {
+    bool sdDecision() const {
       return _decision_sd;
     }
 
     /// The trigger result for non-single diffractive (2 arm) trigger
-    const bool nsdDecision() const {
+    bool nsdDecision() const {
       return _decision_nsd_1;
     }
 
     /// The trigger result for non-single diffractive (2 arm) trigger
     /// with special ">= 2" trigger for ppbar bg rejection
-    const bool nsd2Decision() const {
+    bool nsd2Decision() const {
       return _decision_nsd_2;
     }
 
     /// The trigger result
-    const bool samebeams() const {
+    bool samebeams() const {
       return _samebeams;
     }
 
@@ -58,7 +58,7 @@
   protected:
 
     /// Compare with other projections.
-    virtual int compare(const Projection& p) const {
+    virtual int compare(const Projection& UNUSED(p)) const {
       return EQUIVALENT;
     }
 

Modified: trunk/include/Rivet/Projections/UnstableFinalState.hh
==============================================================================
--- trunk/include/Rivet/Projections/UnstableFinalState.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/UnstableFinalState.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -40,9 +40,9 @@
     virtual const ParticleVector& particles() const { return _theParticles; }
 
     /// Is this final state empty?
-    virtual const bool empty() const { return _theParticles.empty(); }
+    virtual bool empty() const { return _theParticles.empty(); }
     /// @deprecated Is this final state empty?
-    virtual const bool isEmpty() const { return _theParticles.empty(); }
+    virtual bool isEmpty() const { return _theParticles.empty(); }
 
   protected:
  

Modified: trunk/include/Rivet/Projections/WFinder.hh
==============================================================================
--- trunk/include/Rivet/Projections/WFinder.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Projections/WFinder.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -80,6 +80,12 @@
     int compare(const Projection& p) const;
 
 
+  public:
+
+    /// Clear the projection
+    void clear();
+
+
   private:
 
     /// Common implementation of constructor operation, taking FS params.

Modified: trunk/include/Rivet/Rivet.hh
==============================================================================
--- trunk/include/Rivet/Rivet.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Rivet.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -20,6 +20,18 @@
 #include <cassert>
 #include <fstream>
 
+
+// Macro to help with overzealous compiler warnings
+#ifdef UNUSED
+#elif defined(__GNUC__)
+# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
+#elif defined(__LCLINT__)
+# define UNUSED(x) /*@unused@*/ x
+#else
+# define UNUSED(x) x
+#endif
+
+
 namespace Rivet {
 
   // Convenient imports of common STL classes and functions.

Modified: trunk/include/Rivet/Tools/BinnedHistogram.hh
==============================================================================
--- trunk/include/Rivet/Tools/BinnedHistogram.hh	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/include/Rivet/Tools/BinnedHistogram.hh	Mon Mar 22 21:59:06 2010	(r2353)
@@ -1,16 +1,9 @@
 // -*- C++ -*-
-/**
- *  BinnedHistogram.hh
- *  Rivet
- *
- *  Created by James Monk on 13/12/2007.
- *
- */
 #ifndef RIVET_BINNEDHISTOGRAM_HH
 #define RIVET_BINNEDHISTOGRAM_HH
 #include "Rivet/Rivet.hh"
 
-namespace Rivet{
+namespace Rivet {
 
 
   /**
@@ -18,40 +11,32 @@
    * each in a different region of a second quantity.  For example, a
    * BinnedHistogram may contain histograms of the cross section differential
    * in PT in different eta regions.
-   *
    **/
-
-  template<typename T> class BinnedHistogram{
- 
+  template<typename T> 
+  class BinnedHistogram {
   public:
+    
+    /// Create a new empty BinnedHistogram
+    BinnedHistogram() {
+      return;
+    }
+ 
+    ///  Add a histogram in the region between @a binMin and @a binMax to this
+    ///  set of BinnedHistograms.
+    const BinnedHistogram<T>& addHistogram(const T& binMin,
+                                           const T& binMax,
+                                           AIDA::IHistogram1D* histo);
+    
+    /// Fill the histogram that lies in the same region as @a bin with the value
+    /// @a val of weight @a weight.
+    AIDA::IHistogram1D* fill(const T& bin,
+                             const T& val,
+                             double weight);
+    
+    const vector<AIDA::IHistogram1D*>& getHistograms() const { return _histos; }
+    vector<AIDA::IHistogram1D*>& getHistograms() { return _histos; }
  
-    /**
-     * Create a new empty BinnedHistogram
-     */
- 
-    BinnedHistogram(){return;};
- 
-    /**
-     *  Add a histogram in the region between binMin and binMax to this set of
-     *  BinnedHistograms.
-     */
- 
-    const BinnedHistogram<T> &addHistogram(const T &binMin,
-                                        const T &binMax,
-                                        AIDA::IHistogram1D *histo);
- 
-    /**
-     *  Fill the histogram that lies in the same region as bin with the
-     *  value val of weight weight.
-     */
- 
-    AIDA::IHistogram1D* const fill(const T &bin,
-                                const T &val,
-                                const double &weight);
- 
-    const vector<AIDA::IHistogram1D*> &getHistograms() const { return _histos; }
-    vector<AIDA::IHistogram1D*> &getHistograms() { return _histos; }
- 
+
   private:
  
     map<T, AIDA::IHistogram1D*> _histosByUpperBound;
@@ -59,6 +44,8 @@
     vector<AIDA::IHistogram1D*> _histos;
  
   };
+
+
 }
 
 #endif

Modified: trunk/src/Core/ProjectionHandler.cc
==============================================================================
--- trunk/src/Core/ProjectionHandler.cc	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/src/Core/ProjectionHandler.cc	Mon Mar 22 21:59:06 2010	(r2353)
@@ -92,7 +92,8 @@
 
 
   // Clone neatly
-  const Projection* ProjectionHandler::_clone(const ProjectionApplier& parent,
+  /// @todo Remove the 'parent' argument?
+  const Projection* ProjectionHandler::_clone(const ProjectionApplier& UNUSED(parent),
                                               const Projection& proj)
   {
     // Clone a new copy of the passed projection on the heap

Modified: trunk/src/Projections/FastJets.cc
==============================================================================
--- trunk/src/Projections/FastJets.cc	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/src/Projections/FastJets.cc	Mon Mar 22 21:59:06 2010	(r2353)
@@ -22,7 +22,6 @@
     setName("FastJets");
     getLog() << Log::DEBUG << "R parameter = " << rparameter << endl;
     getLog() << Log::DEBUG << "Seed threshold = " << seed_threshold << endl;
-    //addProjection(fsp, "FS");
     if (alg == KT) {
       _jdef = fastjet::JetDefinition(fastjet::kt_algorithm, rparameter, fastjet::E_scheme);
     } else if (alg == CAM) {
@@ -63,18 +62,17 @@
     : JetAlg(fsp)
   {
     setName("FastJets");
-    //addProjection(fsp, "FS");
     _jdef = fastjet::JetDefinition(type, rparameter, recom);
   }
 
 
-  FastJets::FastJets(const FinalState& fsp, const fastjet::JetDefinition::Plugin& plugin)
+  FastJets::FastJets(const FinalState& fsp, 
+                     fastjet::JetDefinition::Plugin& plugin)
     : JetAlg(fsp)
   {
     setName("FastJets");
-    //addProjection(fsp, "FS");
-    /// @todo Need to copy the plugin to make a shared_ptr?
-    //_plugin = &plugin;
+    /// @todo Should we be copying the plugin?
+    _plugin.reset(&plugin);
     _jdef = fastjet::JetDefinition(_plugin.get());
   }
 

Modified: trunk/src/Projections/ParisiTensor.cc
==============================================================================
--- trunk/src/Projections/ParisiTensor.cc	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/src/Projections/ParisiTensor.cc	Mon Mar 22 21:59:06 2010	(r2353)
@@ -5,12 +5,24 @@
 
 namespace Rivet {
 
+
   int ParisiTensor::compare(const Projection& p) const {
     return mkNamedPCmp(p, "Sphericity");
   }
 
 
+  void ParisiTensor::clear() {
+    _lambda[0] = 0;
+    _lambda[1] = 0;
+    _lambda[2] = 0;
+    _C = 0;
+    _D = 0;
+  }
+
+
   void ParisiTensor::project(const Event & e) {
+    clear();
+
     // Apply sphericity projection to event
     Sphericity sph = applyProjection<Sphericity>(e, "Sphericity");
 
@@ -22,4 +34,5 @@
     _D = 27 * lambda1() * lambda2() * lambda3();
   }
 
+
 }

Modified: trunk/src/Projections/WFinder.cc
==============================================================================
--- trunk/src/Projections/WFinder.cc	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/src/Projections/WFinder.cc	Mon Mar 22 21:59:06 2010	(r2353)
@@ -78,6 +78,9 @@
     _m2_min = m2_min;
     _m2_max = m2_max;
 
+    // Set ETmiss
+    _etMiss = missingET;
+
     // Make and register an invariant mass final state for the W decay leptons
     vector<pair<PdgId, PdgId> > l_nu_ids;
     l_nu_ids += make_pair(abs(pid), -abs(nu_pid));
@@ -133,8 +136,13 @@
   }
 
 
-  void WFinder::project(const Event& e) {
+  void WFinder::clear() {
     _theParticles.clear();
+  }
+
+
+  void WFinder::project(const Event& e) {
+    clear();
 
     const FinalState& imfs = applyProjection<FinalState>(e, "IMFS");
     if (imfs.particles().size() != 2) {

Modified: trunk/src/Tools/BinnedHistogram.cc
==============================================================================
--- trunk/src/Tools/BinnedHistogram.cc	Mon Mar 22 16:59:59 2010	(r2352)
+++ trunk/src/Tools/BinnedHistogram.cc	Mon Mar 22 21:59:06 2010	(r2353)
@@ -1,79 +1,78 @@
 // -*- C++ -*-
-/**
- *  BinnedHistogram.cpp
- *  Rivet
- *
- *  Created by James Monk on 13/12/2007.
- *
- */
-
 #include "Rivet/Tools/BinnedHistogram.hh"
+#include "Rivet/RivetBoost.hh"
 #include "Rivet/RivetAIDA.hh"
 
-namespace Rivet{
+namespace Rivet {
+
 
   template<typename T>
-  const BinnedHistogram<T> &BinnedHistogram<T>::addHistogram
-  (const T &binMin, const T &binMax, AIDA::IHistogram1D *histo){
- 
-    if(binMin > binMax) throw Error
-      ("Cannot add a binned histogram where the lower bin edge is above the upper edge");
- 
+  const BinnedHistogram<T>& BinnedHistogram<T>::addHistogram(const T& binMin, 
+                                                             const T& binMax, 
+                                                             AIDA::IHistogram1D *histo){
+    if (binMin > binMax) {
+      throw Error
+        ("Cannot add a binned histogram where the lower bin edge is above the upper edge");
+    } 
     _histosByUpperBound[binMax] = histo;
     _histosByLowerBound[binMin] = histo;
     bool found = false;
-    for(vector<AIDA::IHistogram1D*>::iterator histIt = _histos.begin();
-        histIt != _histos.end() && !found; ++histIt){
-      if((*histIt)==histo) found = true;
+    foreach (AIDA::IHistogram1D* hist, _histos) {
+      if (hist == histo) {
+        found = true;
+        break;
+      }
     }
- 
-    if(!found){
+    
+    if (!found){
       _histos.push_back(histo);
     }
- 
+    
     return *this;
   }
-////////////////////////////////////////////////////////////////////////////////
+
+
+
   template<typename T>
-  AIDA::IHistogram1D* const BinnedHistogram<T>::fill(const T &bin,
-                                                     const T &val,
-                                                     const double &weight){
+  AIDA::IHistogram1D* BinnedHistogram<T>::fill(const T& bin,
+                                                     const T& val,
+                                                     double weight) {
 
     typename map<T, AIDA::IHistogram1D*>::iterator histIt =
       _histosByUpperBound.upper_bound(bin);
     //check that the bin is not out of range
-    if(histIt == _histosByUpperBound.end()){
+    if (histIt == _histosByUpperBound.end()) {
       return 0;
     }
  
     AIDA::IHistogram1D* histo = histIt->second;
- 
     histIt = _histosByLowerBound.lower_bound(bin);
-    //no need to check going beyond the upper bound if we already passed above
-    //(given that upper bound > lower bound is checked)
-    //check it is not before the start of the map
-    if(histIt == _histosByLowerBound.begin()){
+
+    // No need to check going beyond the upper bound if we already passed above
+    // (given that upper bound > lower bound is checked)
+    // Check it is not before the start of the map
+    if (histIt == _histosByLowerBound.begin()) {
       return 0;
     }
-    //lowerbound actually gives us the iterator one above the nearest element,
-    //so decrement it.
-    //This is safe because we already checked we're not at the start!
+    // By-lower-bound actually gives us the iterator one above the nearest element,
+    // so decrement it. This is safe because we already checked we're not at the start!
     --histIt;
  
-    if(histo!=histIt->second){
+    if (histo != histIt->second) {
       return 0;
     }
- 
+    
     histo->fill(val, weight);
- 
+    
     return histo;
   }
-////////////////////////////////////////////////////////////////////////////////
-  //Template declarations for the compiler.
+
+
+
+  // Template declarations for the compiler.
   template class BinnedHistogram<double>;
   template class BinnedHistogram<int>;
   template class BinnedHistogram<float>;
 
-}
-////////////////////////////////////////////////////////////////////////////////
 
+}


More information about the Rivet-svn mailing list