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 |
|
---|
15 | class MCorsikaFormat
|
---|
16 | {
|
---|
17 | protected:
|
---|
18 | std::istream *fIn;
|
---|
19 |
|
---|
20 | public:
|
---|
21 | static const unsigned int kSyncMarker;
|
---|
22 |
|
---|
23 | MCorsikaFormat(std::istream * in)
|
---|
24 | : fIn(in) { }
|
---|
25 | virtual ~MCorsikaFormat();
|
---|
26 |
|
---|
27 | virtual Bool_t NextBlock(Bool_t subBlock, 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 |
|
---|
44 | class MCorsikaFormatRaw : public MCorsikaFormat
|
---|
45 | {
|
---|
46 | private:
|
---|
47 |
|
---|
48 | public:
|
---|
49 | MCorsikaFormatRaw(std::istream * in)
|
---|
50 | : MCorsikaFormat(in) {}
|
---|
51 |
|
---|
52 | Bool_t NextBlock(Bool_t subBlock, 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 |
|
---|
61 | class MCorsikaFormatEventIO : public MCorsikaFormat
|
---|
62 | {
|
---|
63 |
|
---|
64 | public:
|
---|
65 | MCorsikaFormatEventIO(std::istream *in)
|
---|
66 | : MCorsikaFormat(in) {}
|
---|
67 |
|
---|
68 |
|
---|
69 | Bool_t NextBlock(Bool_t subBlock, 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 |
|
---|