Changeset 3882 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/29/04 14:01:47 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r3868 r3882  
    3636#include <fstream>
    3737
     38#include "MLog.h"
     39#include "MLogManip.h"
    3840
    3941ClassImp(MExtractFixedWindow);
     
    4951// Default constructor.
    5052//
     53// Calls:
     54// - SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast)
     55//
    5156MExtractFixedWindow::MExtractFixedWindow(const char *name, const char *title)
    5257{
     
    5762  SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast);
    5863
    59   fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst) + 1.;
    60   fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst) + 1.;
     64}
     65
     66
     67// --------------------------------------------------------------------------
     68//
     69// SetRange:
     70//
     71// Checks:
     72// - if the window defined by (fHiGainLast-fHiGainFirst-1) are odd, subtract one
     73// - if the window defined by (fLoGainLast-fLoGainFirst-1) are odd, subtract one
     74// - if the Hi Gain window is smaller than 2, set fHiGainLast to fHiGainFirst+1
     75// - if the Lo Gain window is smaller than 2, set fLoGainLast to fLoGainFirst+1
     76//
     77// Calls:
     78// - MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
     79//
     80// Sets:
     81// - fNumHiGainSamples to: (Float_t)(fHiGainLast-fHiGainFirst+1)
     82// - fNumLoGainSamples to: (Float_t)(fLoGainLast-fLoGainFirst+1)
     83// - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples)
     84// - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples) 
     85// 
     86void MExtractFixedWindow::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
     87{
     88
     89  const Byte_t windowhi = hilast-hifirst+1;
     90  const Byte_t windowlo = lolast-lofirst+1;
     91 
     92  const Byte_t whieven = windowhi & ~1;
     93  const Byte_t wloeven = windowlo & ~1;
     94
     95  if (whieven != windowhi)
     96    {
     97      *fLog << warn << GetDescriptor()
     98            << Form("%s%2i%s%2i",": Hi Gain window size has to be even, set last slice from "
     99                    ,(int)hilast," to ",(int)(hilast-1)) << endl;
     100      hilast -= 1;
     101    }
     102 
     103  if (wloeven != windowlo)
     104    {
     105      *fLog << warn << GetDescriptor()
     106            << Form("%s%2i%s%2i",": Lo Gain window size has to be even, set last slice from "
     107                    ,(int)lolast," to ",(int)(lolast-1)) << endl;
     108      lolast -= 1;
     109    }
     110 
     111  if (whieven<2)
     112    {
     113      *fLog << warn << GetDescriptor()
     114            << Form("%s%2i%s%2i",": Hi Gain window is smaller than 2 FADC sampes, set last slice from"
     115                    ,(int)hilast," to ",(int)(hifirst+1)) << endl;
     116      hilast = hifirst+1;
     117    }
     118 
     119  if (wloeven<2)
     120    {
     121      *fLog << warn << GetDescriptor()
     122            << Form("%s%2i%s%2i",": Lo Gain window is smaller than 2 FADC sampes, set last slice from"
     123                    ,(int)lolast," to ",(int)(lofirst+1)) << endl;
     124      lolast = lofirst+1;       
     125    }
     126
     127
     128  MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
     129
     130  fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst+1);
     131  fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1); 
    61132
    62133  fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
    63   fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
    64 }
    65 
    66 
     134  fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 
     135 
     136}
     137
     138
     139// --------------------------------------------------------------------------
     140//
     141// FindSignalHiGain:
     142//
     143// - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst)
     144// - Sum up contents of *ptr
     145// - If *ptr is greater than fSaturationLimit, raise sat by 1
     146//
    67147void MExtractFixedWindow::FindSignalHiGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const
    68148{
     
    82162}
    83163
     164// --------------------------------------------------------------------------
     165//
     166// FindSignalLoGain:
     167//
     168// - Loop from ptr to (ptr+fLoGainLast-fLoGainFirst)
     169// - Sum up contents of *ptr
     170// - If *ptr is greater than fSaturationLimit, raise sat by 1
     171//
    84172void MExtractFixedWindow::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const
    85173{
Note: See TracChangeset for help on using the changeset viewer.