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 |
|
---|
14 | class MRawEvtData;
|
---|
15 |
|
---|
16 | class MRawEvtPixelIter : public TObject
|
---|
17 | {
|
---|
18 | private:
|
---|
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 |
|
---|
30 | UShort_t fNumEntry;
|
---|
31 |
|
---|
32 | UInt_t fNumBytesHiGain; //!
|
---|
33 | UInt_t fNumBytesLoGain; //!
|
---|
34 |
|
---|
35 | UShort_t fNumBytesPerSample; //!
|
---|
36 |
|
---|
37 | MRawEvtData *fData; //! pointer to object which we are iterating
|
---|
38 |
|
---|
39 | public:
|
---|
40 | MRawEvtPixelIter(MRawEvtData *dat);
|
---|
41 |
|
---|
42 | MRawEvtData *Next();
|
---|
43 |
|
---|
44 | Bool_t Jump(UShort_t id)
|
---|
45 | {
|
---|
46 | //
|
---|
47 | // Jump to the pixel with the pixel-id ID
|
---|
48 | // If it doesn't exist return FALSE
|
---|
49 | //
|
---|
50 | Reset();
|
---|
51 | while (Next())
|
---|
52 | if (GetPixelId() == id)
|
---|
53 | return kTRUE;
|
---|
54 | return kFALSE;
|
---|
55 | }
|
---|
56 |
|
---|
57 | UShort_t GetPixelId() const
|
---|
58 | {
|
---|
59 | //
|
---|
60 | // return Id of actual pixel
|
---|
61 | //
|
---|
62 | return *fHiGainId;
|
---|
63 | }
|
---|
64 |
|
---|
65 | UShort_t GetNumEntry() const
|
---|
66 | {
|
---|
67 | return fNumHiGainEntry;
|
---|
68 | }
|
---|
69 |
|
---|
70 | void *GetHiGainSamples() const
|
---|
71 | {
|
---|
72 | //
|
---|
73 | // return a pointer to the fadc samples of the hi gains
|
---|
74 | // WARNING: Don't forget to get the number of valid entries
|
---|
75 | // (GetNumSamples) to know how many entries of the array
|
---|
76 | // belong to the actual pixel
|
---|
77 | //
|
---|
78 | return fHiGainPos;
|
---|
79 | }
|
---|
80 |
|
---|
81 | UInt_t GetNumBytes() const { return fNumBytesHiGain+fNumBytesLoGain; }
|
---|
82 |
|
---|
83 | Bool_t HasLoGain() const { return fNumBytesLoGain>0; }
|
---|
84 | Bool_t IsABFlagValid() const { return fABFlags ? kTRUE : kFALSE; }
|
---|
85 | Bool_t HasABFlag() const
|
---|
86 | {
|
---|
87 | //
|
---|
88 | // return kTRUE the lo gains exist for the actual pixel, else return kFALSE
|
---|
89 | //
|
---|
90 | return TESTBIT(GetABFlag(), GetPixelId()%8);
|
---|
91 | }
|
---|
92 | Byte_t GetABFlag() const
|
---|
93 | {
|
---|
94 | //
|
---|
95 | // return kTRUE the lo gains exist for the actual pixel, else return kFALSE
|
---|
96 | //
|
---|
97 | return fABFlags ? fABFlags[GetPixelId()/8] : 0;
|
---|
98 | }
|
---|
99 |
|
---|
100 | void *GetLoGainSamples() const
|
---|
101 | {
|
---|
102 | //
|
---|
103 | // return a pointer to the fadc samples of the lo gains if they exist
|
---|
104 | // for the actual pixel, else return zero
|
---|
105 | //
|
---|
106 | return HasLoGain() ? fLoGainPos : NULL;
|
---|
107 | }
|
---|
108 |
|
---|
109 | void Reset();
|
---|
110 |
|
---|
111 | void Draw(Option_t *t="GRAPH");
|
---|
112 |
|
---|
113 | ClassDef(MRawEvtPixelIter, 0) // iterates over all pixels of one MRawEvtData object
|
---|
114 | };
|
---|
115 |
|
---|
116 | #endif
|
---|