HepMC3 event record library: Selector.cc Source File

HepMC3 event record library

Selector.cc
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is part of HepMC
4// Copyright (C) 2014-2023 The HepMC collaboration (see AUTHORS for details)
5//
6///
7/// @file Selector.cc
8/// @brief Implementation of Selector wrappers
9///
10#include "HepMC3/Selector.h"
11
12namespace HepMC3 {
13const SelectorWrapper<int> StandardSelector::STATUS = SelectorWrapper<int>([](ConstGenParticlePtr p)->int{return p->status();});
14const SelectorWrapper<int> StandardSelector::PDG_ID = SelectorWrapper<int>([](ConstGenParticlePtr p)->int{return p->pdg_id();});
15const SelectorWrapper<double> StandardSelector::PT = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().pt();});
16const SelectorWrapper<double> StandardSelector::ENERGY = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().e();});
17const SelectorWrapper<double> StandardSelector::RAPIDITY = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().rap();});
18const SelectorWrapper<double> StandardSelector::ETA = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().eta();});
19const SelectorWrapper<double> StandardSelector::PHI = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().phi();});
20const SelectorWrapper<double> StandardSelector::ET = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().e() * (p->momentum().pt() / p->momentum().p3mod());});
21const SelectorWrapper<double> StandardSelector::MASS = SelectorWrapper<double>([](ConstGenParticlePtr p)->double{return p->momentum().m();});
22
23 ConstSelectorPtr abs(const Selector &input)
24{
25 return input.abs();
26}
27
28 AttributeFeature Selector::ATTRIBUTE(const std::string &name) {return {name};}
29
30} // namespace HepMC3
Selector.h
definition of Selector class
HepMC3::AttributeFeature
AttributeFeature.
Definition AttributeFeature.h:22
HepMC3::SelectorWrapper
Forward declaration of SelectorWrapper.
Definition Selector.h:85
HepMC3::Selector
Selector is an interface to "standard" Features that are valid for both integral and floating point c...
Definition Selector.h:57
HepMC3::Selector::abs
virtual ConstSelectorPtr abs() const =0
abs function
HepMC3::Selector::ATTRIBUTE
static AttributeFeature ATTRIBUTE(const std::string &name)
ATTRIBUTE function.
Definition Selector.cc:28
HepMC3::StandardSelector::MASS
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< double > MASS
Mass.
Definition Selector.h:184
HepMC3::StandardSelector::PT
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< double > PT
Transverse momentum.
Definition Selector.h:178
HepMC3::StandardSelector::PDG_ID
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< int > PDG_ID
PDG ID.
Definition Selector.h:177
HepMC3::StandardSelector::PHI
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< double > PHI
Azimuthal angle.
Definition Selector.h:182
HepMC3::StandardSelector::ETA
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< double > ETA
Pseudorapidity.
Definition Selector.h:181
HepMC3::StandardSelector::ET
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< double > ET
Transverse energy.
Definition Selector.h:183
HepMC3::StandardSelector::STATUS
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< int > STATUS
Status.
Definition Selector.h:176
HepMC3::StandardSelector::RAPIDITY
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< double > RAPIDITY
Rapidity.
Definition Selector.h:180
HepMC3::StandardSelector::ENERGY
static HEPMC3search_StandardSelector_EXPORT_API const SelectorWrapper< double > ENERGY
Energy.
Definition Selector.h:179
HepMC3
HepMC3 main namespace.
Definition AnalysisExample.h:24
HepMC3::ConstSelectorPtr
std::shared_ptr< const Selector > ConstSelectorPtr
Declaration of ConstSelectorPtr.
Definition Selector.h:26
HepMC3::abs
Feature< Feature_type > abs(const Feature< Feature_type > &input)
Obtain the absolute value of a Feature. This works as you'd expect. If foo is a valid Feature,...
Definition Feature.h:352