16 #include "CLHEP/Random/RandFlat.h" 17 #include "CLHEP/Units/GlobalSystemOfUnits.h" 18 #include "CLHEP/Units/GlobalPhysicalConstants.h" 19 #include "CLHEP/Random/RandFlat.h" 47 produces<HepMCProduct>(
"unsmeared");
48 produces<GenEventInfoProduct>();
64 LogDebug(
"CloseByParticleGunProducer") <<
" CloseByParticleGunProducer : Begin New Event Generation" << endl ;
74 for(
int i=0;
i<numParticles;
i++){
76 particles.push_back(
fPartIDs[partIdx]);
80 double fR = CLHEP::RandFlat::shoot(engine,
fRMin,
fRMax);
81 double fZ = CLHEP::RandFlat::shoot(engine,
fZMin,
fZMax);
85 for (
unsigned int ip=0; ip<particles.size(); ++ip)
89 fR = CLHEP::RandFlat::shoot(engine,tmpR-
fDelta,tmpR+
fDelta);
90 phi = CLHEP::RandFlat::shoot(engine, tmpPhi-
fDelta/fR, tmpPhi+
fDelta/fR);
95 double fEn = CLHEP::RandFlat::shoot(engine,
fEnMin,
fEnMax);
96 int PartID = particles[ip] ;
98 double mass = PData->mass().value() ;
99 double mom =
sqrt(fEn*fEn-mass*mass);
106 double x=fR*
cos(phi);
107 double y=fR*
sin(phi);
110 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(x*cm,y*cm,fZ*cm,timeOffset));
112 HepMC::FourVector
p(px,py,pz,energy) ;
117 p.setX(momentum.x());
118 p.setY(momentum.y());
119 p.setZ(momentum.z());
122 Part->suggest_barcode( barcode );
125 Vtx->add_particle_out(Part);
131 fEvt->add_vertex(Vtx);
136 fEvt->set_signal_process_id(20);
144 BProduct->addHepMCData(
fEvt );
152 LogDebug(
"CloseByParticleGunProducer") <<
" CloseByParticleGunProducer : Event Generation Done " << endl;
CloseByParticleGunProducer(const ParameterSet &)
T getParameter(std::string const &) const
EventNumber_t event() const
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Sin< T >::type sin(const T &t)
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)
void produce(Event &e, const EventSetup &es) override
HepPDT::ParticleData ParticleData
~CloseByParticleGunProducer() override
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::vector< int > fPartIDs
StreamID streamID() const