18 #include "CLHEP/Random/RandFlat.h" 30 produces<HepMCProduct>(
"unsmeared");
31 produces<GenEventInfoProduct>();
40 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
43 std::cout <<
" ExpoRandomPGunProducer : Begin New Event Generation" << std::endl;
60 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
65 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ++ip) {
66 double pmom = CLHEP::RandFlat::shoot(engine,
fMinP,
fMaxP);
67 double y = (1. /
fMinP) * CLHEP::RandFlat::shoot(engine, 0.0, 1.0);
71 while ((pmom < fMinP || pmom >
fMaxP) || !accpt) {
72 pmom = CLHEP::RandFlat::shoot(engine,
fMinP,
fMaxP);
73 y = (1. /
fMinP) * CLHEP::RandFlat::shoot(engine, 0.0, 1.0);
82 double mass = PData->mass().value();
89 double energy2 = mom * mom +
mass *
mass;
96 Part->suggest_barcode(barcode);
98 Vtx->add_particle_out(Part);
110 APart->suggest_barcode(barcode);
112 Vtx->add_particle_out(APart);
116 fEvt->add_vertex(Vtx);
117 fEvt->set_event_number(
e.id().event());
118 fEvt->set_signal_process_id(20);
125 BProduct->addHepMCData(
fEvt);
134 std::cout <<
" FlatRandomPGunProducer : Event Generation Done " << std::endl;
T getParameter(std::string const &) const
void produce(Event &e, const EventSetup &es) override
Sin< T >::type sin(const T &t)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
ESHandle< HepPDT::ParticleDataTable > fPDGTable
Cos< T >::type cos(const T &t)
ExpoRandomPGunProducer(const ParameterSet &pset)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
~ExpoRandomPGunProducer() override
Geom::Theta< T > theta() const