[Rivet-svn] r3407 - in branches/2011-07-aida2yoda: . include/Rivet include/Rivet/Projections include/Rivet/Tools src/Projections test

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Oct 6 12:11:59 BST 2011


Author: hoeth
Date: Thu Oct  6 12:11:57 2011
New Revision: 3407

Log:
reverting c3336, because it did not compile

Added:
   branches/2011-07-aida2yoda/include/Rivet/Projections/PVertex.hh
      - copied unchanged from r3335, branches/2011-07-aida2yoda/include/Rivet/Projections/PVertex.hh
   branches/2011-07-aida2yoda/src/Projections/PVertex.cc
      - copied unchanged from r3335, branches/2011-07-aida2yoda/src/Projections/PVertex.cc
Modified:
   branches/2011-07-aida2yoda/ChangeLog
   branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh
   branches/2011-07-aida2yoda/include/Rivet/Makefile.am
   branches/2011-07-aida2yoda/include/Rivet/Rivet.hh
   branches/2011-07-aida2yoda/include/Rivet/Tools/Utils.hh
   branches/2011-07-aida2yoda/src/Projections/Makefile.am
   branches/2011-07-aida2yoda/test/testApi.cc

Modified: branches/2011-07-aida2yoda/ChangeLog
==============================================================================
--- branches/2011-07-aida2yoda/ChangeLog	Tue Oct  4 13:21:33 2011	(r3406)
+++ branches/2011-07-aida2yoda/ChangeLog	Thu Oct  6 12:11:57 2011	(r3407)
@@ -1,9 +1,7 @@
 2011-08-26  Andy Buckley  <andy at insectnation.org>
 
-	* Removing deprecated features: the setBeams(...) method on
-	Analysis, the MaxRapidity constant, the split(...) function, the
-	default init() method from AnalysisHandler and its test, and the
-	deprecated TotalVisibleMomentum and PVertex projections.
+	* Removing deprecated setBeams method from Analysis, and the
+	deprecated TotalVisibleMomentum projection.
 
 2011-08-23  Andy Buckley  <andy at insectnation.org>
 

Modified: branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh	Tue Oct  4 13:21:33 2011	(r3406)
+++ branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh	Thu Oct  6 12:11:57 2011	(r3407)
@@ -152,6 +152,10 @@
     /// @name Main init/execute/finalise
     //@{
 
+    /// @deprecated Obsolete method, kept only for backwards compatibility
+    void init() {}
+
+
     /// Initialize a run, with the run beams taken from the example event.
     void init(const GenEvent& event);
 
@@ -167,11 +171,9 @@
 
     //@}
 
-
     /// Write all analyses' plots to the named file.
     void writeData(const std::string& filename);
 
-
   private:
 
     /// The collection of Analysis objects to be used.

Modified: branches/2011-07-aida2yoda/include/Rivet/Makefile.am
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/Makefile.am	Tue Oct  4 13:21:33 2011	(r3406)
+++ branches/2011-07-aida2yoda/include/Rivet/Makefile.am	Thu Oct  6 12:11:57 2011	(r3407)
@@ -64,6 +64,7 @@
   Projections/Multiplicity.hh   \
   Projections/NeutralFinalState.hh \
   Projections/ParisiTensor.hh   \
+  Projections/PVertex.hh        \
   Projections/Sphericity.hh     \
   Projections/Spherocity.hh     \
   Projections/SVertex.hh	    \

Copied: branches/2011-07-aida2yoda/include/Rivet/Projections/PVertex.hh (from r3335, branches/2011-07-aida2yoda/include/Rivet/Projections/PVertex.hh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2011-07-aida2yoda/include/Rivet/Projections/PVertex.hh	Thu Oct  6 12:11:57 2011	(r3407, copy of r3335, branches/2011-07-aida2yoda/include/Rivet/Projections/PVertex.hh)
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+#ifndef RIVET_PVertex_HH
+#define RIVET_PVertex_HH
+
+#include "Rivet/Projection.hh"
+#include "Rivet/Event.hh"
+#include "Rivet/Particle.hh"
+
+namespace Rivet {
+
+
+  /// @brief Get the position of the primary vertex of an event.
+  ///
+  /// HepMC doesn't reliably return the signal process vertex, so
+  /// we have to use the "decay vertex" of the beam particles.
+  /// This gives the right position, within experimental resolution,
+  /// but ISR effects can mean that the actual vertex is not right.
+  /// Hence, we don't expose the HepMC GenVertex directly - if it were
+  /// available, people might try to e.g. look at the \f$ p_T \f$
+  /// of the vertex children, which would be extremely unreliable.
+  ///
+  /// @deprecated This should hardly ever be required for MC studies, and is not necessarily reliable!
+  class PVertex : public Projection {
+  public:
+
+    /// @name Standard constructors and destructors.
+    //@{
+
+    /// The default constructor.
+    PVertex()
+      : _thePVertex(0)
+    {
+      setName("PVertex");
+    }
+
+    /// Clone on the heap.
+    virtual const Projection* clone() const {
+      return new PVertex(*this);
+    }
+    //@}
+
+
+    /// Get the primary vertex position.
+    const Vector3 position() const {
+      if (_thePVertex != 0) return Vector3(_thePVertex->position());
+      return Vector3(0,0,0);
+    }
+
+
+  protected:
+
+    /// Do the projection.
+    void project(const Event& e);
+
+
+    /// Compare projections.
+    int compare(const Projection& UNUSED(p)) const {
+      return EQUIVALENT;
+    }
+
+
+  private:
+
+    /// The Primary Vertex in the current collision.
+    GenVertex* _thePVertex;
+
+  };
+
+}
+
+#endif

Modified: branches/2011-07-aida2yoda/include/Rivet/Rivet.hh
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/Rivet.hh	Tue Oct  4 13:21:33 2011	(r3406)
+++ branches/2011-07-aida2yoda/include/Rivet/Rivet.hh	Thu Oct  6 12:11:57 2011	(r3407)
@@ -22,6 +22,8 @@
 
   /// A sensible default maximum value of rapidity for Rivet analyses to use.
   static const double MAXRAPIDITY = 100000.0;
+  /// @deprecated
+  static const double MaxRapidity = 100000.0;
 
   /// A function to get the Rivet version string
   string version();

Modified: branches/2011-07-aida2yoda/include/Rivet/Tools/Utils.hh
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/Tools/Utils.hh	Tue Oct  4 13:21:33 2011	(r3406)
+++ branches/2011-07-aida2yoda/include/Rivet/Tools/Utils.hh	Thu Oct  6 12:11:57 2011	(r3407)
@@ -74,6 +74,10 @@
     return dirs;
   }
 
+  /// @deprecated Use @c pathsplit instead.
+  inline vector<string> split(const string& path, const string& UNUSED(delim) = ":") {
+    return pathsplit(path);
+  }
 
   /// @brief Join several filesystem paths together with a delimiter character.
   /// Note that this does NOT join path elements together with a platform-portable

Modified: branches/2011-07-aida2yoda/src/Projections/Makefile.am
==============================================================================
--- branches/2011-07-aida2yoda/src/Projections/Makefile.am	Tue Oct  4 13:21:33 2011	(r3406)
+++ branches/2011-07-aida2yoda/src/Projections/Makefile.am	Thu Oct  6 12:11:57 2011	(r3407)
@@ -27,6 +27,7 @@
   Multiplicity.cc \
   NeutralFinalState.cc \
   ParisiTensor.cc \
+  PVertex.cc \
   Sphericity.cc \
   Spherocity.cc \
   SVertex.cc \

Copied: branches/2011-07-aida2yoda/src/Projections/PVertex.cc (from r3335, branches/2011-07-aida2yoda/src/Projections/PVertex.cc)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2011-07-aida2yoda/src/Projections/PVertex.cc	Thu Oct  6 12:11:57 2011	(r3407, copy of r3335, branches/2011-07-aida2yoda/src/Projections/PVertex.cc)
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+#include "Rivet/Rivet.hh"
+#include "Rivet/Projections/PVertex.hh"
+#include "HepMC/GenVertex.h"
+#include "HepMC/GenEvent.h"
+
+namespace Rivet {
+
+
+  void PVertex::project(const Event& e) {
+    // We'll *try* to do it right, in case any generators are doing the right thing...
+    _thePVertex = e.genEvent().signal_process_vertex();
+    getLog() << Log::DEBUG << "PVertex ptr from HepMC = " << _thePVertex << endl;
+    if (!_thePVertex) {
+      // Since no signal vertices are filled in existing Fortran & C++ MC's,
+      // the decay vertex from first vertex in event with 2 incoming particles
+   
+      HepMC::GenEvent::vertex_const_iterator vIt = e.genEvent().vertices_begin();
+      while((*vIt)->particles_in_size() != 2 && vIt != e.genEvent().vertices_end()){
+        ++vIt;
+      }
+   
+      if(vIt != e.genEvent().vertices_end()) _thePVertex = *vIt;
+    }
+    assert(_thePVertex);
+    const unsigned int pVertexParticleSize = _thePVertex->particles_in_size();
+    if (pVertexParticleSize != 2 ) {
+      stringstream ss;
+      ss << "Wrong number of Primary Vertex particles: " << pVertexParticleSize;
+      throw Error(ss.str());
+    }
+  }
+
+
+}

Modified: branches/2011-07-aida2yoda/test/testApi.cc
==============================================================================
--- branches/2011-07-aida2yoda/test/testApi.cc	Tue Oct  4 13:21:33 2011	(r3406)
+++ branches/2011-07-aida2yoda/test/testApi.cc	Thu Oct  6 12:11:57 2011	(r3407)
@@ -16,6 +16,9 @@
   vector<string> moreanalyses(1, "MC_JETS");
   rivet.addAnalyses(moreanalyses);
 
+  // Initialise: obsolete, but allowed for compatibility
+  rivet.init();
+
   std::istream* file = new std::fstream("testApi.hepmc", std::ios::in);
   HepMC::IO_GenEvent hepmcio(*file);
   HepMC::GenEvent* evt = hepmcio.read_next_event();


More information about the Rivet-svn mailing list