5#ifndef GENERATORMODULES_GENDATA_H
6#define GENERATORMODULES_GENDATA_H
9#include "GaudiKernel/ServiceHandle.h"
10#include "GaudiKernel/IPartPropSvc.h"
11#include "GaudiKernel/IIncidentSvc.h"
15#include "HepPDT/ParticleData.hh"
16#include "HepPDT/ParticleDataTable.hh"
41 if (
m_ppSvc.retrieve().isFailure()) {
42 std::cerr<<
"GenData: failed to retrieve PartPropSvc\n";
47 const int absPid = std::abs(pid);
48 return m_ppSvc->PDT()->particle(HepPDT::ParticleID(absPid));
53 const HepPDT::ParticleData* particle =
particleData(std::abs(pdgId));
54 return particle ? std::optional<double>{particle->mass().value()} : std::nullopt;
58 const HepPDT::ParticleData* particle =
particleData(std::abs(pdgId));
59 return particle ? std::optional<double>{particle->lifetime()} : std::nullopt;
63 const HepPDT::ParticleData* particle =
particleData(std::abs(pdgId));
64 return particle ? std::optional<std::string>{particle->name()} : std::nullopt;
Helpers for checking error return status codes and reporting errors.
Property holding a SG store/key/clid from which a ReadHandle is made.
std::optional< std::string > particleName(int pdgId) const
std::optional< double > particleMass(int pdgId) const
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
const HepPDT::ParticleData * particleData(int pid) const
Access an element in the particle data table.
std::optional< double > particleLifetime(int pdgId) const
std::atomic< bool > m_initialized