154 if ( m_logLevel <=
int(MSG::DEBUG) ) {
155 std::cout <<
"AthenaHepMCtoG4EventAction: - Generating Primaries"
160 p_evt = (
const HepMC::GenEvent *)(*p_evtCollItr);
165 if ( m_logLevel <=
int(MSG::WARNING) ) {
166 std::cout <<
"AthenaHepMCtoG4EventAction: - HepMC ptr == null"
174 G4PrimaryVertex* vertex =
new G4PrimaryVertex(0.,0.,0.,0.);
177 for ( HepMC::GenEvent::vertex_const_iterator
v = p_evt->vertices_begin();
178 v != p_evt->vertices_end(); ++
v ) {
180 for (HepMC::GenVertex::particle_iterator it=
181 (*v)->particles_begin(HepMC::children);
182 it!=(*v)->particles_end(HepMC::children);
185 if (!(*it)->end_vertex() && (*it)->status()==1 ) {
195 for (HepMC::GenVertex::particle_iterator it=
196 (*v)->particles_begin(HepMC::children);
197 it!=(*v)->particles_end(HepMC::children);
200 if ( (*it)->status() != 1)
continue;
202 int pdgcode=(*it)->pdg_id();
214 const G4ThreeVector& p=(*it)->momentum();
215 G4PrimaryParticle *part;
217 part=
new G4PrimaryParticle (pdgcode,p.x()*GeV,p.y()*GeV,p.z()*GeV);
219 G4ParticleDefinition *pdef = G4Geantino::GeantinoDefinition();
220 part=
new G4PrimaryParticle (pdef,p.x()*GeV,p.y()*GeV,p.z()*GeV);
223 vertex->SetPosition((*v)->position().x(),
224 (*v)->position().y(),
225 (*v)->position().z());
226 vertex->SetT0((*v)->position().t());
228 vertex->SetPrimary(part);
234 anEvent->AddPrimaryVertex(vertex);
236 if ( m_logLevel <=
int(MSG::DEBUG) ) {
237 std::cout <<
"AthenaHepMCtoG4EventAction: - done. G4Event has "
238 <<
n <<
" particles. "