Changeset 16428 for trunk/Mars/mcore


Ignore:
Timestamp:
05/29/13 14:04:26 (11 years ago)
Author:
tbretz
Message:
Added copy cnstructor to DrsCalibration; allow CorrectStep to be called without a map... I hope the compiler will realize and remove the conditional from the loops
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/DrsCalib.h

    r15278 r16428  
    220220    }
    221221
    222     static double FindStep(const size_t ch0, const float *vec, int16_t roi, const int16_t pos, const uint16_t *map)
     222    static double FindStep(const size_t ch0, const float *vec, int16_t roi, const int16_t pos, const uint16_t *map=NULL)
    223223    {
    224224        // We have about 1% of all cases which are not ahndled here,
     
    237237        {
    238238            const size_t hw = ch0+p;
    239             const size_t sw = map[hw]*roi + pos;
     239            const size_t sw = (map?map[hw]:hw)*roi + pos;
    240240
    241241            const double diff = vec[sw]-vec[sw-1];
     
    250250    }
    251251
    252     static void SubtractStep(const size_t ch0, const double avg, float *vec, int16_t roi, int32_t pos, const uint16_t *map)
     252    static void SubtractStep(const size_t ch0, const double avg, float *vec, int16_t roi, int32_t pos, const uint16_t *map=NULL)
    253253    {
    254254        if (pos==0 || pos>=roi)
     
    265265            {
    266266                const size_t hw = ch0+p;
    267                 const size_t sw = map[hw]*roi + j;
     267                const size_t sw = (map?map[hw]:hw)*roi + j;
    268268
    269269                vec[sw] -= sub;
     
    307307    static Step CorrectStep(float *vec, uint16_t nch, uint16_t roi,
    308308                            const int16_t *prev, const int16_t *start,
    309                             const int16_t offset, const uint16_t *map)
     309                            const int16_t offset, const uint16_t *map=NULL)
    310310    {
    311311
    312312        std::vector<Step> list;
     313        list.reserve(nch);
    313314
    314315        // Fill steps into array
     
    331332        }
    332333
    333         if (list.size()==0)
     334        if (list.empty())
    334335            return Step();
    335336
     
    522523    static void SlidingAverage(float *const vec, const uint32_t roi, const uint16_t w)
    523524    {
    524         if (w==0)
    525             return;
    526 
    527         if (w>roi)
     525        if (w==0 || w>roi)
    528526            return;
    529527
     
    954952
    955953    DrsCalibration() :
    956         fOffset  (1440*1024, 0),
    957         fGain    (1440*1024, 4096),
    958         fTrgOff  (1600*1024, 0),
     954        fOffset(1440*1024, 0),
     955        fGain(1440*1024, 4096),
     956        fTrgOff (1600*1024, 0),
    959957        fNumOffset(1),
    960958        fNumGain(2000),
     
    969967            fDateRunEnd[i] = "1970-01-01T00:00:00";
    970968        }
     969    }
     970
     971    DrsCalibration(const DrsCalibration &cpy) :
     972        fOffset(cpy.fOffset),
     973        fGain(cpy.fGain),
     974        fTrgOff(cpy.fTrgOff),
     975        fNumOffset(cpy.fNumOffset),
     976        fNumGain(cpy.fNumGain),
     977        fNumTrgOff(cpy.fNumTrgOff),
     978        fStep(cpy.fStep),
     979        fRoi(cpy.fRoi),
     980        fNumTm(cpy.fNumTm),
     981        fDateObs(cpy.fDateObs),
     982        fDateRunBeg(cpy.fDateRunBeg),
     983        fDateRunEnd(cpy.fDateRunEnd),
     984        fDateEnd(cpy.fDateEnd)
     985    {
    971986    }
    972987
Note: See TracChangeset for help on using the changeset viewer.