Changeset 5373 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
11/10/04 18:01:46 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5371 r5373  
    3434       relatively good precision although still the extensive test with
    3535       the noise calculation from the extractor directly is missing.
     36     - subtract the pedestal right at the beginning instead of twice
     37       during execution of the filter.
     38
     39   * msignal/MExtractTimeAndChargeSpline.cc
     40     - added treatment of IsNoiseCalculation() for the "integral"
     41       method.
     42
    3643
    3744 2004/11/10: Abelardo Moralejo
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc

    r5368 r5373  
    228228
    229229  //
    230   // Check for saturation in all other slices
    231   //
    232   while (p<end)
    233     {
    234 
    235       fHiGainSignal[count++] = (Float_t)*p;
    236 
    237       if (*p > max)
    238         {
    239           max    = *p;
    240           maxpos =  p-ptr;
    241         }
    242 
    243       if (*p++ >= fSaturationLimit)
    244         sat++;
    245     }
    246  
    247   if (fHiLoLast != 0)
    248     {
    249 
    250       end = logain + fHiLoLast;
    251 
    252       while (logain<end)
    253         {
    254 
    255           fHiGainSignal[count++] = (Float_t)*logain;
    256           range++;
    257 
    258           if (*logain > max)
    259             {
    260               max    = *logain;
    261               maxpos =  range;
    262             }
    263          
    264           if (*logain++ >= fSaturationLimit)
    265             sat++;
    266         }
    267     }
    268  
    269   //
    270   // allow one saturated slice
    271   //
    272   if (sat > 0)
    273     return;
    274 
    275   Float_t time_sum  = 0.;
    276   Float_t fmax      = 0.;
    277   Float_t ftime_max = 0.;
    278   Int_t   max_p     = 0;
    279  
     230  // Preparations for the pedestal subtraction (with AB-noise correction)
     231  //
    280232  const Float_t pedes  = ped.GetPedestal();
    281233  const Float_t ABoffs = ped.GetPedestalABoffset();
     
    286238
    287239  //
     240  // Check for saturation in all other slices
     241  //
     242  while (p<end)
     243    {
     244
     245      const Int_t ids      = fHiGainFirst + count ;
     246      const Float_t signal = (Float_t)*p - pedmean[(ids+abflag) & 0x1];
     247      fHiGainSignal[count] = signal;
     248
     249      count++;
     250
     251      if (*p > max)
     252        {
     253          max    = *p;
     254          maxpos =  p-ptr;
     255        }
     256
     257      if (*p++ >= fSaturationLimit)
     258        sat++;
     259    }
     260 
     261  if (fHiLoLast != 0)
     262    {
     263
     264      end = logain + fHiLoLast;
     265
     266      while (logain<end)
     267        {
     268
     269          const Int_t ids      = fHiGainFirst + range ;
     270          const Float_t signal = (Float_t)*logain - pedmean[(ids+abflag) & 0x1];
     271          fHiGainSignal[range] = signal;
     272          range++;
     273
     274          if (*logain > max)
     275            {
     276              max    = *logain;
     277              maxpos =  range;
     278            }
     279         
     280          if (*logain++ >= fSaturationLimit)
     281            sat++;
     282        }
     283    }
     284 
     285  //
     286  // allow one saturated slice
     287  //
     288  if (sat > 0)
     289    return;
     290
     291  Float_t time_sum  = 0.;
     292  Float_t fmax      = 0.;
     293  Float_t ftime_max = 0.;
     294  Int_t   max_p     = 0;
     295 
     296  //
    288297  // Calculate the sum of the first fWindowSize slices
    289298  //
     
    300309      {
    301310        const Int_t   idx = fBinningResolutionHiGain*sample+fBinningResolutionHalfHiGain;
    302         const Float_t pex = fHiGainSignal[sample+i]-pedmean[(sample+i+abflag) & 0x1];
     311        const Float_t pex = fHiGainSignal[sample+i];
    303312        sum              += fAmpWeightsHiGain [idx]*pex;
    304313        time_sum         += fTimeWeightsHiGain[idx]*pex;
     
    348357  {
    349358    const Int_t   idx = fBinningResolutionHiGain*sample + fBinningResolutionHalfHiGain + t_iter;
    350     const Int_t   ids = (IsNoiseCalculation()) ? sample : max_p + sample;
     359    const Int_t   ids = IsNoiseCalculation() ? sample : max_p + sample;
    351360   
    352361    const Float_t pex = ids < 0 ? 0. :
    353       ( ids > range ? 0. : fHiGainSignal[ids]-pedmean[(ids+abflag) & 0x1]);
     362      ( ids > range ? 0. : fHiGainSignal[ids]);
    354363    sum              += fAmpWeightsHiGain [idx]*pex;
    355364    time_sum         += fTimeWeightsHiGain[idx]*pex;
     
    376385
    377386  //
    378   // Check for saturation in all other slices
    379   //
    380   while (p<end)
    381     {
    382 
    383       fLoGainSignal[count++] = (Float_t)*p;
    384 
    385       if (*p > max)
    386         {
    387           max    = *p;
    388           maxpos =  p-ptr;
    389         }
    390 
    391       if (*p++ >= fSaturationLimit)
    392         sat++;
    393     }
    394  
    395   Float_t time_sum  = 0.;
    396   Float_t fmax      = 0.;
    397   Float_t ftime_max = 0.;
    398   Int_t   max_p     = 0;
    399  
     387  // Prepare the low-gain pedestal
     388  //
    400389  const Float_t pedes  = ped.GetPedestal();
    401390  const Float_t ABoffs = ped.GetPedestalABoffset();
     
    406395
    407396  //
     397  // Check for saturation in all other slices
     398  //
     399  while (p<end)
     400    {
     401
     402      const Int_t ids      = fLoGainFirst + count ;
     403      const Float_t signal = (Float_t)*p - pedmean[(ids+abflag) & 0x1];
     404      fLoGainSignal[count] = signal;
     405
     406      count++;
     407
     408      if (*p > max)
     409        {
     410          max    = *p;
     411          maxpos =  p-ptr;
     412        }
     413
     414      if (*p++ >= fSaturationLimit)
     415        sat++;
     416    }
     417 
     418  Float_t time_sum  = 0.;
     419  Float_t fmax      = 0.;
     420  Float_t ftime_max = 0.;
     421  Int_t   max_p     = 0;
     422 
     423  //
    408424  // Calculate the sum of the first fWindowSize slices
    409425  //
     
    420436      {
    421437        const Int_t   idx = fBinningResolutionLoGain*sample+fBinningResolutionHalfLoGain;
    422         const Float_t pex = fLoGainSignal[sample+i]-pedmean[(sample+i+abflag) & 0x1];
     438        const Float_t pex = fLoGainSignal[sample+i];
    423439        sum              += fAmpWeightsLoGain [idx]*pex;
    424440        time_sum         += fTimeWeightsLoGain[idx]*pex;
     
    469485    const Int_t   ids = (IsNoiseCalculation()) ? sample : max_p + sample;;
    470486    const Float_t pex = ids < 0 ? 0. :
    471       ( ids > range ? 0. : fLoGainSignal[ids]-pedmean[(ids+abflag) & 0x1]);
     487      ( ids > range ? 0. : fLoGainSignal[ids]);
    472488    sum              += fAmpWeightsLoGain [idx]*pex;
    473489    time_sum         += fTimeWeightsLoGain[idx]*pex;
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc

    r5293 r5373  
    353353  Int_t  count     = 0;
    354354
    355   Float_t pedes        = ped.GetPedestal();
     355  const Float_t pedes  = ped.GetPedestal();
    356356  const Float_t ABoffs = ped.GetPedestalABoffset();
    357357
    358   Float_t PedMean[2];
    359   PedMean[0] = pedes + ABoffs;
    360   PedMean[1] = pedes - ABoffs;
     358  Float_t pedmean[2];
     359  pedmean[0] = pedes + ABoffs;
     360  pedmean[1] = pedes - ABoffs;
    361361
    362362  fAbMax        = 0.;
     
    371371
    372372      const Int_t ids      = fHiGainFirst + count ;
    373       const Float_t signal = (Float_t)*p - PedMean[(ids+abflag) & 0x1];
     373      const Float_t signal = (Float_t)*p - pedmean[(ids+abflag) & 0x1];
    374374      fHiGainSignal[count] = signal;
    375375
     
    395395
    396396          const Int_t ids      = fHiGainFirst + range ;
    397           const Float_t signal = (Float_t)*logain - PedMean[(ids+abflag) & 0x1];
     397          const Float_t signal = (Float_t)*logain - pedmean[(ids+abflag) & 0x1];
    398398          fHiGainSignal[range] = signal;
    399399          range++;
     
    683683      // Now integrate the whole thing!
    684684      //
    685       Int_t startslice = (Int_t)(fAbMaxPos - fRiseTime);
    686       Int_t lastslice  = (Int_t)(fAbMaxPos + fFallTime);
     685      Int_t startslice = IsNoiseCalculation() ? 0 : (Int_t)(fAbMaxPos - fRiseTime);
     686      Int_t lastslice  = IsNoiseCalculation() ? (Int_t)(fRiseTime+fFallTim) : (Int_t)(fAbMaxPos + fFallTime);
    687687     
    688688      if (startslice < 0)
     
    728728  const Float_t ABoffs = ped.GetPedestalABoffset();
    729729
    730   Float_t PedMean[2];
    731   PedMean[0] = pedes + ABoffs;
    732   PedMean[1] = pedes - ABoffs;
     730  Float_t pedmean[2];
     731  pedmean[0] = pedes + ABoffs;
     732  pedmean[1] = pedes - ABoffs;
    733733
    734734  fAbMax        = 0.;
     
    743743
    744744      const Int_t ids      = fLoGainFirst + count ;
    745       const Float_t signal = (Float_t)*p - PedMean[(ids+abflag) & 0x1];
     745      const Float_t signal = (Float_t)*p - pedmean[(ids+abflag) & 0x1];
    746746      fLoGainSignal[count] = signal;
    747747
     
    10341034      // Now integrate the whole thing!
    10351035      //
    1036       Int_t startslice = (Int_t)(fAbMaxPos - fRiseTime);
    1037       Int_t lastslice  = (Int_t)(fAbMaxPos + fFallTime + 1);
     1036      Int_t startslice = IsNoiseCalculation() ? 0 : (Int_t)(fAbMaxPos - fRiseTime);
     1037      Int_t lastslice  = IsNoiseCalculation() ? (Int_t)(fRiseTime+fFallTim) : (Int_t)(fAbMaxPos + fFallTime + 1);
    10381038     
    10391039      if (startslice < 0)
Note: See TracChangeset for help on using the changeset viewer.