SenecaFileParser.h
Go to the documentation of this file.
1 #ifndef _io_SenecaFileParser_h_
2 #define _io_SenecaFileParser_h_
3 
4 #include <fstream>
5 #include <string>
6 #include <io/IoCodes.h>
7 
8 using namespace std;
9 
10 
11 namespace io {
12 
20  };
21 
22  enum SenecaEMSim {
27  };
28 
30  int ID;
31  float Weight;
32  float X;
33  float Y;
34  float T;
35  float Px;
36  float Py;
37  float Pz;
38  };
39 
41  int ID;
43  unsigned char EMSim;
44  unsigned char HadronicSim;
45  float HObs;
46  int ILowHadr;
47  int IOHadr;
48  int IVersion;
49  float HINJ;
50  float HGround;
51  float HCore;
52  };
53 
55  int ID;
56  float E0;
57  float Theta;
58  float Phi;
59  int ID0;
60  };
61 
62 
73  public:
74  SenecaFileParser(const std::string& FileName, const Mode mode = eRead);
77 
78  Status OpenSenecaFile(const std::string& FileName, Mode mode = eRead);
79  void CloseSenecaFile();
80  unsigned int GetCurrentPosition();
81 
82  Status ProcessFile();
83  SenecaHeaderRecord* GetFileHeader();
84  SenecaEventHeaderRecord* GetCurrentEventHeader();
85  SenecaParticleRecord* GetParticleRecord();
86  Status GotoPosition(unsigned int thePosition);
87  unsigned int GetPosition();
88  Status GotoEvent(unsigned int theEventNumber);
89  Status GetNextEvent();
90  Status ReadParticle();
91  unsigned int GetNumberEvents();
92  unsigned int GetCurrentEvent();
93  Status FileStatus();
94 
98 
99  private:
100  Status DecodeFileHeader(unsigned char* Record);
101  Status DecodeEventHeader(unsigned char* Record);
102  Status DecodeParticleRecord(unsigned char* Record);
103 
104  int SenecaDecodeInt(unsigned char* Buffer);
105  float SenecaDecodeFloat(unsigned char* Buffer);
106 
107  std::ifstream SenecaFile;
109  //std::ofstream DebugFile;
110 
111  unsigned long EventPositions[1024];
112 
116 
117  bool FileOpen;
118 
119  unsigned int NumberEvents;
120  unsigned int CurrentEvent, NextEvent;
121 
122  unsigned int FileSize;
123  unsigned long CurrentPosition;
124  //unsigned int FirstEvent; // unused. LN.
125  };
126 
127 } //io namespace
128 
129 #endif //io_SenecaFileParser_h_
SenecaHadronicSim
SenecaEventHeaderRecord EventHeader
Mode
Available open modes.
Definition: IoCodes.h:16
SenecaParticleRecord ParticleRecord
Status
Return code for seek operation.
Definition: IoCodes.h:24
SenecaHeaderRecord FileHeader
std::ifstream SenecaFile
unsigned long CurrentPosition
void Buffer(sevt::Station &station, const TimeStamp &eventTime, const StationTriggerData::Algorithm algorithm, const int pldBits, const int start, const int stop)

, generated on Tue Sep 26 2023.