Changeset 8346 for trunk/MagicSoft/Mars/mraw
- Timestamp:
- 03/01/07 21:49:15 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
r6253 r8346 71 71 // -------------------------------------------------------------------------- 72 72 // 73 // return kTRUE the lo gains exist for the actual pixel, else return kFALSE74 //75 Bool_t MRawEvtPixelIter::HasLoGain() const76 {77 // We have no lo-gain at all78 if (!fLoGainId)79 return kFALSE;80 81 // This is to make the first call of this function in Next()82 // work properly! NEVER call this function before Next()83 if (fNumLoGainEntry==0)84 return kTRUE;85 86 if (fNumLoGainEntry>fData->fLoGainPixId->GetSize())87 return kFALSE;88 89 Bool_t rc = *fHiGainId!=*fLoGainId;90 91 if (rc)92 return kFALSE;93 94 return kTRUE;95 }96 97 // --------------------------------------------------------------------------98 //99 73 // It steps to the next pixel. If there is no next pixel NULL is returned. 100 74 // If a next pixel where found, a pointer to the primary given (constructor) … … 110 84 111 85 // 112 // if we are already at the last entry there is no 'next' entry anymore 113 // 114 if (HasLoGain()) 86 // For old MC data which stores hi- and lo-gain in two arrays 87 // we have to use the old algorithm 88 // 89 if (fData->fLoGainPixId->GetSize()) 115 90 { 116 // 117 // if higainpixid and logainpixid of the actual pixel are 118 // identical then we have to move the pointer to the next 119 // entry in the lo gains 120 // 91 fNumHiGainEntry++; 92 fHiGainId++; 93 fHiGainPos += fNumHiGainSamples; 94 121 95 fNumLoGainEntry++; 122 96 fLoGainId++; 123 97 fLoGainPos += fNumLoGainSamples; 124 98 } 125 126 // 127 // here we have to move the pointer to the next entry in the hi gains 128 // 129 fNumHiGainEntry++; 130 fHiGainId++; 131 fHiGainPos += fNumHiGainSamples; 99 else 100 { 101 fNumLoGainEntry = ++fNumHiGainEntry; 102 fLoGainId = ++fHiGainId; 103 104 fHiGainPos += fNumHiGainSamples+fNumLoGainSamples; 105 fLoGainPos = fHiGainPos + fNumHiGainSamples; 106 } 132 107 133 108 // … … 152 127 // set pointer to first entry of arrays 153 128 // 154 fHiGainId = fData->fHiGainPixId->GetArray()-1; 155 fLoGainId = fData->fLoGainPixId->GetArray(); 156 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-fNumHiGainSamples; 157 fLoGainPos = fData->fLoGainFadcSamples->GetArray()-fNumLoGainSamples; 158 fABFlags = fData->fABFlags->GetSize()==0 ? 0 : fData->fABFlags->GetArray(); 129 fHiGainId = fData->fHiGainPixId->GetArray()-1; 130 fABFlags = fData->fABFlags->GetSize()==0 ? 0 : fData->fABFlags->GetArray(); 131 132 // 133 // For old MC data which stores hi- and lo-gain in two arrays 134 // we have to use the old algorithm 135 // 136 if (fData->fLoGainPixId->GetSize()) 137 { 138 fLoGainId = fData->fLoGainPixId->GetArray(); 139 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-fNumHiGainSamples; 140 fLoGainPos = fData->fLoGainFadcSamples->GetArray()-fNumLoGainSamples; 141 } 142 else 143 { 144 fLoGainId = fHiGainId; 145 fLoGainPos = fHiGainPos+fNumHiGainSamples; 146 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-(fNumHiGainSamples+fNumLoGainSamples); 147 } 159 148 160 149 // … … 175 164 } 176 165 166 // -------------------------------------------------------------------------- 167 // 168 // Returns the index of the FADC slice the maximum signal in. If the highest 169 // slices have the same value the last one is returned. 170 // 171 Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample(const Byte_t hifirst, const Byte_t hilast) const 172 { 173 const Int_t l = hilast>fNumHiGainSamples ? fNumHiGainSamples : hilast+1; 174 175 Byte_t *beg = fHiGainPos+hifirst; 176 177 Byte_t *ptr = beg+1; 178 Byte_t *max = beg; 179 const Byte_t *end = fHiGainPos + l; 180 181 do if (*ptr>*max) max = ptr; 182 while (++ptr != end); 183 184 return max-fHiGainPos; 185 } 186 187 // -------------------------------------------------------------------------- 188 // 189 // Returns the index of the FADC slice the maximum signal in. If no lo-gains 190 // are available -1 is returned. If the highest slices have the same value the 191 // last one is returned. 192 // 193 Short_t MRawEvtPixelIter::GetIdxMaxLoGainSample(const Byte_t lofirst, const Byte_t lolast) const 194 { 195 if (!HasLoGain()) 196 return -1; // means: not found 197 198 const Int_t l = lolast>fNumLoGainSamples ? fNumLoGainSamples : lolast+1; 199 200 Byte_t *beg = fLoGainPos+lofirst; 201 202 Byte_t *ptr = beg+1; 203 Byte_t *max = beg; 204 const Byte_t *end = fLoGainPos + l; 205 206 do if (*ptr>*max) max = ptr; 207 while (++ptr != end); 208 209 return max-fLoGainPos; 210 } 211 212 // -------------------------------------------------------------------------- 213 // 214 // Returns the maximum signal of all sliced in the hi gain samples 215 // 216 Byte_t MRawEvtPixelIter::GetMaxHiGainSample(const Byte_t hifirst, const Byte_t hilast) const 217 { 218 Byte_t max = 0; 219 220 const Int_t f = hifirst; 221 const Int_t l = hilast>fNumHiGainSamples ? fNumHiGainSamples : hilast+1; 222 223 for (int i=f; i<l; i++) 224 if (fHiGainPos[i]>max) 225 max = fHiGainPos[i]; 226 227 return max; 228 } 229 230 /* 177 231 // -------------------------------------------------------------------------- 178 232 // … … 233 287 234 288 return (sqsum-(Float_t)sum*sum/fNumHiGainSamples)/(fNumHiGainSamples-1); 235 }236 237 // --------------------------------------------------------------------------238 //239 // Returns the index of the FADC slice the maximum signal in. If the highest240 // slices have the same value the last one is returned.241 //242 Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample() const243 {244 Byte_t *ptr = fHiGainPos+1;245 Byte_t *max = fHiGainPos;246 const Byte_t *end = fHiGainPos + fNumHiGainSamples;247 248 do if (*ptr>*max) max = ptr;249 while (++ptr != end);250 251 return max-fHiGainPos;252 }253 254 // --------------------------------------------------------------------------255 //256 // Returns the index of the FADC slice the maximum signal in. If no lo-gains257 // are available -1 is returned. If the highest slices have the same value the258 // last one is returned.259 //260 Short_t MRawEvtPixelIter::GetIdxMaxLoGainSample(const Byte_t lofirst) const261 {262 if (!HasLoGain())263 return -1; // means: not found264 265 Byte_t *ptr = fLoGainPos+lofirst+1;266 Byte_t *max = fLoGainPos+lofirst;267 const Byte_t *end = fLoGainPos + fNumLoGainSamples;268 269 do if (*ptr>*max) max = ptr;270 while (++ptr != end);271 272 return max-fLoGainPos;273 289 } 274 290 … … 299 315 // Returns the maximum signal of all sliced in the hi gain samples 300 316 // 301 Byte_t MRawEvtPixelIter::GetMaxHiGainSample() const302 {303 Byte_t max = 0;304 305 for (int i=0; i<fNumHiGainSamples; i++)306 if (fHiGainPos[i]>max)307 max = fHiGainPos[i];308 309 return max;310 }311 312 // --------------------------------------------------------------------------313 //314 // Returns the maximum signal of all sliced in the hi gain samples315 //316 317 Byte_t MRawEvtPixelIter::GetMaxLoGainSample() const 317 318 { … … 371 372 return sum; 372 373 } 374 */ -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
r6253 r8346 74 74 // belong to the actual pixel 75 75 // 76 // 77 // Use is deprecated! 78 // 76 79 return fHiGainPos; 77 80 } 78 81 79 Byte_t GetNumHiGainSamples() const { return fNumHiGainSamples ; } 80 Byte_t GetNumLoGainSamples() const { return fNumLoGainSamples ; } 82 Byte_t *GetSamples() const 83 { 84 // 85 // return a pointer to the fadc samples of the hi gains 86 // WARNING: Don't forget to get the number of valid entries 87 // (GetNumSamples) to know how many entries of the array 88 // belong to the actual pixel 89 // 90 return fHiGainPos; 91 } 81 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 /* 82 102 ULong_t GetSumHiGainSamples() const; 83 103 ULong_t GetSumSqrHiGainSamples() const; 84 104 Float_t GetVarHiGainSamples() const; 85 105 86 Byte_t GetMaxHiGainSample() const;87 106 Byte_t GetMaxLoGainSample() const; 88 Byte_t GetIdxMaxHiGainSample() const;89 Short_t GetIdxMaxLoGainSample(const Byte_t lofirst=0) const;90 107 Short_t GetIdxMaxHiLoGainSample() const; 91 108 92 Bool_t HasLoGain() const; 109 ULong_t GetSumLoGainSamples() const; 110 ULong_t GetSumSqrLoGainSamples() const; 111 */ 112 Bool_t HasLoGain() const { return fNumLoGainSamples>0; } 93 113 Bool_t IsABFlagValid() const { return fABFlags ? kTRUE : kFALSE; } 94 114 Bool_t HasABFlag() const … … 116 136 } 117 137 118 ULong_t GetSumLoGainSamples() const;119 ULong_t GetSumSqrLoGainSamples() const;120 121 138 void Reset(); 122 139
Note:
See TracChangeset
for help on using the changeset viewer.