144 if ( m_logLevel <=
int( MSG::DEBUG ) )
145 { std::cout <<
"AthenaHepMCtoG4EventAction: - Generating Primaries" << std::endl; }
147 p_evt = (
const HepMC::GenEvent*)( *p_evtCollItr );
152 if ( m_logLevel <=
int( MSG::WARNING ) )
153 { std::cout <<
"AthenaHepMCtoG4EventAction: - HepMC ptr == null" << std::endl; }
158 G4PrimaryVertex* vertex =
new G4PrimaryVertex( 0., 0., 0., 0. );
161 for ( HepMC::GenEvent::vertex_const_iterator
v = p_evt->vertices_begin();
162 v != p_evt->vertices_end(); ++
v )
165 for ( HepMC::GenVertex::particle_iterator it = ( *v )->particles_begin( HepMC::children );
166 it != ( *v )->particles_end( HepMC::children ); it++ )
169 if ( !( *it )->end_vertex() && ( *it )->status() == 1 )
181 for ( HepMC::GenVertex::particle_iterator it =
182 ( *v )->particles_begin( HepMC::children );
183 it != ( *v )->particles_end( HepMC::children ); it++ )
186 if ( ( *it )->status() != 1 )
continue;
188 int pdgcode = ( *it )->pdg_id();
200 const G4ThreeVector& p = ( *it )->momentum();
201 G4PrimaryParticle* part;
202 if ( pdgcode != 999 )
203 { part =
new G4PrimaryParticle( pdgcode, p.x() * GeV, p.y() * GeV, p.z() * GeV ); }
206 G4ParticleDefinition* pdef = G4Geantino::GeantinoDefinition();
207 part =
new G4PrimaryParticle( pdef, p.x() * GeV, p.y() * GeV, p.z() * GeV );
210 vertex->SetPosition( ( *v )->position().x(), ( *v )->position().y(),
211 ( *v )->position().z() );
212 vertex->SetT0( ( *v )->position().t() );
214 vertex->SetPrimary( part );
220 anEvent->AddPrimaryVertex( vertex );
222 if ( m_logLevel <=
int( MSG::DEBUG ) )
224 std::cout <<
"AthenaHepMCtoG4EventAction: - done. G4Event has " <<
n <<
" particles. "