17 #include "CLHEP/Random/RandExponential.h" 18 #include "CLHEP/Random/RandFlat.h" 37 produces<HepMCProduct>(
"unsmeared");
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 ;
97 double energy =
sqrt(energy2) ;
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) ;
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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ExpoRandomPtGunProducer(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
~ExpoRandomPtGunProducer() override
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
void produce(Event &e, const EventSetup &es) override
StreamID streamID() const