6#ifndef HEPMC3_GENPARTICLE_H
7#define HEPMC3_GENPARTICLE_H
17#include "HepMC3/Data/GenParticleData.h"
18#include "HepMC3/FourVector.h"
20#include "HepMC3/GenParticle_fwd.h"
21#include "HepMC3/GenVertex_fwd.h"
23#ifdef HEPMC3_PROTOBUFIO
25class GenEventData_GenParticleData;
34class GenParticle :
public std::enable_shared_from_this<GenParticle> {
36 friend class GenVertex;
37 friend class GenEvent;
50#ifdef HEPMC3_PROTOBUFIO
60 bool in_event()
const {
return (
bool) (m_event); }
68 int id()
const {
return m_id; }
80 std::vector<GenParticlePtr>
parents();
84 std::vector<ConstGenParticlePtr>
parents()
const;
88 std::vector<GenParticlePtr>
children();
92 std::vector<ConstGenParticlePtr>
children()
const;
94 int pid()
const {
return m_data.pid; }
96 int status()
const {
return m_data.status; }
118 bool add_attribute(
const std::string& name, std::shared_ptr<Attribute> att);
128 std::shared_ptr<T>
attribute(
const std::string& name)
const;
154 std::weak_ptr<GenVertex> m_production_vertex;
155 std::weak_ptr<GenVertex> m_end_vertex;
162#include "HepMC3/GenEvent.h"
static const FourVector & ZERO_VECTOR()
Static null FourVector = (0,0,0,0)
Stores event-related information.
std::shared_ptr< T > attribute(const std::string &name, const int &id=0) const
Get attribute of type T.
bool is_generated_mass_set() const
Check if generated mass is set.
std::vector< std::string > attribute_names() const
Get list of names of attributes assigned to this particle.
bool add_attribute(const std::string &name, std::shared_ptr< Attribute > att)
Add an attribute to this particle.
int id() const
Get the particle ID number (not PDG ID)
void set_momentum(const FourVector &momentum)
Set momentum.
bool in_event() const
Check if this particle belongs to an event.
const FourVector & momentum() const
Get momentum.
void set_pdg_id(const int &pidin)
Set PDG ID.
std::vector< GenParticlePtr > parents()
Convenience access to immediate incoming particles via production vertex.
const GenParticleData & data() const
Get particle data.
int pdg_id() const
Get PDG ID.
std::shared_ptr< T > attribute(const std::string &name) const
Get attribute of type T.
void set_pid(int pid)
Set PDG ID.
void remove_attribute(const std::string &name)
Remove attribute.
int status() const
Get status code.
std::vector< GenParticlePtr > children()
Convenience access to immediate outgoing particles via end vertex.
ConstGenVertexPtr end_vertex() const
Get end vertex (const version)
void set_generated_mass(double m)
Set generated mass.
std::string attribute_as_string(const std::string &name) const
Get attribute of any type as string.
double generated_mass() const
Get generated mass.
GenParticle(const FourVector &momentum=FourVector::ZERO_VECTOR(), int pid=0, int status=0)
Default constructor.
ConstGenVertexPtr production_vertex() const
Get production vertex (const version)
void unset_generated_mass()
Declare that generated mass is not set.
GenEvent * parent_event()
Get the parent event.
const GenEvent * parent_event() const
Get the parent event (const)
void set_status(int status)
Set status code.
int abs_pid() const
Get absolute value of PDG ID.
int pid() const
Get PDG ID.
Stores serializable particle information.