1 | #ifndef MARS_MCorsikaRead
|
---|
2 | #define MARS_MCorsikaRead
|
---|
3 |
|
---|
4 | #include <vector>
|
---|
5 |
|
---|
6 | #ifndef MARS_MRead
|
---|
7 | #include "MRead.h"
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | #ifndef ROOT_TArrayF
|
---|
11 | #include <TArrayF.h>
|
---|
12 | #endif
|
---|
13 |
|
---|
14 | class TList;
|
---|
15 | //class MZlib;
|
---|
16 | class MTaskList;
|
---|
17 |
|
---|
18 | class MCorsikaRunHeader;
|
---|
19 | class MCorsikaEvtHeader;
|
---|
20 | class MPhotonEvent;
|
---|
21 | class MCorsikaFormat;
|
---|
22 |
|
---|
23 | class MCorsikaRead : public MRead
|
---|
24 | {
|
---|
25 | private:
|
---|
26 | MCorsikaRunHeader *fRunHeader; //! run header information container to fill from file
|
---|
27 | MCorsikaEvtHeader *fEvtHeader; //! event header information container to fill from file
|
---|
28 | MPhotonEvent *fEvent; //! event information
|
---|
29 |
|
---|
30 | Int_t fTelescopeIdx; // Index of telescope to be extracted
|
---|
31 | Int_t fArrayIdx; // Index of telescope-array to be extracted
|
---|
32 | Bool_t fForceMode; // Force mode skipping defect RUNE
|
---|
33 |
|
---|
34 | TList *fFileNames; // list of file names
|
---|
35 | UInt_t fNumFile; //! number of next file
|
---|
36 | UInt_t fNumEvents; //! input stream (file to read from)
|
---|
37 | UInt_t fNumTotalEvents; //! total number of events in all files
|
---|
38 |
|
---|
39 | MCorsikaFormat *fInFormat; //! access to input corsika data
|
---|
40 |
|
---|
41 | MParList *fParList; //! tasklist to call ReInit from
|
---|
42 |
|
---|
43 | UInt_t fNumTelescopes; //! Number of telescopes in array
|
---|
44 | Int_t fNumTelescope; //! Number of telescope currently being read
|
---|
45 | TArrayF fTelescopeX; //! x pos (measured towards north, unit: cm)
|
---|
46 | TArrayF fTelescopeY; //! y pos (measured towards west, unit: cm)
|
---|
47 | TArrayF fTelescopeZ; //! z pos (from detection level, unit: cm)
|
---|
48 | TArrayF fTelescopeR; //! Radii of spheres around tel. (unit: cm)
|
---|
49 |
|
---|
50 | Int_t fBlockType; //! block type of the just read block header
|
---|
51 | Int_t fBlockVersion; //! block version of the just read block header
|
---|
52 | Int_t fBlockIdentifier; //! block identifier of the just read block header
|
---|
53 | Int_t fBlockLength; //! block length from the just read block header
|
---|
54 |
|
---|
55 | Int_t fReadState; //! 0: nothing read yet
|
---|
56 | // 1: RUNH is already read
|
---|
57 | // 2: EVTH is already read
|
---|
58 | // 3: EVTE is already read, run still open
|
---|
59 | // 4: inside of a top level block (1205)
|
---|
60 | // 5: RUNE is already read
|
---|
61 | // 10: raw events are currently read
|
---|
62 | // 15: undefined status
|
---|
63 | Int_t fTopBlockLength; // remaining length of the current top-level block 1204
|
---|
64 |
|
---|
65 | std::vector<Float_t> fRawEvemtBuffer; //! buffer of raw event data
|
---|
66 | //UInt_t fInterleave;
|
---|
67 | //Bool_t fForce;
|
---|
68 |
|
---|
69 | Int_t OpenNextFile(Bool_t print=kTRUE, Bool_t telrequired=kTRUE);
|
---|
70 | Int_t ReadTelescopePosition();
|
---|
71 | Int_t ReadNextBlockHeader();
|
---|
72 |
|
---|
73 | // MTask
|
---|
74 | Int_t PreProcess(MParList *pList);
|
---|
75 | Int_t Process();
|
---|
76 | Int_t PostProcess();
|
---|
77 |
|
---|
78 |
|
---|
79 | public:
|
---|
80 | MCorsikaRead(const char *filename=NULL, const char *name=NULL, const char *title=NULL);
|
---|
81 | ~MCorsikaRead();
|
---|
82 |
|
---|
83 | Bool_t CalcNumTotalEvents();
|
---|
84 |
|
---|
85 | void SetForceMode(Bool_t b=kTRUE) { fForceMode=b; }
|
---|
86 | void SetTelescopeIdx(Int_t idx) { fTelescopeIdx = idx; }
|
---|
87 | void SetArrayIdx(Int_t idx) { fArrayIdx = idx; }
|
---|
88 |
|
---|
89 | TString GetFullFileName() const;
|
---|
90 |
|
---|
91 | Int_t AddFile(const char *fname, Int_t entries=-1);
|
---|
92 | Bool_t Rewind();
|
---|
93 | UInt_t GetEntries() { return fNumTotalEvents/*/fInterleave*/; }
|
---|
94 |
|
---|
95 | UInt_t GetNumFiles() { return fFileNames->GetEntries(); }
|
---|
96 |
|
---|
97 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
98 |
|
---|
99 | ClassDef(MCorsikaRead, 0) // Task to read the raw data binary file
|
---|
100 | };
|
---|
101 |
|
---|
102 | #endif
|
---|