Ignore:
Timestamp:
05/21/14 16:47:27 (10 years ago)
Author:
tbretz
Message:
Modified the interface to allow to process external daata as well.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/msignal/MFilterData.cc

    r17836 r17872  
    5454    fName  = name  ? name  : "MFilterData";
    5555    fTitle = title ? title : "Class to filter the data";
     56
     57    // Default weights
     58    fWeights.resize(14);
     59    fWeights[ 0] = -0.217305;
     60    fWeights[ 1] = -0.213277;
     61    fWeights[ 2] = -0.193537;
     62    fWeights[ 3] = -0.181686;
     63    fWeights[ 4] = -0.15356;
     64    fWeights[ 5] = -0.129926;
     65    fWeights[ 6] = -0.0792033;
     66    fWeights[ 7] = -0.0219311;
     67    fWeights[ 8] =  0.0550301;
     68    fWeights[ 9] =  0.127364;
     69    fWeights[10] =  0.206711;
     70    fWeights[11] =  0.246864;
     71    fWeights[12] =  0.271012;
     72    fWeights[13] =  0.283444;
    5673}
    5774
     
    7188        return kFALSE;
    7289
    73     if (fWeights.size()==0)
    74     {
    75         fWeights.resize(14);
    76         fWeights[ 0] = -0.217305;
    77         fWeights[ 1] = -0.213277;
    78         fWeights[ 2] = -0.193537;
    79         fWeights[ 3] = -0.181686;
    80         fWeights[ 4] = -0.15356;
    81         fWeights[ 5] = -0.129926;
    82         fWeights[ 6] = -0.0792033;
    83         fWeights[ 7] = -0.0219311;
    84         fWeights[ 8] =  0.0550301;
    85         fWeights[ 9] =  0.127364;
    86         fWeights[10] =  0.206711;
    87         fWeights[11] =  0.246864;
    88         fWeights[12] =  0.271012;
    89         fWeights[13] =  0.283444;
    90     }
    91 
    9290    return kTRUE;
    9391}
    9492
    95 // --------------------------------------------------------------------------
    96 //
    97 //
    98 Int_t MFilterData::Process()
     93void MFilterData::Filter(UShort_t npix, UShort_t nroi, const Float_t *beg, Float_t *out) const
    9994{
    100     // FIXME: Implement an alternative: the simple filter
    101     // (p[10]+p[11]+p[12]) - (p[0]+p[1]+p[2])
    102     // Store first sum in ring-buffer
    103 
    104     const uint16_t nroi = fSignalIn->GetNumSamples();
    105     const uint16_t npix = fSignalIn->GetNumPixels();
    106     const uint16_t nw   = fWeights.size();
    107     //const uint16_t last = nroi-1;
    108 
    109     if (fSignalIn!=fSignalOut)
    110         fSignalOut->InitSamples(nroi); // contains setting to 0
     95    const uint16_t nw = fWeights.size();
    11196
    11297    const float *begw = fWeights.data();
    11398    const float *endw = fWeights.data()+nw;
    11499
    115     const Float_t *beg = fSignalIn->GetSamples();
    116 
    117     Float_t *out = fSignalOut->GetSamples();
    118100    for (const Float_t *in=beg; in<beg+nroi*npix; )
    119101    {
     
    146128        // }
    147129    }
     130}
     131
     132// --------------------------------------------------------------------------
     133//
     134//
     135Int_t MFilterData::Process()
     136{
     137    // FIXME: Implement an alternative: the simple filter
     138    // (p[10]+p[11]+p[12]) - (p[0]+p[1]+p[2])
     139    // Store first sum in ring-buffer
     140
     141    const uint16_t nroi = fSignalIn->GetNumSamples();
     142    const uint16_t npix = fSignalIn->GetNumPixels();
     143
     144    if (fSignalIn!=fSignalOut)
     145        fSignalOut->InitSamples(nroi); // contains setting to 0
     146
     147    Filter(npix, nroi, fSignalIn->GetSamples(), fSignalOut->GetSamples());
    148148
    149149    return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.