14 #include <CLHEP/Random/RandFlat.h> 15 #include <CLHEP/Units/SystemOfUnits.h> 26 produces<HepMCProduct>(
"unsmeared");
27 produces<GenEventInfoProduct>();
29 edm::LogInfo(
"ParticleGun") <<
"FlatRandomOneOverPtGunProducer: initialized with minimum and maximum 1/pt " 39 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
41 LogDebug(
"ParticleGun") <<
" FlatRandomOneOverPtGunProducer : Begin New Event Generation";
56 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
61 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ++ip) {
62 double xx = CLHEP::RandFlat::shoot(engine, 0.0, 1.0);
70 double mass = PData->mass().value();
76 double energy2 = mom * mom +
mass *
mass;
80 Part->suggest_barcode(barcode);
82 Vtx->add_particle_out(Part);
83 LogDebug(
"ParticleGun") <<
"FlatRandomOneOverPtGunProducer: Event generated with pt:eta:phi " <<
pt <<
" " <<
eta 84 <<
" " <<
phi <<
" (" <<
theta / CLHEP::deg <<
":" <<
phi / CLHEP::deg <<
")";
93 APart->suggest_barcode(barcode);
95 Vtx->add_particle_out(APart);
99 fEvt->add_vertex(Vtx);
100 fEvt->set_event_number(
e.id().event());
101 fEvt->set_signal_process_id(20);
107 std::unique_ptr<HepMCProduct> BProduct(
new HepMCProduct());
108 BProduct->addHepMCData(
fEvt);
114 LogDebug(
"ParticleGun") <<
" FlatRandomOneOverPtGunProducer : Event Generation Done ";
T getParameter(std::string const &) const
Sin< T >::type sin(const T &t)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
FlatRandomOneOverPtGunProducer(const ParameterSet &pset)
ESHandle< HepPDT::ParticleDataTable > fPDGTable
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
void produce(Event &e, const EventSetup &es) override
~FlatRandomOneOverPtGunProducer() override
HepPDT::ParticleData ParticleData
Log< level::Info, false > LogInfo
Geom::Theta< T > theta() const