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