Changeset 17864


Ignore:
Timestamp:
05/15/14 19:11:30 (11 years ago)
Author:
tbretz
Message:
Minor simplification and level adaption.
File:
1 edited

Legend:

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

    r17862 r17864  
    116116
    117117        // Is there any chance for saturation?
    118         if (*pmax<1800)
     118        if (*pmax<1900)
    119119            continue;
    120120
     
    126126
    127127        // Do a spline interpolation to find the crossing of 1.8V
    128         // before and after the maximum
     128        // before and after the maximum (This is a level, I think
     129        // there is no saturation effect at all yet)
    129130        MExtralgoSpline s(pbeg, rangehi, fDev1.GetArray(), fDev2.GetArray());
    130131        s.SetExtractionType(MExtralgoSpline::kAmplitudeRel);
     
    135136
    136137        // If the width above 1.8V is below 3 samples... go ahead as usual.
    137         if (width>3)
     138        if (width<3)
     139            continue;
     140
     141        // Estimate the amplitude and the arrival time from the width
     142        const double amplitude = (1800-baseline)/(0.898417 - 0.0187633*width + 0.000163919*width*width - 6.87369e-7*width*width*width + 1.13264e-9*width*width*width*width);
     143        const double deltat    = -1.41371-0.0525846*width + 93.2763/(width+13.196);
     144        const double time0     = leading-deltat-1;
     145
     146        const Int_t beg = TMath::FloorNint(leading);
     147        const Int_t end = TMath::CeilNint(falling);
     148
     149        ptr += fHiGainFirst+1;
     150        for (Int_t i=beg-5; i<end+5; i++)
    138151        {
    139             // Estimate the amplitude and the arrival time from the width
    140             const double amplitude = (1800-baseline)/(0.898417 - 0.0187633*width + 0.000163919*width*width - 6.87369e-7*width*width*width + 1.13264e-9*width*width*width*width);
    141             const double deltat    = -1.41371-0.0525846*width + 93.2763/(width+13.196);
    142             const double time0     = leading-deltat-1;
    143 
    144             const Int_t beg = TMath::FloorNint(leading);
    145             const Int_t end = TMath::CeilNint(falling);
    146 
    147             ptr += fHiGainFirst+1;
    148             for (Int_t i=beg-5; i<end+5; i++)
    149             {
    150                 const double x = i-time0;
    151                 const double v = amplitude*(1-1/(1+exp(x/2.14)))*exp(-x/38.8)+baseline;
    152                 if (v>ptr[i])
    153                     ptr[i] = v;
    154             }
     152            const double x = i-time0;
     153            const double v = amplitude*(1-1/(1+exp(x/2.14)))*exp(-x/38.8)+baseline;
     154            if (v>ptr[i])
     155                ptr[i] = v;
    155156        }
    156157    }
Note: See TracChangeset for help on using the changeset viewer.