00001
00002 #ifndef HEPMC_GEN_PARTICLE_H
00003 #define HEPMC_GEN_PARTICLE_H
00004
00006
00007
00008
00009
00010
00011
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "HepMC/Flow.h"
00030 #include "HepMC/Polarization.h"
00031 #include "HepMC/SimpleVector.h"
00032 #include <iostream>
00033 #ifdef _WIN32
00034 #define hepmc_uint64_t __int64
00035 #else
00036 #include <stdint.h>
00037 #define hepmc_uint64_t uint64_t
00038 #endif
00039
00040 namespace HepMC {
00041
00042 class GenVertex;
00043 class GenEvent;
00044
00045
00047
00055 class GenParticle {
00056
00057 friend class GenVertex;
00058 friend class GenEvent;
00060 friend std::ostream& operator<<( std::ostream&, const GenParticle& );
00061
00062 public:
00064 GenParticle(void);
00066 GenParticle( const FourVector& momentum, int pdg_id,
00067 int status = 0, const Flow& itsflow = Flow(),
00068 const Polarization& polar = Polarization(0,0) );
00069 GenParticle( const GenParticle& inparticle );
00070 virtual ~GenParticle();
00071
00072 void swap( GenParticle & other);
00073 GenParticle& operator=( const GenParticle& inparticle );
00074
00075 bool operator==( const GenParticle& ) const;
00077 bool operator!=( const GenParticle& ) const;
00078
00080 void print( std::ostream& ostr = std::cout ) const;
00081
00082 operator HepMC::FourVector() const;
00083
00085
00087
00089 const FourVector & momentum() const;
00091 int pdg_id() const;
00093 int status() const;
00095 const Flow & flow() const;
00097 int flow( int code_index ) const;
00099 const Polarization & polarization() const;
00101 GenVertex* production_vertex() const;
00103 GenVertex* end_vertex() const;
00105 GenEvent* parent_event() const;
00106
00113 double generated_mass() const;
00114
00116 double generatedMass() const { return generated_mass(); }
00117
00118
00123 int barcode() const;
00124
00126
00128
00130 bool suggest_barcode( int the_bar_code );
00131
00132 void set_momentum( const FourVector& vec4 );
00133 void set_pdg_id( int id );
00134 void set_status( int status = 0 );
00135 void set_flow( const Flow& f );
00136 void set_flow( int code_index, int code = 0 );
00137
00138 void set_polarization( const Polarization& pol = Polarization(0,0) );
00141 void set_generated_mass( const double & m );
00142
00144 void setGeneratedMass( const double & m )
00145 { return set_generated_mass(m); }
00146
00147 protected:
00148
00149
00150
00152 void set_production_vertex_( GenVertex* productionvertex = 0);
00154 void set_end_vertex_( GenVertex* decayvertex = 0 );
00155 void set_barcode_( int the_bar_code );
00156
00159 void convert_momentum( const double& );
00160
00161 private:
00162 FourVector m_momentum;
00163 int m_pdg_id;
00164 int m_status;
00165 Flow m_flow;
00166 Polarization m_polarization;
00167 GenVertex* m_production_vertex;
00168 GenVertex* m_end_vertex;
00169 int m_barcode;
00170 double m_generated_mass;
00171
00172
00173 };
00174
00176
00178
00179 inline GenParticle::operator HepMC::FourVector() const
00180 { return m_momentum; }
00181
00182 inline const FourVector & GenParticle::momentum() const
00183 { return m_momentum; }
00184
00185 inline int GenParticle::pdg_id() const { return m_pdg_id; }
00186
00187 inline int GenParticle::status() const { return m_status; }
00188
00189 inline GenVertex* GenParticle::production_vertex() const
00190 { return m_production_vertex; }
00191
00192 inline GenVertex* GenParticle::end_vertex() const { return m_end_vertex; }
00193
00194 inline const Flow & GenParticle::flow() const { return m_flow; }
00195
00196 inline int GenParticle::flow( int code_index ) const
00197 { return m_flow.icode( code_index ); }
00198
00199 inline const Polarization & GenParticle::polarization() const
00200 { return m_polarization; }
00201
00202 inline void GenParticle::set_momentum( const FourVector& vec4 )
00203 { m_momentum = vec4; }
00204
00205 inline void GenParticle::set_pdg_id( int id ) { m_pdg_id = id; }
00206
00207 inline void GenParticle::set_status( int status ) { m_status = status; }
00208
00209 inline void GenParticle::set_flow( const Flow& f ) { m_flow = f; }
00210
00211 inline void GenParticle::set_flow( int code_index, int code )
00212 {
00213 if ( code == 0 ) {
00214 m_flow.set_unique_icode( code_index );
00215 } else {
00216 m_flow.set_icode( code_index, code );
00217 }
00218 }
00219
00220 inline void GenParticle::set_polarization( const Polarization& polar )
00221 { m_polarization = polar; }
00222
00223 inline int GenParticle::barcode() const { return m_barcode; }
00224
00225 inline void GenParticle::set_barcode_( int bc ) { m_barcode = bc; }
00226
00227 }
00228
00229 #endif // HEPMC_GEN_PARTICLE_H
00230
00231