StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StreamInfo.h
1 //--------------------------------------------------------------------------
2 #ifndef HEPMC_STREAM_INFO_H
3 #define HEPMC_STREAM_INFO_H
4 
6 // garren@fnal.gov, March 2009
7 //
8 // This class contains the extra information needed when using streaming IO
10 
11 #include <string>
12 #include "HepMC/Units.h"
13 
14 namespace HepMC {
15 
17 enum known_io { gen=1, ascii, extascii, ascii_pdt, extascii_pdt };
18 
20 
26 class StreamInfo {
27 public:
29  StreamInfo( );
32 
34  std::string IO_GenEvent_Key() const { return m_io_genevent_start; }
36  std::string IO_GenEvent_End() const { return m_io_genevent_end; }
37 
41  std::string IO_Ascii_Key() const { return m_io_ascii_start; }
43  std::string IO_Ascii_End() const { return m_io_ascii_end; }
45  std::string IO_Ascii_PDT_Key() const { return m_io_ascii_pdt_start; }
47  std::string IO_Ascii_PDT_End() const { return m_io_ascii_pdt_end; }
48 
52  std::string IO_ExtendedAscii_Key() const { return m_io_extendedascii_start; }
54  std::string IO_ExtendedAscii_End() const { return m_io_extendedascii_end; }
56  std::string IO_ExtendedAscii_PDT_Key() const { return m_io_extendedascii_pdt_start; }
58  std::string IO_ExtendedAscii_PDT_End() const { return m_io_extendedascii_pdt_end; }
59 
61  int io_type() const { return m_io_type; }
63  void set_io_type( int );
64 
67  bool has_key() const { return m_has_key; }
69  void set_has_key( bool );
70 
72  Units::MomentumUnit io_momentum_unit() const { return m_io_momentum_unit; }
74  Units::LengthUnit io_position_unit() const { return m_io_position_unit; }
75 
78  int stream_id() const { return m_stream_id; }
79 
81  bool finished_first_event() const { return m_finished_first_event_io; }
83  void set_finished_first_event( bool b ) { m_finished_first_event_io = b; }
84 
89  void use_input_units( Units::MomentumUnit, Units::LengthUnit );
90 
93  bool reading_event_header();
95  void set_reading_event_header(bool);
96 
97 private: // data members
98  bool m_finished_first_event_io;
99  // GenEvent I/O method keys
100  std::string m_io_genevent_start;
101  std::string m_io_ascii_start;
102  std::string m_io_extendedascii_start;
103  std::string m_io_genevent_end;
104  std::string m_io_ascii_end;
105  std::string m_io_extendedascii_end;
106  // particle data I/O method keys
107  std::string m_io_ascii_pdt_start;
108  std::string m_io_extendedascii_pdt_start;
109  std::string m_io_ascii_pdt_end;
110  std::string m_io_extendedascii_pdt_end;
111  // io information
112  int m_io_type;
113  bool m_has_key;
114  // default io units - used only when reading a file with no units
115  Units::MomentumUnit m_io_momentum_unit;
116  Units::LengthUnit m_io_position_unit;
117  // used to keep identify the I/O stream
118  unsigned int m_stream_id;
119  static unsigned int m_stream_counter;
120  // used to keep track when reading event
121  bool m_reading_event_header;
122 
123 };
124 
125 } // HepMC
126 
127 #endif // HEPMC_STREAM_INFO_H
128 //--------------------------------------------------------------------------
std::string IO_Ascii_PDT_End() const
IO_Ascii end particle data block key.
Definition: StreamInfo.h:47
std::string IO_GenEvent_End() const
IO_GenEvent end event block key.
Definition: StreamInfo.h:36
bool finished_first_event() const
Special information is processed the first time we use the IO.
Definition: StreamInfo.h:81
void set_finished_first_event(bool b)
Special information is processed the first time we use the IO.
Definition: StreamInfo.h:83
StreamInfo()
default constructor
Definition: StreamInfo.cc:13
Units::LengthUnit io_position_unit() const
get the I/O length units
Definition: StreamInfo.h:74
bool has_key() const
Definition: StreamInfo.h:67
std::string IO_Ascii_PDT_Key() const
IO_Ascii begin particle data block key.
Definition: StreamInfo.h:45
void use_input_units(Units::MomentumUnit, Units::LengthUnit)
Definition: StreamInfo.cc:38
void set_io_type(int)
set IO type
Definition: StreamInfo.cc:43
std::string IO_Ascii_End() const
IO_Ascii end event block key.
Definition: StreamInfo.h:43
int io_type() const
get IO type
Definition: StreamInfo.h:61
std::string IO_ExtendedAscii_PDT_Key() const
IO_ExtendedAscii begin particle data block key.
Definition: StreamInfo.h:56
void set_has_key(bool)
set to false if the stream does not have a file type key
Definition: StreamInfo.cc:47
Units::MomentumUnit io_momentum_unit() const
get the I/O momentum units
Definition: StreamInfo.h:72
std::string IO_ExtendedAscii_End() const
IO_ExtendedAscii end event block key.
Definition: StreamInfo.h:54
bool reading_event_header()
Definition: StreamInfo.cc:51
known_io
The known_io enum is used to track which type of input is being read.
Definition: StreamInfo.h:17
std::string IO_GenEvent_Key() const
IO_GenEvent begin event block key.
Definition: StreamInfo.h:34
~StreamInfo()
destructor
Definition: StreamInfo.h:31
StreamInfo contains extra information needed when using streaming IO.
Definition: StreamInfo.h:26
void set_reading_event_header(bool)
set the reading_event_header flag
Definition: StreamInfo.cc:55
std::string IO_ExtendedAscii_Key() const
Definition: StreamInfo.h:52
std::string IO_ExtendedAscii_PDT_End() const
IO_ExtendedAscii end particle data block key.
Definition: StreamInfo.h:58
int stream_id() const
Definition: StreamInfo.h:78
std::string IO_Ascii_Key() const
Definition: StreamInfo.h:41