[Rivet-svn] rivet: Use std::function in expanded method signatures on JetAlg.

Rivet Mercurial rivet at projects.hepforge.org
Wed Jan 18 00:45:02 GMT 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/91107f717f9c
branches:  release-2-5-x
changeset: 5669:91107f717f9c
user:      Andy Buckley <andy at insectnation.org>
date:      Wed Jan 18 00:42:46 2017 +0000
description:
Use std::function in expanded method signatures on JetAlg.

diffs (truncated from 193 to 50 lines):

--- a/ChangeLog	Mon Jan 16 21:26:17 2017 +0000
+++ b/ChangeLog	Wed Jan 18 00:42:46 2017 +0000
@@ -1,3 +1,7 @@
+2017-01-18  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Use std::function in functor-expanded method signatures on JetAlg.
+
 2017-01-16  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Convert FinalState particles() accessors to use std::function
--- a/include/Rivet/Projections/JetAlg.hh	Mon Jan 16 21:26:17 2017 +0000
+++ b/include/Rivet/Projections/JetAlg.hh	Wed Jan 18 00:42:46 2017 +0000
@@ -80,10 +80,10 @@
     /// @name Access to jet objects
     //@{
 
-    /// Get jets in no guaranteed order, with optional cuts on \f$ p_\perp \f$ and rapidity.
+    /// Get jets in no guaranteed order, with an optional Cut
     /// @note Returns a copy rather than a reference, due to cuts
     virtual Jets jets(const Cut& c=Cuts::open()) const {
-      return filterBy(_jets(), c);
+      return filter_select(_jets(), c);
       // const Jets rawjets = _jets();
       // // Just return a copy of rawjets if the cut is open
       // if (c == Cuts::open()) return rawjets;
@@ -96,24 +96,39 @@
       // return rtn;
     }
 
+    /// Get jets in no guaranteed order, with a selection functor
+    /// @note Returns a copy rather than a reference, due to cuts
+    virtual Jets jets(const JetSelector& selector) const {
+      return filter_select(_jets(), selector);
+    }
 
-    /// @todo Want to add a general filtering function, but that clashes with the sorting functor... SFINAE?
 
-
-    /// Get the jets, ordered by supplied sorting function object, with optional cuts on \f$ p_\perp \f$ and rapidity.
+    /// Get the jets with a Cut applied, and ordered by supplied sorting functor
     /// @note Returns a copy rather than a reference, due to cuts and sorting
-    template <typename F>
-    Jets jets(F sorter, const Cut& c=Cuts::open()) const {
+    Jets jets(const Cut& c, const JetSorter& sorter) const {
       /// @todo Will the vector be efficiently std::move'd by value through this function chain?
       return sortBy(jets(c), sorter);
     }
 
+    /// Get the jets, ordered by supplied sorting functor, with an optional Cut
+    /// @note Returns a copy rather than a reference, due to cuts and sorting


More information about the Rivet-svn mailing list