Changeset 3883


Ignore:
Timestamp:
04/29/04 14:06:19 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/msignal
Files:
4 edited

Legend:

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

    r3882 r3883  
    2828//  MExtractFixedWindow
    2929//
    30 //  Extracts the signal from a fixed window
     30//  Extracts the signal from a fixed window in a given range.
     31//
     32//  Call: SetRange(fHiGainFirst, fHiGainLast, fLoGainFirst, fLoGainLast)
     33//  to modify the ranges.
     34//  Defaults are:
     35//
     36//   fHiGainFirst =  fgHiGainFirst =  3
     37//   fHiGainLast  =  fgHiGainLast  =  14
     38//   fLoGainFirst =  fgLoGainFirst =  3
     39//   fLoGainLast  =  fgLoGainLast  =  14
    3140//
    3241//////////////////////////////////////////////////////////////////////////////
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.h

    r3868 r3883  
    3131  MExtractFixedWindow(const char *name=NULL, const char *title=NULL);
    3232
     33  void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
     34 
    3335  ClassDef(MExtractFixedWindow, 0) // Signal Extractor for a fixed extraction window
    3436};
  • trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.cc

    r3868 r3883  
    4040#include "MLogManip.h"
    4141
     42
    4243ClassImp(MExtractSlidingWindow);
    4344
     
    5556//
    5657MExtractSlidingWindow::MExtractSlidingWindow(const char *name, const char *title)
     58    : fWindowSizeHiGain(fgHiGainWindowSize),
     59      fWindowSizeLoGain(fgLoGainWindowSize)
    5760{
    5861
     
    6164
    6265  SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast);
    63   SetWindowSize();
    64 
     66}
     67
     68void MExtractSlidingWindow::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
     69{
     70
     71  MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
     72
     73  //
     74  // Redo the checks if the window is still inside the ranges
     75  //
     76
     77  SetWindowSize(fWindowSizeHiGain,fWindowSizeLoGain);
     78 
    6579}
    6680
     
    7286
    7387  if (fWindowSizeHiGain != windowh)
    74     *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size has to be even, set to: "
     88    *fLog << warn << GetDescriptor() << ": Hi Gain window size has to be even, set to: "
    7589          << int(fWindowSizeHiGain) << " samples " << endl;
    7690 
    77     if (fWindowSizeLoGain != windowl)
    78       *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size has to be even, set to: "
    79             << int(fWindowSizeLoGain) << " samples " << endl;
     91  if (fWindowSizeLoGain != windowl)
     92    *fLog << warn << GetDescriptor() << ": Lo Gain window size has to be even, set to: "
     93          << int(fWindowSizeLoGain) << " samples " << endl;
    8094   
    81     if (fWindowSizeHiGain<2)
    82       {
    83         fWindowSizeHiGain = 2;
    84       *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size set to two samples" << endl;
    85       }
     95  const Byte_t availhirange = (fHiGainLast-fHiGainFirst+1) & ~1;
     96  const Byte_t availlorange = (fLoGainLast-fLoGainFirst+1) & ~1;
     97
     98  if (fWindowSizeHiGain > availhirange)
     99    {
     100      *fLog << warn << GetDescriptor()
     101            << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fWindowSizeHiGain,
     102                    " is bigger than available range: [",(int)fHiGainFirst,",",(int)fHiGainLast,"]") << endl;
     103      *fLog << warn << GetDescriptor()
     104            << ": Will set window size to: " << (int)availhirange << endl;
     105      fWindowSizeHiGain = availhirange;
     106    }
     107 
     108  if (fWindowSizeLoGain > availlorange)
     109    {
     110      *fLog << warn << GetDescriptor()
     111            << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fWindowSizeLoGain,
     112                    " is bigger than available range: [",(int)fLoGainFirst,",",(int)fLoGainLast,"]") << endl;
     113      *fLog << warn << GetDescriptor()
     114            << ": Will set window size to: " << (int)availlorange << endl;
     115      fWindowSizeLoGain = availlorange;
     116    }
     117 
     118  if (fWindowSizeHiGain<2)
     119    {
     120      fWindowSizeHiGain = 2;
     121      *fLog << warn << GetDescriptor() << ": Hi Gain window size set to two samples" << endl;
     122    }
     123 
     124  if (fWindowSizeLoGain<2)
     125    {
     126      fWindowSizeLoGain = 2;
     127      *fLog << warn << GetDescriptor() << ": Lo Gain window size set to two samples" << endl;
     128    }
    86129   
    87     if (fWindowSizeLoGain<2)
    88     {
    89       fWindowSizeLoGain = 2;
    90       *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size set to two samples" << endl;
    91     }
    92    
    93     fNumHiGainSamples = (Float_t)fWindowSizeHiGain;
    94     fNumLoGainSamples = (Float_t)fWindowSizeLoGain;
    95    
    96     fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
    97     fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
    98 }
    99 
     130  fNumHiGainSamples = (Float_t)fWindowSizeHiGain;
     131  fNumLoGainSamples = (Float_t)fWindowSizeLoGain;
     132 
     133  fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
     134  fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
     135
     136}
    100137
    101138
  • trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.h

    r3868 r3883  
    2323  void   FindSignalLoGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const; 
    2424
     25 
    2526public:
    2627  MExtractSlidingWindow(const char *name=NULL, const char *title=NULL);
    2728
     29  void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
    2830  void SetWindowSize(Byte_t windowh=fgHiGainWindowSize,
    2931                     Byte_t windowl=fgLoGainWindowSize);
Note: See TracChangeset for help on using the changeset viewer.