17 #include "CLHEP/Random/RandFlat.h" 41 produces<HepMCProduct>(
"unsmeared");
42 produces<GenEventInfoProduct>();
51 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
54 cout <<
" MultiParticleInConeGunProducer : Begin New Event Generation" << endl;
70 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
75 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ++ip) {
81 double mass = PData->mass().value();
87 double energy2 = mom * mom +
mass *
mass;
92 Part->suggest_barcode(barcode);
94 Vtx->add_particle_out(Part);
100 for (
unsigned iPic = 0; iPic !=
fInConeIds.size(); iPic++) {
101 unsigned int nTry = 0;
106 double alpha = CLHEP::RandFlat::shoot(engine, -3.14159265358979323846, 3.14159265358979323846);
119 const unsigned int maxL = 100;
121 while (iL++ < maxL) {
122 if (phiIc > 3.14159265358979323846)
123 phiIc -= 2 * 3.14159265358979323846;
124 else if (phiIc < -3.14159265358979323846)
125 phiIc += 2 * 3.14159265358979323846;
127 if (
abs(phiIc) < 3.14159265358979323846)
140 cout <<
" MultiParticleInConeGunProducer : could not produce a particle " <<
fInConeIds[iPic] <<
" in cone " 152 double massIc = PDataIc->mass().value();
153 double momIc = momR * mom;
154 double energyIc =
sqrt(momIc * momIc + massIc * massIc);
156 double thetaIc = 2. * atan(
exp(-etaIc));
157 double pxIc = momIc *
sin(thetaIc) *
cos(phiIc);
158 double pyIc = momIc *
sin(thetaIc) *
sin(phiIc);
159 double pzIc = momIc *
cos(thetaIc);
161 HepMC::FourVector pIc(pxIc, pyIc, pzIc, energyIc);
163 PartIc->suggest_barcode(barcode);
165 Vtx->add_particle_out(PartIc);
171 fEvt->add_vertex(Vtx);
172 fEvt->set_event_number(
e.id().event());
173 fEvt->set_signal_process_id(20);
180 BProduct->addHepMCData(
fEvt);
187 cout <<
" MultiParticleInConeGunProducer : Event Generation Done " << endl;
unsigned int fInConeMaxTry
T getParameter(std::string const &) const
Sin< T >::type sin(const T &t)
std::vector< int > fInConeIds
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
MultiParticleInConeGunProducer(const ParameterSet &)
ESHandle< HepPDT::ParticleDataTable > fPDGTable
void produce(Event &e, const EventSetup &es) override
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
~MultiParticleInConeGunProducer() override