Changeset 11754


Ignore:
Timestamp:
08/03/11 15:07:06 (14 years ago)
Author:
tbretz
Message:
Added GetPixelStats and changed type of scalerel from uint32 to uint64
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DrsCalib.h

    r11745 r11754  
    205205                      const int32_t *offset, const uint32_t scaleabs,
    206206                      const int64_t *gain,   const uint64_t scalegain,
    207                       const int64_t *trgoff, const uint32_t scalerel)
     207                      const int64_t *trgoff, const uint64_t scalerel)
    208208    {
    209209        for (size_t ch=0; ch<1440; ch++)
     
    312312            it++;
    313313            i2++;
     314        }
     315    }
     316
     317    static void GetPixelStats(float *ptr, const float *data, uint16_t roi)
     318    {
     319        for (int i=0; i<1440; i++)
     320        {
     321            const float *vec = data+i*roi;
     322
     323            double max = vec[0];
     324            int    pos = 0;
     325            double sum  = vec[0];
     326            double sum2 = vec[0]*vec[0];
     327            for (int j=1; j<roi; j++)
     328            {
     329                sum  += vec[j];
     330                sum2 += vec[j]*vec[j];
     331
     332                if (vec[j]>max)
     333                {
     334                    max = vec[j];
     335                    pos = j;
     336                }
     337            }
     338            sum  /= roi;
     339            sum2 /= roi;
     340
     341            *(ptr+0*1440+i) = sum;
     342            *(ptr+1*1440+i) = sqrt(sum2 - sum * sum);
     343            *(ptr+2*1440+i) = max;
     344            *(ptr+3*1440+i) = pos;
    314345        }
    315346    }
Note: See TracChangeset for help on using the changeset viewer.