14 #include "CLHEP/Random/RandFlat.h"
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
26 produces<HepMCProduct>(
"unsmeared");
27 produces<GenEventInfoProduct>();
29 edm::LogInfo(
"ParticleGun") <<
"FlatRandomOneOverPtGunProducer: initialized with minimum and maximum 1/pt "
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();
72 double mom = pt /
sin(theta);
73 double px = pt *
cos(phi);
74 double py = pt *
sin(phi);
75 double pz = mom *
cos(theta);
76 double energy2 = mom * mom + mass *
mass;
78 HepMC::FourVector
p(px, py, pz, energy);
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 <<
")";
87 HepMC::FourVector ap(-px, -py, -pz, energy);
88 int APartID = -PartID;
89 if (PartID == 22 || PartID == 23) {
93 APart->suggest_barcode(barcode);
95 Vtx->add_particle_out(APart);
99 fEvt->add_vertex(Vtx);
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 ";
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static std::vector< std::string > checklist log
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
Exp< T >::type exp(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
T getParameter(std::string const &) const
StreamID streamID() const