Changeset 8571 for trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
- Timestamp:
- 06/17/07 15:51:55 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
r8364 r8571 63 63 MRawEvtPixelIter::MRawEvtPixelIter(MRawEvtData *dat) : fABFlags(0), fData(dat) 64 64 { 65 fNum HiGainSamples = dat->GetNumHiGainSamples();66 fNum LoGainSamples = dat->GetNumLoGainSamples();65 fNumBytesHiGain = dat->GetNumHiGainSamples()*dat->GetNumBytesPerSample(); 66 fNumBytesLoGain = dat->GetNumLoGainSamples()*dat->GetNumBytesPerSample(); 67 67 68 68 Reset(); … … 91 91 fNumHiGainEntry++; 92 92 fHiGainId++; 93 fHiGainPos += fNum HiGainSamples;93 fHiGainPos += fNumBytesHiGain; 94 94 95 95 fNumLoGainEntry++; 96 96 fLoGainId++; 97 fLoGainPos += fNum LoGainSamples;97 fLoGainPos += fNumBytesLoGain; 98 98 } 99 99 else … … 102 102 fLoGainId = ++fHiGainId; 103 103 104 fHiGainPos += fNum HiGainSamples+fNumLoGainSamples;105 fLoGainPos = fHiGainPos + fNum HiGainSamples;104 fHiGainPos += fNumBytesHiGain+fNumBytesLoGain; 105 fLoGainPos = fHiGainPos + fNumBytesHiGain; 106 106 } 107 107 … … 137 137 { 138 138 fLoGainId = fData->fLoGainPixId->GetArray(); 139 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-fNum HiGainSamples;140 fLoGainPos = fData->fLoGainFadcSamples->GetArray()-fNum LoGainSamples;139 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-fNumBytesHiGain; 140 fLoGainPos = fData->fLoGainFadcSamples->GetArray()-fNumBytesLoGain; 141 141 } 142 142 else 143 143 { 144 144 fLoGainId = fHiGainId; 145 fLoGainPos = fHiGainPos+fNum HiGainSamples;146 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-(fNum HiGainSamples+fNumLoGainSamples);145 fLoGainPos = fHiGainPos+fNumBytesHiGain; 146 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-(fNumBytesHiGain+fNumBytesLoGain); 147 147 } 148 148 … … 163 163 fData->Draw(Form("%s%d", t, *fHiGainId)); 164 164 } 165 166 /*167 // --------------------------------------------------------------------------168 //169 // Returns the index of the FADC slice the maximum signal in. If the highest170 // slices have the same value the first one is returned.171 //172 Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample(const Byte_t hifirst, const Byte_t hilast) const173 {174 const Int_t l = hilast>fNumHiGainSamples ? fNumHiGainSamples : hilast+1;175 176 Byte_t *beg = fHiGainPos+hifirst;177 178 Byte_t *ptr = beg+1;179 Byte_t *max = beg;180 const Byte_t *end = fHiGainPos + l;181 182 do if (*ptr>*max) max = ptr;183 while (++ptr != end);184 185 return max-fHiGainPos;186 }187 188 // --------------------------------------------------------------------------189 //190 // Returns the index of the FADC slice the maximum signal in. If no lo-gains191 // are available -1 is returned. If the highest slices have the same value192 // the first one is returned.193 //194 Short_t MRawEvtPixelIter::GetIdxMaxLoGainSample(const Byte_t lofirst, const Byte_t lolast) const195 {196 if (!HasLoGain())197 return -1; // means: not found198 199 const Int_t l = lolast>fNumLoGainSamples ? fNumLoGainSamples : lolast+1;200 201 Byte_t *beg = fLoGainPos+lofirst;202 203 Byte_t *ptr = beg+1;204 Byte_t *max = beg;205 const Byte_t *end = fLoGainPos + l;206 207 do if (*ptr>*max) max = ptr;208 while (++ptr != end);209 210 return max-fLoGainPos;211 }212 213 // --------------------------------------------------------------------------214 //215 // Returns the maximum signal of all sliced in the hi gain samples216 //217 Byte_t MRawEvtPixelIter::GetMaxHiGainSample(const Byte_t hifirst, const Byte_t hilast) const218 {219 Byte_t max = 0;220 221 const Int_t f = hifirst;222 const Int_t l = hilast>fNumHiGainSamples ? fNumHiGainSamples : hilast+1;223 224 for (int i=f; i<l; i++)225 if (fHiGainPos[i]>max)226 max = fHiGainPos[i];227 228 return max;229 }230 231 // --------------------------------------------------------------------------232 //233 // returns the sum of all hi gain fadc samples of the actual pixel234 //235 ULong_t MRawEvtPixelIter::GetSumHiGainSamples() const236 {237 //238 // return the sum of the hi gain samples of the present pixel239 //240 Byte_t *ptr = fHiGainPos;241 const Byte_t *end = fHiGainPos + fNumHiGainSamples;242 243 ULong_t sum=0;244 245 do sum += *ptr++;246 while (ptr != end);247 248 return sum;249 }250 251 // --------------------------------------------------------------------------252 //253 // returns the sum of squares of all hi gain fadc sample of the actual pixel254 //255 ULong_t MRawEvtPixelIter::GetSumSqrHiGainSamples() const256 {257 //258 // return the sum of the squares of the hi gain samples of the present pixel259 //260 Byte_t *ptr = fHiGainPos;261 const Byte_t *end = fHiGainPos + fNumHiGainSamples;262 263 ULong_t sum=0;264 265 do sum += (*ptr)*(*ptr);266 while (++ptr != end);267 268 return sum;269 }270 271 // --------------------------------------------------------------------------272 //273 // Returns the variance (sigma^2) of the HiGainSamples274 //275 Float_t MRawEvtPixelIter::GetVarHiGainSamples() const276 {277 Byte_t *ptr = fHiGainPos;278 const Byte_t *end = fHiGainPos + fNumHiGainSamples;279 280 ULong_t sum=0;281 ULong_t sqsum=0;282 283 do {284 sum += *ptr;285 sqsum += (*ptr)*(*ptr);286 } while (++ptr != end);287 288 return (sqsum-(Float_t)sum*sum/fNumHiGainSamples)/(fNumHiGainSamples-1);289 }290 291 // --------------------------------------------------------------------------292 //293 // Returns the index of the maximum FADC slice from high gain at first. If294 // high gain is saturated it returns the low gain one.295 // If no lo-gains are existing and the hi-gains have saturating values296 // a negative value (-1) is returned.297 //298 Short_t MRawEvtPixelIter::GetIdxMaxHiLoGainSample() const299 {300 Byte_t max = 0;301 Char_t maxi = 0;302 303 for (int i=fNumHiGainSamples-1; i>=0; i--)304 if (fHiGainPos[i]>max)305 {306 max = fHiGainPos[i];307 maxi = i;308 }309 310 return max<0xff ? maxi : GetIdxMaxLoGainSample();311 }312 313 // --------------------------------------------------------------------------314 //315 // Returns the maximum signal of all sliced in the hi gain samples316 //317 Byte_t MRawEvtPixelIter::GetMaxLoGainSample() const318 {319 Byte_t max = 0;320 321 for (int i=fNumLoGainSamples-1; i>=0; i--)322 if (fLoGainPos[i]>max)323 max = fLoGainPos[i];324 325 return max;326 }327 328 // --------------------------------------------------------------------------329 //330 // returns the sum of all lo gain fadc samples of the actual pixel.331 // if no lo gain information is available 0 is returned.332 //333 ULong_t MRawEvtPixelIter::GetSumLoGainSamples() const334 {335 //336 // return the sum of the lo gain samples of the present pixel337 //338 if (!HasLoGain())339 return 0;340 341 Byte_t *ptr = fLoGainPos;342 const Byte_t *end = fLoGainPos + fNumLoGainSamples;343 344 ULong_t sum=0;345 346 do sum += *ptr++;347 while (ptr != end);348 349 return sum;350 }351 352 // --------------------------------------------------------------------------353 //354 // returns the sum of squares of all hi gain fadc sample of the actual pixel355 //356 ULong_t MRawEvtPixelIter::GetSumSqrLoGainSamples() const357 {358 //359 // return the sum of the lo gain samples squares of the present pixel360 //361 if (!HasLoGain())362 return 0;363 364 Byte_t *ptr = fLoGainPos;365 const Byte_t *end = fLoGainPos + fNumLoGainSamples;366 367 ULong_t sum=0;368 369 do sum += (*ptr)*(*ptr);370 while (++ptr != end);371 372 return sum;373 }374 */
Note:
See TracChangeset
for help on using the changeset viewer.