31 produces<HepMCProduct>();
32 produces<GenEventInfoProduct>();
45 cout <<
" FlatRandomPtGunProducer : Begin New Event Generation" << endl ;
54 fEvt =
new HepMC::GenEvent() ;
60 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0.,0.,0.));
65 for (
unsigned int ip=0; ip<
fPartIDs.size(); ++ip)
74 double mass = PData->mass().value() ;
76 double mom = pt/
sin(theta) ;
77 double px = pt*
cos(phi) ;
78 double py = pt*
sin(phi) ;
79 double pz = mom*
cos(theta) ;
80 double energy2= mom*mom + mass*mass ;
82 HepMC::FourVector
p(px,py,pz,energy) ;
85 Part->suggest_barcode( barcode ) ;
87 Vtx->add_particle_out(Part);
91 HepMC::FourVector ap(-px,-py,-pz,energy) ;
92 int APartID = -PartID ;
93 if ( PartID == 22 || PartID == 23 )
99 APart->suggest_barcode( barcode ) ;
101 Vtx->add_particle_out(APart) ;
106 fEvt->add_vertex(Vtx) ;
108 fEvt->set_signal_process_id(20) ;
116 BProduct->addHepMCData(
fEvt );
126 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
FlatRandomPtGunProducer(const ParameterSet &pset)
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.
CLHEP::RandFlat * fRandomGenerator
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
virtual ~FlatRandomPtGunProducer()