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 float time =
sqrt(vx * vx + vy * vy + vz * vz);
114 HepMC::GenVertex* Vtx1 =
new HepMC::GenVertex(HepMC::FourVector(vx, vy, vz, time));
118 double mass = PData->mass().value();
119 double energy2 = px * px + py * py + pz * pz + mass *
mass;
121 HepMC::FourVector
p(px, py, pz, energy);
123 Part->suggest_barcode(barcode);
125 Vtx1->add_particle_out(Part);
126 fEvt->add_vertex(Vtx1);
129 HepMC::GenVertex* Vtx2 =
new HepMC::GenVertex(HepMC::FourVector(-vx, -vy, -vz, time));
130 HepMC::FourVector ap(-px, -py, -pz, energy);
131 int APartID = -PartID;
132 if (PartID == 22 || PartID == 23) {
136 APart->suggest_barcode(barcode);
138 Vtx2->add_particle_out(APart);
139 fEvt->add_vertex(Vtx2);
143 fEvt->set_signal_process_id(20);
150 BProduct->addHepMCData(
fEvt);
157 cout <<
" FlatRandomPtAndDxyGunProducer : End New Event Generation" << endl;
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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
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)
T getParameter(std::string const &) const
StreamID streamID() const