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