Ignore:
Timestamp:
06/16/07 23:10:47 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc

    r8502 r8565  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.5 2007-05-14 09:53:15 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.6 2007-06-16 22:05:27 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    129129}
    130130
     131void MPedestalSubtract::Memcpy(void *dest, Int_t offset, void *src, Int_t cnt) const
     132{
     133        memcpy(dest+offset, src, cnt);
     134/*
     135    if (fRawEvt->GetNumBytesPerSample()==2)
     136        memcpy((UShort_t*)dest+offset, src, cnt*2);
     137    else
     138    {
     139        const Byte_t *b = (Byte_t*)src+offset;
     140        for (USample_t *ptr=(USample_t*)dest; ptr<(USample_t*)dest+cnt; ptr++)
     141            *ptr = *b++;
     142    }
     143 */
     144}
     145
    131146// --------------------------------------------------------------------------
    132147//
     
    137152    const Int_t numh = fRawEvt->GetNumHiGainSamples();
    138153    const Int_t numl = fRawEvt->GetNumLoGainSamples();
     154
     155    const UInt_t scale = fRawEvt->GetScale();
    139156
    140157    // initialize fSignal
     
    154171        }
    155172        // Get pointer were to store merged raw data
    156         Byte_t *sample = fSignal->GetSamplesRaw(pixidx);
     173        USample_t *sample = fSignal->GetSamplesRaw(pixidx);
    157174
    158175        // copy hi- and lo-gains samples together
    159         memcpy(sample,      pixel.GetHiGainSamples(), numh);
    160         memcpy(sample+numh, pixel.GetLoGainSamples(), numl);
     176        Memcpy(sample, 0,    pixel.GetHiGainSamples(), numh);
     177        Memcpy(sample, numh, pixel.GetLoGainSamples(), numl);
    161178
    162179        // start of destination array, end of hi-gain destination array
     
    165182        Float_t *end = beg + fSignal->GetNumSamples();
    166183
    167         const Byte_t *src = sample;
     184        const USample_t *src = sample;
    168185
    169186        // if no pedestals are given just convert the data into
     
    172189        {
    173190            while (beg<end)
    174                 *beg++ = *src++;
     191                *beg++ = *src;//Float_t(*src++)/scale;
    175192            continue;
    176193        }
     
    191208        // FIXME: Shell we really subtract the pedestal from saturating slices???
    192209        for (Float_t *ptr=beg; ptr<end; ptr++)
    193             *ptr = (Float_t)*src++ - mean[(ptr-beg)&1];
     210            *ptr = Float_t(*src++)/scale - mean[(ptr-beg)&1];
    194211    }
    195212
Note: See TracChangeset for help on using the changeset viewer.