Changeset 8519 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
05/16/07 14:56:18 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8518 r8519  
    4242     - removed automatic writing of fDisplay from WriteContainer
    4343     - added a new function WriteDisplay
     44
     45   * mhcalib/MHCalibrationChargeCam.cc, mpedestal/MExtractPedestal.cc,
     46     msignal/MExtractBlindPixel.cc, msignal/MSignalCalc.cc:
     47     - replaced GetMax by GetMaxPos
     48
     49   * mhcalib/MHCalibrationPulseTimeCam.cc:
     50     - use new GetMax returning position and height at once
     51
     52   * mpedestal/MPedestalSubtractedEvt.[h,cc]:
     53     - devided the old function GetMax into GetMax and GetRawMax
     54
     55   * msignal/MExtractTimeAndCharge.cc:
     56     - GetSaturationTime now uses the real maximum as reference not
     57       the maximum of the raw-date
     58     - adapted the use of GetMax
    4459
    4560
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc

    r8452 r8519  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.58 2007-04-27 10:04:47 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.59 2007-05-16 13:56:17 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    751751         continue;
    752752
    753       const Float_t timehi = fRawEvt->GetMax(pixid, hifirst, hilast)+hifirst;
     753      const Float_t timehi = fRawEvt->GetMaxPos(pixid, hifirst, hilast)+hifirst;
    754754      histhi.FillAbsTime(timehi);
    755755
     
    764764          MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(pixid);
    765765
    766           const Float_t timelo = fRawEvt->GetMax(pixid, nhi+lofirst, nhi+lolast)+lofirst;
     766          const Float_t timelo = fRawEvt->GetMaxPos(pixid, nhi+lofirst, nhi+lolast)+lofirst;
    767767          histlo.FillAbsTime(timelo);
    768768
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc

    r8446 r8519  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.38 2007-04-25 14:39:43 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.39 2007-05-16 13:56:17 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    390390
    391391        // Get position of maximum
    392         const Int_t   pos = evt->GetMax(idx);
    393         const Float_t max = evt->GetSamples(idx)[pos];
     392        Float_t max;
     393        const Int_t pos = evt->GetMax(idx, max);
    394394
    395395        // check if maximum is high enough
  • trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc

    r8498 r8519  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.30 2007-05-11 15:47:18 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.31 2007-05-16 13:56:17 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    648648
    649649    // Do some handling if maxpos is last slice?
    650     const Int_t maxposhi = fSignal->GetMax(idx, start, start+range-1);
     650    const Int_t maxposhi = fSignal->GetMaxPos(idx, start, start+range-1);
    651651
    652652    const Float_t *sig = fSignal->GetSamples(idx);
  • trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.cc

    r8361 r8519  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtractedEvt.cc,v 1.3 2007-03-04 12:01:37 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MPedestalSubtractedEvt.cc,v 1.4 2007-05-16 13:56:17 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    130130// --------------------------------------------------------------------------
    131131//
    132 // Get the maximum of the slices [first,last] of pixel index.
     132// Get the maximum of the pedestal subtracted slices [first,last] of
     133// pixel with index idx.
    133134//
    134135// The position returned is the index of the position of the pedestal
    135136// subtracted maximum w.r.t. to first.
    136 // The value returned is the maximum of the raw-data.
     137// The value returned is the maximum corresponding to this index.
    137138//
    138139// Warning: No range checks and no sanity checks are done!
    139140//
    140 Int_t MPedestalSubtractedEvt::GetMax(const Int_t idx, const Int_t first, const Int_t last, UInt_t &val) const
     141Int_t MPedestalSubtractedEvt::GetMax(const Int_t idx, const Int_t first, const Int_t last, Float_t &val) const
    141142{
    142143    // Get pointer to first slice to be considered
    143     Byte_t  const *samb = GetSamplesRaw(idx);
    144     Float_t const *samf = GetSamples(idx);
    145 
    146     Byte_t  const *ptrb = samb+first;
    147     Float_t const *ptrf = samf+first;
     144    Float_t const *sam = GetSamples(idx);
     145
     146    Float_t const *beg = sam+first;
    148147
    149148    // The best information so far: the first slice is the maximum
    150     const Byte_t  *maxb = ptrb;
    151     const Float_t *maxf = ptrf;
    152 
    153     // Store the pointer to the first slice
    154 //    const Byte_t  *begb = ptrb;
    155     const Float_t *begf = ptrf;
    156 
    157     // Calculate the last slice to be considered
    158     const Byte_t  *endb = samb+last;
    159 
    160     while (ptrb<endb)
    161     {
    162         // Pre-increment: check the second slice first
    163         if (*++ptrb>*maxb)
    164             maxb = ptrb;
    165         if (*++ptrf>*maxf)
    166             maxf = ptrf;
    167     }
    168 
    169     val = *maxb;
    170     return maxf-begf;
     149    const Float_t *max = beg;
     150
     151    for (const Float_t *ptr=beg+1; ptr<=sam+last; ptr++)
     152        if (*++ptr>*max)
     153            max = ptr;
     154
     155    val = *max;
     156    return max-beg;
     157}
     158
     159// --------------------------------------------------------------------------
     160//
     161// Get the maximum of the raw slices [first,last] of pixel with index idx.
     162//
     163// The position returned is the index of the position of the raw-data
     164// w.r.t. to first.
     165// The value returned is the maximum corresponding to this index.
     166//
     167// Warning: No range checks and no sanity checks are done!
     168//
     169Int_t MPedestalSubtractedEvt::GetRawMax(const Int_t idx, const Int_t first, const Int_t last, UInt_t &val) const
     170{
     171    // Get pointer to first slice to be considered
     172    Byte_t const *sam = GetSamplesRaw(idx);
     173
     174    Byte_t const *beg = sam+first;
     175
     176    // The best information so far: the first slice is the maximum
     177    const Byte_t *max = beg;
     178
     179    for (const Byte_t *ptr=beg+1; ptr<=sam+last; ptr++)
     180        if (*++ptr>*max)
     181            max = ptr;
     182
     183    val = *max;
     184    return max-beg;
    171185}
    172186
  • trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h

    r8446 r8519  
    4141    Int_t GetSaturation(const Int_t idx, Int_t limit, Int_t &first, Int_t &last) const;
    4242    //void  InterpolateSaturation(const Int_t idx, Int_t limit, Int_t first, Int_t last) const;
    43     Int_t GetMax(const Int_t pixidx, const Int_t first, const Int_t last, UInt_t &val) const;
    44     Int_t GetMax(const Int_t pixidx, const Int_t first, const Int_t last) const
     43
     44    Int_t GetMax(const Int_t pixidx, const Int_t first, const Int_t last, Float_t &val) const;
     45    Int_t GetMax(const Int_t pixidx, Float_t &val) const
    4546    {
    46         UInt_t val;
     47        return GetMax(pixidx, 0, fNumSamples-1, val);
     48    }
     49    Int_t GetMaxPos(const Int_t pixidx, const Int_t first, const Int_t last) const
     50    {
     51        Float_t val;
    4752        return GetMax(pixidx, first, last, val);
    4853    }
    49     Int_t GetMax(const Int_t pixidx, UInt_t &val) const
     54    Int_t GetMaxPos(const Int_t pixidx, Float_t &val) const
    5055    {
    5156        return GetMax(pixidx, 0, fNumSamples-1, val);
    5257    }
    5358
    54     Int_t GetMax(const Int_t pixidx) const
     59    Int_t GetMaxPos(const Int_t pixidx) const
     60    {
     61        Float_t val;
     62        return GetMax(pixidx, 0, fNumSamples-1, val);
     63    }
     64
     65    Int_t GetRawMax(const Int_t idx, const Int_t first, const Int_t last, UInt_t &val) const;
     66    Int_t GetRawMax(const Int_t pixidx, UInt_t &val) const
     67    {
     68        return GetRawMax(pixidx, 0, fNumSamples-1, val);
     69    }
     70    Int_t GetRawMaxPos(const Int_t pixidx, const Int_t first, const Int_t last) const
    5571    {
    5672        UInt_t val;
    57         return GetMax(pixidx, 0, fNumSamples-1, val);
     73        return GetRawMax(pixidx, first, last, val);
    5874    }
     75    Int_t GetRawMaxPos(const Int_t pixidx, UInt_t &val) const
     76    {
     77        return GetRawMax(pixidx, 0, fNumSamples-1, val);
     78    }
     79
     80    Int_t GetRawMaxPos(const Int_t pixidx) const
     81    {
     82        UInt_t val;
     83        return GetRawMax(pixidx, 0, fNumSamples-1, val);
     84    }
     85
     86    UInt_t GetRawMaxVal(const Int_t idx, const Int_t first, const Int_t last) const
     87    {
     88        UInt_t val;
     89        GetRawMax(idx, first, last, val);
     90        return val;
     91    }
     92
     93
    5994    Int_t GetSaturation(const Int_t pixidx, Int_t limit) const
    6095    {
  • trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc

    r8498 r8519  
    362362    Int_t sat1 = fHiGainLast;  // Last  slice to extract and last saturating slice
    363363
    364     UInt_t maxcont;
    365     Int_t maxpos = fSignal->GetMax(idx, sat0, sat1, maxcont);
     364    Int_t maxpos = fSignal->GetMaxPos(idx, sat0, sat1);
    366365
    367366//    numsat = fSignal->GetSaturation(idx, fSaturationLimit, sat0, sat1);
  • 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            }
  • trunk/MagicSoft/Mars/msignal/MSignalCalc.cc

    r8364 r8519  
    137137
    138138        Byte_t *ptr   = raw;
    139         Byte_t *max   = ptr+fRawEvt->GetMax(i, 0, nhi);
     139        Byte_t *max   = ptr+fRawEvt->GetMaxPos(i, 0, nhi);
    140140        Byte_t *end   = ptr+nhi;
    141141        Byte_t *first = max-fBefore;
     
    199199            // Area: x9
    200200            ptr = raw+nhi;
    201             max = ptr+fRawEvt->GetMax(i, nhi, nhi+nlo);
     201            max = ptr+fRawEvt->GetMaxPos(i, nhi, nhi+nlo);
    202202
    203203            if (*max>250)
Note: See TracChangeset for help on using the changeset viewer.