|
[Rivet-svn] rivet: 2 new changesetsRivet Mercurial rivet at projects.hepforge.orgTue Aug 23 00:30:02 BST 2016
details: https://rivet.hepforge.org/hg/rivet/rev/8f1a62a0f1e8 branches: release-2-5-x changeset: 5419:8f1a62a0f1e8 user: Andy Buckley <andy at insectnation.org> date: Mon Aug 22 22:59:11 2016 +0100 description: Add efffilt() functions and Particle/JetEffFilt functors to SmearingFunctions.hh details: https://rivet.hepforge.org/hg/rivet/rev/e5178ffbb67b branches: release-2-5-x changeset: 5420:e5178ffbb67b user: Andy Buckley <andy at insectnation.org> date: Tue Aug 23 00:16:30 2016 +0100 description: Add ATLAS Run 2 loose electron ID efficiency diffs (truncated from 84 to 50 lines): --- a/ChangeLog Sat Aug 20 14:13:48 2016 +0100 +++ b/ChangeLog Tue Aug 23 00:16:30 2016 +0100 @@ -1,3 +1,7 @@ +2016-08-22 Andy Buckley <andy.buckley at cern.ch> + + * Add efffilt() functions and Particle/JetEffFilt functors to SmearingFunctions.hh + 2016-08-20 Andy Buckley <andy.buckley at cern.ch> * Adding filterBy methods for Particle and Jet which accept --- a/include/Rivet/Tools/SmearingFunctions.hh Sat Aug 20 14:13:48 2016 +0100 +++ b/include/Rivet/Tools/SmearingFunctions.hh Tue Aug 23 00:16:30 2016 +0100 @@ -9,6 +9,9 @@ namespace Rivet { + /// @name Random number and filtering utils + //@{ + /// Return a uniformly sampled random number between 0 and 1 /// @todo Move to (math?)utils /// @todo Need to isolate random generators to a single thread @@ -19,6 +22,33 @@ return generate_canonical<double, 10>(gen); } + template <typename FN> + inline bool efffilt(const Particle& p, FN& feff) { + return rand01() < feff(p); + } + template <typename FN> + inline bool efffilt(const Jet& j, FN& feff) { + return rand01() < feff(j); + } + + struct ParticleEffFilter { + template <typename FN> + ParticleEffFilter(const FN& feff) : _feff(feff) {} + bool operator () (const Particle& p) { return efffilt(p, _feff); } + private: + const std::function<bool(const Particle&)> _feff; + }; + + struct JetEffFilter { + template <typename FN> + JetEffFilter(const FN& feff) : _feff(feff) {} + bool operator () (const Jet& j) { return efffilt(j, _feff); } + private: + const std::function<bool(const Jet&)> _feff; + };
More information about the Rivet-svn mailing list |