|
[Rivet-svn] rivet: Add virtual destructors to functor base classes, and make...Rivet Mercurial rivet at projects.hepforge.orgWed Apr 25 10:15:01 BST 2018
details: https://rivet.hepforge.org/hg/rivet/rev/babfa626391f branches: release-2-6-x changeset: 6277:babfa626391f user: Andy Buckley <andy at insectnation.org> date: Wed Apr 25 10:03:23 2018 +0100 description: Add virtual destructors to functor base classes, and make HasPid / HasAbsPid support multiple target PIDs diffs (truncated from 125 to 50 lines): --- a/include/Rivet/Tools/JetUtils.hh Tue Apr 24 10:40:46 2018 +0100 +++ b/include/Rivet/Tools/JetUtils.hh Wed Apr 25 10:03:23 2018 +0100 @@ -46,6 +46,7 @@ /// Base type for Jet -> bool functors struct BoolJetFunctor { virtual bool operator()(const Jet& p) const = 0; + virtual ~BoolJetFunctor() {} }; --- a/include/Rivet/Tools/ParticleBaseUtils.hh Tue Apr 24 10:40:46 2018 +0100 +++ b/include/Rivet/Tools/ParticleBaseUtils.hh Wed Apr 25 10:03:23 2018 +0100 @@ -22,6 +22,7 @@ /// Base type for Particle -> bool functors struct BoolParticleBaseFunctor { virtual bool operator()(const ParticleBase& p) const = 0; + virtual ~BoolParticleBaseFunctor() {} }; @@ -396,6 +397,7 @@ /// Base type for Particle -> double functors struct DoubleParticleBaseFunctor { virtual double operator()(const ParticleBase& p) const = 0; + virtual ~DoubleParticleBaseFunctor() {} }; /// Calculator of @f$ \Delta R @f$ with respect to a given momentum --- a/include/Rivet/Tools/ParticleUtils.hh Tue Apr 24 10:40:46 2018 +0100 +++ b/include/Rivet/Tools/ParticleUtils.hh Wed Apr 25 10:03:23 2018 +0100 @@ -485,6 +485,7 @@ /// Base type for Particle -> bool functors struct BoolParticleFunctor { virtual bool operator()(const Particle& p) const = 0; + virtual ~BoolParticleFunctor() {} }; /// Functor for and-combination of selector logic @@ -534,17 +535,21 @@ /// PID matching functor struct HasPID : public BoolParticleFunctor { - HasPID(PdgId pid) : targetpid(pid) { } - bool operator()(const Particle& p) const { return p.pid() == targetpid; } - PdgId targetpid; + HasPID(PdgId pid) : targetpids{ {pid} } { } + HasPID(vector<PdgId> pids) : targetpids{pids} { } + HasPID(initializer_list<PdgId> pids) : targetpids{pids} { } + bool operator()(const Particle& p) const { return contains(targetpids, p.pid()); } + vector<PdgId> targetpids;
More information about the Rivet-svn mailing list |