Ignore:
Timestamp:
05/16/07 14:56:18 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc

    r8362 r8519  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.64 2007-03-04 13:25:07 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.65 2007-05-16 13:56:17 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    189189// order polynomial interpolation.
    190190//
    191 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxcont) const
     191Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxpos) const
    192192{
    193193    const Int_t p = sat0>1 ? sat0-2 : sat0-1;
    194194    if (sat0<=0)
    195195        return 0;
     196
     197    const Float_t &maxcont = sig[maxpos];
    196198    if (sat0==1)
    197199        return sig[0]>maxcont/2 ? 0 : 0.5;
     
    228230        const Float_t *sig = fSignal->GetSamples(pixidx);
    229231
    230         Int_t sathi0 = fHiGainFirst;  // First slice to extract and first saturating slice
    231         Int_t sathi1 = fHiGainLast;   // Last  slice to extract and last saturating slice
    232 
    233         UInt_t maxcont;
    234         Int_t maxposhi = fSignal->GetMax(pixidx, sathi0, sathi1, maxcont);
     232        const UInt_t maxcont  = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast);
     233        const  Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast);
     234
    235235        // Would it be better to take lastsat-firstsat?
     236        Int_t sathi0   = fHiGainFirst;  // First slice to extract and first saturating slice
     237        Int_t sathi1   = fHiGainLast;   // Last  slice to extract and last saturating slice
    236238        Int_t numsathi = fSignal->GetSaturation(pixidx, fSaturationLimit, sathi0, sathi1);
    237239
     
    253255        if (numsathi>1)
    254256        {
    255             timehi = GetSaturationTime(sathi0, sig, maxcont)-fHiGainFirst;
     257            timehi = GetSaturationTime(sathi0, sig, fHiGainFirst+maxposhi)-fHiGainFirst;
    256258            deltatimehi = 0;
    257259        }
     
    335337                first = numh+fLoGainFirst;
    336338             */
     339            // Would it be better to take lastsat-firstsat?
     340            const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last);
     341
    337342            Int_t satlo0 = first;   // First slice to extract and first saturating slice
    338343            Int_t satlo1 = last;    // Last  slice to extract and last saturating slice
    339 
    340             // Would it be better to take lastsat-firstsat?
    341             UInt_t maxlo;
    342             Int_t maxposlo = fSignal->GetMax(pixidx, satlo0, satlo1, maxlo);
    343344            numsatlo = fSignal->GetSaturation(pixidx, fSaturationLimit, satlo0, satlo1);
    344345
     
    359360            if (numsatlo>1)
    360361            {
    361                 timelo = GetSaturationTime(satlo0, sig, maxlo)-numh-first;
     362                timelo = GetSaturationTime(satlo0, sig, first+maxposlo)-numh-first;
    362363                deltatimelo = 0;
    363364            }
Note: See TracChangeset for help on using the changeset viewer.