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

Class for particle data access in GenBase. More...

#include <GenData.h>

Collaboration diagram for GenData:

Public Member Functions

Construction/destruction
 GenData ()
 Constructor.
virtual ~GenData ()
 Virtual destructor.

Particle data accessors

ServiceHandle< IPartPropSvc > m_ppSvc {"PartPropSvc", "GenData"}
 Handle on the particle property service.
std::atomic< bool > m_initialized {false}
const ServiceHandle< IPartPropSvc > partPropSvc () const
 Access the particle property service.
const HepPDT::ParticleDataTable & particleTable () const
 Get a particle data table.
const HepPDT::ParticleDataTable & pdt () const
 Shorter alias to get a particle data table.
const HepPDT::ParticleData * particleData (int pid) const
 Access an element in the particle data table.
std::optional< double > particleMass (int pdgId) const
std::optional< double > particleLifetime (int pdgId) const
std::optional< std::string > particleName (int pdgId) const

Detailed Description

Class for particle data access in GenBase.

Definition at line 37 of file GenData.h.

Constructor & Destructor Documentation

◆ GenData()

GenData::GenData ( )
inline

Constructor.

Definition at line 44 of file GenData.h.

44{ };

◆ ~GenData()

virtual GenData::~GenData ( )
inlinevirtual

Virtual destructor.

Definition at line 47 of file GenData.h.

47{ }

Member Function Documentation

◆ particleData()

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

Access an element in the particle data table.

Definition at line 75 of file GenData.h.

75 {
76 return pdt().particle(HepPDT::ParticleID(std::abs(pid)));
77 }
const HepPDT::ParticleDataTable & pdt() const
Shorter alias to get a particle data table.
Definition GenData.h:72

◆ particleLifetime()

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

Definition at line 87 of file GenData.h.

87 {
88 const HepPDT::ParticleData* particle = particleData(std::abs(pdgId));
89 if (!particle) {
90 return std::nullopt;
91 }
92 return particle->lifetime();
93 }
const HepPDT::ParticleData * particleData(int pid) const
Access an element in the particle data table.
Definition GenData.h:75
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ particleMass()

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

Definition at line 79 of file GenData.h.

79 {
80 const HepPDT::ParticleData* particle = particleData(std::abs(pdgId));
81 if (!particle) {
82 return std::nullopt;
83 }
84 return particle->mass().value();
85 }

◆ particleName()

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

Definition at line 94 of file GenData.h.

94 {
95 const HepPDT::ParticleData* particle = particleData(std::abs(pdgId));
96 if (!particle) {
97 return std::nullopt;
98 }
99 return particle->name();
100 }

◆ particleTable()

const HepPDT::ParticleDataTable & GenData::particleTable ( ) const
inline

Get a particle data table.

Definition at line 60 of file GenData.h.

60 {
61 if (!m_initialized) {
62 if (m_ppSvc.retrieve().isFailure()) {
63 std::cerr<< "GenData: failed to retrieve PartPropSvc\n";
64 std::abort();
65 }
66 m_initialized = true;
67 }
68 return *(m_ppSvc->PDT());
69 }
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition GenData.h:109
std::atomic< bool > m_initialized
Definition GenData.h:110

◆ partPropSvc()

const ServiceHandle< IPartPropSvc > GenData::partPropSvc ( ) const
inline

Access the particle property service.

Definition at line 55 of file GenData.h.

55 {
56 return m_ppSvc;
57 }

◆ pdt()

const HepPDT::ParticleDataTable & GenData::pdt ( ) const
inline

Shorter alias to get a particle data table.

Definition at line 72 of file GenData.h.

72{ return particleTable(); }
const HepPDT::ParticleDataTable & particleTable() const
Get a particle data table.
Definition GenData.h:60

Member Data Documentation

◆ m_initialized

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

Definition at line 110 of file GenData.h.

110{false};

◆ m_ppSvc

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

Handle on the particle property service.

Definition at line 109 of file GenData.h.

109{"PartPropSvc", "GenData"};

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