190 {
191 MsgStream log(
msgSvc(), name() );
192 log << MSG::INFO << "BesTwogam executing" << endmsg;
193 HepMC::HEPEVT_Wrapper::set_max_number_entries( 2000 );
194 HepMC::HEPEVT_Wrapper::set_sizeof_real( 8 );
195 HepMC::IO_HEPEVT HepEvtIO;
198
200 {
201 log << MSG::ERROR << " BesTwogam: fail to generate good event" << endl;
202 return StatusCode::FAILURE;
203 }
204 m_numberEvent++;
205 if ( log.level() < MSG::INFO )
LULIST( 1 );
207
208 HepMC::GenEvent* evt = HepEvtIO.read_next_event();
209 evt->set_event_number( m_numberEvent );
210 evt->set_signal_process_id( 1 );
211
212 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(), "/Event/Gen" );
213 if ( anMcCol != 0 )
214 {
215
216 MsgStream log(
msgSvc(), name() );
217 log << MSG::INFO << "Add McGenEvent to existing collection" << endmsg;
218 McGenEvent* mcEvent = new McGenEvent( evt );
219 anMcCol->push_back( mcEvent );
220 }
221 else
222 {
223
225 McGenEvent* mcEvent = new McGenEvent( evt );
226 mcColl->push_back( mcEvent );
227 StatusCode sc = eventSvc()->registerObject( "/Event/Gen", mcColl );
228 if ( sc != StatusCode::SUCCESS )
229 {
230 log << MSG::ERROR << "Could not register McGenEvent" << endmsg;
231 delete mcColl;
232 delete evt;
233 delete mcEvent;
234 return StatusCode::FAILURE;
235 }
236 }
237 return StatusCode::SUCCESS;
238}
ObjectVector< McGenEvent > McGenEventCol