86 MsgStream log(messageService(), name());
88 log << MSG::INFO <<
"Mcgpj initialize" << endreq;
90 static const bool CREATEIFNOTTHERE(
true);
91 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
92 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
94 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
97 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"Mcgpj");
107 if(gRandom)
delete gRandom;
108 gRandom =
new TRandom3();
109 gRandom->SetSeed(engine->getSeed());
126 const int MaxList = 20;
127 bool InList[MaxList];
128 for(
int j = 0; j<MaxList; j++) InList[j] =
true;
130 double EBeam = 0.5*cmE;
133 log<<MSG::ERROR<<
"Invalid value of beam energy:"<<
EBeam<<endreq;
134 return StatusCode::FAILURE;
197 }
catch(std::logic_error lge){
198 log<<MSG::ERROR<<lge.what()<<endreq;
199 return StatusCode::FAILURE;
211 log<<MSG::INFO<<
"Cross-section statistical precision will be better than "
216 log<<MSG::INFO<<
"Hard photon on big angle is not included!"<<endreq;
219 log<<MSG::INFO<<
"Vacuum polarization is not included!"<<endreq;
222 log<<MSG::INFO<<
"Final state radiation is not included!"<<endreq;
225 log<<MSG::INFO<<
"Alpha order generation only!"<<endreq;
233 else if(proc==1 || proc==5)
245 for(
int j = 0; j<MaxList; j++) InList[j] =
false;
251 return StatusCode::FAILURE;
269 fpid[0] = 11; fpid[1] = -11; fM = 0.51099891;
272 fpid[0] = 13; fpid[1] = -13; fM = 105.658367;
275 fpid[0] = 211; fpid[1] = -211; fM = 139.57018;
278 fpid[0] = 130; fpid[1] = 310; fM = 497.614;
281 fpid[0] = 321; fpid[1] = -321; fM = 493.677;
284 fpid[0] = 15; fpid[1] = -15; fM = 1776.84;
287 fpid[0] = 22; fpid[1] = 22; fM = 0;
290 double EBeam = 0.5*cmE;
291 if(0>de) de = 0.005*
EBeam;
313 log << MSG::INFO <<
"Mcgpj initialize finished" << endreq;
315 return StatusCode::SUCCESS;
319 MsgStream log(messageService(), name());
320 log << MSG::INFO <<
"Mcgpj executing" << endreq;
321 log<<MSG::WARNING<<
"execute start"<<endreq;
324 GenEvent* evt =
new GenEvent(1,1);
326 GenVertex* prod_vtx =
new GenVertex();
328 evt->add_vertex( prod_vtx );
332 new GenParticle(HepLorentzVector(0,0,0.5*cmE*1e-3,0.5*cmE*1e-3),-11, 3);
333 p->suggest_barcode(1);
334 prod_vtx->add_particle_in(p);
338 new GenParticle(HepLorentzVector(0,0,0.5*cmE*1e-3, 0.5*cmE*1e-3), 11, 3);
339 p->suggest_barcode(2);
340 prod_vtx->add_particle_in(p);
349 for(
int i=0; i<np;i++){
350 double ptot = mom[i*4+3];
351 double px = ptot*mom[i*4+0];
352 double py = ptot*mom[i*4+1];
353 double pz = ptot*mom[i*4+2];
361 p =
new GenParticle( HepLorentzVector(px,py,pz,
etot), pid, 1);
362 p->suggest_barcode(i+3);
363 prod_vtx->add_particle_out(p);
369 for(
size_t i=0;i<nmax;i++){
373 new GenParticle( HepLorentzVector(
q.X()*1e-3,
q.Y()*1e-3,
q.Z()*1e-3,
q.T()*1e-3), pid, 1);
374 p->suggest_barcode(i+3);
375 prod_vtx->add_particle_out(p);
380 if( log.level() < MSG::INFO ){
385 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
388 log<<MSG::WARNING<<
"add event"<<endreq;
389 MsgStream log(messageService(), name());
390 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
392 anMcCol->push_back(mcEvent);
395 log<<MSG::WARNING<<
"create collection"<<endreq;
398 mcColl->push_back(mcEvent);
399 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
400 if (sc != StatusCode::SUCCESS) {
401 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
405 return StatusCode::FAILURE;
407 log << MSG::INFO <<
"McGenEventCol created and " << npart
408 <<
" particles stored in McGenEvent" << endreq;
412 log<<MSG::WARNING<<
"execute end"<<endreq;
413 return StatusCode::SUCCESS;