Changeset 11699 for trunk/FACT++


Ignore:
Timestamp:
07/29/11 14:31:14 (13 years ago)
Author:
tbretz
Message:
Added a new function GetSampleStats which directly writes into an array o floats.
File:
1 edited

Legend:

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

    r11687 r11699  
    33protected:
    44    uint64_t fNumEntries;
    5     uint64_t fNumCounter;
    65
    76    size_t fNumSamples;
     
    271270        vector<double>::iterator        ie = error.begin();
    272271
    273         int cnt = 0;
    274272        while (it!=fSum.end())
    275273        {
     
    281279            it++;
    282280            i2++;
    283             cnt++;
    284281        }
    285282
     
    293290
    294291        return make_pair(mean, error);
     292    }
     293
     294    void GetSampleStats(float *ptr, float scale) const
     295    {
     296        if (fNumEntries==0)
     297        {
     298            memset(ptr, 0, sizeof(float)*1024*1440);
     299            return;
     300        }
     301
     302        vector<int64_t>::const_iterator it = fSum.begin();
     303        vector<int64_t>::const_iterator i2 = fSum2.begin();
     304
     305        while (it!=fSum.end())
     306        {
     307            *ptr             = scale*double(*it)/fNumEntries;
     308            *(ptr+1024*1440) = scale*sqrt(double(*i2*int64_t(fNumEntries) - *it * *it))/fNumEntries;
     309
     310            ptr++;
     311            it++;
     312            i2++;
     313        }
    295314    }
    296315
Note: See TracChangeset for help on using the changeset viewer.