17 #include "CLHEP/Random/RandFlat.h" 34 produces<HepMCProduct>(
"unsmeared");
35 produces<GenEventInfoProduct>();
50 cout <<
" FlatRandomPtGunProducer : Begin New Event Generation" << endl ;
59 fEvt =
new HepMC::GenEvent() ;
65 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0.,0.,0.));
70 for (
unsigned int ip=0; ip<
fPartIDs.size(); ++ip)
78 double mass = PData->mass().value() ;
80 double mom = pt/
sin(theta) ;
81 double px = pt*
cos(phi) ;
82 double py = pt*
sin(phi) ;
83 double pz = mom*
cos(theta) ;
84 double energy2= mom*mom + mass*
mass ;
85 double energy =
sqrt(energy2) ;
86 HepMC::FourVector
p(px,py,pz,energy) ;
89 Part->suggest_barcode( barcode ) ;
91 Vtx->add_particle_out(Part);
95 HepMC::FourVector ap(-px,-py,-pz,energy) ;
97 if ( PartID == 22 || PartID == 23 )
103 APart->suggest_barcode( barcode ) ;
105 Vtx->add_particle_out(APart) ;
110 fEvt->add_vertex(Vtx) ;
112 fEvt->set_signal_process_id(20) ;
120 BProduct->addHepMCData(
fEvt );
130 cout <<
" FlatRandomPtGunProducer : Event Generation Done " << endl;
T getParameter(std::string const &) const
EventNumber_t event() const
virtual void produce(Event &e, const EventSetup &es) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
FlatRandomPtGunProducer(const ParameterSet &pset)
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
virtual ~FlatRandomPtGunProducer()
StreamID streamID() const