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