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 bool hasParents() const;
00123 bool hasChildren() const;
00124 int numParents() const;
00125 int numChildren() const;
00126
00127
00128 int collisionNumber() const;
00129 HepLorentzVector creationVertex() const;
00130 HepLorentzVector decayVertex() const;
00131
00132
00133
00134
00135
00136
00137
00138
00139 int barcode() const;
00140 bool suggest_barcode( int the_bar_code );
00141
00143
00145
00146 void set_momentum( const HepLorentzVector& vec4 );
00147 void set_pdg_id( int id );
00148 void set_status( int status = 0 );
00149 void set_flow( const Flow& f );
00150 void set_flow( int code_index, int code );
00151 void set_polarization( const Polarization& polarization =
00152 Polarization(0,0) );
00153 void setGeneratedMass( const double & m );
00154
00155
00156
00157
00158
00159 void setParticleID ( HepPDT::ParticleID pid );
00160 void setCollisionNumber ( int coll );
00161 void setMomentum ( double px, double py, double pz, double E );
00162 void changeParticleType (ParticleData & pd) { itsParticleData = &pd; }
00163 void changeDecayData (DecayData & dd) { itsDecayData = ⅆ }
00164
00165
00166
00167
00168 int ParticleID() const { return pdg_id(); }
00169 int StatusCode() const { return status(); }
00170 int Mother() const;
00171 int SecondMother() const;
00172 int BeginDaughters() const;
00173 int EndDaughters() const;
00174 int CollisionNumber() const { return collisionNumber(); }
00175 HepLorentzVector Momentum() const { return momentum(); }
00176 double Mass() const { return generatedMass(); }
00177 HepLorentzVector CreationVertex() const { return creationVertex(); }
00178 HepLorentzVector DecayVertex() const { return decayVertex(); }
00179
00180
00181 void setStatusCode ( int status ) { set_status(status); }
00182
00183 protected:
00184
00185 static unsigned int counter();
00186
00187 void set_production_vertex_( GenVertex* productionvertex = 0);
00188 void set_end_vertex_( GenVertex* decayvertex = 0 );
00189 void set_barcode_( int the_bar_code );
00190
00191 private:
00192 HepLorentzVector m_momentum;
00193 int m_pdg_id;
00194 int m_status;
00195 Flow m_flow;
00196 Polarization m_polarization;
00197 GenVertex* m_production_vertex;
00198 GenVertex* m_end_vertex;
00199 int m_barcode;
00200 double itsGeneratedMass;
00201 int itsCollisionNumber;
00202 ParticleData * itsParticleData;
00203
00204 DecayData * itsDecayData;
00205
00206 static unsigned int s_counter;
00207 };
00208
00210
00212 inline GenParticle::operator HepLorentzVector() const
00213 { return m_momentum; }
00214
00215 inline HepLorentzVector GenParticle::momentum() const
00216 { return m_momentum; }
00217
00218 inline int GenParticle::pdg_id() const { return m_pdg_id; }
00219
00220 inline int GenParticle::status() const { return m_status; }
00221
00222 inline GenVertex* GenParticle::production_vertex() const
00223 { return m_production_vertex; }
00224
00225 inline GenVertex* GenParticle::end_vertex() const { return m_end_vertex; }
00226
00227 inline Flow GenParticle::flow() const { return m_flow; }
00228
00229 inline int GenParticle::flow( int code_index ) const
00230 { return m_flow.icode( code_index ); }
00231
00232 inline Polarization GenParticle::polarization() const
00233 { return m_polarization; }
00234
00235 inline void GenParticle::set_momentum( const HepLorentzVector& vec4 )
00236 { m_momentum = vec4; }
00237
00238 inline void GenParticle::set_pdg_id( int id )
00239 { m_pdg_id = id; }
00240
00241 inline void GenParticle::set_status( int status ) { m_status = status; }
00242
00243 inline void GenParticle::set_flow( const Flow& f ) { m_flow = f; }
00244
00245 inline void GenParticle::set_flow( int code_index, int code )
00246 { m_flow.set_icode( code_index, code ); }
00247
00248 inline void GenParticle::set_polarization( const Polarization& polar )
00249 { m_polarization = polar; }
00250
00251 inline int GenParticle::barcode() const { return m_barcode; }
00252
00253 inline void GenParticle::set_barcode_( int bc ) { m_barcode = bc; }
00254
00255 }
00256
00257 #endif // HEPMC_GEN_PARTICLE_H
00258
00259