source: branches/Corsika7405Compatibility/mcorsika/MCorsikaFormat.h@ 18242

Last change on this file since 18242 was 18179, checked in by dbaack, 10 years ago
File size: 1.8 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
20 Bool_t fMMCS = true;
21
22public:
23 static const unsigned int kSyncMarker;
24
25 MCorsikaFormat(std::istream * in)
26 : fIn(in) { }
27 virtual ~MCorsikaFormat();
28
29 virtual Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
30 Int_t & blockIdentifier, Int_t & blockLength) const = 0;
31
32 void Seek(std::streampos offset) {fIn->seekg(offset, std::ios::cur);}
33
34 virtual Bool_t SeekEvtEnd() = 0;
35
36 virtual Bool_t IsEventioFormat() const = 0;
37
38 virtual Bool_t Eof() const;
39
40 Bool_t Read(void *ptr, Int_t i) const;
41
42
43 static MCorsikaFormat *CorsikaFormatFactory(const char *fileName);
44
45 const Bool_t isMMCS() {return fMMCS;}
46};
47
48
49class MCorsikaFormatRaw : public MCorsikaFormat
50{
51private:
52 Bool_t fFortranRaw = false;
53
54public:
55 MCorsikaFormatRaw(std::istream * in)
56 : MCorsikaFormat(in) {}
57 MCorsikaFormatRaw(std::istream* in, Bool_t fortranRaw)
58 : MCorsikaFormat(in), fFortranRaw (fortranRaw) {}
59
60 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
61 Int_t & blockIdentifier, Int_t & blockLength) const;
62
63 Bool_t SeekEvtEnd();
64
65 Bool_t IsEventioFormat() const {return kFALSE;}
66};
67
68
69class MCorsikaFormatEventIO : public MCorsikaFormat
70{
71
72public:
73 MCorsikaFormatEventIO(std::istream *in)
74 : MCorsikaFormat(in) {}
75
76
77 Bool_t NextBlock(Int_t readState, Int_t & blockType, Int_t & blockVersion,
78 Int_t & blockIdentifier, Int_t & blockLength) const;
79
80 Bool_t SeekEvtEnd();
81
82 Bool_t IsEventioFormat() const { return kTRUE; }
83
84};
85
86#endif
87
Note: See TracBrowser for help on using the repository browser.