HepMC3 event record library
|
Stores particle-related information.
Definition at line 31 of file GenParticle.h.
#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... | |
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... | |
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... | |
Friends | |
class | GenVertex |
class | GenEvent |
Deprecated functionality | |
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... | |
int | pdg_id () const |
Get PDG ID. More... | |
void | set_pdg_id (const int &pidin) |
Set PDG ID. More... | |
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.
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.
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.
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.
std::vector< ConstGenParticlePtr > 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.
GenVertexPtr end_vertex | ( | ) |
Get end vertex.
ConstGenVertexPtr end_vertex | ( | ) | const |
Get end vertex (const version)
Definition at line 70 of file GenParticle.cc.
References GenParticle::m_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 |
Check if this particle belongs to an event.
Definition at line 51 of file GenParticle.h.
std::vector< ConstGenParticlePtr > 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)
|
inline |
GenVertexPtr production_vertex | ( | ) |
Get production vertex.
ConstGenVertexPtr production_vertex | ( | ) | const |
Get production vertex (const version)
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.
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.
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.