[Rivet-svn] r2903 - in trunk: . include/Rivet include/Rivet/Projections

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Jan 31 16:24:13 GMT 2011


Author: buckley
Date: Mon Jan 31 16:24:12 2011
New Revision: 2903

Log:
Adding jet versions of Hendrik's new cmpByP and get*ByP particle sorting/comparison functions

Modified:
   trunk/ChangeLog
   trunk/include/Rivet/Jet.hh
   trunk/include/Rivet/Particle.hh
   trunk/include/Rivet/Projections/JetAlg.hh

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Mon Jan 31 16:23:32 2011	(r2902)
+++ trunk/ChangeLog	Mon Jan 31 16:24:12 2011	(r2903)
@@ -1,5 +1,8 @@
 2011-01-31  Andy Buckley  <andy at insectnation.org>
 
+	* Doc tweaks and adding cmp-by-|p| functions for Jets, to match
+	those added by Hendrik for Particles.
+
 	* Don't sum photons around muons in the D0 2010 Z pT analysis.
 
 2011-01-27  Andy Buckley  <andy at insectnation.org>

Modified: trunk/include/Rivet/Jet.hh
==============================================================================
--- trunk/include/Rivet/Jet.hh	Mon Jan 31 16:23:32 2011	(r2902)
+++ trunk/include/Rivet/Jet.hh	Mon Jan 31 16:24:12 2011	(r2903)
@@ -176,17 +176,26 @@
   /// @name Jet comparison functions for STL sorting
   //@{
 
-  // @brief Compare jets by \f$ p_\perp \f$ (descending - usual sorting for HEP)
+  /// @brief Compare jets by \f$ p_\perp \f$ (descending - usual sorting for HEP)
   /// Use this so that highest \f$ p_\perp \f$ is at the front of the list
   inline bool cmpJetsByPt(const Jet& a, const Jet& b) {
     return a.ptSum() > b.ptSum();
   }
-  // @brief Compare jets by \f$ p_\perp \f$ (ascending)
+  /// @brief Compare jets by \f$ p_\perp \f$ (ascending)
   /// Use this so that lowest \f$ p_\perp \f$ is at the front of the list
   inline bool cmpJetsByAscPt(const Jet& a, const Jet& b) {
     return a.ptSum() < b.ptSum();
   }
 
+  /// @brief Compare jets by descending momentum, \f$ p \f$
+  inline bool cmpJetsByP(const Jet& a, const Jet& b) {
+    return a.momentum().vector3().mod() > b.momentum().vector3().mod();
+  }
+  /// @brief Compare jets by ascending momentum, \f$ p \f$
+  inline bool cmpJetsByAscP(const Jet& a, const Jet& b) {
+    return a.momentum().vector3().mod() < b.momentum().vector3().mod();
+  }
+
   // @brief Compare jets by \f$ E_\perp \f$ (descending - usual sorting for HEP)
   /// Use this so that highest \f$ E_\perp \f$ is at the front of the list
   inline bool cmpJetsByEt(const Jet& a, const Jet& b) {
@@ -198,56 +207,56 @@
     return a.EtSum() < b.EtSum();
   }
 
-  // @brief Compare jets by \f$ E \f$ (descending - usual sorting for HEP)
+  /// @brief Compare jets by \f$ E \f$ (descending - usual sorting for HEP)
   /// Use this so that highest \f$ E \f$ is at the front of the list
   inline bool cmpJetsByE(const Jet& a, const Jet& b) {
     return a.momentum().E() > b.momentum().E();
   }
-  // @brief Compare jets by \f$ E \f$ (ascending)
+  /// @brief Compare jets by \f$ E \f$ (ascending)
   /// Use this so that lowest \f$ E \f$ is at the front of the list
   inline bool cmpJetsByAscE(const Jet& a, const Jet& b) {
     return a.momentum().E() < b.momentum().E();
   }
 
-  // @brief Compare jets by \f$ \eta \f$ (descending)
+  /// @brief Compare jets by \f$ \eta \f$ (descending)
   /// Use this so that highest \f$ \eta \f$ is at the front of the list
   inline bool cmpJetsByDescPseudorapidity(const Jet& a, const Jet& b) {
     return a.momentum().pseudorapidity() > b.momentum().pseudorapidity();
   }
-  // @brief Compare jets by \f$ \eta \f$ (ascending)
+  /// @brief Compare jets by \f$ \eta \f$ (ascending)
   /// Use this so that lowest \f$ \eta \f$ is at the front of the list
   inline bool cmpJetsByAscPseudorapidity(const Jet& a, const Jet& b) {
     return a.momentum().pseudorapidity() < b.momentum().pseudorapidity();
   }
 
-  // @brief Compare jets by \f$ |\eta| \f$ (descending)
+  /// @brief Compare jets by \f$ |\eta| \f$ (descending)
   /// Use this so that highest \f$ |\eta| \f$ is at the front of the list
   inline bool cmpJetsByDescAbsPseudorapidity(const Jet& a, const Jet& b) {
     return fabs(a.momentum().pseudorapidity()) > fabs(b.momentum().pseudorapidity());
   }
-  // @brief Compare jets by \f$ |\eta| \f$ (ascending)
+  /// @brief Compare jets by \f$ |\eta| \f$ (ascending)
   /// Use this so that lowest \f$ |\eta| \f$ is at the front of the list
   inline bool cmpJetsByAscAbsPseudorapidity(const Jet& a, const Jet& b) {
     return fabs(a.momentum().pseudorapidity()) < fabs(b.momentum().pseudorapidity());
   }
 
-  // @brief Compare jets by \f$ y \f$ (descending)
+  /// @brief Compare jets by \f$ y \f$ (descending)
   /// Use this so that highest \f$ y \f$ is at the front of the list
   inline bool cmpJetsByDescRapidity(const Jet& a, const Jet& b) {
     return a.momentum().rapidity() > b.momentum().rapidity();
   }
-  // @brief Compare jets by \f$ y \f$ (ascending)
+  /// @brief Compare jets by \f$ y \f$ (ascending)
   /// Use this so that lowest \f$ y \f$ is at the front of the list
   inline bool cmpJetsByAscRapidity(const Jet& a, const Jet& b) {
     return a.momentum().rapidity() < b.momentum().rapidity();
   }
 
-  // @brief Compare jets by \f$ |y| \f$ (descending)
+  /// @brief Compare jets by \f$ |y| \f$ (descending)
   /// Use this so that highest \f$ |y| \f$ is at the front of the list
   inline bool cmpJetsByDescAbsRapidity(const Jet& a, const Jet& b) {
     return fabs(a.momentum().rapidity()) > fabs(b.momentum().rapidity());
   }
-  // @brief Compare jets by \f$ |y| \f$ (ascending)
+  /// @brief Compare jets by \f$ |y| \f$ (ascending)
   /// Use this so that lowest \f$ |y| \f$ is at the front of the list
   inline bool cmpJetsByAscAbsRapidity(const Jet& a, const Jet& b) {
     return fabs(a.momentum().rapidity()) < fabs(b.momentum().rapidity());

Modified: trunk/include/Rivet/Particle.hh
==============================================================================
--- trunk/include/Rivet/Particle.hh	Mon Jan 31 16:23:32 2011	(r2902)
+++ trunk/include/Rivet/Particle.hh	Mon Jan 31 16:24:12 2011	(r2903)
@@ -137,11 +137,11 @@
   inline bool cmpParticleByAscPt(const Particle& a, const Particle& b) {
     return a.momentum().pT() < b.momentum().pT();
   }
-  /// Sort by descending transverse momentum, \f$ p \f$
+  /// Sort by descending momentum, \f$ p \f$
   inline bool cmpParticleByP(const Particle& a, const Particle& b) {
     return a.momentum().vector3().mod() > b.momentum().vector3().mod();
   }
-  /// Sort by ascending transverse momentum, \f$ p \f$
+  /// Sort by ascending momentum, \f$ p \f$
   inline bool cmpParticleByAscP(const Particle& a, const Particle& b) {
     return a.momentum().vector3().mod() < b.momentum().vector3().mod();
   }

Modified: trunk/include/Rivet/Projections/JetAlg.hh
==============================================================================
--- trunk/include/Rivet/Projections/JetAlg.hh	Mon Jan 31 16:23:32 2011	(r2902)
+++ trunk/include/Rivet/Projections/JetAlg.hh	Mon Jan 31 16:24:12 2011	(r2903)
@@ -17,6 +17,12 @@
   inline bool cmpMomByAscPt(const FourMomentum& a, const FourMomentum& b) {
     return a.pT() < b.pT();
   }
+  inline bool cmpMomByP(const FourMomentum& a, const FourMomentum& b) {
+    return a.vector3().mod() > b.vector3().mod();
+  }
+  inline bool cmpMomByAscP(const FourMomentum& a, const FourMomentum& b) {
+    return a.vector3().mod() < b.vector3().mod();
+  }
   inline bool cmpMomByEt(const FourMomentum& a, const FourMomentum& b) {
     return a.Et() > b.Et();
   }
@@ -117,6 +123,14 @@
       return jets(cmpJetsByPt, ptmin, ptmax, rapmin, rapmax, rapscheme);
     }
 
+    /// Get the jets, ordered by \f$ |p| \f$, with optional cuts on \f$ p_\perp \f$ and rapidity.
+    /// @todo Introduce MomentumFilter objects for pT, ET, eta, y, etc. filtering, to avoid double-arg ambiguities
+    Jets jetsByP(double ptmin=0.0, double ptmax=MAXDOUBLE,
+                 double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
+                 RapScheme rapscheme=PSEUDORAPIDITY) const {
+      return jets(cmpJetsByP, ptmin, ptmax, rapmin, rapmax, rapscheme);
+    }
+
     /// Get the jets, ordered by \f$ E \f$, with optional cuts on \f$ p_\perp \f$ and rapidity.
     /// @todo Introduce MomentumFilter objects for pT, ET, eta, y, etc. filtering, to avoid double-arg ambiguities
     Jets jetsByE(double ptmin=0.0, double ptmax=MAXDOUBLE,


More information about the Rivet-svn mailing list