Ignore:
Timestamp:
02/04/04 16:24:10 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc

    r2909 r3018  
    217217Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample() const
    218218{
    219     Byte_t max  = 0;
    220     Byte_t maxi = 0;
    221 
    222     for (int i=0; i<fNumHiGainSamples; i++)
    223         if (fHiGainPos[i]>max)
    224         {
    225             max = fHiGainPos[i];
    226             maxi = i;
    227         }
    228 
    229     return maxi;
     219    Byte_t *ptr = fHiGainPos+1;
     220    Byte_t *max = fHiGainPos;
     221    const Byte_t *end = ptr + fNumHiGainSamples;
     222
     223    do if (*ptr>*max) max = ptr;
     224    while (++ptr != end);
     225
     226    return max-fHiGainPos;
    230227}
    231228
     
    241238        return -1; // means: not found
    242239
    243     Byte_t max  = 0;
    244     Byte_t maxi = 0;
    245 
    246     for (int i=fNumLoGainSamples-1; i>=0; i--)
    247         if (fLoGainPos[i]>max)
    248         {
    249             max = fLoGainPos[i];
    250             maxi = i;
    251         }
    252 
    253     return maxi;
     240    Byte_t *ptr = fLoGainPos+1;
     241    Byte_t *max = fLoGainPos;
     242    const Byte_t *end = ptr + fNumLoGainSamples;
     243
     244    do if (*ptr>*max) max = ptr;
     245    while (++ptr != end);
     246
     247    return max-fLoGainPos;
    254248}
    255249
Note: See TracChangeset for help on using the changeset viewer.