16#include "HepMC/GenEvent.h"
17#include "HepMC/GenVertex.h"
18#include "HepMC/GenParticle.h"
20#include "CLHEP/Vector/LorentzVector.h"
23#include "GaudiKernel/SmartDataPtr.h"
54DECLARE_COMPONENT(
Mcgpj)
55Mcgpj::
Mcgpj(const
std::
string& name, ISvcLocator* pSvcLocator):Algorithm(name, pSvcLocator){
56 declareProperty(
"Data", m_datapath =
"${MCGPJROOT}/data");
57 declareProperty(
"VpolFname", m_vpolfname =
"vpol.dat");
58 declareProperty(
"CMEnergy", cmE = 3.097);
59 declareProperty(
"Process", proc = 0);
60 declareProperty(
"NRad", NRad = 20000);
61 declareProperty(
"HardPhoton", IsHardPhoton = 1);
62 declareProperty(
"NoVacPol", IsNoVacPol = 0);
63 declareProperty(
"FSR", IsFSR = 1);
64 declareProperty(
"AcolAngle", pc = 0.);
65 declareProperty(
"DeltaE", de = -1.);
66 declareProperty(
"NTheta0", nt0 = -1.);
67 declareProperty(
"DeltaTheta",
dt = 0.5);
68 declareProperty(
"DeltaPhi", dp = 0.3);
69 declareProperty(
"AverageTheta",
at = 1.1);
70 declareProperty(
"ThetaDetector", td = 1.1 - 0.5/2);
71 declareProperty(
"AverageMomentum", am = 0.090);
72 declareProperty(
"CrossMomentum", cm = 0.090);
73 declareProperty(
"MinimumEnergy", em = 0.050);
74 declareProperty(
"ThetaIntermediate", ti = 0.473);
75 declareProperty(
"AlphaScale", al = 1.);
76 declareProperty(
"ThetaMinus", thm = -1.);
77 declareProperty(
"ThetaPlus", thp = -1.);
78 declareProperty(
"AbsoluteError", te = 0.05);
79 declareProperty(
"RelativeError", re = 0.05);
81 declareProperty(
"BeamSpread", spread = -1);
83 declareProperty(
"Mode5pi", m_fmode5pi = 0);
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;
133 if( ( EBeam < 100 || EBeam > 2500 ) && !IsNoVacPol ){
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;
418 MsgStream log(messageService(), name());
427 log << MSG::INFO <<
"Mcgpj finalized" << endreq;
429 return StatusCode::SUCCESS;
double cos(const BesAngle a)
************Class m_alfQCDMZ INTEGER m_KFfin INTEGER m_IVfin INTEGER m_ibox *COMMON c_DZface $ alphaQED at(Q^2=MZ^2) DIZET $ m_alfQCDMZ
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
ObjectVector< McGenEvent > McGenEventCol
TVCrossPart * MatrixElements
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.
void SetAlphaScale(const double &x)
void MakeParts(double err)
size_t GenUnWeightedEvent()
TLorentzVector ** GetParticles()
void SetBeamSpread(double x=1)
void AverageTheta(const double &x)
void SetNEvents(const unsigned int &n)
void SetPartList(const bool *InList)
void SetDatadir(std::string dir)
void Set_ThetaMin(const double &x)
void Set_Type(const int x)
void Set_ThetaInt(const double &x)
void Set_dE_Abs(const double &x)
double Get_RelativeError()
void Set_RelativeError(const double &x)
void SetVpolFname(std::string fname)
void Set_Theta0_Rel(const double &x)
void Set_E(const double &x)
void Set_TotalError(const double &x)
virtual void SetHardPhoton(const bool &x)