16 #include "CLHEP/Random/RandFlat.h" 17 #include "CLHEP/Units/GlobalSystemOfUnits.h" 18 #include "CLHEP/Units/GlobalPhysicalConstants.h" 19 #include "CLHEP/Random/RandFlat.h" 34 LogError(
"CloseByParticleGunProducer") <<
" Please fix MinEta and MaxEta values in the configuration";
39 LogError(
"CloseByParticleGunProducer") <<
" Please fix RMin and RMax values in the configuration";
52 produces<HepMCProduct>(
"unsmeared");
53 produces<GenEventInfoProduct>();
62 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
65 LogDebug(
"CloseByParticleGunProducer") <<
" CloseByParticleGunProducer : Begin New Event Generation" << endl;
73 double fZ = CLHEP::RandFlat::shoot(engine,
fZMin,
fZMax);
80 fR = (fZ / sinh(fEta));
87 for (
unsigned int ip = 0; ip < numParticles; ++ip) {
90 phi = CLHEP::RandFlat::shoot(engine, tmpPhi -
fDelta /
fR, tmpPhi +
fDelta /
fR);
103 double mass = PData->mass().value();
104 double mom2 = fEn * fEn -
mass *
mass;
116 double y =
fR *
sin(phi);
117 constexpr
double c = 2.99792458e+1;
119 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(
x * cm, y * cm, fZ * cm,
timeOffset));
126 p.setX(momentum.x());
127 p.setY(momentum.y());
128 p.setZ(momentum.z());
131 Part->suggest_barcode(barcode);
134 Vtx->add_particle_out(Part);
140 fEvt->add_vertex(Vtx);
143 fEvt->set_event_number(
e.id().event());
144 fEvt->set_signal_process_id(20);
151 BProduct->addHepMCData(
fEvt);
158 LogDebug(
"CloseByParticleGunProducer") <<
" CloseByParticleGunProducer : Event Generation Done " << endl;
CloseByParticleGunProducer(const ParameterSet &)
T getParameter(std::string const &) const
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
Sin< T >::type sin(const T &t)
Log< level::Error, false > LogError
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