20 WriterHEPEVT::WriterHEPEVT(
const std::string &filename): m_file(filename), m_stream(&m_file), m_events_count(0),m_vertices_positions_present(true)
22 HEPMC3_WARNING(
"WriterHEPEVT::WriterHEPEVT: HEPEVT format is outdated. Please use HepMC3 format instead." )
29 HEPMC3_WARNING(
"WriterHEPEVT::WriterHEPEVT: HEPEVT format is outdated. Please use HepMC3 format instead." )
37 char* cursor=&(buf[0]);
38 cursor +=sprintf(cursor,
"% 8i% 8i",HEPEVT_Wrapper::status(index), HEPEVT_Wrapper::id(index));
41 cursor +=sprintf(cursor,
"% 8i% 8i",HEPEVT_Wrapper::first_parent(index),HEPEVT_Wrapper::last_parent(index));
42 cursor +=sprintf(cursor,
"% 8i% 8i",HEPEVT_Wrapper::first_child(index),HEPEVT_Wrapper::last_child(index));
43 cursor +=sprintf(cursor,
"% 19.8E% 19.8E% 19.8E% 19.8E% 19.8E\n",HEPEVT_Wrapper::px(index),HEPEVT_Wrapper::py(index),HEPEVT_Wrapper::pz(index),HEPEVT_Wrapper::e(index),HEPEVT_Wrapper::m(index));
44 cursor +=sprintf(cursor,
"%-48s% 19.8E% 19.8E% 19.8E% 19.8E\n",
" ",HEPEVT_Wrapper::x(index),HEPEVT_Wrapper::y(index),HEPEVT_Wrapper::z(index),HEPEVT_Wrapper::t(index));
48 cursor +=sprintf(cursor,
"% 8i% 8i",HEPEVT_Wrapper::first_child(index),HEPEVT_Wrapper::last_child(index));
49 cursor +=sprintf(cursor,
"% 19.8E% 19.8E% 19.8E% 19.8E\n",HEPEVT_Wrapper::px(index),HEPEVT_Wrapper::py(index),HEPEVT_Wrapper::pz(index),HEPEVT_Wrapper::m(index));
51 unsigned long length = cursor - &(buf[0]);
59 cursor +=sprintf(cursor,
"E% 8i %8i\n",HEPEVT_Wrapper::event_number(),HEPEVT_Wrapper::number_entries());
60 unsigned long length = cursor - &(buf[0]);
75 std::ofstream* ofs =
dynamic_cast<std::ofstream*
>(
m_stream);
76 if (ofs && !ofs->is_open())
return;
77 if (ofs) ofs->close();
82 return (
bool)
m_file.rdstate();