16#include "CLHEP/Vector/LorentzVector.h"
17#include "HepMC/GenEvent.h"
18#include "HepMC/GenParticle.h"
19#include "HepMC/GenVertex.h"
21#include "GaudiKernel/ISvcLocator.h"
22#include "GaudiKernel/MsgStream.h"
23#include "GaudiKernel/SmartDataPtr.h"
25#include "BesRndmGenSvc/IBesRndmGenSvc.h"
26#include "GeneratorObject/McGenEvent.h"
28#include "cfortran/cfortran.h"
43#define MOMSET COMMON_BLOCK( MOMSET_DEF, momset )
50#define GLIMIT( LENMX ) CCALLSFSUB1( GLIMIT, glimit, INT, LENMX )
53#define DUMPS( NOUT ) CCALLSFSUB1( DUMPS, dumps, INT, NOUT )
56#define BHWIDE( MODE, XPAR, NPAR ) \
57 CCALLSFSUB3( BHWIDE, bhwide, INT, DOUBLEV, INTV, MODE, XPAR, NPAR )
60#define MARINI( IJKLIN, NTOTIN, NTOT2N ) \
61 CCALLSFSUB3( MARINI, marini, INT, INT, INT, IJKLIN, NTOTIN, NTOT2N )
65extern void marran_(
float* rvec,
int* nma );
66extern void ecuran_(
double* rvec,
int* nma );
67extern void carran_(
double* rvec,
int* nma );
77 for (
int i = 0; i < nmax; i++ ) rvec[i] = rvecd[i];
85 for (
int i = 0; i < nmax; i++ ) rvec[i] = rvecd[i];
93 for (
int i = 0; i < nmax; i++ ) rvec[i] = rvecd[i];
101 : Algorithm( name, pSvcLocator ) {
102 declareProperty(
"CMEnergy", m_cmEnergy = 3.097 );
103 declareProperty(
"EleMinThetaAngle", m_ThMine = 22 );
104 declareProperty(
"EleMaxThetaAngle", m_ThMaxe = 158 );
105 declareProperty(
"PosMinThetaAngle", m_ThMinp = 22 );
106 declareProperty(
"PosMaxThetaAngle", m_ThMaxp = 158 );
107 declareProperty(
"EleMinEnergy", m_EnMine = 0.01 );
108 declareProperty(
"PosMinEnergy", m_EnMinp = 0.01 );
109 declareProperty(
"Acollinearity", m_Acolli = 10 );
110 declareProperty(
"SoftPhotonCut",
111 m_infraredCut = 1E-5 );
112 declareProperty(
"VacuumPolarization",
117 declareProperty(
"KeyMod",
122 declareProperty(
"KeyLib", m_keyLib = 2 );
125 declareProperty(
"EWC",
136 MsgStream log(
msgSvc(), name() );
138 log << MSG::INFO <<
"Bhwide initialize" << endmsg;
140 static const bool CREATEIFNOTTHERE(
true );
141 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE );
142 if ( !RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc )
144 log << MSG::ERROR <<
" Could not initialize Random Number Service" << endmsg;
147 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine(
"Bhwide" );
148 engine->showStatus();
157 double AMAZ = 91.1882;
158 double GAMMZ = 2.4952;
159 double SINW2 = 0.22225;
160 double AMTOP = 174.3;
161 double AMHIG = 115.0;
168 int KeyOpt = 1000 * KeyZof + 100 * KeyCha + 10 * KeyWgt + KeyRnd;
170 int KeyEWC = m_keyEwc;
172 int KeyLib = m_keyLib;
174 int KeyMod = m_keyMod;
175 int KeyPia = m_keyPia;
176 int KeyRad = 1000 * KeyEWC + 100 * KeyLib + 10 * KeyMod + KeyPia;
182 xpar[0] = m_cmEnergy;
190 xpar[8] = m_infraredCut;
202 return StatusCode::SUCCESS;
206 MsgStream log(
msgSvc(), name() );
207 log << MSG::INFO <<
"Bhwide executing" << endmsg;
211 if ( log.level() < MSG::INFO )
221 GenEvent* evt =
new GenEvent( 1, 1 );
223 GenVertex* prod_vtx =
new GenVertex();
225 evt->add_vertex( prod_vtx );
228 GenParticle* p =
new GenParticle(
231 p->suggest_barcode( ++npart );
232 prod_vtx->add_particle_in( p );
238 p->suggest_barcode( ++npart );
239 prod_vtx->add_particle_in( p );
245 p->suggest_barcode( ++npart );
246 prod_vtx->add_particle_out( p );
252 p->suggest_barcode( ++npart );
253 prod_vtx->add_particle_out( p );
256 for ( iphot = 0; iphot <
MOMSET.nphot; iphot++ )
259 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.phot[0][iphot],
MOMSET.phot[1][iphot],
263 p->suggest_barcode( ++npart );
264 prod_vtx->add_particle_out( p );
267 if ( log.level() < MSG::INFO ) { evt->print(); }
270 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(),
"/Event/Gen" );
274 MsgStream log(
msgSvc(), name() );
275 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endmsg;
277 anMcCol->push_back( mcEvent );
284 mcColl->push_back( mcEvent );
285 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen", mcColl );
286 if ( sc != StatusCode::SUCCESS )
288 log << MSG::ERROR <<
"Could not register McGenEvent" << endmsg;
292 return StatusCode::FAILURE;
296 log << MSG::INFO <<
"McGenEventCol created and " << npart
297 <<
" particles stored in McGenEvent" << endmsg;
301 return StatusCode::SUCCESS;
305 MsgStream log(
msgSvc(), name() );
309 log << MSG::INFO <<
"Bhwide finalized" << endmsg;
311 return StatusCode::SUCCESS;
DECLARE_COMPONENT(BesBdkRc)
#define MARINI(IJKLIN, NTOTIN, NTOT2N)
void marran_(float *rvec, int *nma)
void carran_(double *rvec, int *nma)
#define BHWIDE(MODE, XPAR, NPAR)
COMMON_BLOCK_DEF(MOMSET_DEF, MOMSET)
void ecuran_(double *rvec, int *nma)
ObjectVector< McGenEvent > McGenEventCol
static void FlatArray(double *vect, const int size)
static void setRandomEngine(CLHEP::HepRandomEngine *randomEngine)
Bhwide(const std::string &name, ISvcLocator *pSvcLocator)
PROTOCCALLSFSUB3(INPUT, input, PLONG, PINT, PSTRING)
PROTOCCALLSFSUB1(RLXDRESETF, rlxdresetf, INTV)