Ignore:
Timestamp:
06/23/04 02:00:32 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/msignal
Files:
2 added
11 edited

Legend:

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

    r4298 r4340  
    186186// - If *logain is greater than fSaturationLimit, raise sat by 1
    187187//
    188 void MExtractFixedWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const
    189 {
     188void MExtractFixedWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const
     189{
     190
     191  Int_t summ = 0;
    190192
    191193  Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1;
     
    193195  while (ptr<end)
    194196    {
    195       sum += *ptr;
     197      summ += *ptr;
    196198      if (*ptr++ >= fSaturationLimit)
    197199        sat++;
    198200    }
    199201
    200   if (fHiLoLast == 0)
    201     return;
    202  
     202  Byte_t *p = logain;
    203203  end = logain + fHiLoLast;
    204   while (logain<end)
    205     {
    206       sum += *logain;
    207      
    208       if (*logain++ >= fSaturationLimit)
     204  while (p<end)
     205    {
     206      summ += *p;
     207      if (*p++ >= fSaturationLimit)
    209208        sat++;
    210209    }
     210
     211  sum = (Float_t)summ;
     212
     213  return;
    211214}
    212215
     
    221224// - Add contents of *logain to sum
    222225//
    223 void MExtractFixedWindow::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const
    224 {
     226void MExtractFixedWindow::FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const
     227{
     228
     229  Int_t summ = 0;
    225230
    226231  Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1;
     
    228233  while (ptr<end)
    229234    {
    230       sum += *ptr;
     235      summ += *ptr;
    231236     
    232237      if (*ptr++ >= fSaturationLimit)
    233238        sat++;
    234239    }
     240
     241  sum = (Float_t)summ;
    235242}
    236243
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.h

    r3951 r4340  
    2222  static const Byte_t fgLoGainLast;      // Last FADC slice Lo-Gain (currently set to: 14)
    2323
    24   void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const;
    25   void   FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const;
     24  void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const;
     25  void   FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const;
    2626  void   StreamPrimitive(ofstream &out) const;
    2727 
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc

    r4252 r4340  
    299299// - If *ptr is greater than fSaturationLimit, raise sat by 1
    300300//
    301 void MExtractFixedWindowPeakSearch::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const
     301void MExtractFixedWindowPeakSearch::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const
    302302{
    303303
    304304  Byte_t *end = ptr + fWindowSizeHiGain-fHiLoLast;
    305305
     306  Int_t summ = 0;
    306307  //
    307308  // Calculate the sum of the "window" slices starting in ptr
     
    309310  while (ptr<end)
    310311    {
    311       sum += *ptr;
     312      summ += *ptr;
    312313      if (*ptr++ >= fSaturationLimit)
    313314        sat++;
     
    323324    {
    324325 
    325       sum += *p;
     326      summ += *p;
    326327      if (*p++ >= fSaturationLimit)
    327328        sat++;
    328329    }
    329330
     331  sum = (Float_t)summ;
    330332  return;
    331333}
     
    339341// - If *ptr is greater than fSaturationLimit, raise sat by 1
    340342//
    341 void MExtractFixedWindowPeakSearch::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const
     343void MExtractFixedWindowPeakSearch::FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const
    342344{
    343345  //
     
    345347  //
    346348  Byte_t *p = ptr;
     349  Int_t summ = 0;
    347350
    348351  while (p<ptr+fWindowSizeLoGain)
    349352    {
    350       sum += *p;
     353      summ += *p;
    351354      if (*p++ >= fSaturationLimit)
    352355        sat++;
    353356    }
    354357
     358  sum = (Float_t)summ;
    355359  return;
    356360}
     
    417421      // Find signal in hi- and lo-gain
    418422      //
    419       Int_t sumhi=0;
     423      Float_t sumhi=0.;
    420424      Byte_t sathi=0;
    421425
    422426      FindSignalHiGain(pixel.GetHiGainSamples()+hiGainFirst, pixel.GetLoGainSamples(), sumhi, sathi);
    423427
    424       Int_t sumlo=0;
     428      Float_t sumlo=0.;
    425429      Byte_t satlo=0;
    426430      if (pixel.HasLoGain())
     
    449453
    450454      pix.SetGainSaturation(sathi, sathi, satlo);
     455
     456      //      pix.SetNumHiGainSlices(fNumHiGainSamples);
     457      //      pix.SetNumLoGainSlices(fNumLoGainSamples);     
     458     
    451459    } /* while (pixel.Next()) */
    452460
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h

    r4252 r4340  
    2626  Byte_t  fLowGainPeakShift;     // Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices.
    2727
    28   void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const;
    29   void   FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const; 
     28  void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const;
     29  void   FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const; 
    3030
    3131  void   FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat) const;
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowSpline.cc

    r4276 r4340  
    224224// - If *logain is greater than fSaturationLimit, raise sat by 1
    225225//
    226 void MExtractFixedWindowSpline::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const
     226void MExtractFixedWindowSpline::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const
    227227{
    228228 
     
    236236  fHiGainFirstDeriv[0]  = 0.;
    237237
    238   Float_t sumf = *ptr++/2.;
     238  Int_t summ = 0;
     239  sum = (Float_t)*ptr++/2.;
    239240  //
    240241  // Check for saturation in all other slices
     
    243244    {
    244245
    245       sumf += *ptr;
     246      summ += *ptr;
    246247      i++;
    247248
     
    260261  if (fHiLoLast == 0)
    261262    {
    262       sumf += *ptr/2.;
     263      sum += (Float_t)*ptr/2.;
    263264      fHiGainSecondDeriv[++i] = 0.;     
    264265
     
    266267  else
    267268    {
    268       sumf += *ptr;
     269      summ += *ptr;
    269270      i++;
    270271
     
    279280        {
    280281
    281           sumf += *logain;
     282          summ += *logain;
    282283          i++;
    283284         
     
    291292         
    292293        }
    293       sumf += *logain/2;
     294      sum += (Float_t)*logain/2;
    294295      fHiGainSecondDeriv[++i] = 0.;
    295296    }
     
    298299    {
    299300      fHiGainSecondDeriv[k] = fHiGainSecondDeriv[k]*fHiGainSecondDeriv[k+1] + fHiGainFirstDeriv[k];
    300       sumf += 0.25*fHiGainSecondDeriv[k];
    301     }
    302  
    303   sum = (Int_t)sumf;
     301      sum += 0.25*fHiGainSecondDeriv[k];
     302    }
     303 
     304  sum += (Float_t)summ;
    304305}
    305306
     
    312313// - If *ptr is greater than fSaturationLimit, raise sat by 1
    313314//
    314 void MExtractFixedWindowSpline::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const
     315void MExtractFixedWindowSpline::FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const
    315316{
    316317 
     
    324325  fLoGainFirstDeriv[0]  = 0.;
    325326
    326   Float_t sumf = *ptr++/2.;
     327  Int_t summ = 0;
     328  sum = (Float_t)*ptr++/2.;
    327329  //
    328330  // Check for saturation in all other slices
     
    331333    {
    332334
    333       sumf += *ptr;
     335      summ += *ptr;
    334336      i++;
    335337
     
    346348    sat++;
    347349
    348   sumf += *ptr/2.;
     350  sum += (Float_t)*ptr/2.;
    349351  fLoGainSecondDeriv[++i] = 0.;     
    350352 
     
    352354    {
    353355      fLoGainSecondDeriv[k] = fLoGainSecondDeriv[k]*fLoGainSecondDeriv[k+1] + fLoGainFirstDeriv[k];
    354       sumf += 0.25*fLoGainSecondDeriv[k];
    355     }
    356  
    357   sum = (Int_t)sumf;
    358 }
    359 
     356      sum += 0.25*fLoGainSecondDeriv[k];
     357    }
     358 
     359  sum += (Float_t)summ;
     360}
     361
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowSpline.h

    r4276 r4340  
    2323  Bool_t ReInit    (MParList *pList);
    2424 
    25   void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const;
    26   void   FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const;
     25  void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const;
     26  void   FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const;
    2727
    2828public:
  • trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.cc

    r3951 r4340  
    215215// - Check if the sum has become bigger and store it in case yes.
    216216//
    217 void MExtractSlidingWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &max, Byte_t &sat) const
     217void MExtractSlidingWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &max, Byte_t &sat) const
    218218{
    219219    const Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1;
    220220
    221221    Int_t sum=0;
     222    Int_t sumtot =0;
    222223
    223224    //
     
    259260    // This is fast and accurate (because we are using int's)
    260261    //
    261     max=sum;
     262    sumtot=sum;
    262263    for (p=ptr; p+fWindowSizeHiGain-fHiLoLast<end; p++)
    263264    {
    264265        sum += *(p+fWindowSizeHiGain-fHiLoLast) - *p;
    265         if (sum>max)
    266             max = sum;
     266        if (sum>sumtot)
     267            sumtot = sum;
    267268    }
    268269
     
    270271    {
    271272        sum += *l - *p++;
    272         if (sum>max)
    273             max = sum;
    274     }
    275 
     273        if (sum>sumtot)
     274            sumtot = sum;
     275    }
     276    max = (Float_t)sumtot;
    276277}
    277278
     
    288289// - Check if the sum has become bigger and store it in case yes.
    289290//
    290 void MExtractSlidingWindow::FindSignalLoGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const
     291void MExtractSlidingWindow::FindSignalLoGain(Byte_t *ptr, Float_t &max, Byte_t &sat) const
    291292{
    292293    const Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1;
    293294
    294295    Int_t sum=0;
    295 
     296    Int_t sumtot=0;
    296297    //
    297298    // Calculate the sum of the first fWindowSize slices
     
    318319    // This is fast and accurate (because we are using int's)
    319320    //
    320     max=sum;
     321    sumtot=sum;
    321322    for (p=ptr; p+fWindowSizeLoGain<end; p++)
    322323    {
    323324        sum += *(p+fWindowSizeLoGain) - *p;
    324         if (sum>max)
    325             max = sum;
    326     }
    327 }
    328 
     325        if (sum>sumtot)
     326            sumtot = sum;
     327    }
     328    max = (Float_t)sumtot;
     329}
     330
     331
  • trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.h

    r3951 r4340  
    2020  Byte_t  fWindowSizeLoGain;             // Number of Lo Gain slices in window 
    2121 
    22   void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &max, Byte_t &sat) const;
    23   void   FindSignalLoGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const; 
     22  void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &max, Byte_t &sat) const;
     23  void   FindSignalLoGain(Byte_t *ptr, Float_t &max, Byte_t &sat) const; 
    2424
    2525  Bool_t  ReInit(MParList *pList);
  • trunk/MagicSoft/Mars/msignal/MExtractor.cc

    r4235 r4340  
    228228
    229229
    230 void MExtractor::FindSignalHiGain(Byte_t *firstused, Byte_t *logain, Int_t &sum, Byte_t &sat) const
     230void MExtractor::FindSignalHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Byte_t &sat) const
    231231{
    232232  return;
    233233}
    234234
    235 void MExtractor::FindSignalLoGain(Byte_t *firstused, Int_t &sum, Byte_t &sat) const
     235void MExtractor::FindSignalLoGain(Byte_t *firstused, Float_t &sum, Byte_t &sat) const
    236236{
    237237  return;
     
    251251  while (pixel.Next())
    252252    {
    253       Int_t sumhi  = 0;
     253      Float_t sumhi = 0.;
    254254      Byte_t sathi = 0;
    255255
    256256      FindSignalHiGain(pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), sumhi, sathi);
    257257
    258       Int_t  sumlo = 0;
     258      Float_t sumlo = 0.;
    259259      Byte_t satlo = 0;
    260260
     
    269269      const Float_t pedes  = ped.GetPedestal();
    270270      const Float_t pedrms = ped.GetPedestalRms();
    271      
     271
    272272      pix.SetExtractedSignal(sumhi - pedes*fNumHiGainSamples, pedrms*fSqrtHiGainSamples,
    273273                             sumlo - pedes*fNumLoGainSamples, pedrms*fSqrtLoGainSamples);
  • trunk/MagicSoft/Mars/msignal/Makefile

    r4276 r4340  
    3737           MExtractFixedWindowPeakSearch.cc \
    3838           MExtractFixedWindowSpline.cc \
     39           MExtractAmplitudeSpline.cc \
    3940           MExtractSignal.cc \
    4041           MExtractSignal2.cc \
  • trunk/MagicSoft/Mars/msignal/SignalLinkDef.h

    r4276 r4340  
    1919#pragma link C++ class MExtractFixedWindowPeakSearch+;
    2020#pragma link C++ class MExtractFixedWindowSpline+;
     21#pragma link C++ class MExtractAmplitudeSpline+;
    2122#pragma link C++ class MExtractPINDiode++;
    2223#pragma link C++ class MExtractBlindPixel++;
Note: See TracChangeset for help on using the changeset viewer.