HepMC3 event record library
|
GenericFeature defines the Feature interface GenericFeature is not intended to be used directly. The derived Feature class and its specialisations should be used. More...
#include <Feature.h>
Public Types | |
using | Evaluator_type = std::function< Feature_type(ConstGenParticlePtr)> |
using | EvaluatorPtr = std::shared_ptr< Evaluator_type > |
Public Member Functions | |
Feature_type | operator() (ConstGenParticlePtr input) const |
access the underlying feature value More... | |
Filter | operator> (Feature_type value) const |
greater than operator More... | |
Filter | operator< (Feature_type value) const |
less than operator More... | |
Filter | operator>= (Feature_type value) const |
greater than or equals operator More... | |
Filter | operator<= (Feature_type value) const |
less than or equals operator More... | |
virtual Filter | operator== (Feature_type value) const |
equality operator More... | |
virtual Filter | operator!= (Feature_type value) const |
inequality operator More... | |
Protected Member Functions | |
GenericFeature (Evaluator_type functor) | |
Hide the constructor so no one can use GenericFeature directly. More... | |
GenericFeature (const GenericFeature ©) | |
Hide the copy constructor. More... | |
Protected Attributes | |
EvaluatorPtr | m_internal |
GenericFeature defines the Feature interface GenericFeature is not intended to be used directly. The derived Feature class and its specialisations should be used.
A Feature wraps a function object that can extract a generic Feature_type from a ConstGenParticlePtr. Usually the Feature_type would be something like int (e.g. status) or double (e.g. pT), but it could in principle be any attribute of a particle so long as there are well defined <, <=, >, >=, == and != operators for that attribute, as well as an abs function.
Once a Feature is defined, you can obtain Filters that select Particles according to that Feature by e.g. Feature<int> status([](ConstGenParticlePtr p)->int{return p->status();}); bool is_stable = (status == 1)(p); Filter is_beam = (status == 4); bool beam = is_beam(p);
An abs function is also defined, so abs(Feature) works as you'd expect, e.g. Feature<double> rapidity([](ConstGenParticlePtr p)->double{return p->momentum().rap();}); Filter rapCut = abs(rapidity) < 2.5;
Please also see the Selector interface, which defines an abstract interface to Feature that is free of the template params and also includes some standard Features such as
Selector::STATUS; Selector::PDG_ID; Selector::PT; Selector::RAPIDITY;
|
inlineprotected |
Hide the constructor so no one can use GenericFeature directly.
|
inlineprotected |
inequality operator
Reimplemented in Feature< Feature_type, typename std::enable_if< std::is_floating_point< Feature_type >::value, void >::type >.
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
equality operator
Reimplemented in Feature< Feature_type, typename std::enable_if< std::is_floating_point< Feature_type >::value, void >::type >.
|
inline |
|
inline |