File indexing completed on 2025-01-18 10:01:09
0001
0002 #ifndef HEPMC_GEN_PARTICLE_H
0003 #define HEPMC_GEN_PARTICLE_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "HepMC/Flow.h"
0030 #include "HepMC/Polarization.h"
0031 #include "HepMC/SimpleVector.h"
0032 #include "HepMC/IteratorRange.h"
0033 #include <iostream>
0034 #ifdef _WIN32
0035 #define hepmc_uint64_t __int64
0036 #else
0037 #include <stdint.h> // for uint64_t
0038 #define hepmc_uint64_t uint64_t
0039 #endif
0040
0041 namespace HepMC {
0042
0043 class GenVertex;
0044 class GenEvent;
0045
0046 class GenParticleProductionRange;
0047 class ConstGenParticleProductionRange;
0048 class GenParticleEndRange;
0049 class ConstGenParticleEndRange;
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 class GenParticle {
0061
0062 friend class GenVertex;
0063 friend class GenEvent;
0064
0065 friend std::ostream& operator<<( std::ostream&, const GenParticle& );
0066
0067 public:
0068
0069 GenParticle(void);
0070
0071 GenParticle( const FourVector& momentum, int pdg_id,
0072 int status = 0, const Flow& itsflow = Flow(),
0073 const Polarization& polar = Polarization(0,0) );
0074 GenParticle( const GenParticle& inparticle );
0075 virtual ~GenParticle();
0076
0077 void swap( GenParticle & other);
0078 GenParticle& operator=( const GenParticle& inparticle );
0079
0080 bool operator==( const GenParticle& ) const;
0081
0082 bool operator!=( const GenParticle& ) const;
0083
0084
0085 void print( std::ostream& ostr = std::cout ) const;
0086
0087 operator HepMC::FourVector() const;
0088
0089
0090
0091
0092
0093
0094 const FourVector & momentum() const;
0095
0096 int pdg_id() const;
0097
0098 int status() const;
0099
0100 const Flow & flow() const;
0101
0102 int flow( int code_index ) const;
0103
0104 const Polarization & polarization() const;
0105
0106 GenVertex* production_vertex() const;
0107
0108 GenVertex* end_vertex() const;
0109
0110 GenEvent* parent_event() const;
0111
0112
0113
0114
0115
0116
0117
0118 double generated_mass() const;
0119
0120
0121 double generatedMass() const { return generated_mass(); }
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134 int barcode() const;
0135
0136
0137 bool is_undecayed() const;
0138
0139 bool has_decayed() const;
0140
0141
0142
0143 bool is_beam() const;
0144
0145
0146 GenParticleProductionRange particles_in( IteratorRange range = relatives );
0147
0148 ConstGenParticleProductionRange particles_in( IteratorRange range = relatives ) const;
0149
0150 GenParticleEndRange particles_out( IteratorRange range = relatives );
0151
0152 ConstGenParticleEndRange particles_out( IteratorRange range = relatives ) const;
0153
0154
0155
0156
0157
0158
0159 bool suggest_barcode( int the_bar_code );
0160
0161 void set_momentum( const FourVector& vec4 );
0162 void set_pdg_id( int id );
0163 void set_status( int status = 0 );
0164 void set_flow( const Flow& f );
0165 void set_flow( int code_index, int code = 0 );
0166
0167 void set_polarization( const Polarization& pol = Polarization(0,0) );
0168
0169
0170 void set_generated_mass( const double & m );
0171
0172
0173 void setGeneratedMass( const double & m )
0174 { return set_generated_mass(m); }
0175
0176 protected:
0177
0178
0179
0180
0181 void set_production_vertex_( GenVertex* productionvertex = 0);
0182
0183 void set_end_vertex_( GenVertex* decayvertex = 0 );
0184 void set_barcode_( int the_bar_code );
0185
0186
0187
0188 void convert_momentum( const double& );
0189
0190 private:
0191 FourVector m_momentum;
0192 int m_pdg_id;
0193 int m_status;
0194 Flow m_flow;
0195 Polarization m_polarization;
0196 GenVertex* m_production_vertex;
0197 GenVertex* m_end_vertex;
0198 int m_barcode;
0199 double m_generated_mass;
0200
0201
0202 };
0203
0204
0205
0206
0207
0208 inline GenParticle::operator HepMC::FourVector() const
0209 { return m_momentum; }
0210
0211 inline const FourVector & GenParticle::momentum() const
0212 { return m_momentum; }
0213
0214 inline int GenParticle::pdg_id() const { return m_pdg_id; }
0215
0216 inline int GenParticle::status() const { return m_status; }
0217
0218 inline GenVertex* GenParticle::production_vertex() const
0219 { return m_production_vertex; }
0220
0221 inline GenVertex* GenParticle::end_vertex() const { return m_end_vertex; }
0222
0223 inline const Flow & GenParticle::flow() const { return m_flow; }
0224
0225 inline int GenParticle::flow( int code_index ) const
0226 { return m_flow.icode( code_index ); }
0227
0228 inline const Polarization & GenParticle::polarization() const
0229 { return m_polarization; }
0230
0231 inline void GenParticle::set_momentum( const FourVector& vec4 )
0232 { m_momentum = vec4; }
0233
0234 inline void GenParticle::set_pdg_id( int id ) { m_pdg_id = id; }
0235
0236 inline void GenParticle::set_status( int st ) { m_status = st; }
0237
0238 inline void GenParticle::set_flow( const Flow& f ) { m_flow = f; }
0239
0240 inline void GenParticle::set_flow( int code_index, int code )
0241 {
0242 if ( code == 0 ) {
0243 m_flow.set_unique_icode( code_index );
0244 } else {
0245 m_flow.set_icode( code_index, code );
0246 }
0247 }
0248
0249 inline void GenParticle::set_polarization( const Polarization& polar )
0250 { m_polarization = polar; }
0251
0252 inline int GenParticle::barcode() const { return m_barcode; }
0253
0254 inline void GenParticle::set_barcode_( int bc ) { m_barcode = bc; }
0255
0256 inline bool GenParticle::is_undecayed() const {
0257 return ( m_status==1 ) ? true : false;
0258 }
0259 inline bool GenParticle::has_decayed() const {
0260 return ( m_status==2 ) ? true : false;
0261 }
0262 inline bool GenParticle::is_beam() const {
0263 return ( m_status==4 ) ? true : false;
0264 }
0265
0266 }
0267
0268 #endif
0269
0270