HepMC3 event record library
WriterHEPEVTZEUS.cc
1#include "WriterHEPEVTZEUS.h"
3namespace HepMC3
4{
5WriterHEPEVTZEUS::WriterHEPEVTZEUS(const std::string &filename):WriterHEPEVT(filename) {}
7{
8 char buf[512];//Note: the format is fixed, so no reason for complicatied tratment
9 char* cursor = &(buf[0]);
10 cursor += sprintf(cursor, " E % 12i% 12i% 12i\n", m_hepevt_interface.event_number(), 0, m_hepevt_interface.number_entries());
11 unsigned long length = cursor - &(buf[0]);
12 m_stream->write( buf, length );
13}
14void WriterHEPEVTZEUS::write_hepevt_particle( int index, bool iflong)
15{
16 if (!iflong) printf("INFO: the parameter is ignored as HEPEVTZEUS always uses long format\n");
17 char buf[512];//Note: the format is fixed, so no reason for complicatied tratment
18 char* cursor = &(buf[0]);
19 cursor += sprintf(cursor,"% 12i% 8i", m_hepevt_interface.status(index), m_hepevt_interface.id(index));
20 cursor += sprintf(cursor,"% 8i% 8i", m_hepevt_interface.first_parent(index), m_hepevt_interface.last_parent(index));
21 cursor += sprintf(cursor,"% 8i% 8i", m_hepevt_interface.first_child(index), m_hepevt_interface.last_child(index));
22 cursor += sprintf(cursor, "% 19.11E% 19.11E% 19.11E% 19.11E% 19.11E\n", m_hepevt_interface.px(index), m_hepevt_interface.py(index), m_hepevt_interface.pz(index), m_hepevt_interface.e(index), m_hepevt_interface.m(index));
23 cursor += sprintf(cursor, "%-52s% 19.11E% 19.11E% 19.11E% 19.11E% 19.11E\n", " ", m_hepevt_interface.x(index), m_hepevt_interface.y(index), m_hepevt_interface.z(index), m_hepevt_interface.t(index), 0.0);
24 std::ptrdiff_t length = cursor - &(buf[0]);
25 m_stream->write( buf, length );
26}
27}// namespace HepMC3
Definition of class HEPEVT_Wrapper.
Definition of class WriterHEPEVTZEUS.
int first_child(const int index) const
Get index of 1st daughter.
int last_parent(const int index) const
Get index of last mother.
int event_number() const
Get event number.
int last_child(const int index) const
Get index of last daughter.
int first_parent(const int index) const
Get index of 1st mother.
double pz(const int index) const
Get Z momentum.
double py(const int index) const
Get Y momentum.
int id(const int index) const
Get PDG particle id.
double t(const int index) const
Get production time.
double y(const int index) const
Get Y Production vertex.
int number_entries() const
Get number of entries.
double m(const int index) const
Get generated mass.
int status(const int index) const
Get status code.
double px(const int index) const
Get X momentum.
double z(const int index) const
Get Z Production vertex.
double x(const int index) const
Get X Production vertex.
double e(const int index) const
Get Energy.
void write_hepevt_particle(int index, bool iflong=true) override
Write particles.
void write_hepevt_event_header() override
Write the header.
WriterHEPEVTZEUS(const std::string &filename)
Constructor.
GenEvent I/O serialization for HEPEVT files.
Definition: WriterHEPEVT.h:28
HEPEVT_Wrapper_Template< 100000 > m_hepevt_interface
Templated HEPEVT interface.
Definition: WriterHEPEVT.h:89
std::ostream * m_stream
Output stream.
Definition: WriterHEPEVT.h:86
HepMC3 main namespace.