Changeset 4896 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
09/09/04 16:55:42 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4895 r4896  
    1919
    2020                                                 -*-*- END OF LINE -*-*-
     21
     22 2004/09/09: Markus Gaug
     23
     24   * msignal/MExtractor.cc
     25   * msignal/MExtractTimeHighestIntegral.cc
     26   * msignal/MExtractSlidingWindow.cc
     27   * msignal/MExtractPINDiode.cc
     28   * msignal/MExtractFixedWindow.cc
     29   * msignal/MExtractBlindPixel.cc
     30   * msignal/MExtractAmplitudeSpline.cc
     31     - removed some possible bugs in the case that no LoGain is
     32       available at all.
     33
    2134
    2235 2004/09/09: Thomas Bretz
  • trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc

    r4771 r4896  
    260260  }
    261261
    262   const Int_t firstdesired   = (Int_t)fHiGainFirst;
    263   Int_t lastavailable  = (Int_t)fRunHeader->GetNumSamplesHiGain()-1;
    264  
    265   if (firstdesired > lastavailable)
    266   {
    267       const Int_t diff = firstdesired - lastavailable;
    268       *fLog << endl;
    269       *fLog << warn << "First Hi Gain slice " << (int)fHiGainFirst << " out of range [0,";
    270       *fLog << lastavailable << "]... start at slice " << diff << " of the Lo Gain " << endl;
    271      
    272       fHiLoFirst   = diff;
    273     }
    274 
    275   const Int_t lastdesired   = (Int_t)fHiGainLast;
    276  
     262  const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain();
     263  const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain();
     264  Int_t lastavailable       =  higainsamples-1;
     265
     266  if (logainsamples)
     267    {
     268      //
     269      // If the signal is searched entirely in the low-gain range, have
     270      // to skip the higain completely. This is steered by the variable fHiLoFirst
     271      //
     272      const Int_t firstdesired   = (Int_t)fHiGainFirst;
     273 
     274      if (firstdesired > lastavailable)
     275        {
     276          const Int_t diff = firstdesired - lastavailable;
     277          *fLog << endl;
     278          *fLog << warn << "First Hi Gain slice " << (int)fHiGainFirst << " out of range [0,";
     279          *fLog << lastavailable << "]... start at slice " << diff << " of the Lo Gain " << endl;
     280         
     281          fHiLoFirst   = diff;
     282        }
     283    }
     284 
     285  const Int_t lastdesired = (Int_t)fHiGainLast;
     286
    277287  if (lastdesired > lastavailable)
    278288    {
    279       Int_t diff = lastdesired - lastavailable;
    280       lastavailable += (Int_t)fRunHeader->GetNumSamplesLoGain()-1;
     289      Int_t diff     = lastdesired - lastavailable;
     290      lastavailable += logainsamples ? logainsamples-1 : 0;
    281291     
    282292      if (lastdesired > lastavailable)
     
    285295          *fLog << "Last Hi Gain slice " << (int)fHiGainLast << " out of range [0,";
    286296          *fLog << lastavailable << "]... reduce upper limit by " << diff << endl;
    287           diff = (Int_t)fRunHeader->GetNumSamplesLoGain();
    288         }
    289 
    290       fHiGainLast = (Int_t)fRunHeader->GetNumSamplesHiGain() - 1;
    291       fHiLoLast = diff;
     297          diff = logainsamples;
     298        }
     299
     300      fHiGainLast = higainsamples - 1;
     301      fHiLoLast   = logainsamples ? diff : 0;
    292302    }
    293303
     
    669679
    670680          sum = 0;
    671           FindSignalFilter(pixel.GetLoGainSamples(), sum, sat);         
     681          if (pixel.HasLoGain())
     682            FindSignalFilter(pixel.GetLoGainSamples(), sum, sat);         
    672683
    673684          /*
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.cc

    r4766 r4896  
    9999
    100100  const Byte_t windowhi = hilast-hifirst+1;
    101   const Byte_t windowlo = lolast-lofirst+1;
    102  
    103101  const Byte_t whieven = windowhi & ~1;
    104   const Byte_t wloeven = windowlo & ~1;
    105102
    106103  if (whieven != windowhi)
     
    112109    }
    113110 
    114   if (wloeven != windowlo)
    115     {
    116       *fLog << warn << GetDescriptor()
    117             << Form("%s%2i%s%2i",": Lo Gain window size has to be even, set last slice from "
    118                     ,(int)lolast," to ",(int)(lolast-1)) << endl;
    119       lolast -= 1;
    120     }
    121  
    122111  if (whieven<2)
    123112    {
     
    128117    }
    129118 
    130   if (wloeven<2)
    131     {
    132       *fLog << warn << GetDescriptor()
     119
     120  if (lolast != 0)
     121    {
     122      const Byte_t windowlo = lolast-lofirst+1;
     123      const Byte_t wloeven = windowlo & ~1;
     124
     125      if (wloeven != windowlo)
     126        {
     127          *fLog << warn << GetDescriptor()
     128                << Form("%s%2i%s%2i",": Lo Gain window size has to be even, set last slice from "
     129                        ,(int)lolast," to ",(int)(lolast-1)) << endl;
     130          lolast -= 1;
     131        }
     132     
     133      if (wloeven<2)
     134        {
     135          *fLog << warn << GetDescriptor()
    133136            << Form("%s%2i%s%2i",": Lo Gain window is smaller than 2 FADC sampes, set last slice from"
    134137                    ,(int)lolast," to ",(int)(lofirst+1)) << endl;
    135       lolast = lofirst+1;       
    136     }
    137 
     138          lolast = lofirst+1;       
     139        }
     140    }
    138141
    139142  MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
    140143
    141144  fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst+1);
    142   fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1); 
     145  if (fLoGainLast != 0)
     146    fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1); 
     147  else
     148    fNumLoGainSamples = 0.;
    143149
    144150  fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
     
    166172  *fLog << inf << GetDescriptor() << ": Taking " << fNumHiGainSamples
    167173        << " HiGain samples from slice " << (Int_t)fHiGainFirst
    168         << " to " << (Int_t)(fHiGainLast+fHiLoLast) << "incl" << endl;
     174        << " to " << (Int_t)(fHiGainLast+fHiLoLast) << " incl" << endl;
    169175  *fLog << inf << GetDescriptor() << ": Taking " << fNumLoGainSamples
    170176        << " LoGain samples from slice " << (Int_t)fLoGainFirst
    171         << " to " << (Int_t)fLoGainLast << "incl" << endl;
     177        << " to " << (Int_t)fLoGainLast << " incl" << endl;
    172178  return kTRUE;
    173179 
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.h

    r4723 r4896  
    2727 
    2828  Bool_t ReInit(MParList *pList);
    29 
     29 
    3030public:
    3131
  • trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc

    r3962 r4896  
    128128  MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
    129129
    130 
    131130  fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst+1);
    132   fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1); 
     131  fNumLoGainSamples = (fLoGainLast == 0) ? 0. : (Float_t)(fLoGainLast-fLoGainFirst+1); 
    133132
    134133  fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
    135134  fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 
    136135 
    137   fNumSamples = fHiGainLast-fHiGainFirst+1+fLoGainLast-fLoGainFirst+1;
     136  fNumSamples = (fLoGainLast == 0)
     137    ? fHiGainLast-fHiGainFirst+1
     138    : fHiGainLast-fHiGainFirst+1+fLoGainLast-fLoGainFirst+1;
    138139  fSqrtSamples = TMath::Sqrt((Float_t)fNumSamples);
    139140 
     
    260261 
    261262  FindSignalandVarianceHiGain(pixel.GetHiGainSamples()+fHiGainFirst,sum,sum2,sat);
    262   FindSignalandVarianceLoGain(pixel.GetLoGainSamples()+fLoGainFirst,sum,sum2,sat);
     263  if (pixel.HasLoGain())
     264    FindSignalandVarianceLoGain(pixel.GetLoGainSamples()+fLoGainFirst,sum,sum2,sat);
    263265
    264266  const Float_t var = ((Float_t)sum2 - (Float_t)sum*sum/fNumSamples)/(fNumSamples-1);
  • trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc

    r4732 r4896  
    7979  MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
    8080
    81 
    8281  Int_t range = fHiGainLast - fHiGainFirst + 1;
    8382 
     
    9291    }
    9392 
    94   range = fLoGainLast - fLoGainFirst + 1;
    95 
    96   if (range < 2)
    97     {
    98       *fLog << warn << GetDescriptor()
    99             << Form("%s%2i%s%2i%s",": Lo-Gain Extraction range [",(int)fLoGainFirst,","
    100                     ,fLoGainLast,"] too small, ") << endl;
    101       *fLog << warn << GetDescriptor()
    102             << " will move logher limit to obtain 4 slices " << endl;
    103       SetRange(fHiGainFirst, fHiGainLast,fLoGainFirst,fLoGainLast+4-range);
    104     }
    105 
     93  if (fLoGainLast != 0)
     94    {
     95      range = fLoGainLast - fLoGainFirst + 1;
     96     
     97      if (range < 2)
     98        {
     99          *fLog << warn << GetDescriptor()
     100                << Form("%s%2i%s%2i%s",": Lo-Gain Extraction range [",(int)fLoGainFirst,","
     101                        ,fLoGainLast,"] too small, ") << endl;
     102          *fLog << warn << GetDescriptor()
     103                << " will move lower limit to obtain 4 slices " << endl;
     104          SetRange(fHiGainFirst, fHiGainLast,fLoGainFirst,fLoGainLast+4-range);
     105        }
     106    }
    106107
    107108  SetWindowSize(fHiGainWindowSize,fLoGainWindowSize);
    108109
    109110  fNumHiGainSamples = fHiGainLast-fHiGainFirst+1;
    110   fNumLoGainSamples = fLoGainLast-fLoGainFirst+1;
     111  fNumLoGainSamples = fLoGainLast ? fLoGainLast-fLoGainFirst+1 : 0;
    111112 
    112113}
  • trunk/MagicSoft/Mars/msignal/MExtractor.cc

    r4723 r4896  
    191191Bool_t MExtractor::ReInit(MParList *pList)
    192192{
    193     Int_t lastdesired   = (Int_t)(fLoGainLast);
    194     Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1;
    195 
    196     if (lastavailable < 0)
     193
     194  const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain();
     195
     196  Int_t lastdesired;
     197  Int_t lastavailable;
     198
     199  if (logainsamples)
     200    {
     201
     202      lastdesired   = (Int_t)(fLoGainLast);
     203      lastavailable = logainsamples-1;
     204     
     205      if (lastavailable < 0)
    197206        *fLog << warn << GetDescriptor() << " - WARNING: Number of available Low-Gain Slices is smaller than or equal zero!" << endl;
    198 
     207     
    199208    if (lastdesired > lastavailable)
    200     {
     209      {
    201210        const Int_t diff = lastdesired - lastavailable;
    202 
     211       
    203212        *fLog << endl;
    204213        *fLog << warn << GetDescriptor() << ": Selected Lo Gain FADC Window [";
     
    207216        *fLog << GetDescriptor() << ": Will reduce the upper edge to " << (int)(fLoGainLast - diff) << endl;
    208217        SetRange(fHiGainFirst, fHiGainLast, fLoGainFirst, fLoGainLast-diff);
    209     }
    210 
    211     lastdesired   = (Int_t)fHiGainLast;
    212     lastavailable = (Int_t)fRunHeader->GetNumSamplesHiGain()-1;
    213 
    214     if (lastavailable < 0)
    215     {
    216         *fLog << err << GetDescriptor();
    217         *fLog << " - ERROR: Number of available High-Gain Slices is smaller than or equal zero!" << endl;
    218         return kFALSE;
    219     }
    220 
     218      }
     219    }
     220  else
     221    SetRange(fHiGainFirst, fHiGainLast, 0,0);     
     222 
     223  const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain();
     224
     225  if (higainsamples <= 0)
     226    {
     227      *fLog << err << GetDescriptor();
     228      *fLog << " - ERROR: Number of available High-Gain Slices is smaller than or equal zero!" << endl;
     229      return kFALSE;
     230    }
     231
     232  lastdesired   = (Int_t)fHiGainLast;
     233  lastavailable = higainsamples-1;
     234 
    221235  if (lastdesired > lastavailable)
    222   {
     236    {
    223237      const Int_t diff = lastdesired - lastavailable;
    224 
     238     
    225239      *fLog << endl;
    226240      *fLog << warn << GetDescriptor() << ": Selected Hi Gain FADC Window [";
     
    230244      *fLog << Form("%2i", diff) << " samples from the Low-Gain for the High-Gain extraction";
    231245      *fLog << endl;
    232 
     246     
    233247      fHiGainLast -= diff;
    234248      fHiLoLast    = diff;
    235   }
    236 
     249    }
     250 
    237251  return kTRUE;
    238252}
Note: See TracChangeset for help on using the changeset viewer.