46 produces<HepMCProduct>();
47 produces<GenEventInfoProduct>();
60 cout <<
" MultiParticleInConeGunProducer : Begin New Event Generation" << endl ;
69 fEvt =
new HepMC::GenEvent() ;
76 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0.,0.,0.));
81 for (
unsigned int ip=0; ip<
fPartIDs.size(); ++ip)
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 ;
99 HepMC::FourVector
p(px,py,pz,energy) ;
102 Part->suggest_barcode( barcode ) ;
104 Vtx->add_particle_out(Part);
109 for (
unsigned iPic=0; iPic!=
fInConeIds.size();iPic++){
116 double dEta = dR*
cos(alpha);
125 double etaIc = eta+dEta;
126 double phiIc = phi+
dPhi;
128 const unsigned int maxL=100;
131 if (phiIc > 3.14159265358979323846) phiIc-=2*3.14159265358979323846;
132 else if(phiIc <-3.14159265358979323846) phiIc+=2*3.14159265358979323846;
134 if (
abs(phiIc)<3.14159265358979323846)
break;
147 cout <<
" MultiParticleInConeGunProducer : could not produce a particle "
161 double massIc= PDataIc->mass().value() ;
162 double momIc = momR * mom;
163 double energyIc =
sqrt(momIc*momIc + massIc*massIc);
165 double thetaIc = 2.*atan(
exp(-etaIc)) ;
166 double pxIc = momIc*
sin(thetaIc)*
cos(phiIc);
167 double pyIc = momIc*
sin(thetaIc)*
sin(phiIc);
168 double pzIc = momIc*
cos(thetaIc);
170 HepMC::FourVector pIc(pxIc,pyIc,pzIc,energyIc) ;
172 PartIc->suggest_barcode( barcode ) ;
174 Vtx->add_particle_out(PartIc);
180 fEvt->add_vertex(Vtx) ;
182 fEvt->set_signal_process_id(20) ;
190 BProduct->addHepMCData(
fEvt );
198 cout <<
" MultiParticleInConeGunProducer : Event Generation Done " << endl;
T getParameter(std::string const &) const
EventNumber_t event() const
unsigned int fInConeMaxTry
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
std::vector< int > fInConeIds
MultiParticleInConeGunProducer(const ParameterSet &)
ESHandle< HepPDT::ParticleDataTable > fPDGTable
double dPhi(double phi1, double phi2)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void produce(Event &e, const EventSetup &es) override
CLHEP::RandFlat * fRandomGenerator
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
virtual ~MultiParticleInConeGunProducer()