18 #include "CLHEP/Random/RandFlat.h"
30 produces<HepMCProduct>(
"unsmeared");
31 produces<GenEventInfoProduct>();
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) {
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();
85 double pt = mom *
sin(theta);
86 double px = pt *
cos(phi);
87 double py = pt *
sin(phi);
88 double pz = mom *
cos(theta);
89 double energy2 = mom * mom + mass *
mass;
94 HepMC::FourVector
p(px, py, pz, energy);
96 Part->suggest_barcode(barcode);
98 Vtx->add_particle_out(Part);
102 HepMC::FourVector ap(-px, -py, -pz, energy);
103 int APartID = -PartID;
104 if (PartID == 22 || PartID == 23) {
110 APart->suggest_barcode(barcode);
112 Vtx->add_particle_out(APart);
116 fEvt->add_vertex(Vtx);
118 fEvt->set_signal_process_id(20);
125 BProduct->addHepMCData(
fEvt);
134 std::cout <<
" FlatRandomPGunProducer : Event Generation Done " << std::endl;
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(Event &e, const EventSetup &es) override
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.
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
T getParameter(std::string const &) const
~ExpoRandomPGunProducer() override
StreamID streamID() const