HepMC3 event record library
|
Stores particle-related information. More...
#include <GenParticle.h>
Public Member Functions | |
GenParticle (const FourVector &momentum=FourVector::ZERO_VECTOR(), int pid=0, int status=0) | |
Default constructor. More... | |
GenParticle (const GenParticleData &data) | |
Constructor based on particle data. More... | |
bool | in_event () const |
Check if this particle belongs to an event. More... | |
GenEvent * | parent_event () |
Get parent event. More... | |
const GenEvent * | parent_event () const |
Get parent event. More... | |
int | id () const |
Get particle id. More... | |
const GenParticleData & | data () const |
Get particle data. More... | |
ConstGenVertexPtr | production_vertex () const |
Get production vertex (const version) More... | |
ConstGenVertexPtr | end_vertex () const |
Get end vertex (const version) More... | |
GenVertexPtr | production_vertex () |
Get production vertex. More... | |
GenVertexPtr | end_vertex () |
Get end vertex. More... | |
std::vector< GenParticlePtr > | parents () |
Convenience access to immediate incoming particles via production vertex. More... | |
std::vector< ConstGenParticlePtr > | parents () const |
Convenience access to immediate incoming particles via production vertex (const version) More... | |
std::vector< GenParticlePtr > | children () |
Convenience access to immediate outgoing particles via end vertex. More... | |
std::vector< ConstGenParticlePtr > | children () const |
Convenience access to immediate outgoing particles via end vertex. More... | |
int | pid () const |
Get PDG ID. More... | |
int | abs_pid () const |
Get absolute value of PDG ID. More... | |
int | status () const |
Get status code. More... | |
const FourVector & | momentum () const |
Get momentum. More... | |
bool | is_generated_mass_set () const |
Check if generated mass is set. More... | |
double | generated_mass () const |
Get generated mass. More... | |
void | set_pid (int pid) |
Set PDG ID. More... | |
void | set_status (int status) |
Set status code. More... | |
void | set_momentum (const FourVector &momentum) |
Set momentum. More... | |
void | set_generated_mass (double m) |
Set generated mass. More... | |
void | unset_generated_mass () |
Declare that generated mass is not set. More... | |
bool | add_attribute (const std::string &name, std::shared_ptr< Attribute > att) |
Add an attribute to this particle. More... | |
std::vector< std::string > | attribute_names () const |
Get list of names of attributes assigned to this particle. More... | |
void | remove_attribute (const std::string &name) |
Remove attribute. More... | |
template<class T > | |
std::shared_ptr< T > | attribute (const std::string &name) const |
Get attribute of type T. More... | |
std::string | attribute_as_string (const std::string &name) const |
Get attribute of any type as string. More... | |
Deprecated functionality | |
int | pdg_id () const |
Get PDG ID. More... | |
void | set_pdg_id (const int &pidin) |
Set PDG ID. More... | |
Private Attributes | |
GenEvent * | m_event |
Parent event. More... | |
int | m_id |
Index. More... | |
GenParticleData | m_data |
Particle data. More... | |
std::weak_ptr< GenVertex > | m_production_vertex |
Production vertex. More... | |
std::weak_ptr< GenVertex > | m_end_vertex |
End vertex. More... | |
Friends | |
class | GenVertex |
class | GenEvent |
Stores particle-related information.
Definition at line 31 of file GenParticle.h.
GenParticle | ( | const FourVector & | momentum = FourVector::ZERO_VECTOR() , |
int | pid = 0 , |
||
int | status = 0 |
||
) |
Default constructor.
Definition at line 19 of file GenParticle.cc.
References GenParticleData::is_mass_set, GenParticle::m_data, GenParticleData::mass, GenParticleData::momentum, GenParticleData::pid, and GenParticleData::status.
GenParticle | ( | const GenParticleData & | data | ) |
Constructor based on particle data.
Definition at line 29 of file GenParticle.cc.
|
inline |
Get absolute value of PDG ID.
Definition at line 87 of file GenParticle.h.
References HepMC3::abs().
bool add_attribute | ( | const std::string & | name, |
std::shared_ptr< Attribute > | att | ||
) |
Add an attribute to this particle.
This will overwrite existing attribute if an attribute with the same name is present. The attribute will be stored in the parent_event().
Definition at line 94 of file GenParticle.cc.
References GenEvent::add_attribute(), and GenParticle::parent_event().
std::shared_ptr< T > attribute | ( | const std::string & | name | ) | const |
Get attribute of type T.
Definition at line 158 of file GenParticle.h.
std::string attribute_as_string | ( | const std::string & | name | ) | const |
Get attribute of any type as string.
Definition at line 110 of file GenParticle.cc.
References GenEvent::attribute_as_string(), and GenParticle::parent_event().
std::vector< std::string > attribute_names | ( | ) | const |
Get list of names of attributes assigned to this particle.
Definition at line 100 of file GenParticle.cc.
References GenEvent::attribute_names(), and GenParticle::parent_event().
std::vector< GenParticlePtr > children | ( | ) |
Convenience access to immediate outgoing particles via end vertex.
Definition at line 86 of file GenParticle.cc.
References GenParticle::end_vertex(), and GenParticle::m_end_vertex.
std::vector< ConstGenParticlePtr > children | ( | ) | const |
Convenience access to immediate outgoing particles via end vertex.
Definition at line 90 of file GenParticle.cc.
References GenParticle::end_vertex(), and GenParticle::m_end_vertex.
|
inline |
Get particle data.
Definition at line 61 of file GenParticle.h.
ConstGenVertexPtr end_vertex | ( | ) | const |
Get end vertex (const version)
Definition at line 74 of file GenParticle.cc.
References GenParticle::m_end_vertex.
GenVertexPtr end_vertex | ( | ) |
double generated_mass | ( | ) | const |
Get generated mass.
This function will return mass as set by a generator/tool. If not set, it will return momentum().m()
Definition at line 35 of file GenParticle.cc.
References GenParticleData::is_mass_set, FourVector::m(), GenParticle::m_data, GenParticleData::mass, and GenParticleData::momentum.
|
inline |
Get particle id.
Definition at line 60 of file GenParticle.h.
|
inline |
Check if this particle belongs to an event.
Definition at line 51 of file GenParticle.h.
|
inline |
Check if generated mass is set.
Definition at line 90 of file GenParticle.h.
|
inline |
Get momentum.
Definition at line 89 of file GenParticle.h.
|
inline |
Get parent event.
Definition at line 58 of file GenParticle.h.
|
inline |
Get parent event.
Definition at line 59 of file GenParticle.h.
std::vector< GenParticlePtr > parents | ( | ) |
Convenience access to immediate incoming particles via production vertex.
Definition at line 78 of file GenParticle.cc.
References GenParticle::m_production_vertex, and GenParticle::production_vertex().
std::vector< ConstGenParticlePtr > parents | ( | ) | const |
Convenience access to immediate incoming particles via production vertex (const version)
Definition at line 82 of file GenParticle.cc.
References GenParticle::m_production_vertex, and GenParticle::production_vertex().
|
inline |
|
inline |
Get PDG ID.
Definition at line 86 of file GenParticle.h.
ConstGenVertexPtr production_vertex | ( | ) | const |
Get production vertex (const version)
Definition at line 66 of file GenParticle.cc.
References GenParticle::m_production_vertex.
GenVertexPtr production_vertex | ( | ) |
Get production vertex.
Definition at line 62 of file GenParticle.cc.
References GenParticle::m_production_vertex.
void remove_attribute | ( | const std::string & | name | ) |
Remove attribute.
Definition at line 106 of file GenParticle.cc.
References GenParticle::parent_event(), and GenEvent::remove_attribute().
void set_generated_mass | ( | double | m | ) |
Set generated mass.
Definition at line 52 of file GenParticle.cc.
References GenParticleData::is_mass_set, GenParticle::m_data, and GenParticleData::mass.
void set_momentum | ( | const FourVector & | momentum | ) |
Set momentum.
Definition at line 48 of file GenParticle.cc.
References GenParticle::m_data, and GenParticleData::momentum.
|
inline |
void set_pid | ( | int | pid | ) |
Set PDG ID.
Definition at line 40 of file GenParticle.cc.
References GenParticle::m_data, and GenParticleData::pid.
void set_status | ( | int | status | ) |
Set status code.
Definition at line 44 of file GenParticle.cc.
References GenParticle::m_data, and GenParticleData::status.
|
inline |
Get status code.
Definition at line 88 of file GenParticle.h.
void unset_generated_mass | ( | ) |
Declare that generated mass is not set.
Definition at line 57 of file GenParticle.cc.
References GenParticleData::is_mass_set, GenParticle::m_data, and GenParticleData::mass.
|
private |
Particle data.
Definition at line 146 of file GenParticle.h.
|
private |
End vertex.
Definition at line 149 of file GenParticle.h.
|
private |
Parent event.
Definition at line 144 of file GenParticle.h.
|
private |
Index.
Definition at line 145 of file GenParticle.h.
|
private |
Production vertex.
Definition at line 148 of file GenParticle.h.