16#include "HepMC/GenEvent.h"
17#include "HepMC/GenVertex.h"
18#include "HepMC/GenParticle.h"
19#include "CLHEP/Vector/LorentzVector.h"
21#include "GaudiKernel/MsgStream.h"
22#include "GaudiKernel/ISvcLocator.h"
23#include "GaudiKernel/AlgFactory.h"
24#include "GaudiKernel/DataSvc.h"
25#include "GaudiKernel/SmartDataPtr.h"
30#include "cfortran/cfortran.h"
46#define MOMSET COMMON_BLOCK(MOMSET_DEF, momset)
53#define GLIMIT(LENMX) CCALLSFSUB1(GLIMIT,glimit,INT,LENMX)
56#define DUMPS(NOUT) CCALLSFSUB1(DUMPS,dumps,INT,NOUT)
59#define BHWIDE(MODE,XPAR,NPAR) CCALLSFSUB3(BHWIDE,bhwide,INT,DOUBLEV,INTV,MODE,XPAR,NPAR)
62#define MARINI(IJKLIN, NTOTIN, NTOT2N) CCALLSFSUB3(MARINI, marini, INT, INT, INT, IJKLIN, NTOTIN, NTOT2N)
66 extern void marran_(
float* rvec,
int* nma);
67 extern void ecuran_(
double* rvec,
int* nma);
68 extern void carran_(
double* rvec,
int* nma);
82 for(
int i=0; i<nmax; i++) rvec[i]=rvecd[i];
91 for(
int i=0; i<nmax; i++) rvec[i]=rvecd[i];
100 for(
int i=0; i<nmax; i++) rvec[i]=rvecd[i];
110Bhwide::Bhwide(
const string& name, ISvcLocator* pSvcLocator):Algorithm( name, pSvcLocator )
112 declareProperty(
"CMEnergy", m_cmEnergy = 3.097);
113 declareProperty(
"EleMinThetaAngle", m_ThMine = 22);
114 declareProperty(
"EleMaxThetaAngle", m_ThMaxe = 158);
115 declareProperty(
"PosMinThetaAngle", m_ThMinp = 22);
116 declareProperty(
"PosMaxThetaAngle", m_ThMaxp = 158);
117 declareProperty(
"EleMinEnergy", m_EnMine = 0.01);
118 declareProperty(
"PosMinEnergy", m_EnMinp = 0.01);
119 declareProperty(
"Acollinearity", m_Acolli = 10);
120 declareProperty(
"SoftPhotonCut", m_infraredCut = 1E-5);
121 declareProperty(
"VacuumPolarization", m_keyPia = 3);
122 declareProperty(
"KeyMod", m_keyMod = 2);
123 declareProperty(
"KeyLib", m_keyLib = 2);
124 declareProperty(
"EWC", m_keyEwc = 1);
132 MsgStream log(messageService(), name());
134 log << MSG::INFO <<
"Bhwide initialize" << endreq;
136 static const bool CREATEIFNOTTHERE(
true);
137 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
138 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
140 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
143 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"Bhwide");
144 engine->showStatus();
153 double AMAZ = 91.1882;
154 double GAMMZ = 2.4952;
155 double SINW2 = 0.22225;
156 double AMTOP = 174.3;
157 double AMHIG = 115.0;
164 int KeyOpt = 1000*KeyZof +100*KeyCha +10*KeyWgt + KeyRnd;
166 int KeyEWC = m_keyEwc;
168 int KeyLib = m_keyLib;
170 int KeyMod = m_keyMod;
171 int KeyPia = m_keyPia;
172 int KeyRad = 1000*KeyEWC + 100*KeyLib + 10*KeyMod + KeyPia;
178 xpar[0] = m_cmEnergy;
186 xpar[8] = m_infraredCut;
198 return StatusCode::SUCCESS;
203 MsgStream log(messageService(), name());
204 log << MSG::INFO <<
"Bhwide executing" << endreq;
209 if( log.level() < MSG::INFO )
219 GenEvent* evt =
new GenEvent(1,1);
221 GenVertex* prod_vtx =
new GenVertex();
223 evt->add_vertex( prod_vtx );
226 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p1[0],
MOMSET.p1[1],
229 p->suggest_barcode( ++npart );
230 prod_vtx->add_particle_in(p);
235 p->suggest_barcode( ++npart );
236 prod_vtx->add_particle_in(p);
239 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p2[0],
MOMSET.p2[1],
242 p->suggest_barcode( ++npart );
243 prod_vtx->add_particle_out(p);
248 p->suggest_barcode( ++npart );
249 prod_vtx->add_particle_out(p);
252 for (iphot=0; iphot<
MOMSET.nphot; iphot++)
255 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.phot[0][iphot],
MOMSET.phot[1][iphot],
258 p->suggest_barcode( ++npart );
259 prod_vtx->add_particle_out(p);
262 if( log.level() < MSG::INFO )
268 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
272 MsgStream log(messageService(), name());
273 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
275 anMcCol->push_back(mcEvent);
282 mcColl->push_back(mcEvent);
283 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
284 if (sc != StatusCode::SUCCESS)
286 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
290 return StatusCode::FAILURE;
294 log << MSG::INFO <<
"McGenEventCol created and " << npart <<
" particles stored in McGenEvent" << endreq;
298 return StatusCode::SUCCESS;
303 MsgStream log(messageService(), name());
307 log << MSG::INFO <<
"Bhwide finalized" << endreq;
309 return StatusCode::SUCCESS;
void marran_(float *rvec, int *nma)
void carran_(double *rvec, int *nma)
#define MARINI(IJKLIN, NTOTIN, NTOT2N)
#define BHWIDE(MODE, XPAR, NPAR)
void ecuran_(double *rvec, int *nma)
ObjectVector< McGenEvent > McGenEventCol
#define PROTOCCALLSFSUB3(UN, LN, T1, T2, T3)
#define COMMON_BLOCK_DEF(DEFINITION, NAME)
#define PROTOCCALLSFSUB1(UN, LN, T1)
static void FlatArray(double *vect, const int size)
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
Bhwide(const std::string &name, ISvcLocator *pSvcLocator)
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.