HepMC3 event record library
|
Selector is an interface to "standard" Features that are valid for both integral and floating point comparisons.
You would use this in preference to the more general Feature<> templated type. A Selector is constructed from a function to extract features from particles, e.g.
ConstSelectorPtr status = std::make_shared<SelectorWrapper<int> >([](ConstParticlePtr p)->int{return p->status();}); ConstSelectorPtr pt = std::make_shared<SelectorWrapper<double> >([](ConstParticlePtr p)->double{return p->momentum().pt();});
You can then use the Selector to construct Filter functions that evaluate on particles, e.g. Filter is_stable = (*status) == 1; bool stable = is_stable(p); bool beam = (*status == 4)(p);
Selector contains a few standard Selectors already defined, e.g.
ConstGenParticlePtr p; (Selector::STATUS == 1)(p); (Selector::PT > 15.)(p); (abs(Selector::RAPIDITY) < 2.5)(p);
you can also combined them e.g.
Filter myCuts = (Selector::PT > 15.) && (*abs(Selector::RAPIDITY) < 2.5) || (Selector::PT > 100.); bool passCuts = myCuts(p);
Definition at line 55 of file Selector.h.
#include <Selector.h>
Static Public Member Functions | |
static AttributeFeature | ATTRIBUTE (const std::string &name) |
Static Public Attributes | |
static const SelectorWrapper< int > | STATUS = SelectorWrapper<int>([](ConstGenParticlePtr p)->int{return p->status();}) |
static const SelectorWrapper< int > | PDG_ID = SelectorWrapper<int>([](ConstGenParticlePtr p)->int{return p->pdg_id();}) |
static const SelectorWrapper < double > | PT = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().pt();}) |
static const SelectorWrapper < double > | ENERGY = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().e();}) |
static const SelectorWrapper < double > | RAPIDITY = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().rap();}) |
static const SelectorWrapper < double > | ETA = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().eta();}) |
static const SelectorWrapper < double > | PHI = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().phi();}) |
static const SelectorWrapper < double > | ET = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().e() * (p->momentum().pt() / p->momentum().p3mod());}) |
static const SelectorWrapper < double > | MASS = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().m();}) |