205 {
206 MsgStream log(
msgSvc(), name() );
207 log << MSG::INFO << "Bhwide executing" << endmsg;
208
210
211 if ( log.level() < MSG::INFO )
212 {
214
215
216 }
217
218 int npart = 0;
219
220
221 GenEvent* evt = new GenEvent( 1, 1 );
222
223 GenVertex* prod_vtx = new GenVertex();
224
225 evt->add_vertex( prod_vtx );
226
227
228 GenParticle* p = new GenParticle(
230 3 );
231 p->suggest_barcode( ++npart );
232 prod_vtx->add_particle_in( p );
233
234
235 p = new GenParticle(
237 3 );
238 p->suggest_barcode( ++npart );
239 prod_vtx->add_particle_in( p );
240
241
242 p = new GenParticle(
244 1 );
245 p->suggest_barcode( ++npart );
246 prod_vtx->add_particle_out( p );
247
248
249 p = new GenParticle(
251 1 );
252 p->suggest_barcode( ++npart );
253 prod_vtx->add_particle_out( p );
254
255 int iphot = 0;
256 for ( iphot = 0; iphot <
MOMSET.nphot; iphot++ )
257 {
258
259 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.phot[0][iphot],
MOMSET.phot[1][iphot],
262 22, 1 );
263 p->suggest_barcode( ++npart );
264 prod_vtx->add_particle_out( p );
265 }
266
267 if ( log.level() < MSG::INFO ) { evt->print(); }
268
269
270 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(), "/Event/Gen" );
271 if ( anMcCol != 0 )
272 {
273
274 MsgStream log(
msgSvc(), name() );
275 log << MSG::INFO << "Add McGenEvent to existing collection" << endmsg;
276 McGenEvent* mcEvent = new McGenEvent( evt );
277 anMcCol->push_back( mcEvent );
278 }
279 else
280 {
281
283 McGenEvent* mcEvent = new McGenEvent( evt );
284 mcColl->push_back( mcEvent );
285 StatusCode sc = eventSvc()->registerObject( "/Event/Gen", mcColl );
286 if ( sc != StatusCode::SUCCESS )
287 {
288 log << MSG::ERROR << "Could not register McGenEvent" << endmsg;
289 delete mcColl;
290 delete evt;
291 delete mcEvent;
292 return StatusCode::FAILURE;
293 }
294 else
295 {
296 log << MSG::INFO << "McGenEventCol created and " << npart
297 << " particles stored in McGenEvent" << endmsg;
298 }
299 }
300
301 return StatusCode::SUCCESS;
302}
#define BHWIDE(MODE, XPAR, NPAR)
ObjectVector< McGenEvent > McGenEventCol