Changeset 5746 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
01/08/05 20:08:03 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5744 r5746  
    4444   * msignal/MExtractTimeAndChargeDigitalFilter.cc
    4545     - fixed two bugs introduced yesterday by TB.
     46
     47   * msignal/MExtractTimeAndChargeSpline.cc
     48   * msignal/MExtractTimeAndChargeSlidingWindow.cc
     49     - adopt part of TB's speed accelerations into these classes
     50
     51   * msignal/MExtractTimeAndCharge.cc
     52     - fix the low-gain extraction window for the case that the high-gain
     53       is saturated. Was skipped so far.
    4654
    4755
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc

    r5734 r5746  
    8686
    8787const Float_t MExtractTimeAndCharge::fgLoGainStartShift = -2.8;
    88 
    8988// --------------------------------------------------------------------------
    9089//
     
    157156                                fLoGainFirst, fLoGainLast, fNumLoGainSamples);
    158157
     158
    159159  return kTRUE;
    160160}
     
    166166// Calculate the integral of the FADC time slices and store them as a new
    167167// pixel in the MExtractedSignalCam container.
    168 // The functions FindTimeAndChargeHiGain() and FindTimeAndChargeLoGain are
     168// The functions FindTimeAndChargeHiGain() and FindTimeAndChargeLoGain() are
    169169// supposed to extract the signal themselves.
    170170//
    171171Int_t MExtractTimeAndCharge::Process()
    172172{
    173     // This cleaning is nor necessary: It is done automatically by
    174     // Reset() before each execution of the Tasklist (Process())
    175     //  fArrTime->Clear();
    176     //  fSignals->Clear();
    177173
    178174  MRawEvtPixelIter pixel(fRawEvt);
     
    216212
    217213          fLoGainFirstSave = fLoGainFirst;
    218           const Byte_t logainstart = (Byte_t)(timehi+fLoGainStartShift);
    219           if (!sathi)
    220               fLoGainFirst = logainstart > fLoGainFirstSave ? logainstart : fLoGainFirstSave;
    221 
    222           if (fLoGainFirst < fLoGainLast)
    223           {
     214          const Byte_t logainstart = sathi
     215            ? sathi + (Int_t)fLoGainStartShift
     216            : (Byte_t)(timehi + fLoGainStartShift);
     217          fLoGainFirst = logainstart > fLoGainFirstSave ? logainstart : fLoGainFirstSave;
     218
     219          if ( fLoGainFirst < fLoGainLast )
     220            {
    224221              const Bool_t logainabflag = (higainabflag + pixel.GetNumHiGainSamples()) & 0x1;
    225222              FindTimeAndChargeLoGain(pixel.GetLoGainSamples()+fLoGainFirst,
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSlidingWindow.cc

    r5511 r5746  
    210210 
    211211  Float_t max = 0;  // highest integral content of all windows
    212   Int_t count = 0;  // counter to recognize the AB-flag
     212  Int_t count = 0;
     213  sat         = 0;
    213214
    214215  const Float_t pedes  = ped.GetPedestal();
    215216  const Float_t ABoffs = ped.GetPedestalABoffset();
    216217
    217   Float_t PedMean[2];
    218   PedMean[0] = pedes + ABoffs;
    219   PedMean[1] = pedes - ABoffs;
    220 
     218  Float_t PedMean[2] = { pedes + ABoffs, pedes - ABoffs };
    221219  //
    222220  // Check for saturation in all other slices
    223221  //
     222  Int_t ids = fHiGainFirst;
     223
    224224  while (p<first+fWindowSizeHiGain)
    225225    {
    226       const Int_t ids      = fHiGainFirst + count;
    227       const Float_t signal = (Float_t)*p - PedMean[(ids+abflag) & 0x1];     
     226
     227      const Float_t signal = (Float_t)*p - PedMean[(ids++ + abflag) & 0x1];     
    228228      sum                 += signal;
    229229      fHiGainSignal[count] = signal;
    230230     
    231231      if (*p++ >= fSaturationLimit)
    232         sat++;
    233 
     232        if (!sat)
     233            sat = p-first+fHiGainFirst-1;
     234     
    234235      count++;
    235236    }
     
    240241  while (p<end)
    241242    if (*p++ >= fSaturationLimit)
    242       sat++;
     243      if (!sat)
     244        sat = p-first+fHiGainFirst-1;
    243245 
    244246  if (IsNoiseCalculation())
     
    257259    {
    258260     
    259       const Int_t ids      = fHiGainFirst + count + fWindowSizeHiGain;
    260       const Float_t signal = (Float_t)*(p+fWindowSizeHiGain) - PedMean[(ids+abflag) & 0x1];     
     261      const Float_t signal = (Float_t)*(p+fWindowSizeHiGain) - PedMean[(ids++ + abflag) & 0x1];     
    261262      sum                 += signal - fHiGainSignal[count];
    262263      fHiGainSignal[count + fWindowSizeHiGain] = signal;
     
    281282        {
    282283         
    283           const Int_t   ids    = fHiGainFirst + count + fWindowSizeHiGain;
    284           const Float_t signal = (Float_t)*l - PedMean[(ids+abflag) & 0x1];         
     284          const Float_t signal = (Float_t)*l - PedMean[(ids++ + abflag) & 0x1];         
    285285          sum                 += signal - fHiGainSignal[count];
    286286          fHiGainSignal[count + fWindowSizeHiGain] = signal;
    287           count++;
    288287          if (*l++ >= fSaturationLimit)
    289             sat++;
     288            if (!sat)
     289              sat = l-logain+fHiGainLast-1;
    290290         
    291291          if (sum>max)
     
    294294              idx   = count+1;
    295295            }
     296          count++;
    296297          p++;
    297298        }
    298299     
    299       if (fHiLoLast > fWindowSizeHiGain)
     300      if (fHiLoLast > (Byte_t)fWindowSizeHiGain)
    300301        {
    301302          while (l < logain + fHiLoLast)
    302303            {
    303               const Int_t   ids    = fHiGainFirst + count + fWindowSizeHiGain;
    304               const Float_t signal = (Float_t)*l - PedMean[(ids+abflag) & 0x1];         
     304              const Float_t signal = (Float_t)*l - PedMean[(ids++ + abflag) & 0x1];         
    305305              sum                 += signal - fHiGainSignal[count];
    306306              fHiGainSignal[count+fWindowSizeHiGain] = signal;
    307               count++;
    308               if (*(l+fWindowSizeHiGain) >= fSaturationLimit)
    309                 sat++;
    310              
     307
     308              if (*l++ >= fSaturationLimit)
     309                if (!sat)
     310                  sat = l-logain+fHiGainLast-1;
     311
    311312              if (sum>max)
    312313                {
     
    314315                  idx   = count+1;
    315316                }
    316               l++;
     317              count++;
    317318            } /* while (l < logain + fHiLoLast) */
    318319        } /* if (fHiLoLast > fWindowSizeHiGain) */
     
    333334  sum   = max;
    334335
    335   time  = sum != 0 ? timesignalsum / max  + Float_t(fHiGainFirst) : 1.;
    336   dtime = sum != 0 ? ped.GetPedestalRms() / max * sqrt(timesquaredsum - fWindowSizeHiGain*time) : 1.;
     336  time  = max > 0.1 ? timesignalsum / max  + Float_t(fHiGainFirst) : 1.;
     337  dtime = max > 0.1 ? ped.GetPedestalRms() / max * sqrt(timesquaredsum - fWindowSizeHiGain*time) : 1.;
    337338
    338339}
     
    358359  const Float_t ABoffs = ped.GetPedestalABoffset();
    359360
    360   Float_t PedMean[2];
    361   PedMean[0] = pedes + ABoffs;
    362   PedMean[1] = pedes - ABoffs;
    363 
     361  Float_t PedMean[2] = { pedes + ABoffs, pedes - ABoffs };
    364362  //
    365363  // Check for saturation in all other slices
    366364  //
     365  Int_t ids = fLoGainFirst;
     366
    367367  while (p<first+fWindowSizeLoGain)
    368368    {
    369       const Int_t ids      = fLoGainFirst + count;
    370       const Float_t signal = (Float_t)*p - PedMean[(ids+abflag) & 0x1];     
     369      const Float_t signal = (Float_t)*p - PedMean[(ids++ + abflag) & 0x1];     
    371370      sum                 += signal;
    372371      fLoGainSignal[count] = signal;
     
    400399    {
    401400
    402       const Int_t ids      = fLoGainFirst + count + fWindowSizeLoGain;
    403       const Float_t signal = (Float_t)*(p+fWindowSizeLoGain) - PedMean[(ids+abflag) & 0x1];     
     401      const Float_t signal = (Float_t)*(p+fWindowSizeLoGain) - PedMean[(ids++ + abflag) & 0x1];     
    404402      sum                 += signal - fLoGainSignal[count];
    405403      fLoGainSignal[count + fWindowSizeLoGain] = signal;
     
    427425  sum   = max;
    428426
    429   time  = sum != 0 ? timesignalsum / max  + Float_t(fLoGainFirst) : 1.;
    430   dtime = sum != 0 ? ped.GetPedestalRms() / max * sqrt(timesquaredsum - fWindowSizeLoGain*time) : 1.;
     427  time  = max > 0.1 ? timesignalsum / max  + Float_t(fLoGainFirst) : 1.;
     428  dtime = max > 0.1 ? ped.GetPedestalRms() / max * sqrt(timesquaredsum - fWindowSizeLoGain*time) : 1.;
    431429}
    432430
Note: See TracChangeset for help on using the changeset viewer.