[Rivet-svn] r3056 - in trunk: . include/Rivet include/Rivet/Math

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Apr 14 15:49:58 BST 2011


Author: hoeth
Date: Thu Apr 14 15:49:57 2011
New Revision: 3056

Log:
deltaR, deltaEta, deltaPhi now accept also particles and jets as arguments

Modified:
   trunk/ChangeLog
   trunk/include/Rivet/Jet.hh
   trunk/include/Rivet/Math/MathUtils.hh
   trunk/include/Rivet/Math/Vector3.hh
   trunk/include/Rivet/Math/Vector4.hh
   trunk/include/Rivet/Particle.hh

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Wed Apr 13 16:17:09 2011	(r3055)
+++ trunk/ChangeLog	Thu Apr 14 15:49:57 2011	(r3056)
@@ -1,3 +1,13 @@
+2011-04-14  Hendrik Hoeth <hendrik.hoeth at cern.ch>
+
+	* deltaR, deltaPhi, deltaEta now available in all combinations of
+	FourVector, FourMomentum, Vector3, doubles. They also accept jets
+	and particles as arguments now.
+
+2011-04-13  David Grellscheid <david.grellscheid at durham.ac.uk>
+
+	* added ATLAS 8983313: 0-lepton BSM
+
 2011-04-01  Andy Buckley  <andy at insectnation.org>
 
 	* bin/rivet-mkanalysis: Don't try to download SPIRES or HepData

Modified: trunk/include/Rivet/Jet.hh
==============================================================================
--- trunk/include/Rivet/Jet.hh	Wed Apr 13 16:17:09 2011	(r3055)
+++ trunk/include/Rivet/Jet.hh	Thu Apr 14 15:49:57 2011	(r3056)
@@ -264,6 +264,146 @@
 
   //@}
 
+  inline double deltaR(const Jet& j1, const Jet& j2,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(j1.momentum(), j2.momentum(), scheme);
+  }
+
+  inline double deltaR(const Jet& j, const Particle& p,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(j.momentum(), p.momentum(), scheme);
+  }
+
+  inline double deltaR(const Particle& p, const Jet& j,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(p.momentum(), j.momentum(), scheme);
+  }
+
+  inline double deltaR(const Jet& j, const FourMomentum& v,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(j.momentum(), v, scheme);
+  }
+
+  inline double deltaR(const Jet& j, const FourVector& v,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(j.momentum(), v, scheme);
+  }
+
+  inline double deltaR(const Jet& j, const Vector3& v) {
+    return deltaR(j.momentum(), v);
+  }
+
+  inline double deltaR(const Jet& j, double eta, double phi) {
+    return deltaR(j.momentum(), eta, phi);
+  }
+
+  inline double deltaR(const FourMomentum& v, const Jet& j,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(v, j.momentum(), scheme);
+  }
+
+  inline double deltaR(const FourVector& v, const Jet& j,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(v, j.momentum(), scheme);
+  }
+
+  inline double deltaR(const Vector3& v, const Jet& j) {
+    return deltaR(v, j.momentum());
+  }
+
+  inline double deltaR(double eta, double phi, const Jet& j) {
+    return deltaR(eta, phi, j.momentum());
+  }
+
+
+  inline double deltaPhi(const Jet& j1, const Jet& j2) {
+    return deltaPhi(j1.momentum(), j2.momentum());
+  }
+
+  inline double deltaPhi(const Jet& j, const Particle& p) {
+    return deltaPhi(j.momentum(), p.momentum());
+  }
+
+  inline double deltaPhi(const Particle& p, const Jet& j) {
+    return deltaPhi(p.momentum(), j.momentum());
+  }
+
+  inline double deltaPhi(const Jet& j, const FourMomentum& v) {
+    return deltaPhi(j.momentum(), v);
+  }
+
+  inline double deltaPhi(const Jet& j, const FourVector& v) {
+    return deltaPhi(j.momentum(), v);
+  }
+
+  inline double deltaPhi(const Jet& j, const Vector3& v) {
+    return deltaPhi(j.momentum(), v);
+  }
+
+  inline double deltaPhi(const Jet& j, double phi) {
+    return deltaPhi(j.momentum(), phi);
+  }
+
+  inline double deltaPhi(const FourMomentum& v, const Jet& j) {
+    return deltaPhi(v, j.momentum());
+  }
+
+  inline double deltaPhi(const FourVector& v, const Jet& j) {
+    return deltaPhi(v, j.momentum());
+  }
+
+  inline double deltaPhi(const Vector3& v, const Jet& j) {
+    return deltaPhi(v, j.momentum());
+  }
+
+  inline double deltaPhi(double phi, const Jet& j) {
+    return deltaPhi(phi, j.momentum());
+  }
+
+
+  inline double deltaEta(const Jet& j1, const Jet& j2) {
+    return deltaEta(j1.momentum(), j2.momentum());
+  }
+
+  inline double deltaEta(const Jet& j, const Particle& p) {
+    return deltaEta(j.momentum(), p.momentum());
+  }
+
+  inline double deltaEta(const Particle& p, const Jet& j) {
+    return deltaEta(p.momentum(), j.momentum());
+  }
+
+  inline double deltaEta(const Jet& j, const FourMomentum& v) {
+    return deltaEta(j.momentum(), v);
+  }
+
+  inline double deltaEta(const Jet& j, const FourVector& v) {
+    return deltaEta(j.momentum(), v);
+  }
+
+  inline double deltaEta(const Jet& j, const Vector3& v) {
+    return deltaEta(j.momentum(), v);
+  }
+
+  inline double deltaEta(const Jet& j, double eta) {
+    return deltaEta(j.momentum(), eta);
+  }
+
+  inline double deltaEta(const FourMomentum& v, const Jet& j) {
+    return deltaEta(v, j.momentum());
+  }
+
+  inline double deltaEta(const FourVector& v, const Jet& j) {
+    return deltaEta(v, j.momentum());
+  }
+
+  inline double deltaEta(const Vector3& v, const Jet& j) {
+    return deltaEta(v, j.momentum());
+  }
+
+  inline double deltaEta(double eta, const Jet& j) {
+    return deltaEta(eta, j.momentum());
+  }
 
 }
 

Modified: trunk/include/Rivet/Math/MathUtils.hh
==============================================================================
--- trunk/include/Rivet/Math/MathUtils.hh	Wed Apr 13 16:17:09 2011	(r3055)
+++ trunk/include/Rivet/Math/MathUtils.hh	Thu Apr 14 15:49:57 2011	(r3056)
@@ -389,6 +389,12 @@
     return mapAngle0ToPi(phi1 - phi2);
   }
 
+  /// Calculate the difference between two pseudorapidities,
+  /// returning the unsigned value.
+  inline double deltaEta(double eta1, double eta2) {
+    return fabs(eta1 - eta2);
+  }
+
   /// Calculate the distance between two points in 2D rapidity-azimuthal
   /// ("\f$ \eta-\phi \f$") space. The phi values are given in radians.
   inline double deltaR(double rap1, double phi1, double rap2, double phi2) {

Modified: trunk/include/Rivet/Math/Vector3.hh
==============================================================================
--- trunk/include/Rivet/Math/Vector3.hh	Wed Apr 13 16:17:09 2011	(r3055)
+++ trunk/include/Rivet/Math/Vector3.hh	Thu Apr 14 15:49:57 2011	(r3056)
@@ -328,6 +328,47 @@
 
   /////////////////////////////////////////////////////
 
+  /// @name \f$ |\Delta eta| \f$ calculations from 3-vectors
+  //@{
+
+  /// Calculate the difference in pseudorapidity between two spatial vectors.
+  inline double deltaEta(const Vector3& a, const Vector3& b) {
+    return deltaEta(a.pseudorapidity(), b.pseudorapidity());
+  }
+
+  /// Calculate the difference in pseudorapidity between two spatial vectors.
+  inline double deltaEta(const Vector3& v, double eta2) {
+    return deltaEta(v.pseudorapidity(), eta2);
+  }
+
+  /// Calculate the difference in pseudorapidity between two spatial vectors.
+  inline double deltaEta(double eta1, const Vector3& v) {
+    return deltaEta(eta1, v.pseudorapidity());
+  }
+
+  //@}
+
+
+  /// @name \f$ \Delta phi \f$ calculations from 3-vectors
+  //@{
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const Vector3& a, const Vector3& b) {
+    return deltaPhi(a.azimuthalAngle(), b.azimuthalAngle());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const Vector3& v, double phi2) {
+    return deltaPhi(v.azimuthalAngle(), phi2);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(double phi1, const Vector3& v) {
+    return deltaPhi(phi1, v.azimuthalAngle());
+  }
+
+  //@}
+
 
   /// @name \f$ \Delta R \f$ calculations from 3-vectors
   //@{

Modified: trunk/include/Rivet/Math/Vector4.hh
==============================================================================
--- trunk/include/Rivet/Math/Vector4.hh	Wed Apr 13 16:17:09 2011	(r3055)
+++ trunk/include/Rivet/Math/Vector4.hh	Thu Apr 14 15:49:57 2011	(r3056)
@@ -706,8 +706,195 @@
     }
   }
 
+  /// @brief Calculate the 2D rapidity-azimuthal ("eta-phi") distance between two four-vectors.
+  /// There is a scheme ambiguity for momentum-type four vectors
+  /// as to whether the pseudorapidity (a purely geometric concept) or the
+  /// rapidity (a relativistic energy-momentum quantity) is to be used: this can
+  /// be chosen via the optional scheme parameter.
+  inline double deltaR(const FourMomentum& a, const FourVector& b,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    switch (scheme) {
+    case PSEUDORAPIDITY:
+      return deltaR(a.vector3(), b.vector3());
+    case RAPIDITY:
+      return deltaR(a.rapidity(), a.azimuthalAngle(), FourMomentum(b).rapidity(), b.azimuthalAngle());
+    default:
+      throw std::runtime_error("The specified deltaR scheme is not yet implemented");
+    }
+  }
+
+  /// @brief Calculate the 2D rapidity-azimuthal ("eta-phi") distance between two four-vectors.
+  /// There is a scheme ambiguity for momentum-type four vectors
+  /// as to whether the pseudorapidity (a purely geometric concept) or the
+  /// rapidity (a relativistic energy-momentum quantity) is to be used: this can
+  /// be chosen via the optional scheme parameter.
+  inline double deltaR(const FourVector& a, const FourMomentum& b,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    switch (scheme) {
+    case PSEUDORAPIDITY:
+      return deltaR(a.vector3(), b.vector3());
+    case RAPIDITY:
+      return deltaR(FourMomentum(a).rapidity(), a.azimuthalAngle(), b.rapidity(), b.azimuthalAngle());
+    default:
+      throw std::runtime_error("The specified deltaR scheme is not yet implemented");
+    }
+  }
+
+  /// @brief Calculate the 2D rapidity-azimuthal ("eta-phi") distance between a
+  /// three-vector and a four-vector.
+  inline double deltaR(const FourMomentum& a, const Vector3& b) {
+    return deltaR(a.vector3(), b);
+  }
+
+  /// @brief Calculate the 2D rapidity-azimuthal ("eta-phi") distance between a
+  /// three-vector and a four-vector.
+  inline double deltaR(const Vector3& a, const FourMomentum& b) {
+    return deltaR(a, b.vector3());
+  }
+
+  /// @brief Calculate the 2D rapidity-azimuthal ("eta-phi") distance between a
+  /// three-vector and a four-vector.
+  inline double deltaR(const FourVector& a, const Vector3& b) {
+    return deltaR(a.vector3(), b);
+  }
+
+  /// @brief Calculate the 2D rapidity-azimuthal ("eta-phi") distance between a
+  /// three-vector and a four-vector.
+  inline double deltaR(const Vector3& a, const FourVector& b) {
+    return deltaR(a, b.vector3());
+  }
+
   //@}
 
+  /// @name \f$ \Delta phi \f$ calculations from 4-vectors
+  //@{
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourMomentum& a, const FourMomentum& b) {
+    return deltaPhi(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourMomentum& v, double phi2) {
+    return deltaPhi(v.vector3(), phi2);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(double phi1, const FourMomentum& v) {
+    return deltaPhi(phi1, v.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourVector& a, const FourVector& b) {
+    return deltaPhi(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourVector& v, double phi2) {
+    return deltaPhi(v.vector3(), phi2);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(double phi1, const FourVector& v) {
+    return deltaPhi(phi1, v.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourVector& a, const FourMomentum& b) {
+    return deltaPhi(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourMomentum& a, const FourVector& b) {
+    return deltaPhi(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourVector& a, const Vector3& b) {
+    return deltaPhi(a.vector3(), b);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const Vector3& a, const FourVector& b) {
+    return deltaPhi(a, b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const FourMomentum& a, const Vector3& b) {
+    return deltaPhi(a.vector3(), b);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaPhi(const Vector3& a, const FourMomentum& b) {
+    return deltaPhi(a, b.vector3());
+  }
+
+  //@}
+
+  /// @name \f$ |\Delta eta| \f$ calculations from 4-vectors
+  //@{
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourMomentum& a, const FourMomentum& b) {
+    return deltaEta(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourMomentum& v, double eta2) {
+    return deltaEta(v.vector3(), eta2);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(double eta1, const FourMomentum& v) {
+    return deltaEta(eta1, v.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourVector& a, const FourVector& b) {
+    return deltaEta(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourVector& v, double eta2) {
+    return deltaEta(v.vector3(), eta2);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(double eta1, const FourVector& v) {
+    return deltaEta(eta1, v.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourVector& a, const FourMomentum& b) {
+    return deltaEta(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourMomentum& a, const FourVector& b) {
+    return deltaEta(a.vector3(), b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourVector& a, const Vector3& b) {
+    return deltaEta(a.vector3(), b);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const Vector3& a, const FourVector& b) {
+    return deltaEta(a, b.vector3());
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const FourMomentum& a, const Vector3& b) {
+    return deltaEta(a.vector3(), b);
+  }
+
+  /// Calculate the difference in azimuthal angle between two spatial vectors.
+  inline double deltaEta(const Vector3& a, const FourMomentum& b) {
+    return deltaEta(a, b.vector3());
+  }
+
+  //@}
 
   //////////////////////////////////////////////////////
 

Modified: trunk/include/Rivet/Particle.hh
==============================================================================
--- trunk/include/Rivet/Particle.hh	Wed Apr 13 16:17:09 2011	(r3055)
+++ trunk/include/Rivet/Particle.hh	Thu Apr 14 15:49:57 2011	(r3056)
@@ -198,6 +198,120 @@
   }
   //@}
 
+  inline double deltaR(const Particle& p1, const Particle& p2,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(p1.momentum(), p2.momentum(), scheme);
+  }
+
+  inline double deltaR(const Particle& p, const FourMomentum& v,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(p.momentum(), v, scheme);
+  }
+
+  inline double deltaR(const Particle& p, const FourVector& v,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(p.momentum(), v, scheme);
+  }
+
+  inline double deltaR(const Particle& p, const Vector3& v) {
+    return deltaR(p.momentum(), v);
+  }
+
+  inline double deltaR(const Particle& p, double eta, double phi) {
+    return deltaR(p.momentum(), eta, phi);
+  }
+
+  inline double deltaR(const FourMomentum& v, const Particle& p,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(v, p.momentum(), scheme);
+  }
+
+  inline double deltaR(const FourVector& v, const Particle& p,
+                       RapScheme scheme = PSEUDORAPIDITY) {
+    return deltaR(v, p.momentum(), scheme);
+  }
+
+  inline double deltaR(const Vector3& v, const Particle& p) {
+    return deltaR(v, p.momentum());
+  }
+
+  inline double deltaR(double eta, double phi, const Particle& p) {
+    return deltaR(eta, phi, p.momentum());
+  }
+
+
+  inline double deltaPhi(const Particle& p1, const Particle& p2) {
+    return deltaPhi(p1.momentum(), p2.momentum());
+  }
+
+  inline double deltaPhi(const Particle& p, const FourMomentum& v) {
+    return deltaPhi(p.momentum(), v);
+  }
+
+  inline double deltaPhi(const Particle& p, const FourVector& v) {
+    return deltaPhi(p.momentum(), v);
+  }
+
+  inline double deltaPhi(const Particle& p, const Vector3& v) {
+    return deltaPhi(p.momentum(), v);
+  }
+
+  inline double deltaPhi(const Particle& p, double phi) {
+    return deltaPhi(p.momentum(), phi);
+  }
+
+  inline double deltaPhi(const FourMomentum& v, const Particle& p) {
+    return deltaPhi(v, p.momentum());
+  }
+
+  inline double deltaPhi(const FourVector& v, const Particle& p) {
+    return deltaPhi(v, p.momentum());
+  }
+
+  inline double deltaPhi(const Vector3& v, const Particle& p) {
+    return deltaPhi(v, p.momentum());
+  }
+
+  inline double deltaPhi(double phi, const Particle& p) {
+    return deltaPhi(phi, p.momentum());
+  }
+
+
+  inline double deltaEta(const Particle& p1, const Particle& p2) {
+    return deltaEta(p1.momentum(), p2.momentum());
+  }
+
+  inline double deltaEta(const Particle& p, const FourMomentum& v) {
+    return deltaEta(p.momentum(), v);
+  }
+
+  inline double deltaEta(const Particle& p, const FourVector& v) {
+    return deltaEta(p.momentum(), v);
+  }
+
+  inline double deltaEta(const Particle& p, const Vector3& v) {
+    return deltaEta(p.momentum(), v);
+  }
+
+  inline double deltaEta(const Particle& p, double eta) {
+    return deltaEta(p.momentum(), eta);
+  }
+
+  inline double deltaEta(const FourMomentum& v, const Particle& p) {
+    return deltaEta(v, p.momentum());
+  }
+
+  inline double deltaEta(const FourVector& v, const Particle& p) {
+    return deltaEta(v, p.momentum());
+  }
+
+  inline double deltaEta(const Vector3& v, const Particle& p) {
+    return deltaEta(v, p.momentum());
+  }
+
+  inline double deltaEta(double eta, const Particle& p) {
+    return deltaEta(eta, p.momentum());
+  }
 
 }
 


More information about the Rivet-svn mailing list