[Rivet-svn] rivet: 4 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Tue Apr 19 12:45:02 BST 2016


details:   https://rivet.hepforge.org/hg/rivet/rev/936d609cbc50
branches:  
changeset: 5167:936d609cbc50
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Apr 19 11:11:08 2016 +0100
description:
Improve/fix std::function address decoding

details:   https://rivet.hepforge.org/hg/rivet/rev/f130869f034b
branches:  
changeset: 5168:f130869f034b
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Apr 19 11:11:26 2016 +0100
description:
Just committing to preserve some debug code

details:   https://rivet.hepforge.org/hg/rivet/rev/de9ec21bb9fc
branches:  
changeset: 5169:de9ec21bb9fc
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Apr 19 11:12:52 2016 +0100
description:
Removing debug stuff

details:   https://rivet.hepforge.org/hg/rivet/rev/31938d99ea0f
branches:  
changeset: 5170:31938d99ea0f
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Apr 19 11:44:18 2016 +0100
description:
Move getaddr functions into a central get_address(std::function) in RivetSTL.hh

diffs (truncated from 170 to 50 lines):

--- a/include/Rivet/Projections/SmearedJets.hh	Mon Apr 18 22:32:59 2016 +0100
+++ b/include/Rivet/Projections/SmearedJets.hh	Tue Apr 19 11:44:18 2016 +0100
@@ -76,13 +76,17 @@
     /// Compare to another SmearedJets
     int compare(const Projection& p) const {
       const SmearedJets& other = dynamic_cast<const SmearedJets&>(p);
-      if (_mkhash(_jetEffFn) == 0) return UNDEFINED;
-      if (_mkhash(_bTagEffFn) == 0) return UNDEFINED;
-      if (_mkhash(_cTagEffFn) == 0) return UNDEFINED;
-      if (_mkhash(_jetSmearFn) == 0) return UNDEFINED;
+      if (get_address(_jetEffFn) == 0) return UNDEFINED;
+      if (get_address(_bTagEffFn) == 0) return UNDEFINED;
+      if (get_address(_cTagEffFn) == 0) return UNDEFINED;
+      if (get_address(_jetSmearFn) == 0) return UNDEFINED;
+      MSG_TRACE("Eff hashes = " << get_address(_jetEffFn) << "," << get_address(other._jetEffFn) << "; " <<
+                "smear hashes = " << get_address(_jetSmearFn) << "," << get_address(other._jetSmearFn) << "; " <<
+                "b-tag hashes = " << get_address(_bTagEffFn) << "," << get_address(other._bTagEffFn) << "; " <<
+                "c-tag hashes = " << get_address(_cTagEffFn) << "," << get_address(other._cTagEffFn));
       return
-        cmp(_mkhash(_jetEffFn), _mkhash(other._jetEffFn)) || cmp(_mkhash(_jetSmearFn), _mkhash(other._jetSmearFn)) ||
-        cmp(_mkhash(_bTagEffFn), _mkhash(other._bTagEffFn)) || cmp(_mkhash(_cTagEffFn), _mkhash(other._cTagEffFn));
+        cmp(get_address(_jetEffFn), get_address(other._jetEffFn)) || cmp(get_address(_jetSmearFn), get_address(other._jetSmearFn)) ||
+        cmp(get_address(_bTagEffFn), get_address(other._bTagEffFn)) || cmp(get_address(_cTagEffFn), get_address(other._cTagEffFn));
     }
 
 
@@ -94,7 +98,7 @@
       for (const Jet& j : truthjets) {
         const double jeff = (_jetEffFn) ? _jetEffFn(j) : 1;
         MSG_DEBUG("Efficiency of jet " << j.mom() << " = " << 100*jeff << "%");
-        MSG_DEBUG("Efficiency of jet with mom=" << j.mom()/GeV << "GeV, "
+        MSG_DEBUG("Efficiency of jet with mom=" << j.mom()/GeV << " GeV, "
                   << "pT=" << j.pT()/GeV << ", eta=" << j.eta()
                   << " : " << 100*jeff << "%");
         if (jeff == 0) continue; //< no need to roll expensive dice
@@ -128,25 +132,11 @@
 
   private:
 
-    /// Make a hash integer from the provided wrapped Jet -> double function
-    size_t _mkhash(const std::function<double(const Jet&)>& fn) const {
-      const size_t rtn = reinterpret_cast<size_t>(fn.target<double(*)(const Jet&)>());
-      MSG_TRACE("J2D hash = " << rtn);
-      return rtn;
-    }
-
-    /// Make a hash integer from the provided wrapped Jet -> Jet function
-    size_t _mkhash(const std::function<Jet(const Jet&)>& fn) const {
-      const size_t rtn = reinterpret_cast<size_t>(fn.target<Jet(*)(const Jet&)>());
-      MSG_TRACE("J2J hash = " << rtn);


More information about the Rivet-svn mailing list