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++)
79 double energy = CLHEP::RandFlat::shoot(engine,
fMinE,
fMaxE) ;
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) ;
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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
StreamID streamID() const
void produce(Event &e, const EventSetup &es) override
~FlatRandomEGunProducer() override