12 #include "CLHEP/Units/GlobalSystemOfUnits.h"
26 produces<HepMCProduct>();
27 produces<GenEventInfoProduct>();
29 edm::LogInfo(
"ParticleGun") <<
"FlatRandomOneOverPtGunProducer: initialized with minimum and maximum 1/pt " << fMinOneOverPt <<
":" <<
fMaxOneOverPt;
38 LogDebug(
"ParticleGun") <<
" FlatRandomOneOverPtGunProducer : Begin New Event Generation";
47 fEvt =
new HepMC::GenEvent() ;
53 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0.,0.,0.));
58 for (
unsigned int ip=0; ip<
fPartIDs.size(); ++ip) {
65 if (pt != 0) pt = 1./pt;
69 double mass = PData->mass().value() ;
71 double mom = pt/
sin(theta) ;
72 double px = pt*
cos(phi) ;
73 double py = pt*
sin(phi) ;
74 double pz = mom*
cos(theta) ;
75 double energy2= mom*mom + mass*
mass ;
77 HepMC::FourVector
p(px,py,pz,energy) ;
79 Part->suggest_barcode( barcode ) ;
81 Vtx->add_particle_out(Part);
82 LogDebug(
"ParticleGun") <<
"FlatRandomOneOverPtGunProducer: Event generated with pt:eta:phi " << pt <<
" " << eta <<
" " << phi <<
" (" << theta/CLHEP::deg <<
":" << phi/CLHEP::deg <<
")";
85 HepMC::FourVector ap(-px,-py,-pz,energy) ;
86 int APartID = -PartID ;
87 if ( PartID == 22 || PartID == 23 ) {
91 APart->suggest_barcode( barcode ) ;
93 Vtx->add_particle_out(APart) ;
98 fEvt->add_vertex(Vtx) ;
100 fEvt->set_signal_process_id(20) ;
106 std::auto_ptr<HepMCProduct> BProduct(
new HepMCProduct()) ;
107 BProduct->addHepMCData(
fEvt );
113 LogDebug(
"ParticleGun") <<
" FlatRandomOneOverPtGunProducer : Event Generation Done ";
T getParameter(std::string const &) const
EventNumber_t event() const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
FlatRandomOneOverPtGunProducer(const ParameterSet &pset)
virtual ~FlatRandomOneOverPtGunProducer()
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)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
virtual void produce(Event &e, const EventSetup &es)