HepMC Reference Documentation

HepMC

HepMC::GenParticle Class Reference

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

#include <GenParticle.h>

List of all members.

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.
virtual ~GenParticle ()
void swap (GenParticle &other)
 swap
GenParticleoperator= (const GenParticle &inparticle)
bool operator== (const GenParticle &) const
 check for equality
bool operator!= (const GenParticle &) const
 check for inequality
void print (std::ostream &ostr=std::cout) const
 dump this particle's full info to ostr
 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
double generatedMass () const
 generatedMass() is included for backwards compatibility with CLHEP HepMC
int barcode () const
 particle barcode
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
bool suggest_barcode (int the_bar_code)
 In general there is no reason to "suggest_barcode".
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
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.

Examples:

example_BuildEventFromScratch.cc, example_UsingIterators.cc, testFlow.cc, testMass.cc.in, and testPrintBug.cc.

Definition at line 55 of file GenParticle.h.


Constructor & Destructor Documentation

HepMC::GenParticle::GenParticle ( void   ) 

default constructor

Definition at line 14 of file GenParticle.cc.

HepMC::GenParticle::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

Definition at line 23 of file GenParticle.cc.

References set_flow().

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().

HepMC::GenParticle::~GenParticle (  )  [virtual]

Definition at line 58 of file GenParticle.cc.

References parent_event(), and HepMC::GenEvent::remove_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.

Examples:
testFlow.cc.

Definition at line 238 of file GenParticle.h.

Referenced by GenParticle(), main(), HepMC::operator<<(), print(), set_end_vertex_(), and set_production_vertex_().

void HepMC::GenParticle::convert_momentum ( const double &   )  [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().

GenVertex * HepMC::GenParticle::end_vertex (  )  const [inline]

pointer to the decay vertex

Definition at line 207 of file GenParticle.h.

Referenced by HepMC::GenVertex::add_particle_in(), HepMC::Flow::connected_partners(), HepMC::Flow::dangling_connected_partners(), HepMC::operator<<(), parent_event(), print(), and HepMC::GenVertex::remove_particle().

int HepMC::GenParticle::flow ( int  code_index  )  const [inline]

particle flow index

Definition at line 211 of file GenParticle.h.

References HepMC::Flow::icode().

const Flow & HepMC::GenParticle::flow (  )  const [inline]

particle flow

Examples:
testFlow.cc.

Definition at line 209 of file GenParticle.h.

Referenced by main().

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(), and operator==().

double HepMC::GenParticle::generatedMass (  )  const [inline]

generatedMass() is included for backwards compatibility with CLHEP HepMC

Definition at line 116 of file GenParticle.h.

References generated_mass().

bool HepMC::GenParticle::has_decayed (  )  const [inline]

Convenience method. Returns true if status==2.

Definition at line 245 of file GenParticle.h.

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 248 of file GenParticle.h.

bool HepMC::GenParticle::is_undecayed (  )  const [inline]

Convenience method. Returns true if status==1.

Definition at line 242 of file GenParticle.h.

const FourVector & HepMC::GenParticle::momentum (  )  const [inline]

standard 4 momentum

Definition at line 197 of file GenParticle.h.

Referenced by HepMC::operator<<(), operator==(), and print().

HepMC::GenParticle::operator HepMC::FourVector (  )  const [inline]

conversion operator

Definition at line 194 of file GenParticle.h.

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

check for inequality

Definition at line 102 of file GenParticle.cc.

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  )  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(), m_flow, momentum(), pdg_id(), polarization(), and status().

GenEvent * HepMC::GenParticle::parent_event (  )  const

pointer to the event that owns this particle

Definition at line 123 of file GenParticle.cc.

References end_vertex(), HepMC::GenVertex::parent_event(), and production_vertex().

Referenced by set_end_vertex_(), set_production_vertex_(), suggest_barcode(), and ~GenParticle().

int HepMC::GenParticle::pdg_id (  )  const [inline]

particle ID

Definition at line 200 of file GenParticle.h.

Referenced by HepMC::operator<<(), operator==(), and print().

const Polarization & HepMC::GenParticle::polarization (  )  const [inline]

polarization information

Definition at line 214 of file GenParticle.h.

Referenced by operator==(), and print().

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().

GenVertex * HepMC::GenParticle::production_vertex (  )  const [inline]

pointer to the production vertex

Definition at line 204 of file GenParticle.h.

Referenced by HepMC::GenVertex::add_particle_out(), HepMC::Flow::connected_partners(), HepMC::Flow::dangling_connected_partners(), parent_event(), print(), and HepMC::GenVertex::remove_particle().

void HepMC::GenParticle::set_barcode_ ( int  the_bar_code  )  [inline, protected]

for use by GenEvent only

Definition at line 240 of file GenParticle.h.

Referenced by suggest_barcode().

void HepMC::GenParticle::set_end_vertex_ ( GenVertex decayvertex = 0  )  [protected]

set decay vertex - for internal use only

Definition at line 142 of file GenParticle.cc.

References barcode(), parent_event(), and HepMC::GenEvent::remove_barcode().

Referenced by HepMC::GenVertex::add_particle_in(), GenParticle(), and HepMC::GenVertex::remove_particle().

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

set particle flow index

Definition at line 226 of file GenParticle.h.

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

void HepMC::GenParticle::set_flow ( const Flow f  )  [inline]

set particle flow

Examples:
testFlow.cc.

Definition at line 224 of file GenParticle.h.

Referenced by GenParticle(), and main().

void HepMC::GenParticle::set_generated_mass ( const double &  m  ) 

define the actual generated mass

If you do not call set_generated_mass(), then generated_mass() will simply return the mass calculated from momentum()

Definition at line 240 of file GenParticle.cc.

Referenced by setGeneratedMass().

void HepMC::GenParticle::set_momentum ( const FourVector vec4  )  [inline]

set standard 4 momentum

Definition at line 217 of file GenParticle.h.

void HepMC::GenParticle::set_pdg_id ( int  id  )  [inline]

set particle ID

Definition at line 220 of file GenParticle.h.

void HepMC::GenParticle::set_polarization ( const Polarization pol = Polarization(0, 0)  )  [inline]

set polarization

Definition at line 235 of file GenParticle.h.

void HepMC::GenParticle::set_production_vertex_ ( GenVertex productionvertex = 0  )  [protected]

set production vertex - for internal use only

Definition at line 129 of file GenParticle.cc.

References barcode(), parent_event(), and HepMC::GenEvent::remove_barcode().

Referenced by HepMC::GenVertex::add_particle_out(), GenParticle(), and HepMC::GenVertex::remove_particle().

void HepMC::GenParticle::set_status ( int  status = 0  )  [inline]

set decay status

Definition at line 222 of file GenParticle.h.

void HepMC::GenParticle::setGeneratedMass ( const double &  m  )  [inline]

setGeneratedMass() is included for backwards compatibility with CLHEP HepMC

Definition at line 159 of file GenParticle.h.

References set_generated_mass().

int HepMC::GenParticle::status (  )  const [inline]

HEPEVT decay status.

Definition at line 202 of file GenParticle.h.

Referenced by HepMC::operator<<(), operator==(), and print().

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 GenParticle().

void HepMC::GenParticle::swap ( GenParticle other  ) 

swap

Definition at line 63 of file GenParticle.cc.

References m_barcode, m_end_vertex, m_flow, m_generated_mass, m_momentum, m_pdg_id, m_polarization, m_production_vertex, m_status, HepMC::Polarization::swap(), HepMC::Flow::swap(), and HepMC::FourVector::swap().

Referenced by operator=().


Friends And Related Function Documentation

friend class GenEvent [friend]

Definition at line 58 of file GenParticle.h.

friend class GenVertex [friend]

Definition at line 57 of file GenParticle.h.

std::ostream& operator<< ( std::ostream &  ostr,
const GenParticle part 
) [friend]

print particle

Definition at line 189 of file GenParticle.cc.


The documentation for this class was generated from the following files:
Generated on Thu Jan 7 13:10:18 2010 for HepMC by  doxygen 1.4.7