17 #include "CLHEP/Random/RandFlat.h"
36 produces<HepMCProduct>();
37 produces<GenEventInfoProduct>();
39 cout <<
"Internal FlatRandomEGun is initialzed" << endl ;
56 cout <<
" FlatRandomEGunProducer : Begin New Event Generation" << endl ;
65 fEvt =
new HepMC::GenEvent() ;
72 HepMC::GenVertex* Vtx =
new HepMC::GenVertex( HepMC::FourVector(0.,0.,0.));
77 for (
unsigned int ip=0; ip<
fPartIDs.size(); ip++)
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 );
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
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
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
Geom::Phi< T > phi() const
StreamID streamID() const
virtual void produce(Event &e, const EventSetup &es) override