source: branches/Corsika7500Compatibility/mraw/MRawEvtPixelIter.h@ 19536

Last change on this file since 19536 was 11488, checked in by tbretz, 13 years ago
Added iterator to start cell.
File size: 3.1 KB
Line 
1#ifndef MARS_MRawEvtPixelIter
2#define MARS_MRawEvtPixelIter
3///////////////////////////////////////////////////////////////////////////////
4//
5// MRawEvtPixelIter
6//
7// class to iterate over all pixels of one event.
8//
9///////////////////////////////////////////////////////////////////////////////
10#ifndef MARS_MAGIC
11#include "MAGIC.h"
12#endif
13
14class MRawEvtData;
15
16class MRawEvtPixelIter : public TObject
17{
18private:
19 UShort_t fNumHiGainEntry; //! actual number of entry in fHiGainPixId
20 UShort_t fNumLoGainEntry; //! actual number of entry in fLoGainPixId
21
22 UShort_t *fHiGainId; //! actual entry of fHiGainPixId
23 UShort_t *fLoGainId; //! actual entry of fLoGainPixId
24
25 Byte_t *fHiGainPos; //! pointer to hi-gain samples of actual pixel
26 Byte_t *fLoGainPos; //! pointer to lo-gain samples of actual pixel
27
28 Byte_t *fABFlags; //! pointer to AB flags
29 UShort_t *fStartCell; //! pointer to AB flags
30
31 UShort_t fNumEntry;
32
33 UInt_t fNumBytesHiGain; //!
34 UInt_t fNumBytesLoGain; //!
35
36 UShort_t fNumBytesPerSample; //!
37
38 MRawEvtData *fData; //! pointer to object which we are iterating
39
40public:
41 MRawEvtPixelIter(MRawEvtData *dat);
42
43 MRawEvtData *Next();
44
45 Bool_t Jump(UShort_t id)
46 {
47 //
48 // Jump to the pixel with the pixel-id ID
49 // If it doesn't exist return FALSE
50 //
51 Reset();
52 while (Next())
53 if (GetPixelId() == id)
54 return kTRUE;
55 return kFALSE;
56 }
57
58 UShort_t GetPixelId() const
59 {
60 //
61 // return Id of actual pixel
62 //
63 return *fHiGainId;
64 }
65
66 UShort_t GetNumEntry() const
67 {
68 return fNumHiGainEntry;
69 }
70
71 void *GetHiGainSamples() const
72 {
73 //
74 // return a pointer to the fadc samples of the hi gains
75 // WARNING: Don't forget to get the number of valid entries
76 // (GetNumSamples) to know how many entries of the array
77 // belong to the actual pixel
78 //
79 return fHiGainPos;
80 }
81
82 UInt_t GetNumBytes() const { return fNumBytesHiGain+fNumBytesLoGain; }
83
84 Bool_t HasLoGain() const { return fNumBytesLoGain>0; }
85 Bool_t IsABFlagValid() const { return fABFlags ? kTRUE : kFALSE; }
86 Bool_t HasABFlag() const
87 {
88 //
89 // return kTRUE the lo gains exist for the actual pixel, else return kFALSE
90 //
91 return TESTBIT(GetABFlag(), GetPixelId()%8);
92 }
93 Byte_t GetABFlag() const
94 {
95 //
96 // return kTRUE the lo gains exist for the actual pixel, else return kFALSE
97 //
98 return fABFlags ? fABFlags[GetPixelId()/8] : 0;
99 }
100
101 void *GetLoGainSamples() const
102 {
103 //
104 // return a pointer to the fadc samples of the lo gains if they exist
105 // for the actual pixel, else return zero
106 //
107 return HasLoGain() ? fLoGainPos : NULL;
108 }
109
110 UShort_t GetStartCell() const
111 {
112 return fStartCell ? *fStartCell : 0;
113 }
114
115 void Reset();
116
117 void Draw(Option_t *t="GRAPH");
118
119 ClassDef(MRawEvtPixelIter, 0) // iterates over all pixels of one MRawEvtData object
120};
121
122#endif
Note: See TracBrowser for help on using the repository browser.