| 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 | Byte_t fNumHiGainSamples; //!
|
|---|
| 33 | Byte_t fNumLoGainSamples; //!
|
|---|
| 34 |
|
|---|
| 35 | MRawEvtData *fData; //! pointer to object which we are iterating
|
|---|
| 36 |
|
|---|
| 37 | public:
|
|---|
| 38 | MRawEvtPixelIter(MRawEvtData *dat);
|
|---|
| 39 |
|
|---|
| 40 | MRawEvtData *Next();
|
|---|
| 41 |
|
|---|
| 42 | Bool_t Jump(UShort_t id)
|
|---|
| 43 | {
|
|---|
| 44 | //
|
|---|
| 45 | // Jump to the pixel with the pixel-id ID
|
|---|
| 46 | // If it doesn't exist return FALSE
|
|---|
| 47 | //
|
|---|
| 48 | Reset();
|
|---|
| 49 | while (Next())
|
|---|
| 50 | if (GetPixelId() == id)
|
|---|
| 51 | return kTRUE;
|
|---|
| 52 | return kFALSE;
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | UShort_t GetPixelId() const
|
|---|
| 56 | {
|
|---|
| 57 | //
|
|---|
| 58 | // return Id of actual pixel
|
|---|
| 59 | //
|
|---|
| 60 | return *fHiGainId;
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | UShort_t GetNumEntry() const
|
|---|
| 64 | {
|
|---|
| 65 | return fNumHiGainEntry;
|
|---|
| 66 | }
|
|---|
| 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 | /*
|
|---|
| 80 | This function is dangerous as long as MC with split hi-/lo-gain are used
|
|---|
| 81 | Byte_t *GetSamples() const
|
|---|
| 82 | {
|
|---|
| 83 | //
|
|---|
| 84 | // return a pointer to the fadc samples of the hi gains
|
|---|
| 85 | // WARNING: Don't forget to get the number of valid entries
|
|---|
| 86 | // (GetNumSamples) to know how many entries of the array
|
|---|
| 87 | // belong to the actual pixel
|
|---|
| 88 | //
|
|---|
| 89 | return fHiGainPos;
|
|---|
| 90 | }
|
|---|
| 91 | */
|
|---|
| 92 |
|
|---|
| 93 | // Byte_t GetNumHiGainSamples() const { return fNumHiGainSamples ; }// Use is deprecated!
|
|---|
| 94 | // Byte_t GetNumLoGainSamples() const { return fNumLoGainSamples ; }// Use is deprecated!
|
|---|
| 95 | Byte_t GetNumSamples() const { return fNumHiGainSamples+fNumLoGainSamples; }
|
|---|
| 96 |
|
|---|
| 97 | // Byte_t GetIdxMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
|
|---|
| 98 | // Short_t GetIdxMaxLoGainSample(const Byte_t lofirst=0, const Byte_t lolast=0xff) const;
|
|---|
| 99 |
|
|---|
| 100 | // Byte_t GetMaxHiGainSample(const Byte_t hifirst=0, const Byte_t hilast=0xff) const;
|
|---|
| 101 |
|
|---|
| 102 | // ULong_t GetSumHiGainSamples() const;
|
|---|
| 103 | // ULong_t GetSumSqrHiGainSamples() const;
|
|---|
| 104 | // Float_t GetVarHiGainSamples() const;
|
|---|
| 105 |
|
|---|
| 106 | // Byte_t GetMaxLoGainSample() const;
|
|---|
| 107 | // Short_t GetIdxMaxHiLoGainSample() const;
|
|---|
| 108 |
|
|---|
| 109 | // ULong_t GetSumLoGainSamples() const;
|
|---|
| 110 | // ULong_t GetSumSqrLoGainSamples() const;
|
|---|
| 111 |
|
|---|
| 112 | Bool_t HasLoGain() const { return fNumLoGainSamples>0; }
|
|---|
| 113 | Bool_t IsABFlagValid() const { return fABFlags ? kTRUE : kFALSE; }
|
|---|
| 114 | Bool_t HasABFlag() const
|
|---|
| 115 | {
|
|---|
| 116 | //
|
|---|
| 117 | // return kTRUE the lo gains exist for the actual pixel, else return kFALSE
|
|---|
| 118 | //
|
|---|
| 119 | return TESTBIT(GetABFlag(), GetPixelId()%8);
|
|---|
| 120 | }
|
|---|
| 121 | Byte_t GetABFlag() const
|
|---|
| 122 | {
|
|---|
| 123 | //
|
|---|
| 124 | // return kTRUE the lo gains exist for the actual pixel, else return kFALSE
|
|---|
| 125 | //
|
|---|
| 126 | return fABFlags ? fABFlags[GetPixelId()/8] : 0;
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 | Byte_t *GetLoGainSamples() const
|
|---|
| 130 | {
|
|---|
| 131 | //
|
|---|
| 132 | // return a pointer to the fadc samples of the lo gains if they exist
|
|---|
| 133 | // for the actual pixel, else return zero
|
|---|
| 134 | //
|
|---|
| 135 | return HasLoGain() ? fLoGainPos : NULL;
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | void Reset();
|
|---|
| 139 |
|
|---|
| 140 | void Draw(Option_t *t="GRAPH");
|
|---|
| 141 |
|
|---|
| 142 | ClassDef(MRawEvtPixelIter, 0) // iterates over all pixels of one MRawEvtData object
|
|---|
| 143 | };
|
|---|
| 144 |
|
|---|
| 145 | #endif
|
|---|