17 #include "CLHEP/Random/RandFlat.h"
32 produces<HepMCProduct>(
"unsmeared");
33 produces<GenEventInfoProduct>();
35 cout <<
"Internal FlatRandomEGun is initialzed" << endl;
48 cout <<
" FlatRandomEGunProducer : Begin New Event Generation" << endl;
64 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
69 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ip++) {
75 double mass = PData->mass().value();
76 double mom2 = energy * energy - mass *
mass;
84 double px = mom *
sin(theta) *
cos(phi);
85 double py = mom *
sin(theta) *
sin(phi);
86 double pz = mom *
cos(theta);
88 HepMC::FourVector
p(px, py, pz, energy);
90 Part->suggest_barcode(barcode);
92 Vtx->add_particle_out(Part);
95 HepMC::FourVector ap(-px, -py, -pz, energy);
96 int APartID = -PartID;
97 if (PartID == 22 || PartID == 23) {
101 APart->suggest_barcode(barcode);
103 Vtx->add_particle_out(APart);
106 fEvt->add_vertex(Vtx);
108 fEvt->set_signal_process_id(20);
115 BProduct->addHepMCData(
fEvt);
125 cout <<
" FlatRandomEGunProducer : Event Generation Done " << endl;
FlatRandomEGunProducer(const ParameterSet &pset)
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
T getParameter(std::string const &) const
StreamID streamID() const
void produce(Event &e, const EventSetup &es) override
~FlatRandomEGunProducer() override