|
[Rivet-svn] rivet: Add templated FN filtering arg versions of the Jet::*Tags...Rivet Mercurial rivet at projects.hepforge.orgTue Sep 20 00:30:02 BST 2016
details: https://rivet.hepforge.org/hg/rivet/rev/95b1fec6a0a6 branches: release-2-5-x changeset: 5498:95b1fec6a0a6 user: Andy Buckley <andy at insectnation.org> date: Tue Sep 20 00:26:19 2016 +0100 description: Add templated FN filtering arg versions of the Jet::*Tags() and ::*Tagged() functions. diffs (truncated from 122 to 50 lines): --- a/ChangeLog Mon Sep 19 13:33:22 2016 +0100 +++ b/ChangeLog Tue Sep 20 00:26:19 2016 +0100 @@ -1,3 +1,8 @@ +2016-09-20 Andy Buckley <andy.buckley at cern.ch> + + * Add templated FN filtering arg versions of the Jet::*Tags() and + Jet::*Tagged() functions. + 2016-09-18 Andy Buckley <andy.buckley at cern.ch> * Add CMS partonic top analysis (CMS_2015_I1397174) --- a/include/Rivet/Jet.hh Mon Sep 19 13:33:22 2016 +0100 +++ b/include/Rivet/Jet.hh Tue Sep 20 00:26:19 2016 +0100 @@ -6,6 +6,7 @@ #include "Rivet/Jet.fhh" #include "Rivet/Particle.hh" #include "Rivet/Tools/Cuts.hh" +#include "Rivet/Tools/Utils.hh" #include "Rivet/Tools/RivetFastJet.hh" #include "Rivet/Math/LorentzTrans.hh" #include <numeric> @@ -91,6 +92,11 @@ Particles& tags() { return _tags; } /// @brief Particles which have been tag-matched to this jet (const version) const Particles& tags() const { return _tags; } + /// @brief Particles which have been tag-matched to this jet _and_ pass a selector function + /// + /// @note Note the less efficient return by value, due to the filtering. + template <typename FN> + Particles tags(const FN& f) const { return filter_select(tags(), f); } /// @brief Particles which have been tag-matched to this jet _and_ pass a Cut /// /// @note Note the less efficient return by value, due to the cut-pass filtering. @@ -101,24 +107,45 @@ /// /// The default jet finding adds b-hadron tags by ghost association. Particles bTags(const Cut& c=Cuts::open()) const; + /// @brief b particles which have been tag-matched to this jet _and_ pass a selector function + template <typename FN> + Particles bTags(const FN& f) const { return filter_select(bTags(), f); } + /// Does this jet have at least one b-tag (that passes an optional Cut)? bool bTagged(const Cut& c=Cuts::open()) const { return !bTags(c).empty(); } + /// Does this jet have at least one b-tag (that passes the supplied selector function)? + template <typename FN> + Particles bTagged(const FN& f) const { return !bTags(f).empty(); } /// @brief c (and not b) particles which have been tag-matched to this jet (and pass an optional Cut) ///
More information about the Rivet-svn mailing list |