[Rivet-svn] rivet: Make Particles and Jets into actual specialisations of st...

Rivet Mercurial rivet at projects.hepforge.org
Sun May 20 22:00:02 BST 2018


details:   https://rivet.hepforge.org/hg/rivet/rev/5b2baf1011f6
branches:  release-2-6-x
changeset: 6292:5b2baf1011f6
user:      Andy Buckley <andy at insectnation.org>
date:      Sun May 20 21:58:36 2018 +0100
description:
Make Particles and Jets into actual specialisations of std::vector rather than typedefs, and update surrounding classes to use them. The specialisations can implicitly cast to vectors of FourMomentum (and maybe Pseudojet).

diffs (truncated from 442 to 50 lines):

--- a/ChangeLog	Fri May 18 16:14:56 2018 +0100
+++ b/ChangeLog	Sun May 20 21:58:36 2018 +0100
@@ -1,3 +1,10 @@
+2018-05-20  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Make Particles and Jets into actual specialisations of
+	std::vector rather than typedefs, and update surrounding classes
+	to use them. The specialisations can implicitly cast to vectors of
+	FourMomentum (and maybe Pseudojet).
+
 2018-05-18  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Make CmpAnaHandle::operator() const, for GCC 8 (thanks to CMS)
--- a/include/Rivet/Jet.fhh	Fri May 18 16:14:56 2018 +0100
+++ b/include/Rivet/Jet.fhh	Sun May 20 21:58:36 2018 +0100
@@ -4,6 +4,7 @@
 
 #include "Rivet/Tools/RivetSTL.hh"
 #include "Rivet/Tools/RivetFastJet.hh"
+#include "Rivet/Math/Vectors.hh"
 
 namespace Rivet {
 
@@ -14,9 +15,16 @@
   // Forward declaration
   class Jet;
 
-  /// Typedef for a collection of Jet objects.
-  typedef std::vector<Jet> Jets;
-
+  /// A collection of Jet objects.
+  class Jets : public std::vector<Jet> {
+  public:
+    using base = std::vector<Jet>; //< using-declarations don't like template syntax
+    using base::base; //< import base-class constructors
+    /// Add copy constructor from vector<Jet>
+    operator FourMomenta () const; //< implementation in Jet.cc
+    /// @todo Add conversion to PseudoJets
+  };
+  Jets operator + (const Jets& a, const Jets& b);
   //@}
 
 
--- a/include/Rivet/Particle.fhh	Fri May 18 16:14:56 2018 +0100
+++ b/include/Rivet/Particle.fhh	Sun May 20 21:58:36 2018 +0100
@@ -3,6 +3,7 @@
 #define RIVET_Particle_FHH
 
 #include "Rivet/Tools/RivetSTL.hh"
+#include "Rivet/Math/Vectors.hh"


More information about the Rivet-svn mailing list