87 MsgStream log(messageService(), name());
89 log << MSG::INFO <<
"Mcgpj initialize" << endreq;
91 static const bool CREATEIFNOTTHERE(
true);
92 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
93 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
95 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
98 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"Mcgpj");
108 if(gRandom)
delete gRandom;
109 gRandom =
new TRandom3();
110 gRandom->SetSeed(engine->getSeed());
127 const int MaxList = 20;
128 bool InList[MaxList];
129 for(
int j = 0; j<MaxList; j++) InList[j] =
true;
131 double EBeam = 0.5*cmE;
134 log<<MSG::ERROR<<
"Invalid value of beam energy:"<<
EBeam<<endreq;
135 return StatusCode::FAILURE;
198 }
catch(std::logic_error lge){
199 log<<MSG::ERROR<<lge.what()<<endreq;
200 return StatusCode::FAILURE;
212 log<<MSG::INFO<<
"Cross-section statistical precision will be better than "
217 log<<MSG::INFO<<
"Hard photon on big angle is not included!"<<endreq;
220 log<<MSG::INFO<<
"Vacuum polarization is not included!"<<endreq;
223 log<<MSG::INFO<<
"Final state radiation is not included!"<<endreq;
226 log<<MSG::INFO<<
"Alpha order generation only!"<<endreq;
234 else if(proc==1 || proc==5)
246 for(
int j = 0; j<MaxList; j++) InList[j] =
false;
252 return StatusCode::FAILURE;
270 fpid[0] = 11; fpid[1] = -11; fM = 0.51099891;
273 fpid[0] = 13; fpid[1] = -13; fM = 105.658367;
276 fpid[0] = 211; fpid[1] = -211; fM = 139.57018;
279 fpid[0] = 130; fpid[1] = 310; fM = 497.614;
282 fpid[0] = 321; fpid[1] = -321; fM = 493.677;
285 fpid[0] = 15; fpid[1] = -15; fM = 1776.84;
288 fpid[0] = 22; fpid[1] = 22; fM = 0;
291 double EBeam = 0.5*cmE;
292 if(0>de) de = 0.005*
EBeam;
314 log << MSG::INFO <<
"Mcgpj initialize finished" << endreq;
316 return StatusCode::SUCCESS;
320 MsgStream log(messageService(), name());
321 log << MSG::INFO <<
"Mcgpj executing" << endreq;
322 log<<MSG::WARNING<<
"execute start"<<endreq;
325 GenEvent* evt =
new GenEvent(1,1);
327 GenVertex* prod_vtx =
new GenVertex();
329 evt->add_vertex( prod_vtx );
333 new GenParticle(HepLorentzVector(0,0,0.5*cmE*1e-3,0.5*cmE*1e-3),-11, 3);
334 p->suggest_barcode(1);
335 prod_vtx->add_particle_in(p);
339 new GenParticle(HepLorentzVector(0,0,0.5*cmE*1e-3, 0.5*cmE*1e-3), 11, 3);
340 p->suggest_barcode(2);
341 prod_vtx->add_particle_in(p);
350 for(
int i=0; i<np;i++){
351 double ptot = mom[i*4+3];
352 double px = ptot*mom[i*4+0];
353 double py = ptot*mom[i*4+1];
354 double pz = ptot*mom[i*4+2];
362 p =
new GenParticle( HepLorentzVector(px,py,pz,
etot), pid, 1);
363 p->suggest_barcode(i+3);
364 prod_vtx->add_particle_out(p);
370 for(
size_t i=0;i<nmax;i++){
374 new GenParticle( HepLorentzVector(
q.X()*1e-3,
q.Y()*1e-3,
q.Z()*1e-3,
q.T()*1e-3), pid, 1);
375 p->suggest_barcode(i+3);
376 prod_vtx->add_particle_out(p);
381 if( log.level() < MSG::INFO ){
386 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
389 log<<MSG::WARNING<<
"add event"<<endreq;
390 MsgStream log(messageService(), name());
391 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
393 anMcCol->push_back(mcEvent);
396 log<<MSG::WARNING<<
"create collection"<<endreq;
399 mcColl->push_back(mcEvent);
400 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
401 if (sc != StatusCode::SUCCESS) {
402 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
406 return StatusCode::FAILURE;
408 log << MSG::INFO <<
"McGenEventCol created and " << npart
409 <<
" particles stored in McGenEvent" << endreq;
413 log<<MSG::WARNING<<
"execute end"<<endreq;
414 return StatusCode::SUCCESS;