HepMC3 event record library
WriterHEPEVTZEUS.cc
1 #include "WriterHEPEVTZEUS.h"
3 namespace HepMC3
4 {
5 WriterHEPEVTZEUS::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", HEPEVT_Wrapper::event_number(), 0, HEPEVT_Wrapper::number_entries());
11  unsigned long length = cursor - &(buf[0]);
12  m_stream->write( buf, length );
13 }
15 {
16  char buf[512];//Note: the format is fixed, so no reason for complicatied tratment
17  char* cursor = &(buf[0]);
18  cursor += sprintf(cursor,"% 12i% 8i", HEPEVT_Wrapper::status(index), HEPEVT_Wrapper::id(index));
19  cursor += sprintf(cursor,"% 8i% 8i", HEPEVT_Wrapper::first_parent(index), HEPEVT_Wrapper::last_parent(index));
20  cursor += sprintf(cursor,"% 8i% 8i", HEPEVT_Wrapper::first_child(index), HEPEVT_Wrapper::last_child(index));
21  cursor += sprintf(cursor, "% 19.11E% 19.11E% 19.11E% 19.11E% 19.11E\n", HEPEVT_Wrapper::px(index), HEPEVT_Wrapper::py(index), HEPEVT_Wrapper::pz(index), HEPEVT_Wrapper::e(index), HEPEVT_Wrapper::m(index));
22  cursor += sprintf(cursor, "%-52s% 19.11E% 19.11E% 19.11E% 19.11E% 19.11E\n", " ", HEPEVT_Wrapper::x(index), HEPEVT_Wrapper::y(index), HEPEVT_Wrapper::z(index), HEPEVT_Wrapper::t(index), 0.0);
23  std::ptrdiff_t length = cursor - &(buf[0]);
24  m_stream->write( buf, length );
25 }
26 }// namespace HepMC3
HepMC3::HEPEVT_Wrapper::m
static double m(const int &index)
Get generated mass.
Definition: HEPEVT_Wrapper.h:143
HepMC3::HEPEVT_Wrapper::status
static int status(const int &index)
Get status code.
Definition: HEPEVT_Wrapper.h:133
HepMC3::WriterHEPEVTZEUS::write_hepevt_particle
void write_hepevt_particle(int index)
Write particles.
Definition: WriterHEPEVTZEUS.cc:14
HepMC3::HEPEVT_Wrapper::x
static double x(const int &index)
Get X Production vertex.
Definition: HEPEVT_Wrapper.h:144
HepMC3
HepMC3 main namespace.
Definition: AnalysisExample.h:19
HEPEVT_Wrapper.h
Definition of class HEPEVT_Wrapper.
HepMC3::HEPEVT_Wrapper::py
static double py(const int &index)
Get Y momentum.
Definition: HEPEVT_Wrapper.h:140
HepMC3::WriterHEPEVTZEUS::write_hepevt_event_header
void write_hepevt_event_header()
Write the header.
Definition: WriterHEPEVTZEUS.cc:6
HepMC3::HEPEVT_Wrapper::number_entries
static int number_entries()
Get number of entries.
Definition: HEPEVT_Wrapper.h:132
HepMC3::HEPEVT_Wrapper::z
static double z(const int &index)
Get Z Production vertex.
Definition: HEPEVT_Wrapper.h:146
HepMC3::HEPEVT_Wrapper::e
static double e(const int &index)
Get Energy.
Definition: HEPEVT_Wrapper.h:142
HepMC3::HEPEVT_Wrapper::last_parent
static int last_parent(const int &index)
Get index of last mother.
Definition: HEPEVT_Wrapper.h:136
HepMC3::HEPEVT_Wrapper::first_child
static int first_child(const int &index)
Get index of 1st daughter.
Definition: HEPEVT_Wrapper.h:137
HepMC3::WriterHEPEVTZEUS::WriterHEPEVTZEUS
WriterHEPEVTZEUS(const std::string &filename)
Constructor.
Definition: WriterHEPEVTZEUS.cc:5
HepMC3::HEPEVT_Wrapper::y
static double y(const int &index)
Get Y Production vertex.
Definition: HEPEVT_Wrapper.h:145
WriterHEPEVTZEUS.h
Definition of class WriterHEPEVTZEUS.
HepMC3::HEPEVT_Wrapper::px
static double px(const int &index)
Get X momentum.
Definition: HEPEVT_Wrapper.h:139
HepMC3::WriterHEPEVT
GenEvent I/O serialization for HEPEVT files.
Definition: WriterHEPEVT.h:28
HepMC3::HEPEVT_Wrapper::last_child
static int last_child(const int &index)
Get index of last daughter.
Definition: HEPEVT_Wrapper.h:138
HepMC3::HEPEVT_Wrapper::pz
static double pz(const int &index)
Get Z momentum.
Definition: HEPEVT_Wrapper.h:141
HepMC3::HEPEVT_Wrapper::event_number
static int event_number()
Get event number.
Definition: HEPEVT_Wrapper.h:131
HepMC3::HEPEVT_Wrapper::id
static int id(const int &index)
Get PDG particle id.
Definition: HEPEVT_Wrapper.h:134
HepMC3::HEPEVT_Wrapper::first_parent
static int first_parent(const int &index)
Get index of 1st mother.
Definition: HEPEVT_Wrapper.h:135
HepMC3::WriterHEPEVT::m_stream
std::ostream * m_stream
Output stream.
Definition: WriterHEPEVT.h:80
HepMC3::HEPEVT_Wrapper::t
static double t(const int &index)
Get production time.
Definition: HEPEVT_Wrapper.h:147