Changeset 5790


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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5780 r5790  
    4747       lead to an unsuitable pixel.
    4848
     49   * msignal/MExtractTimeAndChargeDigitalFilter.[h,cc]
     50     - implemented changes suggested by T.B. to speed up calculations
    4951
    5052
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc

    r5747 r5790  
    212212}
    213213
     214void MExtractTimeAndChargeDigitalFilter::CalcBinningResArrays()
     215{
     216
     217  fArrBinningResHiGain.Set(fWindowSizeHiGain);
     218  fArrBinningResHalfHiGain.Set(fWindowSizeHiGain);
     219
     220  for (int i=0; i<fWindowSizeHiGain; i++)
     221    {
     222      fArrBinningResHiGain[i] = fBinningResolutionHiGain*i;
     223      fArrBinningResHalfHiGain[i] = fArrBinningResHiGain[i] + fBinningResolutionHalfHiGain;
     224    }
     225
     226  fArrBinningResLoGain.Set(fWindowSizeLoGain);
     227  fArrBinningResHalfLoGain.Set(fWindowSizeLoGain);
     228 
     229  for (int i=0; i<fWindowSizeLoGain; i++)
     230    {
     231      fArrBinningResLoGain[i] = fBinningResolutionLoGain*i;
     232      fArrBinningResHalfLoGain[i] = fArrBinningResLoGain[i] + fBinningResolutionHalfLoGain;
     233    }
     234}
     235
    214236// --------------------------------------------------------------------------
    215237//
     
    253275      if (*p++ >= fSaturationLimit)
    254276        if (!sat)
    255           sat = ids-3;
     277          sat = ids-4;
    256278    }
    257279
     
    274296          if (*logain++ >= fSaturationLimit)
    275297            if (!sat)
    276               sat = ids-3;
     298              sat = ids-4;
    277299
    278300          range++;
     
    296318      for (Int_t ids=0; ids < fWindowSizeHiGain; ids++)
    297319        {
    298           const Int_t   idx = fBinningResolutionHiGain*ids + fRandomIter;
     320          const Int_t   idx = fArrBinningResHiGain[ids] + fRandomIter;
    299321          sum              += fAmpWeightsHiGain [idx]*fHiGainSignal[ids];
    300322        }
     
    322344      for (Int_t sample=0; sample < fWindowSizeHiGain; sample++)
    323345      {
    324         const Int_t   idx = fBinningResolutionHiGain*sample+fBinningResolutionHalfHiGain;
     346        const Int_t   idx = fArrBinningResHalfHiGain[sample];
    325347        const Float_t pex = fHiGainSignal[sample+i];
    326348        sum              += fAmpWeightsHiGain [idx]*pex;
     
    368390  for (Int_t sample=0; sample < fWindowSizeHiGain; sample++)
    369391  {
    370     const Int_t   idx = fBinningResolutionHiGain*sample + fBinningResolutionHalfHiGain + t_iter;
     392    const Int_t   idx = fArrBinningResHalfHiGain[sample] + t_iter;
    371393    const Int_t   ids = max_p + sample;
    372394    const Float_t pex = ids < 0 ? 0. : ( ids >= range ? 0. : fHiGainSignal[ids]);
     
    435457      for (Int_t ids=0; ids < fWindowSizeLoGain; ids++)
    436458        {
    437           const Int_t   idx = fBinningResolutionLoGain*ids + fRandomIter;
     459          const Int_t   idx = fArrBinningResLoGain[ids] + fRandomIter;
    438460          sum              += fAmpWeightsLoGain [idx]*fLoGainSignal[ids];
    439461        }
     
    460482      for (Int_t sample=0; sample < fWindowSizeLoGain; sample++)
    461483      {
    462         const Int_t   idx = fBinningResolutionLoGain*sample+fBinningResolutionHalfLoGain;
     484        const Int_t   idx = fArrBinningResHalfLoGain[sample];
    463485        const Float_t pex = fLoGainSignal[sample+i];
    464486        sum              += fAmpWeightsLoGain [idx]*pex;
     
    507529  for (Int_t sample=0; sample < fWindowSizeLoGain; sample++)
    508530  {
    509     const Int_t   idx = fBinningResolutionLoGain*sample + fBinningResolutionHalfLoGain + t_iter;
     531    const Int_t   idx = fArrBinningResHalfLoGain[sample] + t_iter;
    510532    const Int_t   ids = max_p + sample;
    511533    const Float_t pex = ids < 0 ? 0. : ( ids >= range ? 0. : fLoGainSignal[ids]);
     
    674696            }
    675697
    676             len = fBinningResolutionLoGain*fWindowSizeHiGain;
     698            len = fBinningResolutionLoGain*fWindowSizeLoGain;
    677699            fAmpWeightsLoGain .Set(len);
    678700            fTimeWeightsLoGain.Set(len);
     
    724746    *fLog << inf << " File contains " << fWindowSizeLoGain << " lo-gain slices ";
    725747    *fLog << "with a resolution of " << fBinningResolutionLoGain << endl;
     748
     749    CalcBinningResArrays();
    726750
    727751    fWeightsSet = kTRUE;
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h

    r5744 r5790  
    88#ifndef MARS_MArrayF
    99#include "MArrayF.h"
     10#endif
     11
     12#ifndef MARS_MArrayI
     13#include "MArrayI.h"
    1014#endif
    1115
     
    3236  MArrayF fLoGainSignal;                        //! Store them in separate arrays
    3337
     38  MArrayI fArrBinningResHiGain;                 //! helping arrays to hold binningres * i
     39  MArrayI fArrBinningResLoGain;                 //! helping arrays to hold binningres * i
     40  MArrayI fArrBinningResHalfHiGain;             //! helping arrays to hold binningres * i + binningreshalf
     41  MArrayI fArrBinningResHalfLoGain;             //! helping arrays to hold binningres * i + binningreshalf
     42 
    3443  Float_t fTimeShiftHiGain;                     //  Time shift from when on to apply the filter
    3544  Float_t fTimeShiftLoGain;                     //  Time shift from when on to apply the filter
     
    5463  Bool_t  InitArrays();
    5564
     65  void CalcBinningResArrays();
     66 
    5667  Int_t   ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    5768
Note: See TracChangeset for help on using the changeset viewer.