13 #include "CLHEP/Random/RandFlat.h"
32 produces<HepMCProduct>(
"unsmeared");
33 produces<GenEventInfoProduct>();
42 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
45 cout <<
" FlatRandomPtAndDxyGunProducer : Begin New Event Generation" << endl;
58 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ++ip) {
71 bool passLoop =
false;
72 while (not passLoop) {
77 float dxysign = CLHEP::RandFlat::shoot(engine, -1, 1);
83 for (
int i = 0;
i < 10000;
i++) {
86 lxy =
sqrt(vx * vx + vy * vy);
96 for (
int j = 0;
j < 100;
j++) {
97 vz = CLHEP::RandFlat::shoot(engine, 0.0,
lzMax_);
99 if (
v0 <= 0
or lxy * lxy / (ConeTheta * ConeTheta) >
v0 *
v0) {
106 passLoop = (passLxy and passLz);
112 HepMC::GenVertex* Vtx1 =
new HepMC::GenVertex(HepMC::FourVector(vx, vy, vz));
116 double mass = PData->mass().value();
121 Part->suggest_barcode(barcode);
123 Vtx1->add_particle_out(Part);
124 fEvt->add_vertex(Vtx1);
127 HepMC::GenVertex* Vtx2 =
new HepMC::GenVertex(HepMC::FourVector(-vx, -vy, -vz));
134 APart->suggest_barcode(barcode);
136 Vtx2->add_particle_out(APart);
137 fEvt->add_vertex(Vtx2);
140 fEvt->set_event_number(
e.id().event());
141 fEvt->set_signal_process_id(20);
148 BProduct->addHepMCData(
fEvt);
155 cout <<
" FlatRandomPtAndDxyGunProducer : End New Event Generation" << endl;