Ignore:
Timestamp:
03/09/04 19:24:09 (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/MExtractSignal.cc

    r3397 r3446  
    109109        return kFALSE;
    110110
    111     fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1,
    112                                 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1);
     111    fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, (Float_t)fNumHiGainSamples,
     112                                fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1, (Float_t)fNumLoGainSamples);
    113113
    114114    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
  • trunk/MagicSoft/Mars/msignal/MExtractSignal2.cc

    r3397 r3446  
    7777}
    7878
    79 void MExtractSignal2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast, Byte_t windowsize)
     79void MExtractSignal2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t windowh, Byte_t lofirst, Byte_t lolast, Byte_t windowl)
    8080{
    8181
     
    8686    fLoGainFirst = lofirst;
    8787
    88    
    89     fWindowSize = windowsize & ~1;
    90 
    91     if (fWindowSize != windowsize)
    92       *fLog << warn << "MExtractSignal2::SetRange - window size has to be even, set to: " << int(fWindowSize) << " samples " << endl;
     88    fWindowSizeHiGain = windowh & ~1;
     89    fWindowSizeLoGain = windowl & ~1;
     90
     91    if (fWindowSizeHiGain != windowh)
     92      *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size has to be even, set to: "
     93            << int(fWindowSizeHiGain) << " samples " << endl;
    9394   
    94     if (fWindowSize<2)
    95     {
    96       fWindowSize = 2;
    97       *fLog << warn << "MExtractSignal2::SetRange - window size set to two samples" << endl;
    98     }
    99 
    100     if (fWindowSize > fNumHiGainSamples)
    101     {
    102       fWindowSize = fNumLoGainSamples & ~1;
    103       *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl;
    104     }
     95    if (fWindowSizeLoGain != windowl)
     96      *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size has to be even, set to: "
     97            << int(fWindowSizeLoGain) << " samples " << endl;
    10598   
    106     if (fWindowSize > fNumLoGainSamples)
    107     {
    108       fWindowSize = fNumLoGainSamples & ~1;
    109       *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl;
    110     }
    111 
    112     fWindowSizeSqrt = TMath::Sqrt((Float_t)fWindowSize);
     99    if (fWindowSizeHiGain<2)
     100    {
     101      fWindowSizeHiGain = 2;
     102      *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size set to two samples" << endl;
     103    }
     104
     105    if (fWindowSizeLoGain<2)
     106    {
     107      fWindowSizeLoGain = 2;
     108      *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size set to two samples" << endl;
     109    }
     110
     111    if (fWindowSizeHiGain > fNumHiGainSamples)
     112    {
     113      fWindowSizeHiGain = fNumHiGainSamples & ~1;
     114      *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size set to "
     115            << int(fWindowSizeHiGain) << " samples " << endl;
     116    }
     117   
     118    if (fWindowSizeLoGain > fNumLoGainSamples)
     119    {
     120      fWindowSizeLoGain = fNumLoGainSamples & ~1;
     121      *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size set to "
     122            << int(fWindowSizeLoGain) << " samples " << endl;
     123    }
     124
     125    fWindowSqrtHiGain = TMath::Sqrt((Float_t)fWindowSizeHiGain);
     126    fWindowSqrtLoGain = TMath::Sqrt((Float_t)fWindowSizeLoGain);
    113127
    114128}
     
    141155        return kFALSE;
    142156
    143     fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1,
    144                                 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1);
     157    fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, (Float_t)fWindowSizeHiGain,
     158                                fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1, (Float_t)fWindowSizeLoGain);
    145159
    146160    fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));
     
    158172}
    159173
    160 void MExtractSignal2::FindSignal(Byte_t *ptr, Byte_t size, Int_t &max, Int_t &sat) const
     174void MExtractSignal2::FindSignal(Byte_t *ptr, Byte_t size, Byte_t window, Int_t &max, Int_t &sat) const
    161175{
    162176    const Byte_t *end = ptr + size;
     
    169183    sat = 0;
    170184    Byte_t *p = ptr;
    171     while (p<ptr+fWindowSize)
     185    while (p<ptr+window)
    172186    {
    173187        sum += *p;
     
    189203    //
    190204    max=sum;
    191     for (p=ptr; p+fWindowSize<end; p++)
    192     {
    193         sum += *(p+fWindowSize) - *p;
     205    for (p=ptr; p+window<end; p++)
     206    {
     207        sum += *(p+window) - *p;
    194208        if (sum>max)
    195209            max = sum;
     
    214228        //
    215229        Int_t sumhi, sathi;
    216         FindSignal(pixel.GetHiGainSamples()+fHiGainFirst, fNumHiGainSamples, sumhi, sathi);
     230        FindSignal(pixel.GetHiGainSamples()+fHiGainFirst, fNumHiGainSamples, fWindowSizeHiGain, sumhi, sathi);
    217231
    218232        Int_t sumlo=0;
     
    220234        if (pixel.HasLoGain())
    221235        {
    222             FindSignal(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, sumlo, satlo);
     236            FindSignal(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, fWindowSizeLoGain, sumlo, satlo);
    223237            if (satlo)
    224238                sat++;
     
    239253        // Set extracted signal with pedestal substracted
    240254        //
    241         pix.SetExtractedSignal(sumhi - pedes*fWindowSize, pedrms*fWindowSizeSqrt,
    242                                sumlo - pedes*fWindowSize, pedrms*fWindowSizeSqrt);
     255        pix.SetExtractedSignal(sumhi - pedes*fWindowSizeHiGain, pedrms*fWindowSqrtHiGain,
     256                               sumlo - pedes*fWindowSizeLoGain, pedrms*fWindowSqrtLoGain);
    243257
    244258        pix.SetGainSaturation(sathi, sathi, satlo);
  • trunk/MagicSoft/Mars/msignal/MExtractSignal2.h

    r3306 r3446  
    3737    Byte_t  fNumLoGainSamples;  // Number of lo gain to be used
    3838
    39     Byte_t  fWindowSize;            // Number of gains in window
    40     Float_t fWindowSizeSqrt;        // Sqaure root of number of gains in window
     39    Byte_t  fWindowSizeHiGain;  // Number of Hi Gain slices in window
     40    Float_t fWindowSqrtHiGain;  // Sqaure root of number of Hi Gain slices in window
     41
     42    Byte_t  fWindowSizeLoGain;  // Number of Lo Gain slices in window
     43    Float_t fWindowSqrtLoGain;  // Sqaure root of number of Lo Gain slices in window
    4144
    4245    Byte_t  fSaturationLimit;
    4346
    44     void   FindSignal(Byte_t *ptr, Byte_t size, Int_t &max, Int_t &sat) const;
     47    void   FindSignal(Byte_t *ptr, Byte_t size, Byte_t window, Int_t &max, Int_t &sat) const;
    4548
    4649    Int_t  PreProcess(MParList *pList);
     
    5053    MExtractSignal2(const char *name=NULL, const char *title=NULL);
    5154
    52     void SetRange(Byte_t hifirst=fgFirst, Byte_t hilast=fgLast, Byte_t lofirst=fgFirst, Byte_t lolast=fgLast, Byte_t window_size=fgWindowSize);
     55    void SetRange(Byte_t hifirst=fgFirst, Byte_t hilast=fgLast, Byte_t windowh=fgWindowSize,
     56                  Byte_t lofirst=fgFirst, Byte_t lolast=fgLast, Byte_t windowl=fgWindowSize);
    5357    void SetSaturationLimit(Byte_t lim) { fSaturationLimit = lim; }
    5458
  • trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.h

    r3306 r3446  
    2424    Byte_t fLastUsedSliceLoGain;
    2525
     26    Float_t fUsedWindowHiGain;
     27    Float_t fUsedWindowLoGain;
     28   
    2629public:
    2730
     
    3639    Int_t GetSize() const;
    3740
    38     Byte_t GetNumUsedFADCSlices() const       { return fLastUsedSliceHiGain-fFirstUsedSliceHiGain+1; }
    39     Byte_t GetNumUsedHiGainFADCSlices() const { return fLastUsedSliceHiGain-fFirstUsedSliceHiGain+1; }
    40     Byte_t GetNumUsedLoGainFADCSlices() const { return fLastUsedSliceLoGain-fFirstUsedSliceLoGain+1; }
     41    Float_t GetNumUsedHiGainFADCSlices() const { return fUsedWindowHiGain; }
     42    Float_t GetNumUsedLoGainFADCSlices() const { return fUsedWindowLoGain; }
    4143
    4244    Byte_t GetFirstUsedSliceHiGain() const    { return fFirstUsedSliceHiGain; }
    43     Byte_t GetLastUsedSliceHiGain() const     { return fLastUsedSliceHiGain; }
     45    Byte_t GetFirstUsedSliceLoGain() const    { return fFirstUsedSliceLoGain; }
    4446
    45     Byte_t GetFirstUsedSliceLoGain() const    { return fFirstUsedSliceLoGain; }
    46     Byte_t GetLastUsedSliceLoGain() const     { return fLastUsedSliceLoGain; }
     47    Byte_t GetLastUsedSliceHiGain()  const    { return fLastUsedSliceHiGain; }
     48    Byte_t GetLastUsedSliceLoGain()  const    { return fLastUsedSliceLoGain; }
    4749
    48     void   SetUsedFADCSlices(Byte_t firsth, Byte_t lasth,
    49                              Byte_t firstl, Byte_t lastl)
     50    void   SetUsedFADCSlices(Byte_t firsth, Byte_t lasth, Float_t winh,
     51                             Byte_t firstl, Byte_t lastl, Float_t winl)
    5052    {
    5153      fFirstUsedSliceHiGain    = firsth;
    5254      fLastUsedSliceHiGain     = lasth;
     55      fUsedWindowHiGain        = winh;
    5356      fFirstUsedSliceLoGain    = firstl;
    5457      fLastUsedSliceLoGain     = lastl;
     58      fUsedWindowLoGain        = winl;
    5559    }
    5660
Note: See TracChangeset for help on using the changeset viewer.