17 #include "CLHEP/Random/RandExponential.h"
18 #include "CLHEP/Random/RandFlat.h"
37 produces<HepMCProduct>();
38 produces<GenEventInfoProduct>();
53 cout <<
" ExpoRandomPtGunProducer : Begin New Event Generation" << endl ;
62 fEvt =
new HepMC::GenEvent() ;
69 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0.,0.,0.));
74 for (
unsigned int ip=0; ip<
fPartIDs.size(); ++ip)
82 while (pt<fMinPt || pt>
fMaxPt)
90 double mass = PData->mass().value() ;
92 double mom = pt/
sin(theta) ;
93 double px = pt*
cos(phi) ;
94 double py = pt*
sin(phi) ;
95 double pz = mom*
cos(theta) ;
96 double energy2= mom*mom + mass*mass ;
101 HepMC::FourVector
p(px,py,pz,energy) ;
104 Part->suggest_barcode( barcode ) ;
106 Vtx->add_particle_out(Part);
111 HepMC::FourVector ap(-px,-py,-pz,energy) ;
112 int APartID = -PartID ;
113 if ( PartID == 22 || PartID == 23 )
121 APart->suggest_barcode( barcode ) ;
123 Vtx->add_particle_out(APart) ;
128 fEvt->add_vertex(Vtx) ;
130 fEvt->set_signal_process_id(20) ;
138 BProduct->addHepMCData(
fEvt );
148 cout <<
" FlatRandomPtGunProducer : Event Generation Done " << endl;
T getParameter(std::string const &) const
EventNumber_t event() const
ExpoRandomPtGunProducer(const ParameterSet &pset)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
virtual ~ExpoRandomPtGunProducer()
ESHandle< HepPDT::ParticleDataTable > fPDGTable
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
virtual void produce(Event &e, const EventSetup &es) override
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
Geom::Phi< T > phi() const
StreamID streamID() const