source: branches/Corsika7500Compatibility/mcorsika/MCorsikaFormat.h@ 18459

Last change on this file since 18459 was 18455, checked in by dbaack, 9 years ago
Commit old changes from 7.4 Branch to this branch
File size: 1.7 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 Bool_t fFortranRaw = false;
48public:
49 MCorsikaFormatRaw(std::istream * in)
50 : MCorsikaFormat(in) {}
51
52 MCorsikaFormatRaw(std::istream* in, Bool_t fortranRaw)
53 : MCorsikaFormat(in), fFortranRaw(fortranRaw) {}
54
55 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
56 Int_t & blockIdentifier, Int_t & blockLength) const;
57
58 Bool_t SeekEvtEnd();
59
60 Bool_t IsEventioFormat() const {return kFALSE;}
61};
62
63
64class MCorsikaFormatEventIO : public MCorsikaFormat
65{
66
67public:
68 MCorsikaFormatEventIO(std::istream *in)
69 : MCorsikaFormat(in) {}
70
71
72 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
73 Int_t & blockIdentifier, Int_t & blockLength) const;
74
75 Bool_t SeekEvtEnd();
76
77 Bool_t IsEventioFormat() const { return kTRUE; }
78
79};
80
81#endif
82
Note: See TracBrowser for help on using the repository browser.