17 #include "CLHEP/Random/RandFlat.h"
36 produces<HepMCProduct>(
"unsmeared");
37 produces<GenEventInfoProduct>();
39 cout <<
"Internal FlatRandomEGun is initialzed" << endl ;
56 cout <<
" FlatRandomEGunProducer : Begin New Event Generation" << endl ;
72 HepMC::GenVertex* Vtx =
new HepMC::GenVertex( HepMC::FourVector(0.,0.,0.));
77 for (
unsigned int ip=0; ip<
fPartIDs.size(); ip++)
84 PData =
fPDGTable->particle(HepPDT::ParticleID(
abs(PartID))) ;
85 double mass = PData->mass().value() ;
86 double mom2 = energy*energy - mass*
mass ;
97 double px = mom*
sin(theta)*
cos(phi) ;
98 double py = mom*
sin(theta)*
sin(phi) ;
99 double pz = mom*
cos(theta) ;
101 HepMC::FourVector
p(px,py,pz,energy) ;
104 Part->suggest_barcode( barcode ) ;
106 Vtx->add_particle_out(Part);
110 HepMC::FourVector ap(-px,-py,-pz,energy) ;
111 int APartID = -PartID ;
112 if ( PartID == 22 || PartID == 23 )
118 APart->suggest_barcode( barcode ) ;
120 Vtx->add_particle_out(APart) ;
124 fEvt->add_vertex(Vtx) ;
126 fEvt->set_signal_process_id(20) ;
135 BProduct->addHepMCData(
fEvt );
136 e.
put(BProduct,
"unsmeared");
146 cout <<
" FlatRandomEGunProducer : Event Generation Done " << endl;
FlatRandomEGunProducer(const ParameterSet &pset)
T getParameter(std::string const &) const
EventNumber_t event() const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
ESHandle< HepPDT::ParticleDataTable > fPDGTable
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual ~FlatRandomEGunProducer()
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
Geom::Phi< T > phi() const
StreamID streamID() const
virtual void produce(Event &e, const EventSetup &es) override