HepMC3 event record library
|
Expose GenericFeature interface to derived Feature class.
This will get used for generic class types that aren't integral or floating point types.
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;
#include <Feature.h>
Public Types | |
using | Evaluator_type = std::function< Feature_type(ConstGenParticlePtr)> |
evaluator type | |
using | EvaluatorPtr = std::shared_ptr< Evaluator_type > |
shared pointer for evaluator type | |
Public Member Functions | |
Feature (Evaluator_type functor) | |
Feature. | |
Feature (const Feature ©) | |
Copy. | |
Feature< Feature_type > | abs () const |
Abs function. | |
Feature_type | operator() (ConstGenParticlePtr input) const |
access the underlying feature value | |
Filter | operator> (Feature_type value) const |
greater than operator | |
Filter | operator< (Feature_type value) const |
less than operator | |
Filter | operator>= (Feature_type value) const |
greater than or equals operator | |
Filter | operator<= (Feature_type value) const |
less than or equals operator | |
virtual Filter | operator== (Feature_type value) const |
equality operator | |
virtual Filter | operator!= (Feature_type value) const |
inequality operator | |
Protected Attributes | |
EvaluatorPtr | m_internal |
internal copy of func for evaluation on the heap so will persist in resulting Filters even if parent Feature object was destroyed | |
|
inherited |
|
inherited |
|
inline |
|
inline |
Abs function.
Definition at line 182 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
inequality operator
Reimplemented in Feature< Feature_type, typename std::enable_if< std::is_floating_point< Feature_type >::value, void >::type >.
Definition at line 107 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
access the underlying feature value
Definition at line 67 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
less than operator
Definition at line 79 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
less than or equals operator
Definition at line 93 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlinevirtualinherited |
equality operator
Reimplemented in Feature< Feature_type, typename std::enable_if< std::is_floating_point< Feature_type >::value, void >::type >.
Definition at line 100 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
greater than operator
Definition at line 73 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
greater than or equals operator
Definition at line 86 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
protectedinherited |