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