210{
211 MsgStream log(messageService(), name());
212
213
214
215 int npart = 0;
216 int pid1,pid2,pst1,pst2;
217 if(m_Ich==1) {pid1=11; pid2=-11; pst1=1;pst2=1;}
218 if(m_Ich==2) {pid1=13; pid2=-13; pst1=1;pst2=1;}
219 if(m_Ich==3) {pid1=22; pid2= 22; pst1=1;pst2=1;}
220 if(m_Ich==4) {pid1=-211; pid2= 211; pst1=1;pst2=1;}
221
222
223 GenEvent* evt = new GenEvent(1,1);
224
225 GenVertex* prod_vtx = new GenVertex();
226
227 evt->add_vertex( prod_vtx );
228
229
230 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p1[1][evtgen],
MOMSET.p1[2][evtgen],
232 11, 3);
233 p->suggest_barcode( ++npart );
234 prod_vtx->add_particle_in(p);
235
236
237
238 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q1[1][evtgen],
MOMSET.q1[2][evtgen],
240 -11, 3);
241
242 p->suggest_barcode( ++npart );
243 prod_vtx->add_particle_in(p);
244
245
246 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p2[1][evtgen],
MOMSET.p2[2][evtgen],
248 pid1,pst1);
249 p->suggest_barcode( ++npart );
250 prod_vtx->add_particle_out(p);
251
252
253
254
255
256
257
258
259
260 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q2[1][evtgen],
MOMSET.q2[2][evtgen],
262 pid2, pst2);
263 p->suggest_barcode( ++npart );
264 prod_vtx->add_particle_out(p);
265
266
267 int iphot=0;
268
269 for (iphot=0; iphot<
ISRPHOTONS.ncqph[evtgen-1]; iphot++)
270 {
271
272
273
274
275 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.phot[1][iphot][evtgen],
MOMSET.phot[2][iphot][evtgen],
276 MOMSET.phot[3][iphot][evtgen],
MOMSET.phot[0][iphot][evtgen]),
277 22, 1);
278 p->suggest_barcode( ++npart );
279 prod_vtx->add_particle_out(p);
280
281 }
282
283
284 evtgen++;
285
286 if( log.level() < MSG::INFO )
287 {
288 evt->print();
289 }
290
291
292 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen");
293 if (anMcCol!=0)
294 {
295
296 MsgStream log(messageService(), name());
297 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
299 anMcCol->push_back(mcEvent);
300 }
301 else
302 {
303
306 mcColl->push_back(mcEvent);
307 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
308 if (sc != StatusCode::SUCCESS)
309 {
310 log << MSG::ERROR << "Could not register McGenEvent" << endreq;
311 delete mcColl;
312 delete evt;
313 delete mcEvent;
314 return StatusCode::FAILURE;
315 }
316 else
317 {
318
319 }
320 }
321
322 return StatusCode::SUCCESS;
323}
ObjectVector< McGenEvent > McGenEventCol