16 #include "CLHEP/Random/RandFlat.h"
17 #include "CLHEP/Units/GlobalSystemOfUnits.h"
18 #include "CLHEP/Units/GlobalPhysicalConstants.h"
19 #include "CLHEP/Random/RandFlat.h"
43 produces<HepMCProduct>(
"unsmeared");
44 produces<GenEventInfoProduct>();
53 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
56 LogDebug(
"CloseByParticleGunProducer") <<
" CloseByParticleGunProducer : Begin New Event Generation" << endl;
66 for (
int i = 0;
i < numParticles;
i++) {
72 double fR = CLHEP::RandFlat::shoot(engine,
fRMin,
fRMax);
73 double fZ = CLHEP::RandFlat::shoot(engine,
fZMin,
fZMax);
77 for (
unsigned int ip = 0; ip <
particles.size(); ++ip) {
80 phi = CLHEP::RandFlat::shoot(engine, tmpPhi -
fDelta /
fR, tmpPhi +
fDelta /
fR);
84 double fEn = CLHEP::RandFlat::shoot(engine,
fEnMin,
fEnMax);
87 double mass = PData->mass().value();
88 double mom2 = fEn * fEn -
mass *
mass;
99 double x =
fR *
cos(phi);
100 double y =
fR *
sin(phi);
101 constexpr
double c = 2.99792458e+1;
103 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(x * cm, y * cm, fZ * cm,
timeOffset));
110 p.setX(momentum.x());
111 p.setY(momentum.y());
112 p.setZ(momentum.z());
115 Part->suggest_barcode(barcode);
118 Vtx->add_particle_out(Part);
124 fEvt->add_vertex(Vtx);
127 fEvt->set_event_number(
e.id().event());
128 fEvt->set_signal_process_id(20);
135 BProduct->addHepMCData(
fEvt);
142 LogDebug(
"CloseByParticleGunProducer") <<
" CloseByParticleGunProducer : Event Generation Done " << endl;