32 #include "CLHEP/Random/RandFlat.h"
39 fOutFileName(pset.getUntrackedParameter<
string>(
"OutFileName",
"FlatEGunHepMC.dat")),
62 if (
fOutStream->rdstate() == std::ios::failbit) {
63 throw cms::Exception(
"FileNotOpen",
"FlatEGunASCIIWriter::beginJob()")
82 HepMC::GenVertex* Vtx =
new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
86 for (
unsigned int ip = 0; ip <
fPartIDs.size(); ip++) {
91 double mass = PData->mass().value();
92 double mom2 = energy * energy - mass *
mass;
97 double px = mom *
sin(theta) *
cos(phi);
98 double py = mom *
sin(theta) *
sin(phi);
99 double pz = mom *
cos(theta);
103 HepMC::FourVector
p(px, py, pz, energy);
105 Vtx->add_particle_out(Part);
107 fEvt->add_vertex(Vtx);
109 fEvt->set_signal_process_id(20);
void beginRun(const edm::Run &, const EventSetup &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
Exp< T >::type exp(const T &t)
std::vector< int > fPartIDs
ESHandle< HepPDT::ParticleDataTable > fPDGTable
bool getData(T &iHolder) const
Cos< T >::type cos(const T &t)
~FlatEGunASCIIWriter() override
Abs< T >::type abs(const T &t)
HepPDT::ParticleData ParticleData
FlatEGunASCIIWriter(const edm::ParameterSet &)
HepMC::IO_GenEvent * fOutStream
T getParameter(std::string const &) const