7 #include "HepMC/GenEvent.h"
8 #include "HepMC/GenVertex.h"
9 #include "HepMC/GenParticle.h"
15 m_momentum(0), m_pdg_id(0), m_status(0), m_flow(this),
16 m_polarization(0), m_production_vertex(0), m_end_vertex(0),
17 m_barcode(0), m_generated_mass(0.)
24 int pdg_id,
int status,
27 m_momentum(momentum), m_pdg_id(pdg_id), m_status(status), m_flow(this),
28 m_polarization(polar), m_production_vertex(0), m_end_vertex(0),
29 m_barcode(0), m_generated_mass(momentum.m())
38 m_momentum( inparticle.momentum() ),
39 m_pdg_id( inparticle.pdg_id() ),
40 m_status( inparticle.status() ),
41 m_flow(inparticle.flow()),
42 m_polarization( inparticle.polarization() ),
43 m_production_vertex(0),
46 m_generated_mass( inparticle.generated_mass() )
58 GenParticle::~GenParticle() {
66 m_momentum.
swap( other.m_momentum );
67 std::swap( m_pdg_id, other.m_pdg_id );
68 std::swap( m_status, other.m_status );
69 m_flow.
swap( other.m_flow );
70 m_polarization.
swap( other.m_polarization );
71 std::swap( m_production_vertex, other.m_production_vertex );
72 std::swap( m_end_vertex, other.m_end_vertex );
73 std::swap( m_barcode, other.m_barcode );
74 std::swap( m_generated_mass, other.m_generated_mass );
97 if ( a.m_flow != this->m_flow )
return false;
103 return !( a == *this );
109 ostr <<
"GenParticle: "
120 ostr <<
" Pol:" <<
polarization() <<
" F:" << m_flow << std::endl;
132 m_production_vertex = prodvertex;
136 if ( its_orig_event != its_new_event ) {
145 m_end_vertex = decayvertex;
147 if ( its_orig_event != its_new_event ) {
164 if ( the_bar_code <0 ) {
165 std::cerr <<
"GenParticle::suggest_barcode WARNING, particle bar "
166 <<
"\n codes MUST be positive integers. Negative "
167 <<
"\n integers are reserved for vertices only. Your "
168 <<
"\n suggestion has been rejected." << std::endl;
171 bool success =
false;
189 std::ostream& operator<<( std::ostream& ostr,
const GenParticle& part ) {
191 std::ios_base::fmtflags orig = ostr.flags();
192 std::streamsize prec = ostr.precision();
197 ostr << part.
pdg_id() <<
" ";
200 ostr.setf(std::ios::scientific, std::ios::floatfield);
201 ostr.setf(std::ios_base::showpos);
209 ostr.setf(std::ios::fmtflags(0), std::ios::floatfield);
210 ostr.unsetf(std::ios_base::showpos);
213 ostr << part.
status() <<
" ";
225 ostr << part.
status() <<
" ";
231 ostr.precision(prec);
237 return m_generated_mass;
241 m_generated_mass = m;
251 if( m_generated_mass > 0. ) m_generated_mass = f*m_generated_mass;
bool operator==(const GenParticle &) const
check for equality
GenEvent * parent_event() const
pointer to the event that owns this particle
void set_generated_mass(const double &m)
define the actual generated mass
int pdg_id() const
particle ID
int barcode() const
unique identifier
GenParticle(void)
default constructor
bool set_barcode(GenParticle *p, int suggested_barcode=false)
set the barcode - intended for use by GenParticle
int barcode() const
particle barcode
GenParticle & operator=(const GenParticle &inparticle)
double e() const
return E
void remove_barcode(GenParticle *p)
intended for use by GenParticle
void set_flow(const Flow &f)
set particle flow
void swap(Flow &other)
swap
double px() const
return px
GenVertex * production_vertex() const
pointer to the production vertex
GenVertex contains information about decay vertices.
bool suggest_barcode(int the_bar_code)
In general there is no reason to "suggest_barcode".
void swap(FourVector &other)
swap
The GenEvent class is the core of HepMC.
double pz() const
return pz
int status() const
HEPEVT decay status.
double generated_mass() const
mass as generated
void set_barcode_(int the_bar_code)
for use by GenEvent only
GenEvent * parent_event() const
pointer to the event that owns this vertex
void set_production_vertex_(GenVertex *productionvertex=0)
set production vertex - for internal use only
The Polarization class stores theta and phi for a GenParticle.
void swap(GenParticle &other)
swap
const Polarization & polarization() const
polarization information
void swap(Polarization &other)
swap
void print(std::ostream &ostr=std::cout) const
dump this particle's full info to ostr
const FourVector & momentum() const
standard 4 momentum
FourVector is a simple representation of a physics 4 vector.
bool operator!=(const GenParticle &) const
check for inequality
GenVertex * end_vertex() const
pointer to the decay vertex
void convert_momentum(const double &)
double py() const
return py
void set_end_vertex_(GenVertex *decayvertex=0)
set decay vertex - for internal use only
The GenParticle class contains information about generated particles.