[Rivet-svn] rivet: Remove const-ref unsafe access methods (not used anywhere)

Rivet Mercurial rivet at projects.hepforge.org
Fri Jun 22 19:45:01 BST 2018


details:   https://rivet.hepforge.org/hg/rivet/rev/c699ebb6bfcf
branches:  release-2-6-x
changeset: 6343:c699ebb6bfcf
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Fri Jun 22 19:42:46 2018 +0100
description:
Remove const-ref unsafe access methods (not used anywhere)

diffs (truncated from 54 to 50 lines):

--- a/include/Rivet/Projections/ZFinder.hh	Fri Jun 22 18:51:03 2018 +0100
+++ b/include/Rivet/Projections/ZFinder.hh	Fri Jun 22 19:42:46 2018 +0100
@@ -80,22 +80,8 @@
     /// For example, to make more fine-grained cuts on the clustered leptons.
     /// The positive charge constituent is first in the list (if not empty), and
     /// the negative one second.
-    Particles constituentLeptons() const;
-    Particles constituents() const { return constituentLeptons(); }
-
-
-    /// Access to the Z constituent clustered leptons, sorted by a comparison functor
-    ///
-    /// Unlike the no-arg version, this returns by value (i.e. is less efficient)
-    Particles constituentLeptons(const ParticleSorter& cmp) const;
-    Particles constituents(const ParticleSorter& cmp) const { return constituentLeptons(cmp); }
-
-
-    // /// Access to all DressedLeptons in the fiducial region.
-    // ///
-    // /// This includes those DressedLeptons that could not
-    // /// be paired up with any other DressedLepton to form a Z candidate.
-    // const vector<DressedLepton>& allLeptons() const { return _allLeptons; }
+    const Particles & constituentLeptons() const;
+    const Particles & constituents() const { return constituentLeptons(); }
 
     /// Access to the particles other than the Z leptons and clustered photons
     ///
--- a/src/Projections/ZFinder.cc	Fri Jun 22 18:51:03 2018 +0100
+++ b/src/Projections/ZFinder.cc	Fri Jun 22 19:42:46 2018 +0100
@@ -57,21 +57,12 @@
 
 
 
-  Particles ZFinder::constituentLeptons() const {
-    /// @note Ugly -- if there's no boson, the user should already have
-    /// stopped. Being forced to return by value because of an edge case which
-    /// is anyway wrong = yuck
-    if (empty()) return Particles();
+  const Particles & ZFinder::constituentLeptons() const {
+    static const Particles none;
+    if (empty()) return none;
     return boson().constituents();
-    // return boson().constituents(isChargedLepton);
   }
 
-
-  Particles ZFinder::constituentLeptons(const ParticleSorter& cmp) const {
-    return sortBy(constituentLeptons(), cmp);
-  }
-


More information about the Rivet-svn mailing list