14 #include "CLHEP/Random/RandFlat.h" 17 class HepRandomEngine;
34 produces<HepMCProduct>(
"unsmeared");
35 produces<GenEventInfoProduct>();
47 LogDebug(
"FlatThetaGun") <<
"FlatRandomEThetaGunProducer : Begin New Event Generation";
66 HepMC::GenVertex* Vtx =
new HepMC::GenVertex( HepMC::FourVector(0.,0.,0.));
71 for (
unsigned int ip=0; ip<
fPartIDs.size(); ip++) {
72 double energy = CLHEP::RandFlat::shoot(engine,
fMinE,
fMaxE);
78 double mass = PData->mass().value() ;
79 double mom2 = energy*energy - mass*
mass ;
80 double mom = (mom2 > 0. ?
std::sqrt(mom2) : 0.);
81 double px = mom*
sin(theta)*
cos(phi) ;
82 double py = mom*
sin(theta)*
sin(phi) ;
83 double pz = mom*
cos(theta) ;
85 HepMC::FourVector
p(px,py,pz,energy) ;
87 Part->suggest_barcode( barcode ) ;
89 Vtx->add_particle_out(Part);
92 HepMC::FourVector ap(-px,-py,-pz,energy) ;
94 if ( PartID == 22 || PartID == 23 ) {
98 APart->suggest_barcode( barcode ) ;
100 Vtx->add_particle_out(APart) ;
104 fEvt->add_vertex(Vtx) ;
106 fEvt->set_signal_process_id(20) ;
113 std::unique_ptr<HepMCProduct> BProduct(
new HepMCProduct()) ;
114 BProduct->addHepMCData(
fEvt );
121 LogDebug(
"FlatThetaGun") <<
"FlatRandomEThetaGunProducer : Event Generation Done";
T getParameter(std::string const &) const
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~FlatRandomEThetaGunProducer() override
Sin< T >::type sin(const T &t)
ESHandle< HepPDT::ParticleDataTable > fPDGTable
Geom::Theta< T > theta() const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
HepPDT::ParticleData ParticleData
StreamID streamID() const
std::vector< int > fPartIDs
void produce(Event &e, const EventSetup &es) override