[Rivet-svn] rivet: 4 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Tue Jun 27 17:30:02 BST 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/f78c1be82800
branches:  
changeset: 5909:f78c1be82800
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Jun 27 17:16:24 2017 +0100
description:
More type cleanup

details:   https://rivet.hepforge.org/hg/rivet/rev/a74280c2ef9a
branches:  
changeset: 5910:a74280c2ef9a
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Jun 27 17:16:54 2017 +0100
description:
Extend and add more aliases to CmpState enum

details:   https://rivet.hepforge.org/hg/rivet/rev/9ddcc457deb3
branches:  
changeset: 5911:9ddcc457deb3
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Jun 27 17:17:27 2017 +0100
description:
Add a ParticleSmearFn::cmp() method, using get_address

details:   https://rivet.hepforge.org/hg/rivet/rev/4b462ee321c1
branches:  
changeset: 5912:4b462ee321c1
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Jun 27 17:17:46 2017 +0100
description:
Implement SmearedParticles compare function

diffs (truncated from 105 to 50 lines):

--- a/include/Rivet/Projections/SmearedJets.hh	Tue Jun 27 12:18:48 2017 +0100
+++ b/include/Rivet/Projections/SmearedJets.hh	Tue Jun 27 17:17:46 2017 +0100
@@ -155,10 +155,10 @@
     Jets _recojets;
 
     /// Stored efficiency functions
-    std::function<double(const Jet&)> _jetEffFn, _bTagEffFn, _cTagEffFn;
+    JetEffFn _jetEffFn, _bTagEffFn, _cTagEffFn;
 
     /// Stored smearing function
-    std::function<Jet(const Jet&)> _jetSmearFn;
+    JetSmearFn _jetSmearFn;
 
   };
 
--- a/include/Rivet/Projections/SmearedParticles.hh	Tue Jun 27 12:18:48 2017 +0100
+++ b/include/Rivet/Projections/SmearedParticles.hh	Tue Jun 27 17:17:46 2017 +0100
@@ -111,28 +111,20 @@
 
     /// Compare to another SmearedParticles
     int compare(const Projection& p) const {
-      /// @todo Need to implement the comparison operator on the *EffSmearFn structs
-      return UNDEFINED;
+      // Compare truth particles definitions
+      const int teq = mkPCmp(p, "TruthParticles");
+      if (teq != EQUIVALENT) return UNEQUAL;
 
-      /// STD::FUNCTION VERSION
-      // const SmearedParticles& other = dynamic_cast<const SmearedParticles&>(p);
-      // if (get_address(_detFns[0]) == 0) return UNDEFINED;
-      // MSG_TRACE("hashes = ");
-      // for (size_t i = 0; i < _detFns.size(); ++i)
-      //   MSG_TRACE( get_address(_detFns[i]) << "," << get_address(other._detFns[i]) << "; ");
-      // Cmp<unsigned long> ret = mkPCmp(other, "TruthParticles");
-      // for (size_t i = 0; i < _detFns.size(); ++i)
-      //   ret = ret || cmp(get_address(_detFns[i]), get_address(other._detFns[i]));
-      // return ret;
+      // Compare lists of detector functions
+      const SmearedParticles& other = dynamic_cast<const SmearedParticles&>(p);
+      if (_detFns.size() != other._detFns.size()) return UNEQUAL;
+      for (size_t i = 0; i < _detFns.size(); ++i) {
+        const int feq = _detFns[i].cmp(other._detFns[i]);
+        if (feq != EQUIVALENT) return UNEQUAL;
+      }
 
-      /// OLD VERSION
-      // if (get_address(_effFn) == 0) return UNDEFINED;
-      // if (get_address(_smearFn) == 0) return UNDEFINED;
-      // MSG_TRACE("Eff hashes = " << get_address(_effFn) << "," << get_address(other._effFn) << "; " <<
-      //           "smear hashes = " << get_address(_smearFn) << "," << get_address(other._smearFn));


More information about the Rivet-svn mailing list