ATLAS Offline Software
Loading...
Searching...
No Matches
HepMCHelpers.h File Reference

ATLAS-specific HepMC functions. More...

#include <vector>
#include <cmath>
#include <algorithm>
#include <array>
#include <cstdlib>
#include <set>
#include "TruthUtils/MagicNumbers.h"
#include "AtlasPID.h"
Include dependency graph for HepMCHelpers.h:

Go to the source code of this file.

Classes

class  MC::DecodedPID
 Implementation of classification functions according to PDG2022. More...

Namespaces

namespace  MC
namespace  MC::Pythia8

Macros

#define TRUTHUTILS_ATLASPID_H

Functions

template<class T>
bool MC::Pythia8::isConditionA (const T &p)
 To be understood.
template<class T>
bool MC::Pythia8::isConditionB (const T &p)
template<class T>
bool MC::Pythia8::isConditionC (const T &p)
template<class T>
bool MC::isQuark (const T &p)
 PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to do this they are first ordered by family and within families by weak isospin.
template<>
bool MC::isQuark (const int &p)
template<>
bool MC::isQuark (const DecodedPID &p)
template<class T>
bool MC::isSMQuark (const T &p)
template<>
bool MC::isSMQuark (const int &p)
template<>
bool MC::isSMQuark (const DecodedPID &p)
template<class T>
bool MC::isStrange (const T &p)
template<>
bool MC::isStrange (const int &p)
template<class T>
bool MC::isCharm (const T &p)
template<>
bool MC::isCharm (const int &p)
template<class T>
bool MC::isBottom (const T &p)
template<>
bool MC::isBottom (const int &p)
template<class T>
bool MC::isTop (const T &p)
template<>
bool MC::isTop (const int &p)
template<class T>
bool MC::isLepton (const T &p)
 APID: the fourth generation leptons are leptons.
template<>
bool MC::isLepton (const int &p)
template<>
bool MC::isLepton (const DecodedPID &p)
template<class T>
bool MC::isSMLepton (const T &p)
 APID: the fourth generation leptons are not standard model leptons.
template<>
bool MC::isSMLepton (const int &p)
template<>
bool MC::isSMLepton (const DecodedPID &p)
template<class T>
bool MC::isChLepton (const T &p)
 APID: the fourth generation leptons are leptons.
template<>
bool MC::isChLepton (const int &p)
template<class T>
bool MC::isElectron (const T &p)
template<>
bool MC::isElectron (const int &p)
template<class T>
bool MC::isMuon (const T &p)
template<>
bool MC::isMuon (const int &p)
template<class T>
bool MC::isTau (const T &p)
template<>
bool MC::isTau (const int &p)
template<class T>
bool MC::isNeutrino (const T &p)
 APID: the fourth generation neutrinos are neutrinos.
template<>
bool MC::isNeutrino (const int &p)
template<class T>
bool MC::isSMNeutrino (const T &p)
template<>
bool MC::isSMNeutrino (const int &p)
template<class T>
bool MC::isFourthGeneration (const T &p)
 Is this a 4th generation fermion?
template<>
bool MC::isFourthGeneration (const int &p)
template<class T>
bool MC::isDiquark (const T &p)
 PDG rule 4 Diquarks have 4-digit numbers with nq1 >= nq2 and nq3 = 0 APID: states with top quarks are diquarks APID: states with fourth generation quarks are not diquarks.
template<>
bool MC::isDiquark (const DecodedPID &p)
template<>
bool MC::isDiquark (const int &p)
template<class T>
bool MC::isMeson (const T &p)
 Table 43.1 PDG rule 5a: The numbers specifying the meson’s quark content conform to the convention nq1= 0 and nq2 >= nq3.
template<>
bool MC::isMeson (const DecodedPID &p)
template<>
bool MC::isMeson (const int &p)
template<class T>
bool MC::isQuarkonium (const T &p)
 Is this a heavy-flavour quarkonium meson?
template<>
bool MC::isQuarkonium (const DecodedPID &p)
template<>
bool MC::isQuarkonium (const int &p)
template<class T>
bool MC::isBaryon (const T &p)
 Table 43.2 APID: states with fourth generation quarks are not baryons.
template<>
bool MC::isBaryon (const DecodedPID &p)
template<>
bool MC::isBaryon (const int &p)
template<class T>
bool MC::isTetraquark (const T &p)
 PDG rule 14 The 9-digit tetra-quark codes are ±1nrnLnq1nq20nq3nq4nJ.
template<>
bool MC::isTetraquark (const DecodedPID &p)
template<>
bool MC::isTetraquark (const int &p)
template<class T>
bool MC::isPentaquark (const T &p)
 PDG rule 15 The 9-digit penta-quark codes are ±1nrnLnq1nq2nq3nq4nq5nJ, sorted such that nq1≥nq2≥nq3≥nq4.
template<>
bool MC::isPentaquark (const DecodedPID &p)
template<>
bool MC::isPentaquark (const int &p)
template<class T>
bool MC::isHadron (const T &p)
template<>
bool MC::isHadron (const DecodedPID &p)
template<>
bool MC::isHadron (const int &p)
template<class T>
bool MC::isTrajectory (const T &p)
 PDG rule 8: The pomeron and odderon trajectories and a generic reggeon trajectory of states in QCD areassigned codes 990, 9990, and 110 respectively.
template<>
bool MC::isTrajectory (const int &p)
template<class T>
bool MC::isBoson (const T &p)
 PDG rule 9: Two-digit numbers in the range 21–30 are provided for the Standard Model gauge and Higgs bosons.
template<>
bool MC::isBoson (const int &p)
template<>
bool MC::isBoson (const DecodedPID &p)
template<class T>
bool MC::isGluon (const T &p)
template<>
bool MC::isGluon (const int &p)
template<class T>
bool MC::isPhoton (const T &p)
template<>
bool MC::isPhoton (const int &p)
template<class T>
bool MC::isZ (const T &p)
template<>
bool MC::isZ (const int &p)
template<class T>
bool MC::isW (const T &p)
template<>
bool MC::isW (const int &p)
template<class T>
bool MC::isHeavyBoson (const T &p)
 APID: Additional "Heavy"/"prime" versions of W and Z bosons (Used in MCTruthClassifier)
template<>
bool MC::isHeavyBoson (const int &p)
template<class T>
bool MC::isHiggs (const T &p)
 APID: HIGGS boson is only one particle.
template<>
bool MC::isHiggs (const int &p)
template<class T>
bool MC::isMSSMHiggs (const T &p)
 APID: Additional Higgs bosons for MSSM (Used in MCTruthClassifier)
template<>
bool MC::isMSSMHiggs (const int &p)
template<class T>
bool MC::isGraviton (const T &p)
template<>
bool MC::isGraviton (const int &p)
template<class T>
bool MC::isResonance (const T &p)
template<class T>
bool MC::isLeptoQuark (const T &p)
 PDG rule 11c: “One-of-a-kind” exotic particles are assigned numbers in the range 41–80.
template<>
bool MC::isLeptoQuark (const int &p)
template<class T>
bool MC::isPythia8Specific (const T &p)
template<>
bool MC::isPythia8Specific (const DecodedPID &p)
template<>
bool MC::isPythia8Specific (const int &p)
template<class T>
bool MC::isNeutrinoRH (const T &p)
 PDG Rule 12: APID: Helper function for right-handed neutrino states These are generator defined PDG ID values for right handed neutrinos.
template<>
bool MC::isNeutrinoRH (const int &p)
template<class T>
bool MC::isGenSpecific (const T &p)
 Main Table for MC internal use 81–100,901–930,998-999,1901–1930,2901–2930, and 3901–3930.
template<>
bool MC::isGenSpecific (const int &p)
template<class T>
bool MC::isGeantino (const T &p)
template<>
bool MC::isGeantino (const int &p)
template<class T>
bool MC::isGlueball (const T &p)
 APID: Definition of Glueballs: SM glueballs 99X (X=1,5), 999Y (Y=3,7)
template<>
bool MC::isGlueball (const DecodedPID &p)
template<>
bool MC::isGlueball (const int &p)
template<class T>
bool MC::isSquark (const T &p)
 PDG rule 11d Fundamental supersymmetric particles are identified by adding a nonzero n to the particle number.
template<>
bool MC::isSquark (const DecodedPID &p)
template<>
bool MC::isSquark (const int &p)
template<class T>
bool MC::isSquarkLH (const T &p)
template<>
bool MC::isSquarkLH (const DecodedPID &p)
template<>
bool MC::isSquarkLH (const int &p)
template<class T>
bool MC::isSquarkRH (const T &p)
template<>
bool MC::isSquarkRH (const DecodedPID &p)
template<>
bool MC::isSquarkRH (const int &p)
template<class T>
bool MC::isSlepton (const T &p)
template<>
bool MC::isSlepton (const DecodedPID &p)
template<>
bool MC::isSlepton (const int &p)
template<class T>
bool MC::isSleptonLH (const T &p)
template<>
bool MC::isSleptonLH (const DecodedPID &p)
template<>
bool MC::isSleptonLH (const int &p)
template<class T>
bool MC::isSleptonRH (const T &p)
template<>
bool MC::isSleptonRH (const DecodedPID &p)
template<>
bool MC::isSleptonRH (const int &p)
template<class T>
bool MC::isGaugino (const T &p)
template<>
bool MC::isGaugino (const DecodedPID &p)
template<>
bool MC::isGaugino (const int &p)
template<class T>
bool MC::isSuperpartner (const T &p)
template<>
bool MC::isSuperpartner (const DecodedPID &p)
template<>
bool MC::isSuperpartner (const int &p)
template<class T>
bool MC::isTechnicolor (const T &p)
 PDG rule 11e Technicolor states have n = 3, with technifermions treated like ordinary fermions.
template<>
bool MC::isTechnicolor (const DecodedPID &p)
template<>
bool MC::isTechnicolor (const int &p)
template<class T>
bool MC::isExcited (const T &p)
 PDG rule 11f Excited (composite) quarks and leptons are identified by setting n= 4 and nr= 0.
template<>
bool MC::isExcited (const DecodedPID &p)
template<>
bool MC::isExcited (const int &p)
template<class T>
bool MC::isRGlueball (const T &p)
 PDG rule 11g: Within several scenarios of new physics, it is possible to have colored particles sufficiently long-lived for color-singlet hadronic states to form around them.
template<>
bool MC::isRGlueball (const DecodedPID &p)
template<>
bool MC::isRGlueball (const int &p)
template<class T>
bool MC::isRMeson (const T &p)
template<>
bool MC::isRMeson (const DecodedPID &p)
template<>
bool MC::isRMeson (const int &p)
template<class T>
bool MC::isRBaryon (const T &p)
template<>
bool MC::isRBaryon (const DecodedPID &p)
template<>
bool MC::isRBaryon (const int &p)
template<class T>
bool MC::isRHadron (const T &p)
template<>
bool MC::isRHadron (const DecodedPID &p)
template<>
bool MC::isRHadron (const int &p)
template<class T>
bool MC::hasSquark (const T &p, const int &q)
template<>
bool MC::hasSquark (const DecodedPID &p, const int &q)
template<>
bool MC::hasSquark (const int &p, const int &q)
template<class T>
bool MC::isSUSY (const T &p)
template<>
bool MC::isSUSY (const DecodedPID &p)
template<>
bool MC::isSUSY (const int &p)
template<class T>
bool MC::isKK (const T &p)
 PDG rule 11h A black hole in models with extra dimensions has code 5000040.
template<>
bool MC::isKK (const DecodedPID &p)
template<>
bool MC::isKK (const int &p)
template<class T>
bool MC::isMonopole (const T &p)
 PDG rule 11i Magnetic monopoles and dyons are assumed to have one unit of Dirac monopole charge and a variable integer number nq1nq2 nq3 units of electric charge.
template<>
bool MC::isMonopole (const DecodedPID &p)
template<>
bool MC::isMonopole (const int &p)
template<class T>
bool MC::isDM (const T &p)
 PDG rule 11j: The nature of Dark Matter (DM) is not known, and therefore a definitive classificationis too early.
template<>
bool MC::isDM (const int &p)
template<class T>
bool MC::isHiddenValley (const T &p)
 PDG rule 11k Hidden Valley particles have n = 4 and n_r = 9, and trailing numbers in agreement with their nearest-analog standard particles, as far as possible.
template<>
bool MC::isHiddenValley (const DecodedPID &p)
template<>
bool MC::isHiddenValley (const int &p)
template<class T>
bool MC::isGenericMultichargedParticle (const T &p)
 In addition, there is a need to identify ”Q-ball” and similar very exotic (multi-charged) particles which may have large, non-integer charge.
template<>
bool MC::isGenericMultichargedParticle (const DecodedPID &p)
template<>
bool MC::isGenericMultichargedParticle (const int &p)
template<class T>
bool MC::isNucleus (const T &p)
 PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
template<>
bool MC::isNucleus (const DecodedPID &p)
template<>
bool MC::isNucleus (const int &p)
template<class T>
bool MC::hasQuark (const T &p, const int &q)
template<>
bool MC::hasQuark (const DecodedPID &p, const int &q)
template<>
bool MC::hasQuark (const int &p, const int &q)
template<class T>
bool MC::hasStrange (const T &p)
template<class T>
bool MC::hasCharm (const T &p)
template<class T>
bool MC::hasBottom (const T &p)
template<class T>
bool MC::hasTop (const T &p)
template<class T>
int MC::baryonNumber3 (const T &p)
template<>
int MC::baryonNumber3 (const DecodedPID &p)
template<>
int MC::baryonNumber3 (const int &p)
template<class T>
double MC::baryonNumber (const T &p)
template<>
double MC::baryonNumber (const DecodedPID &p)
template<>
double MC::baryonNumber (const int &p)
template<class T>
int MC::strangeness (const T &p)
template<>
int MC::strangeness (const DecodedPID &p)
template<>
int MC::strangeness (const int &p)
template<class T>
int MC::numberOfLambdas (const T &p)
template<>
int MC::numberOfLambdas (const DecodedPID &p)
template<>
int MC::numberOfLambdas (const int &p)
template<class T>
int MC::numberOfProtons (const T &p)
template<>
int MC::numberOfProtons (const DecodedPID &p)
template<>
int MC::numberOfProtons (const int &p)
template<class T>
bool MC::isBSM (const T &p)
 APID: graviton and all Higgs extensions are BSM.
template<>
bool MC::isBSM (const DecodedPID &p)
template<>
bool MC::isBSM (const int &p)
template<class T>
bool MC::isTransportable (const T &p)
template<>
bool MC::isTransportable (const DecodedPID &p)
template<>
bool MC::isTransportable (const int &p)
template<class T>
bool MC::isValid (const T &p)
 Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
template<>
bool MC::isValid (const DecodedPID &p)
template<>
bool MC::isValid (const int &p)
template<class T>
int MC::leadingQuark (const T &p)
template<>
int MC::leadingQuark (const DecodedPID &p)
template<>
int MC::leadingQuark (const int &p)
template<class T>
bool MC::isLightHadron (const T &p)
template<class T>
bool MC::isHeavyHadron (const T &p)
template<class T>
bool MC::isStrangeHadron (const T &p)
template<class T>
bool MC::isCharmHadron (const T &p)
template<class T>
bool MC::isBottomHadron (const T &p)
template<class T>
bool MC::isTopHadron (const T &p)
template<class T>
bool MC::isLightMeson (const T &p)
template<class T>
bool MC::isHeavyMeson (const T &p)
template<class T>
bool MC::isStrangeMeson (const T &p)
template<class T>
bool MC::isCharmMeson (const T &p)
template<class T>
bool MC::isBottomMeson (const T &p)
template<class T>
bool MC::isTopMeson (const T &p)
template<class T>
bool MC::isCCbarMeson (const T &p)
template<>
bool MC::isCCbarMeson (const DecodedPID &p)
template<>
bool MC::isCCbarMeson (const int &p)
template<class T>
bool MC::isBBbarMeson (const T &p)
template<>
bool MC::isBBbarMeson (const DecodedPID &p)
template<>
bool MC::isBBbarMeson (const int &p)
template<class T>
bool MC::isLightBaryon (const T &p)
template<class T>
bool MC::isHeavyBaryon (const T &p)
template<class T>
bool MC::isStrangeBaryon (const T &p)
template<class T>
bool MC::isCharmBaryon (const T &p)
template<class T>
bool MC::isBottomBaryon (const T &p)
template<class T>
bool MC::isTopBaryon (const T &p)
template<class T>
bool MC::isWeaklyDecayingBHadron (const T &p)
template<>
bool MC::isWeaklyDecayingBHadron (const int &p)
template<>
bool MC::isWeaklyDecayingBHadron (const DecodedPID &p)
template<class T>
bool MC::isWeaklyDecayingCHadron (const T &p)
template<>
bool MC::isWeaklyDecayingCHadron (const int &p)
template<>
bool MC::isWeaklyDecayingCHadron (const DecodedPID &p)
template<class T>
int MC::charge3 (const T &p)
template<class T>
double MC::fractionalCharge (const T &p)
template<class T>
double MC::charge (const T &p)
template<class T>
double MC::threeCharge (const T &p)
template<class T>
bool MC::isCharged (const T &p)
template<>
int MC::charge3 (const DecodedPID &p)
template<>
int MC::charge3 (const int &p)
template<class T>
bool MC::isNeutral (const T &p)
template<>
bool MC::isNeutral (const DecodedPID &p)
template<>
bool MC::isNeutral (const int &p)
template<>
double MC::fractionalCharge (const DecodedPID &p)
template<>
double MC::fractionalCharge (const int &p)
template<class T>
bool MC::isEMInteracting (const T &p)
template<>
bool MC::isEMInteracting (const int &p)
template<class T>
bool MC::isParton (const T &p)
template<class T>
int MC::spin2 (const T &p)
template<>
int MC::spin2 (const DecodedPID &p)
template<>
int MC::spin2 (const int &p)
template<class T>
double MC::spin (const T &p)
template<>
double MC::spin (const DecodedPID &p)
template<>
double MC::spin (const int &p)
template<class T>
std::vector< int > MC::containedQuarks (const T &p)
template<>
std::vector< int > MC::containedQuarks (const int &p)
template<>
std::vector< int > MC::containedQuarks (const DecodedPID &p)
template<class T>
bool MC::isStrongInteracting (const T &p)
template<>
bool MC::isStrongInteracting (const int &p)
template<class T>
bool MC::isInteracting (const T &p)
 Identify if the particle with given PDG ID would not interact with the detector, i.e. not a neutrino or WIMP.
template<class T>
bool MC::isChargedNonShowering (const T &p)
 Identify if the particle with given PDG ID would produce ID tracks but not shower in the detector if stable.
template<class T>
bool MC::isBeam (const T &p)
 Identify if the particle is beam particle.
template<class T>
bool MC::isDecayed (const T &p)
 Identify if the particle decayed.
template<class T>
bool MC::isStable (const T &p)
 Identify if the particle is stable, i.e. has not decayed.
template<class T>
bool MC::isFinalState (const T &p)
 Identify if the particle is final state particle.
template<class T>
bool MC::isPhysical (const T &p)
 Identify if the particle is physical, i.e. is stable or decayed.
template<class T>
bool MC::isGenStable (const T &p)
 Determine if the particle is stable at the generator (not det-sim) level,.
template<class T>
bool MC::isSimStable (const T &p)
 Identify if the particle is considered stable at the post-detector-sim stage.
template<class T>
bool MC::isSimInteracting (const T &p)
 Identify if the particle could interact with the detector during the simulation, e.g. not a neutrino or WIMP.
template<class T>
bool MC::isStableOrSimDecayed (const T &p)
 Identify if particle is satble or decayed in simulation.
template<class T>
bool MC::isZeroEnergyPhoton (const T &p)
 Identify a photon with zero energy. Probably a workaround for a generator bug.
template<class T>
bool MC::isSpecialNonInteracting (const T &p)
 Identify a special non-interacting particles.
template<class T>
MC::findMother (T thePart)
 Function to get a mother of particle. MCTruthClassifier legacy.
template<class C, class T>
MC::findMatching (C TruthContainer, T p)
 Function to find a particle in container.
template<class T>
void MC::findParticleAncestors (T thePart, std::set< T > &allancestors)
 Function to find all ancestors of the particle.
template<class T>
void MC::findParticleStableDescendants (T thePart, std::set< T > &allstabledescendants)
 Function to get the particle stable MC daughters.
template<class T>
bool MC::isHardScatteringVertex (T pVert)
 Function to classify the vertex as hard scattering vertex.
template<class T>
bool MC::isFromHadron (T p, T hadron, bool &fromTau, bool &fromBSM)
 Function to classify the particle.
template<class T>
auto MC::findSimulatedEndVertex (T thePart) -> decltype(thePart->end_vertex())
 Function to find the end vertex of a particle.
template<class V>
auto MC::findFinalStateParticles (V theVert) -> decltype(theVert->particles_out())
 Function to find the stable particle descendants of the given vertex..

Variables

static const int MC::TABLESIZE = 100
static const std::array< int, TABLESIZEMC::triple_charge
static const std::array< int, TABLESIZEMC::double_spin
static const int MC::DQUARK = 1
static const int MC::UQUARK = 2
static const int MC::SQUARK = 3
static const int MC::CQUARK = 4
static const int MC::BQUARK = 5
static const int MC::TQUARK = 6
static const int MC::BPRIME = 7
static const int MC::TPRIME = 8
static const int MC::QUARK_LIMIT = BPRIME
static const int MC::ELECTRON = 11
static const int MC::POSITRON = -ELECTRON
static const int MC::NU_E = 12
static const int MC::MUON = 13
static const int MC::NU_MU = 14
static const int MC::TAU = 15
static const int MC::NU_TAU = 16
static const int MC::LPRIME = 17
static const int MC::NUPRIME = 18
static const int MC::GLUON = 21
static const int MC::COMPOSITEGLUON = 9
static const int MC::PHOTON = 22
static const int MC::Z0BOSON = 23
static const int MC::WPLUSBOSON = 24
static const int MC::HIGGSBOSON = 25
static const int MC::ZPRIME = 32
static const int MC::ZDBLPRIME = 33
static const int MC::WPLUSPRIME = 34
static const int MC::HIGGS2 = 35
static const int MC::HIGGS3 = 36
static const int MC::HIGGSPLUS = 37
static const int MC::HIGGSPLUSPLUS = 38
static const int MC::GRAVITON = 39
static const int MC::HIGGS4 = 40
static const int MC::LEPTOQUARK = 42
static const int MC::DARKPHOTON = 60000
 PDG Ids for Mavtop madgraph UFO model found under DarkX.
static const int MC::MAVTOP = 60001
static const int MC::PIPLUS = 211
static const int MC::PIMINUS = -PIPLUS
static const int MC::PI0 = 111
static const int MC::K0L = 130
static const int MC::K0S = 310
static const int MC::K0 = 311
static const int MC::KPLUS = 321
static const int MC::DPLUS = 411
static const int MC::DSTAR = 413
static const int MC::D0 = 421
static const int MC::DSPLUS = 431
static const int MC::JPSI = 443
static const int MC::B0 = 511
static const int MC::BCPLUS = 541
static const int MC::PROTON = 2212
static const int MC::NEUTRON = 2112
static const int MC::LAMBDA0 = 3122
static const int MC::LAMBDACPLUS = 4122
static const int MC::LAMBDAB0 = 5122
static const int MC::PSI2S = 20443
static const int MC::RH_NU_E = 9900012
 PDG Rule 12: Generator defined PDG ID values for right handed neutrinos and corresponding W+ boson from a Left-Right symmetric Standard Model extension.
static const int MC::RH_NU_MU = 9900014
static const int MC::RH_NU_TAU = 9900016
static const int MC::WBOSON_LRSM = 9900024
static const int MC::LEAD = 1000822080
static const int MC::OXYGEN = 1000080160
static const int MC::NEON = 1000100200
static const int MC::HELIUM = 1000020040
static const int MC::POMERON = 990
 PDG rule 8: The pomeron and odderon trajectories and a generic reggeon trajectory of states in QCD areassigned codes 990, 9990, and 110 respectively.
static const int MC::ODDERON = 9990
static const int MC::REGGEON = 110
static const int MC::GEANTINOPLUS = 998
 PDG rule 10: Codes 81–100 are reserved for generator-specific pseudoparticles and concepts.
static const int MC::GEANTINO0 = 999
static const std::array< int, 10 > MC::is_strange

Detailed Description

ATLAS-specific HepMC functions.

Definition in file HepMCHelpers.h.

Macro Definition Documentation

◆ TRUTHUTILS_ATLASPID_H

#define TRUTHUTILS_ATLASPID_H

Definition at line 6 of file HepMCHelpers.h.