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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Jun 1 18:26:06 BST 2011


Author: hoeth
Date: Wed Jun  1 18:26:06 2011
New Revision: 3116

Log:
Added BeamThrust projection

Added:
   trunk/include/Rivet/Projections/BeamThrust.hh
   trunk/src/Projections/BeamThrust.cc
Modified:
   trunk/ChangeLog
   trunk/include/Rivet/Makefile.am
   trunk/src/Projections/Makefile.am

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Wed Jun  1 18:20:41 2011	(r3115)
+++ trunk/ChangeLog	Wed Jun  1 18:26:06 2011	(r3116)
@@ -1,3 +1,7 @@
+2011-06-01  Hendrik Hoeth <hendrik.hoeth at cern.ch>
+
+	* Add BeamThrust projection
+
 2011-05-31  Hendrik Hoeth <hendrik.hoeth at cern.ch>
 
 	* Fix LIBS for fastjet-3.0

Modified: trunk/include/Rivet/Makefile.am
==============================================================================
--- trunk/include/Rivet/Makefile.am	Wed Jun  1 18:20:41 2011	(r3115)
+++ trunk/include/Rivet/Makefile.am	Wed Jun  1 18:26:06 2011	(r3116)
@@ -33,6 +33,7 @@
 nobase_pkginclude_HEADERS +=   \
   Projections/AxesDefinition.hh \
   Projections/Beam.hh           \
+  Projections/BeamThrust.hh     \
   Projections/CentralEtHCM.hh   \
   Projections/ChargedFinalState.hh \
   Projections/ChargedLeptons.hh \

Added: trunk/include/Rivet/Projections/BeamThrust.hh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/include/Rivet/Projections/BeamThrust.hh	Wed Jun  1 18:26:06 2011	(r3116)
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+#ifndef RIVET_BeamThrust_HH
+#define RIVET_BeamThrust_HH
+
+#include "Rivet/Projection.hh"
+#include "Rivet/Projections/FinalState.hh"
+#include "Rivet/Event.hh"
+
+namespace Rivet {
+
+  class BeamThrust : public Projection {
+  public:
+
+    /// Constructor.
+    BeamThrust() {}
+
+    BeamThrust(const FinalState& fsp) {
+      setName("BeamThrust");
+      addProjection(fsp, "FS");
+    }
+
+    /// Clone on the heap.
+    virtual const Projection* clone() const {
+      return new BeamThrust(*this);
+    }
+
+  protected:
+
+    /// Perform the projection on the Event
+    void project(const Event& e) {
+      const vector<Particle> ps
+        = applyProjection<FinalState>(e, "FS").particles();
+      calc(ps);
+    }
+
+    /// Compare projections
+    int compare(const Projection& p) const {
+      return mkNamedPCmp(p, "FS");
+    }
+
+
+  public:
+
+    double beamthrust() const { return _beamthrust; }
+
+  public:
+
+    /// @name Direct methods
+    /// Ways to do the calculation directly, without engaging the caching system
+    //@{
+
+    /// Manually calculate the beamthrust, without engaging the caching system
+    void calc(const FinalState& fs);
+
+    /// Manually calculate the beamthrust, without engaging the caching system
+    void calc(const vector<Particle>& fsparticles);
+
+    /// Manually calculate the beamthrust, without engaging the caching system
+    void calc(const vector<FourMomentum>& fsmomenta);
+
+    //@}
+
+
+  private:
+
+    /// The beamthrust scalar.
+    double _beamthrust;
+
+  private:
+
+    /// Explicitly calculate the beamthrust values.
+    void _calcBeamThrust(const vector<FourMomentum>& fsmomenta);
+
+  };
+
+}
+
+#endif

Added: trunk/src/Projections/BeamThrust.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/src/Projections/BeamThrust.cc	Wed Jun  1 18:26:06 2011	(r3116)
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+#include "Rivet/Rivet.hh"
+#include "Rivet/Projections/BeamThrust.hh"
+#include "Rivet/Tools/Logging.hh"
+
+
+namespace Rivet {
+
+
+  void BeamThrust::calc(const FinalState& fs) {
+    calc(fs.particles());
+  }
+
+  void BeamThrust::calc(const vector<Particle>& fsparticles) {
+    vector<FourMomentum> fsmomenta;
+    fsmomenta.reserve(fsparticles.size());
+    foreach (const Particle& p, fsparticles) {
+      const FourMomentum p4 = p.momentum();
+      fsmomenta.push_back(p4);
+    }
+    _calcBeamThrust(fsmomenta);
+  }
+
+  void BeamThrust::calc(const vector<FourMomentum>& fsmomenta) {
+    _calcBeamThrust(fsmomenta);
+  }
+
+  /////////////////////////////////////////////////
+
+  // Do the full calculation
+  void BeamThrust::_calcBeamThrust(const vector<FourMomentum>& fsmomenta) {
+    _beamthrust = 0.;
+    foreach (const FourMomentum& p, fsmomenta) {
+      _beamthrust += p.E() - fabs(p.z());
+    }
+  }
+
+}

Modified: trunk/src/Projections/Makefile.am
==============================================================================
--- trunk/src/Projections/Makefile.am	Wed Jun  1 18:20:41 2011	(r3115)
+++ trunk/src/Projections/Makefile.am	Wed Jun  1 18:26:06 2011	(r3116)
@@ -1,6 +1,7 @@
 noinst_LTLIBRARIES = libRivetProjections.la
 libRivetProjections_la_SOURCES = \
   Beam.cc \
+  BeamThrust.cc \
   ChargedFinalState.cc \
   ChargedLeptons.cc \
   CentralEtHCM.cc \


More information about the Rivet-svn mailing list