20 #include <CLHEP/Random/RandFlat.h> 35 produces<HepMCProduct>(
"unsmeared");
36 produces<GenEventInfoProduct>();
45 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
48 edm::LogInfo(
"RandomtXiGunProducer") <<
"Begin New Event Generation\n";
63 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
68 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ++ip) {
85 edm::LogInfo(
"RandomtXiGunProducer") <<
"WARNING: t limits redefined (unphysical values for given xi).\n";
88 t = (
fLog_t) ?
pow(CLHEP::RandFlat::shoot(engine, log10(min_t), log10(max_t)), 10)
89 : CLHEP::RandFlat::shoot(engine, min_t, max_t);
94 Part->suggest_barcode(barcode);
96 Vtx->add_particle_out(Part);
102 double max_t =
fMaxt;
105 <<
"WARNING: t limits redefined (unphysical values for given xi)." << endl;
108 t = (
fLog_t) ?
pow(CLHEP::RandFlat::shoot(engine, log10(min_t), log10(max_t)), 10)
109 : CLHEP::RandFlat::shoot(engine, min_t, max_t);
114 Part2->suggest_barcode(barcode);
116 Vtx->add_particle_out(Part2);
120 fEvt->add_vertex(Vtx);
121 fEvt->set_event_number(
e.id().event());
122 fEvt->set_signal_process_id(20);
128 std::unique_ptr<HepMCProduct> BProduct(
new HepMCProduct());
129 BProduct->addHepMCData(
fEvt);
138 edm::LogInfo(
"RandomtXiGunProducer") <<
" Event Generation Done \n";
159 <<
"-----------------------------------------------------------------------------------------------------\n" 160 <<
"Produced a proton with phi : " <<
phi <<
" theta: " <<
theta <<
" t: " <<
t <<
" Xi: " <<
Xi <<
"\n" 161 <<
" Px : " <<
px <<
" Py : " <<
py <<
" Pz : " << pz <<
"\n" 162 <<
" direction: " << direction <<
"\n" 163 <<
"-----------------------------------------------------------------------------------------------------" 166 return HepMC::FourVector(
px,
py, pz, sEnergy);
HepMC::FourVector make_particle(double t, double Xi, double phi, int PartID, int direction)
T getParameter(std::string const &) const
RandomtXiGunProducer(const ParameterSet &)
Sin< T >::type sin(const T &t)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
T getUntrackedParameter(std::string const &, T const &) const
Cos< T >::type cos(const T &t)
~RandomtXiGunProducer() override
Abs< T >::type abs(const T &t)
ESHandle< HepPDT::ParticleDataTable > fPDGTable
Log< level::Info, false > LogInfo
void produce(Event &e, const EventSetup &es) override
std::vector< int > fPartIDs
const HepPDT::ParticleData * PData
Geom::Theta< T > theta() const
double Minimum_t(double xi)
Power< A, B >::type pow(const A &a, const B &b)