StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
HepMC::GenParticle Class Reference

The GenParticle class contains information about generated particles. More...

#include <GenParticle.h>

Public Member Functions

 GenParticle (void)
 default constructor
 
 GenParticle (const FourVector &momentum, int pdg_id, int status=0, const Flow &itsflow=Flow(), const Polarization &polar=Polarization(0, 0))
 constructor requires momentum and particle ID
 
 GenParticle (const GenParticle &inparticle)
 shallow copy. More...
 
void swap (GenParticle &other)
 swap
 
GenParticleoperator= (const GenParticle &inparticle)
 
bool operator== (const GenParticle &) const
 check for equality More...
 
bool operator!= (const GenParticle &) const
 check for inequality
 
void print (std::ostream &ostr=std::cout) const
 dump this particle's full info to ostr More...
 
 operator HepMC::FourVector () const
 conversion operator
 
const FourVectormomentum () const
 standard 4 momentum
 
int pdg_id () const
 particle ID
 
int status () const
 HEPEVT decay status.
 
const Flowflow () const
 particle flow
 
int flow (int code_index) const
 particle flow index
 
const Polarizationpolarization () const
 polarization information
 
GenVertexproduction_vertex () const
 pointer to the production vertex
 
GenVertexend_vertex () const
 pointer to the decay vertex
 
GenEventparent_event () const
 pointer to the event that owns this particle
 
double generated_mass () const
 mass as generated More...
 
double generatedMass () const
 generatedMass() is included for backwards compatibility with CLHEP HepMC
 
int barcode () const
 particle barcode More...
 
bool is_undecayed () const
 Convenience method. Returns true if status==1.
 
bool has_decayed () const
 Convenience method. Returns true if status==2.
 
bool is_beam () const
 
GenParticleProductionRange particles_in (IteratorRange range=relatives)
 incoming particle range
 
ConstGenParticleProductionRange particles_in (IteratorRange range=relatives) const
 incoming particle range
 
GenParticleEndRange particles_out (IteratorRange range=relatives)
 outgoing particle range
 
ConstGenParticleEndRange particles_out (IteratorRange range=relatives) const
 outgoing particle range
 
bool suggest_barcode (int the_bar_code)
 In general there is no reason to "suggest_barcode". More...
 
void set_momentum (const FourVector &vec4)
 set standard 4 momentum
 
void set_pdg_id (int id)
 set particle ID
 
void set_status (int status=0)
 set decay status
 
void set_flow (const Flow &f)
 set particle flow
 
void set_flow (int code_index, int code=0)
 
void set_polarization (const Polarization &pol=Polarization(0, 0))
 set polarization
 
void set_generated_mass (const double &m)
 define the actual generated mass More...
 
void setGeneratedMass (const double &m)
 setGeneratedMass() is included for backwards compatibility with CLHEP HepMC
 

Protected Member Functions

void set_production_vertex_ (GenVertex *productionvertex=0)
 set production vertex - for internal use only
 
void set_end_vertex_ (GenVertex *decayvertex=0)
 set decay vertex - for internal use only
 
void set_barcode_ (int the_bar_code)
 for use by GenEvent only
 
void convert_momentum (const double &)
 

Friends

class GenVertex
 
class GenEvent
 
std::ostream & operator<< (std::ostream &, const GenParticle &)
 print particle
 

Detailed Description

The GenParticle class contains information about generated particles.

HepMC::GenParticle contains momentum, generated mass, particle ID, decay status, flow, polarization, pointers to production and decay vertices and a unique barcode identfier.

Definition at line 60 of file GenParticle.h.

Constructor & Destructor Documentation

HepMC::GenParticle::GenParticle ( const GenParticle inparticle)

shallow copy.

Shallow copy: does not copy the vertex pointers (note - impossible to copy vertex pointers which having the vertex and particles in/out point-back to one another – unless you copy the entire tree – which we don't want to do)

Definition at line 37 of file GenParticle.cc.

References barcode(), set_end_vertex_(), set_production_vertex_(), and suggest_barcode().

Member Function Documentation

int HepMC::GenParticle::barcode ( ) const
inline

particle barcode

The barcode is the particle's reference number, every vertex in the event has a unique barcode. Particle barcodes are positive numbers, vertex barcodes are negative numbers.

Please note that the barcodes are intended for internal use within HepMC as a unique identifier for the particles and vertices. Using the barcode to encode extra information is an abuse of the barcode data member and causes confusion among users.

Definition at line 252 of file GenParticle.h.

Referenced by GenParticle(), Tauolapp::TauolaHepMCParticle::getBarcode(), Photospp::PhotosHepMCParticle::getBarcode(), StarEvtGenDecayer::ImportParticles(), HepMC::operator<<(), print(), HepMC::GenEvent::read(), HepMC::GenEvent::remove_barcode(), HepMC::GenEvent::set_barcode(), set_end_vertex_(), and set_production_vertex_().

void HepMC::GenParticle::convert_momentum ( const double &  f)
protected

scale the momentum vector and generated mass this method is only for use by GenEvent

Definition at line 246 of file GenParticle.cc.

References HepMC::FourVector::e(), HepMC::FourVector::px(), HepMC::FourVector::py(), and HepMC::FourVector::pz().

double HepMC::GenParticle::generated_mass ( ) const

mass as generated

Because of precision issues, the generated mass is not always the same as the mass calculated from the momentum 4 vector. If the generated mass has been set, then generated_mass() returns that value. If the generated mass has not been set, then generated_mass() returns the mass calculated from the momentum 4 vector.

Definition at line 236 of file GenParticle.cc.

Referenced by generatedMass(), Photospp::PhotosHepMCParticle::getMass(), and operator==().

bool HepMC::GenParticle::is_beam ( ) const
inline

Convenience method. Returns true if status==4 Note that using status 4 for beam particles is a new convention which may not have been implemented by the code originating this GenEvent.

Definition at line 262 of file GenParticle.h.

GenParticle & HepMC::GenParticle::operator= ( const GenParticle inparticle)

shallow.

Shallow: does not copy the vertex pointers (note - impossible to copy vertex pointers which having the vertex and particles in/out point-back to one another – unless you copy the entire tree – which we don't want to do)

Definition at line 77 of file GenParticle.cc.

References swap().

bool HepMC::GenParticle::operator== ( const GenParticle a) const

check for equality

consistent with the definition of the copy constructor as a shallow constructor,.. this operator does not test the vertex pointers. Does not compare barcodes.

Definition at line 89 of file GenParticle.cc.

References generated_mass(), momentum(), pdg_id(), polarization(), and status().

void HepMC::GenParticle::print ( std::ostream &  ostr = std::cout) const

dump this particle's full info to ostr

Dump this particle's full info to ostr, where by default particle.print(); will dump to cout.

Definition at line 106 of file GenParticle.cc.

References HepMC::GenVertex::barcode(), barcode(), HepMC::FourVector::e(), end_vertex(), momentum(), pdg_id(), polarization(), production_vertex(), HepMC::FourVector::px(), HepMC::FourVector::py(), HepMC::FourVector::pz(), and status().

Referenced by Tauolapp::TauolaHepMCParticle::print(), and Photospp::PhotosHepMCParticle::print().

void HepMC::GenParticle::set_flow ( int  code_index,
int  code = 0 
)
inline

set particle flow index

Definition at line 240 of file GenParticle.h.

References HepMC::Flow::set_icode(), and HepMC::Flow::set_unique_icode().

void HepMC::GenParticle::set_generated_mass ( const double &  m)
bool HepMC::GenParticle::suggest_barcode ( int  the_bar_code)

In general there is no reason to "suggest_barcode".

allows a barcode to be suggested for this particle. In general it is better to let the event pick the barcode for you, which is automatic. Returns TRUE if the suggested barcode has been accepted (i.e. the suggested barcode has not already been used in the event, and so it was used). Returns FALSE if the suggested barcode was rejected, or if the particle is not yet part of an event, such that it is not yet possible to know if the suggested barcode will be accepted).

Definition at line 153 of file GenParticle.cc.

References parent_event(), HepMC::GenEvent::set_barcode(), and set_barcode_().

Referenced by HepMC::IO_HEPEVT::build_particle(), HepMC::IO_HERWIG::build_particle(), and GenParticle().


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