ATLAS Offline Software
Loading...
Searching...
No Matches
GenData Class Reference

GenData is a class for particle data access. More...

#include <GenData.h>

Collaboration diagram for GenData:

Public Member Functions

 GenData ()
virtual ~GenData ()
std::optional< double > particleMass (int pdgId) const
std::optional< double > particleLifetime (int pdgId) const
std::optional< std::string > particleName (int pdgId) const

Private Member Functions

const HepPDT::ParticleData * particleData (int pid) const
 Access an element in the particle data table.

Private Attributes

ServiceHandle< IPartPropSvc > m_ppSvc {"PartPropSvc", "GenData"}
 Handle on the particle property service.
std::atomic< bool > m_initialized {false}

Detailed Description

GenData is a class for particle data access.

Definition at line 30 of file GenData.h.

Constructor & Destructor Documentation

◆ GenData()

GenData::GenData ( )
inline

Definition at line 33 of file GenData.h.

33{ };

◆ ~GenData()

virtual GenData::~GenData ( )
inlinevirtual

Definition at line 35 of file GenData.h.

35{ }

Member Function Documentation

◆ particleData()

const HepPDT::ParticleData * GenData::particleData ( int pid) const
inlineprivate

Access an element in the particle data table.

Definition at line 39 of file GenData.h.

39 {
40 if (!m_initialized) {
41 if (m_ppSvc.retrieve().isFailure()) {
42 std::cerr<< "GenData: failed to retrieve PartPropSvc\n";
43 std::abort();
44 }
45 m_initialized = true;
46 }
47 const int absPid = std::abs(pid);
48 return m_ppSvc->PDT()->particle(HepPDT::ParticleID(absPid));
49 }
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition GenData.h:70
std::atomic< bool > m_initialized
Definition GenData.h:71

◆ particleLifetime()

std::optional< double > GenData::particleLifetime ( int pdgId) const
inline

Definition at line 57 of file GenData.h.

57 {
58 const HepPDT::ParticleData* particle = particleData(std::abs(pdgId));
59 return particle ? std::optional<double>{particle->lifetime()} : std::nullopt;
60 }
const HepPDT::ParticleData * particleData(int pid) const
Access an element in the particle data table.
Definition GenData.h:39
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ particleMass()

std::optional< double > GenData::particleMass ( int pdgId) const
inline

Definition at line 52 of file GenData.h.

52 {
53 const HepPDT::ParticleData* particle = particleData(std::abs(pdgId));
54 return particle ? std::optional<double>{particle->mass().value()} : std::nullopt;
55 }

◆ particleName()

std::optional< std::string > GenData::particleName ( int pdgId) const
inline

Definition at line 62 of file GenData.h.

62 {
63 const HepPDT::ParticleData* particle = particleData(std::abs(pdgId));
64 return particle ? std::optional<std::string>{particle->name()} : std::nullopt;
65 }

Member Data Documentation

◆ m_initialized

std::atomic<bool> GenData::m_initialized {false}
mutableprivate

Definition at line 71 of file GenData.h.

71{false};

◆ m_ppSvc

ServiceHandle<IPartPropSvc> GenData::m_ppSvc {"PartPropSvc", "GenData"}
private

Handle on the particle property service.

Definition at line 70 of file GenData.h.

70{"PartPropSvc", "GenData"};

The documentation for this class was generated from the following file: