130 MsgStream log(
msgSvc(), name() );
132 log << MSG::DEBUG <<
"GenModule::execute()" << endmsg;
139 for (
int i = 0; i < numToGenerate; i++ )
146 GenEvent* evt =
new GenEvent( 1, 1 );
153 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(),
"/Event/Gen" );
157 MsgStream log(
msgSvc(), name() );
158 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endmsg;
160 anMcCol->push_back( mcEvent );
167 mcColl->push_back( mcEvent );
169 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen", mcColl );
171 if ( sc != StatusCode::SUCCESS )
173 MsgStream log(
msgSvc(), name() );
174 log << MSG::ERROR <<
"Could not register McGenEvent" << endmsg;
178 return StatusCode::FAILURE;
188 IIncidentSvc* incSvc;
189 service(
"IncidentSvc", incSvc );
190 incSvc->fireIncident( Incident( name(),
"McGenEvent Generated" ) );
296 for ( HepMC::GenEvent::vertex_iterator vtx = evt->vertices_begin();
297 vtx != evt->vertices_end(); ++vtx )
300 for ( HepMC::GenVertex::particle_iterator p = ( *vtx )->particles_begin( HepMC::children );
301 p != ( *vtx )->particles_end( HepMC::children ); ++p )
306 if ( ( *p )->end_vertex() ) ( *p )->end_vertex()->remove_particle( *p );
307 if ( ( *p )->production_vertex() ) ( *p )->production_vertex()->remove_particle( *p );
312 for ( HepMC::GenVertex::particle_iterator p = ( *vtx )->particles_begin( HepMC::parents );
313 p != ( *vtx )->particles_end( HepMC::parents ); ++p )
318 if ( ( *p )->end_vertex() ) ( *p )->end_vertex()->remove_particle( *p );
319 if ( ( *p )->production_vertex() ) ( *p )->production_vertex()->remove_particle( *p );