14 #include "CLHEP/Random/RandFlat.h" 25 throw cms::Exception(
"Configuration") <<
"Not all probabilities given for all particle types " 28 produces<HepMCProduct>(
"unsmeared");
29 produces<GenEventInfoProduct>();
32 <<
" particles in momentum range " <<
fMinP_ <<
":" <<
fMaxP_;
48 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
51 edm::LogVerbatim(
"ParticleGun") <<
"FlatRandomMultiParticlePGunProducer: Begin New Event Generation";
64 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
69 double r1 = CLHEP::RandFlat::shoot(engine, 0., 1.);
70 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ip++) {
78 double mom = CLHEP::RandFlat::shoot(engine,
fMinP_,
fMaxP_);
82 double mass = PData->mass().value();
92 Part->suggest_barcode(barcode);
93 Vtx->add_particle_out(Part);
100 APart->suggest_barcode(barcode);
101 Vtx->add_particle_out(APart);
104 fEvt->add_vertex(Vtx);
105 fEvt->set_event_number(
e.id().event());
106 fEvt->set_signal_process_id(20);
111 std::unique_ptr<HepMCProduct> BProduct(
new HepMCProduct());
112 BProduct->addHepMCData(
fEvt);
119 edm::LogVerbatim(
"ParticleGun") <<
" FlatRandomMultiParticlePGunProducer : Event Generation Done";
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Sin< T >::type sin(const T &t)
FlatRandomMultiParticlePGunProducer(const ParameterSet &pset)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
ESHandle< HepPDT::ParticleDataTable > fPDGTable
~FlatRandomMultiParticlePGunProducer() override
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
std::vector< double > fProbParticle_
Geom::Theta< T > theta() const
void produce(Event &e, const EventSetup &es) override