source: trunk/Mars/mcorsika/MCorsikaRead.h @ 10147

Last change on this file since 10147 was 10147, checked in by rohlfs, 10 years ago
Redesign of the Process() - method.
File size: 3.4 KB
Line 
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
14class TList;
15//class MZlib;
16class MTaskList;
17
18class MCorsikaRunHeader;
19class MCorsikaEvtHeader;
20class MPhotonEvent;
21class MCorsikaFormat;
22
23class MCorsikaRead : public MRead
24{
25private:
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    Int_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
70    Int_t  OpenNextFile(Bool_t print=kTRUE);
71    Bool_t CalcNumTotalEvents();
72    Int_t  ReadTelescopePosition();
73    Int_t  ReadNextBlockHeader();
74
75    // MTask
76    Int_t PreProcess(MParList *pList);
77    Int_t Process();
78    Int_t Process_Old();
79    Int_t PostProcess();
80
81
82public:
83    MCorsikaRead(const char *filename=NULL, const char *name=NULL, const char *title=NULL);
84    ~MCorsikaRead();
85
86    void SetForceMode(Bool_t b=kTRUE) { fForceMode=b; }
87    void SetTelescopeIdx(Int_t idx)   { fTelescopeIdx = idx; }
88    void SetArrayIdx(Int_t idx)       { fArrayIdx = idx; }
89
90    TString GetFullFileName() const;
91
92    Int_t  AddFile(const char *fname, Int_t entries=-1);
93    Bool_t Rewind();
94    UInt_t GetEntries() { return fNumTotalEvents/*/fInterleave*/; }
95
96    ClassDef(MCorsikaRead, 0)   // Task to read the raw data binary file
97};
98
99#endif
Note: See TracBrowser for help on using the repository browser.