13 #include "CLHEP/Random/RandFlat.h" 35 produces<HepMCProduct>(
"unsmeared");
36 produces<GenEventInfoProduct>();
50 cout <<
" FlatRandomPtAndDxyGunProducer : Begin New Event Generation" << endl ;
59 fEvt =
new HepMC::GenEvent() ;
63 for (
unsigned int ip=0; ip<
fPartIDs.size(); ++ip){
77 bool passLoop =
false;
78 while (not passLoop) {
84 float dxysign = CLHEP::RandFlat::shoot(engine, -1, 1);
90 for (
int i=0;
i<10000;
i++){
92 vy = (pt*dxy + vx * py)/px;
93 lxy =
sqrt(vx*vx + vy*vy);
103 for (
int j=0; j<100; j++){
104 vz = CLHEP::RandFlat::shoot(engine, 0.0,
lzMax_);
106 if ( v0<=0
or lxy*lxy/(ConeTheta*ConeTheta) > v0*v0 ) {
113 passLoop = (passLxy and passLz);
119 HepMC::GenVertex* Vtx1 =
new HepMC::GenVertex(HepMC::FourVector(vx,vy,vz));
123 double mass = PData->mass().value() ;
124 double energy2= px*px + py*py + pz*pz + mass*
mass ;
125 double energy =
sqrt(energy2) ;
126 HepMC::FourVector
p(px,py,pz,energy) ;
128 Part->suggest_barcode( barcode ) ;
130 Vtx1->add_particle_out(Part);
131 fEvt->add_vertex(Vtx1) ;
134 HepMC::GenVertex* Vtx2 =
new HepMC::GenVertex(HepMC::FourVector(-vx,-vy,-vz));
135 HepMC::FourVector ap(-px,-py,-pz,energy) ;
137 if ( PartID == 22 || PartID == 23 )
142 APart->suggest_barcode( barcode ) ;
144 Vtx2->add_particle_out(APart) ;
145 fEvt->add_vertex(Vtx2) ;
149 fEvt->set_signal_process_id(20) ;
156 BProduct->addHepMCData(
fEvt );
163 cout <<
" FlatRandomPtAndDxyGunProducer : End New Event Generation" << endl ;
T getParameter(std::string const &) const
EventNumber_t event() const
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.
virtual void produce(Event &e, const EventSetup &es) override
ESHandle< HepPDT::ParticleDataTable > fPDGTable
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::vector< int > fPartIDs
HepPDT::ParticleData ParticleData
FlatRandomPtAndDxyGunProducer(const ParameterSet &pset)
StreamID streamID() const
virtual ~FlatRandomPtAndDxyGunProducer()