13 #include "CLHEP/Random/RandFlat.h" 32 produces<HepMCProduct>(
"unsmeared");
33 produces<GenEventInfoProduct>();
45 cout <<
" FlatRandomPtAndDxyGunProducer : Begin New Event Generation" << endl;
58 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ++ip) {
71 bool passLoop =
false;
72 while (not passLoop) {
77 float dxysign = CLHEP::RandFlat::shoot(engine, -1, 1);
81 px = pt *
cos(phi_vtx);
82 py = pt *
sin(phi_vtx);
83 for (
int i = 0;
i < 10000;
i++) {
85 vy = (pt * dxy + vx *
py) / px;
86 lxy =
sqrt(vx * vx + vy * vy);
87 if (lxy <
abs(
lxyMax_) and (vx * px + vy * py) > 0) {
96 for (
int j = 0;
j < 100;
j++) {
97 vz = CLHEP::RandFlat::shoot(engine, 0.0,
lzMax_);
99 if (v0 <= 0
or lxy * lxy / (ConeTheta * ConeTheta) > v0 * v0) {
106 passLoop = (passLxy and passLz);
112 HepMC::GenVertex* Vtx1 =
new HepMC::GenVertex(HepMC::FourVector(vx, vy, vz));
116 double mass = PData->mass().value();
117 double energy2 = px * px + py * py + pz * pz + mass *
mass;
119 HepMC::FourVector
p(px, py, pz, energy);
121 Part->suggest_barcode(barcode);
123 Vtx1->add_particle_out(Part);
124 fEvt->add_vertex(Vtx1);
127 HepMC::GenVertex* Vtx2 =
new HepMC::GenVertex(HepMC::FourVector(-vx, -vy, -vz));
128 HepMC::FourVector ap(-px, -py, -pz, energy);
130 if (PartID == 22 || PartID == 23) {
134 APart->suggest_barcode(barcode);
136 Vtx2->add_particle_out(APart);
137 fEvt->add_vertex(Vtx2);
141 fEvt->set_signal_process_id(20);
148 BProduct->addHepMCData(
fEvt);
155 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)
~FlatRandomPtAndDxyGunProducer() override
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
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