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
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "CLHEP/config/CLHEP.h"
00039 #include "CLHEP/config/iostream.h"
00040 #include "CLHEP/HepMC/Flow.h"
00041 #include "CLHEP/HepMC/Polarization.h"
00042 #include "CLHEP/Vector/LorentzVector.h"
00043 #include "CLHEP/HepMC/HepMCConfig.h"
00044 #include "CLHEP/HepPDT/ParticleID.hh"
00045 #include <vector>
00046
00047 namespace HepMC {
00048
00049 class GenVertex;
00050 class GenEvent;
00051
00056 class GenParticle {
00057
00058 friend class GenVertex;
00059 friend class GenEvent;
00060 friend std::ostream& operator<<( std::ostream&, const GenParticle& );
00061
00062 public:
00063
00064 typedef HepMCConfig::ParticleData ParticleData;
00065 typedef HepMCConfig::DecayData DecayData;
00066
00067 GenParticle( const HepLorentzVector& momentum, int pdg_id,
00068 int status = 0, const Flow& itsflow = Flow(),
00069 const Polarization& polar = Polarization(0,0) );
00070 GenParticle( const HepLorentzVector& momentum,
00071 ParticleData * pd, DecayData * dd = 0,
00072 int status = 0, const Flow& itsflow = Flow(),
00073 const Polarization& polar = Polarization(0,0) );
00074 GenParticle( const GenParticle& inparticle );
00075 virtual ~GenParticle();
00076
00077 GenParticle& operator=( const GenParticle& inparticle );
00078 bool operator==( const GenParticle& ) const;
00079 bool operator!=( const GenParticle& ) const;
00080
00081
00082 void print( std::ostream& ostr = std::cout ) const;
00083
00084 operator HepLorentzVector() const;
00085
00087
00089
00090 HepLorentzVector momentum() const;
00091 int pdg_id() const;
00092 int status() const;
00093 Flow flow() const;
00094 int flow( int code_index ) const;
00095 double generatedMass() const;
00096
00097
00098
00099
00100 Polarization polarization() const;
00101 GenVertex* production_vertex() const;
00102 GenVertex* end_vertex() const;
00103 GenEvent* parent_event() const;
00104
00105 HepPDT::ParticleID particleID() const;
00106 ParticleData const & particledata() const { return *itsParticleData; }
00107 ParticleData & particledata() { return *itsParticleData; }
00108 DecayData const & decaydata() const { return *itsDecayData; }
00109 DecayData & decaydata() { return *itsDecayData; }
00110
00111
00112 GenParticle * mother() const;
00113 GenParticle * secondMother() const;
00114 GenParticle * beginDaughters() const;
00115 GenParticle * endDaughters() const;
00116
00117 std::vector<GenParticle*> listChildren() const;
00118 std::vector<GenParticle*> listDescendants() const;
00119 std::vector<GenParticle*> listParents() const;
00120 std::vector<GenParticle*> listAncestors() const;
00121
00122
00123 int collisionNumber() const;
00124 HepLorentzVector creationVertex() const;
00125 HepLorentzVector decayVertex() const;
00126
00127
00128
00129
00130
00131
00132
00133
00134 int barcode() const;
00135 bool suggest_barcode( int the_bar_code );
00136
00138
00140
00141 void set_momentum( const HepLorentzVector& vec4 );
00142 void set_pdg_id( int id );
00143 void set_status( int status = 0 );
00144 void set_flow( const Flow& f );
00145 void set_flow( int code_index, int code );
00146 void set_polarization( const Polarization& polarization =
00147 Polarization(0,0) );
00148 void setGeneratedMass( const double & m );
00149
00150
00151
00152
00153
00154 void setParticleID ( HepPDT::ParticleID pid );
00155 void setCollisionNumber ( int coll );
00156 void setMomentum ( double px, double py, double pz, double E );
00157 void changeParticleType (ParticleData & pd) { itsParticleData = &pd; }
00158 void changeDecayData (DecayData & dd) { itsDecayData = ⅆ }
00159
00160
00161
00162
00163 int ParticleID() const { return pdg_id(); }
00164 int StatusCode() const { return status(); }
00165 int Mother() const;
00166 int SecondMother() const;
00167 int BeginDaughters() const;
00168 int EndDaughters() const;
00169 int CollisionNumber() const { return collisionNumber(); }
00170 HepLorentzVector Momentum() const { return momentum(); }
00171 double Mass() const { return generatedMass(); }
00172 HepLorentzVector CreationVertex() const { return creationVertex(); }
00173 HepLorentzVector DecayVertex() const { return decayVertex(); }
00174
00175
00176 void setStatusCode ( int status ) { set_status(status); }
00177
00178 protected:
00179
00180 static unsigned int counter();
00181
00182 void set_production_vertex_( GenVertex* productionvertex = 0);
00183 void set_end_vertex_( GenVertex* decayvertex = 0 );
00184 void set_barcode_( int the_bar_code );
00185
00186 private:
00187 HepLorentzVector m_momentum;
00188 int m_pdg_id;
00189 int m_status;
00190 Flow m_flow;
00191 Polarization m_polarization;
00192 GenVertex* m_production_vertex;
00193 GenVertex* m_end_vertex;
00194 int m_barcode;
00195 double itsGeneratedMass;
00196 int itsCollisionNumber;
00197 ParticleData * itsParticleData;
00198
00199 DecayData * itsDecayData;
00200
00201 static unsigned int s_counter;
00202 };
00203
00205
00207
00208 { return m_momentum; }
00209
00210 inline HepLorentzVector GenParticle::momentum() const
00211 { return m_momentum; }
00212
00213 inline int GenParticle::pdg_id() const { return m_pdg_id; }
00214
00215 inline int GenParticle::status() const { return m_status; }
00216
00217 inline GenVertex* GenParticle::production_vertex() const
00218 { return m_production_vertex; }
00219
00220 inline GenVertex* GenParticle::end_vertex() const { return m_end_vertex; }
00221
00222 inline Flow GenParticle::flow() const { return m_flow; }
00223
00224 inline int GenParticle::flow( int code_index ) const
00225 { return m_flow.icode( code_index ); }
00226
00227 inline Polarization GenParticle::polarization() const
00228 { return m_polarization; }
00229
00230 inline void GenParticle::set_momentum( const HepLorentzVector& vec4 )
00231 { m_momentum = vec4; }
00232
00233 inline void GenParticle::set_pdg_id( int id )
00234 { m_pdg_id = id; }
00235
00236 inline void GenParticle::set_status( int status ) { m_status = status; }
00237
00238 inline void GenParticle::set_flow( const Flow& f ) { m_flow = f; }
00239
00240 inline void GenParticle::set_flow( int code_index, int code )
00241 { m_flow.set_icode( code_index, code ); }
00242
00243 inline void GenParticle::set_polarization( const Polarization& polar )
00244 { m_polarization = polar; }
00245
00246 inline int GenParticle::barcode() const { return m_barcode; }
00247
00248 inline void GenParticle::set_barcode_( int bc ) { m_barcode = bc; }
00249
00250 }
00251
00252 #endif // HEPMC_GEN_PARTICLE_H
00253
00254