1 | #ifndef MRAWEVTPIXELITER_H
|
---|
2 | #define MRAWEVTPIXELITER_H
|
---|
3 |
|
---|
4 | #ifndef MAGIC_H
|
---|
5 | #include "../MBase/MAGIC.h"
|
---|
6 | #endif
|
---|
7 | #ifndef ROOT_TIterator
|
---|
8 | #include <TIterator.h>
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | class MRawEvtData;
|
---|
12 |
|
---|
13 | class MRawEvtPixelIter : public TIterator
|
---|
14 | {
|
---|
15 | private:
|
---|
16 | UShort_t fNumHiGainEntry; //! actual number of entry in fHiGainPixId
|
---|
17 | UShort_t fNumLoGainEntry; //! actual number of entry in fLoGainPixId
|
---|
18 |
|
---|
19 | UShort_t *fHiGainId; //! actual entry of fHiGainPixId
|
---|
20 | UShort_t *fLoGainId; //! actual entry of fLoGainPixId
|
---|
21 |
|
---|
22 | Byte_t *fHiGainPos; //! pointer to hi-gain samples of actual pixel
|
---|
23 | Byte_t *fLoGainPos; //! pointer to lo-gain samples of actual pixel
|
---|
24 |
|
---|
25 | MRawEvtData *fData; //! pointer to object which we are iterating
|
---|
26 |
|
---|
27 | public:
|
---|
28 | MRawEvtPixelIter(MRawEvtData *dat) : fData(dat)
|
---|
29 | {
|
---|
30 | //
|
---|
31 | // WARNING: The Iterator now points to the FIRST entry.
|
---|
32 | // This means that you have to use a do...while loop
|
---|
33 | // NOT a while() loop.
|
---|
34 | //
|
---|
35 | Reset();
|
---|
36 | }
|
---|
37 |
|
---|
38 | TObject *Next();
|
---|
39 |
|
---|
40 | UShort_t GetPixelId() const
|
---|
41 | {
|
---|
42 | //
|
---|
43 | // return Id of actual pixel
|
---|
44 | //
|
---|
45 | return *fHiGainId;
|
---|
46 | }
|
---|
47 |
|
---|
48 | Byte_t *GetHiGainFadcSamples() const
|
---|
49 | {
|
---|
50 | //
|
---|
51 | // return a pointer to the fadc samples of the hi gains
|
---|
52 | // WARNING: Don't forget to get the number of valid entries
|
---|
53 | // (GetNumSamples) to know how many entries of the array
|
---|
54 | // belong to the actual pixel
|
---|
55 | //
|
---|
56 | return fHiGainPos;
|
---|
57 | }
|
---|
58 |
|
---|
59 | Bool_t IsLoGain() const
|
---|
60 | {
|
---|
61 | //
|
---|
62 | // return kTRUE the lo gains exist for the actual pixel, else return kFALSE
|
---|
63 | //
|
---|
64 | return *fHiGainId==*fLoGainId;
|
---|
65 | }
|
---|
66 |
|
---|
67 | Byte_t *GetLoGainFadcSamples() const
|
---|
68 | {
|
---|
69 | //
|
---|
70 | // return a pointer to the fadc samples of the lo gains if they exist
|
---|
71 | // for the actual pixel, else return zero
|
---|
72 | //
|
---|
73 | return IsLoGain() ? fLoGainPos : NULL;
|
---|
74 | }
|
---|
75 |
|
---|
76 | void Reset();
|
---|
77 |
|
---|
78 | ClassDef(MRawEvtPixelIter, 1)
|
---|
79 | };
|
---|
80 |
|
---|
81 | #endif
|
---|