Ignore:
Timestamp:
06/19/07 12:01:35 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r8519 r8584  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.65 2007-05-16 13:56:17 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.66 2007-06-19 11:01:34 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    189189// order polynomial interpolation.
    190190//
    191 Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxpos) const
     191Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxconthalf) const
    192192{
    193193    const Int_t p = sat0>1 ? sat0-2 : sat0-1;
     
    195195        return 0;
    196196
    197     const Float_t &maxcont = sig[maxpos];
    198197    if (sat0==1)
    199         return sig[0]>maxcont/2 ? 0 : 0.5;
     198        return sig[0]>maxconthalf ? 0 : 0.5;
    200199
    201200    if (sig[p]>sig[p+1] || sig[p+1]>sig[p+2])
    202         return sig[p+1]>maxcont/2 ? sat0-1 : sat0-0.5;
     201        return sig[p+1]>maxconthalf ? sat0-1 : sat0-0.5;
    203202
    204203    // Find the place at which the signal is maxcont/2
     
    206205    const TVector3 vy(p, p+1, p+2);
    207206
    208     return MMath::InterpolParabLin(vx, vy, maxcont/2);
     207    return MMath::InterpolParabLin(vx, vy, maxconthalf);
    209208}
    210209
     
    223222    const Int_t numl = fRunHeader->GetNumSamplesLoGain();
    224223
     224    const UInt_t satlim = fSaturationLimit*fRunHeader->GetMax();
     225
    225226    MRawEvtPixelIter pixel(fRawEvt);
    226227    while (pixel.Next())
     
    230231        const Float_t *sig = fSignal->GetSamples(pixidx);
    231232
    232         const UInt_t maxcont  = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast);
    233         const  Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast);
    234 
    235233        // Would it be better to take lastsat-firstsat?
    236234        Int_t sathi0   = fHiGainFirst;  // First slice to extract and first saturating slice
    237235        Int_t sathi1   = fHiGainLast;   // Last  slice to extract and last saturating slice
    238         Int_t numsathi = fSignal->GetSaturation(pixidx, fSaturationLimit, sathi0, sathi1);
     236        Int_t numsathi = fSignal->GetSaturation(pixidx, satlim, sathi0, sathi1);
    239237
    240238        Float_t sumhi =0., deltasumhi =-1; // Set hi-gain of MExtractedSignalPix valid
     
    246244
    247245        if (numsathi<2)
     246        {
     247            const Int_t maxposhi = fSignal->GetMaxPos(pixidx, fHiGainFirst, fHiGainLast);
    248248            FindTimeAndChargeHiGain2(sig+fHiGainFirst, rangehi,
    249249                                     sumhi, deltasumhi, timehi, deltatimehi,
    250250                                     numsathi, maxposhi);
     251        }
    251252
    252253        // If we have saturating slices try to get a better estimate
    253254        // of the arrival time than timehi or sathi0. This is
    254255        // usefull to know where to start lo-gain extraction.
     256        const UInt_t maxcont = fSignal->GetRawMaxVal(pixidx, fHiGainFirst, fHiGainLast);
    255257        if (numsathi>1)
    256258        {
    257             timehi = GetSaturationTime(sathi0, sig, fHiGainFirst+maxposhi)-fHiGainFirst;
     259            timehi = GetSaturationTime(sathi0, sig, maxcont/2)-fHiGainFirst;
    258260            deltatimehi = 0;
    259261        }
     
    338340             */
    339341            // Would it be better to take lastsat-firstsat?
    340             const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last);
    341 
    342342            Int_t satlo0 = first;   // First slice to extract and first saturating slice
    343343            Int_t satlo1 = last;    // Last  slice to extract and last saturating slice
    344             numsatlo = fSignal->GetSaturation(pixidx, fSaturationLimit, satlo0, satlo1);
     344            numsatlo = fSignal->GetSaturation(pixidx, satlim, satlo0, satlo1);
    345345
    346346            //if (satlo0>first && satlo1<last && numsatlo>2)
     
    350350            //}
    351351
    352             const Int_t rangelo = last-first+1;
     352            const Int_t rangelo  = last-first+1;
     353            const Int_t maxposlo = fSignal->GetMaxPos(pixidx, first, last);
    353354            FindTimeAndChargeLoGain2(sig+first, rangelo,
    354355                                     sumlo, deltasumlo, timelo, deltatimelo,
     
    360361            if (numsatlo>1)
    361362            {
    362                 timelo = GetSaturationTime(satlo0, sig, first+maxposlo)-numh-first;
     363                const UInt_t maxrawlo = fSignal->GetRawMaxPos(pixidx, fHiGainFirst, fHiGainLast);
     364                timelo = GetSaturationTime(satlo0, sig, first+maxrawlo)-numh-first;
    363365                deltatimelo = 0;
    364366            }
Note: See TracChangeset for help on using the changeset viewer.