source: branches/MarsISDCBranchBasedOn17887/mcorsika/MCorsikaFormat.h@ 19185

Last change on this file since 19185 was 10213, checked in by rohlfs, 14 years ago
accept an EVTH only after an EVTE and after a RUNH
File size: 1.6 KB
Line 
1#ifndef MARS_MDataFormat
2#define MARS_MDataFormat
3
4#ifndef MARS_MAGIC
5#include "MAGIC.h"
6#endif
7
8#ifndef ROOT_Rtypes
9#include <Rtypes.h>
10#endif
11
12#include <iosfwd>
13#include <fstream>
14
15class MCorsikaFormat
16{
17protected:
18 std::istream *fIn;
19
20public:
21 static const unsigned int kSyncMarker;
22
23 MCorsikaFormat(std::istream * in)
24 : fIn(in) { }
25 virtual ~MCorsikaFormat();
26
27 virtual Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
28 Int_t & blockIdentifier, Int_t & blockLength) const = 0;
29
30 void Seek(std::streampos offset) {fIn->seekg(offset, std::ios::cur);}
31
32 virtual Bool_t SeekEvtEnd() = 0;
33
34 virtual Bool_t IsEventioFormat() const = 0;
35
36 virtual Bool_t Eof() const;
37
38 Bool_t Read(void *ptr, Int_t i) const;
39
40 static MCorsikaFormat *CorsikaFormatFactory(const char *fileName);
41};
42
43
44class MCorsikaFormatRaw : public MCorsikaFormat
45{
46private:
47
48public:
49 MCorsikaFormatRaw(std::istream * in)
50 : MCorsikaFormat(in) {}
51
52 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
53 Int_t & blockIdentifier, Int_t & blockLength) const;
54
55 Bool_t SeekEvtEnd();
56
57 Bool_t IsEventioFormat() const {return kFALSE;}
58};
59
60
61class MCorsikaFormatEventIO : public MCorsikaFormat
62{
63
64public:
65 MCorsikaFormatEventIO(std::istream *in)
66 : MCorsikaFormat(in) {}
67
68
69 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
70 Int_t & blockIdentifier, Int_t & blockLength) const;
71
72 Bool_t SeekEvtEnd();
73
74 Bool_t IsEventioFormat() const { return kTRUE; }
75
76};
77
78#endif
79
Note: See TracBrowser for help on using the repository browser.