ATLAS Offline Software
IO_GenEvent.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 /* Author: Andrii Verbytskyi andrii.verbytskyi@mpp.mpg.de */
5 
6 #ifndef ATLASHEPMC_IOGENEVENT_H
7 #define ATLASHEPMC_IOGENEVENT_H
8 #ifdef HEPMC3
9 #include "HepMC3/Version.h"
10 #include "HepMC3/Reader.h"
11 #include "HepMC3/Writer.h"
12 #include "HepMC3/ReaderAsciiHepMC2.h"
13 #include "HepMC3/WriterAsciiHepMC2.h"
14 namespace HepMC {
15 typedef HepMC3::WriterAsciiHepMC2 WriterAsciiHepMC2;
16 typedef HepMC3::ReaderAsciiHepMC2 ReaderAsciiHepMC2;
17 class IO_GenEvent {
18 public:
19  IO_GenEvent( const std::string& filename="IO_GenEvent.dat",
20  std::ios::openmode mode=std::ios::out ) {
21  if (mode!=std::ios::out) printf("In AtlasHepMC/IO_GenEvent.h in IO_GenEvent(filename,mode) mode should be std::ios::out\n");
22  m_writer=new HepMC3::WriterAsciiHepMC2(filename);
23  }
24  IO_GenEvent( std::ostream & os ) {
25  m_writer=new HepMC3::WriterAsciiHepMC2(os);
26  }
27  ~IO_GenEvent() {
28  if(m_writer) {
29  m_writer->close();
30  delete m_writer;
31  }
32  }
33  void write_event( const HepMC3::GenEvent* evt ) {
34  m_writer->write_event(*evt);
35  }
36 private:
37  HepMC3::WriterAsciiHepMC2 *m_writer;
38 };
39 }
40 #else
41 #include "HepMC/IO_GenEvent.h"
42 #endif
43 #endif
IO_GenEvent.h
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
Preparation.mode
mode
Definition: Preparation.py:95
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
HepMC
Definition: Barcode.h:14
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24