20 #include <CLHEP/Random/RandFlat.h>
35 produces<HepMCProduct>(
"unsmeared");
36 produces<GenEventInfoProduct>();
45 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
48 edm::LogInfo(
"RandomtXiGunProducer") <<
"Begin New Event Generation\n";
63 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
68 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ++ip) {
85 edm::LogInfo(
"RandomtXiGunProducer") <<
"WARNING: t limits redefined (unphysical values for given xi).\n";
88 t = (
fLog_t) ?
pow(CLHEP::RandFlat::shoot(engine, log10(min_t), log10(max_t)), 10)
89 : CLHEP::RandFlat::shoot(engine, min_t, max_t);
94 Part->suggest_barcode(barcode);
96 Vtx->add_particle_out(Part);
102 double max_t =
fMaxt;
105 <<
"WARNING: t limits redefined (unphysical values for given xi)." << endl;
108 t = (
fLog_t) ?
pow(CLHEP::RandFlat::shoot(engine, log10(min_t), log10(max_t)), 10)
109 : CLHEP::RandFlat::shoot(engine, min_t, max_t);
114 Part2->suggest_barcode(barcode);
116 Vtx->add_particle_out(Part2);
120 fEvt->add_vertex(Vtx);
121 fEvt->set_event_number(
e.id().event());
122 fEvt->set_signal_process_id(20);
128 std::unique_ptr<HepMCProduct> BProduct(
new HepMCProduct());
129 BProduct->addHepMCData(
fEvt);
138 edm::LogInfo(
"RandomtXiGunProducer") <<
" Event Generation Done \n";
144 double sEnergy = (1.0 - Xi) *
fpEnergy;
159 <<
"-----------------------------------------------------------------------------------------------------\n"
160 <<
"Produced a proton with phi : " <<
phi <<
" theta: " <<
theta <<
" t: " <<
t <<
" Xi: " << Xi <<
"\n"
161 <<
" Px : " <<
px <<
" Py : " <<
py <<
" Pz : " << pz <<
"\n"
162 <<
" direction: " << direction <<
"\n"
163 <<
"-----------------------------------------------------------------------------------------------------"
166 return HepMC::FourVector(
px,
py, pz, sEnergy);