Changeset 4342 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
06/23/04 02:31:43 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4327 r4342  
    5151    - adapted for various blind pixels
    5252    - adapted Draw for the datacheck
     53
     54  * msignal/MExtractor.[h,cc]
     55  * msignal/MExtractFixedWindow.[h,cc]
     56  * msignal/MExtractSlidingWindow.[h,cc]
     57  * msignal/MExtractFixedWindowPeakSearch.[h,cc]
     58  * msignal/MExtractFixedWindowSpline.[h,cc]
     59    - made sum in FindSignal() float which is now the variable used by
     60      the majority of the extractors.
     61
     62  * msignal/MExtractAmplitudeSpline.[h,cc]
     63    - new extractor calculating the amplitude using a spline.
     64
     65  * mcalib/MCalibrationPix.[h,cc]
     66  * mcalib/MCalibrationChargePix.[h,cc]
     67  * mcalib/MCalibrationChargeCalc.[h,cc]
     68    - added debug flags and output on debug
     69
     70  * mbadpixels/MBadPixelsCam.cc
     71    - enlarged the Print-function
    5372
    5473
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc

    r4217 r4342  
    171171void MBadPixelsCam::Print(Option_t *o) const
    172172{
    173     *fLog << all << GetDescriptor() << ":" << endl;
     173  *fLog << all << GetDescriptor() << ":" << endl;
     174 
     175  *fLog << "Pixels without problems:" << endl;
     176  *fLog << endl;
    174177   
    175     *fLog << "Pixels without problems:" << endl;
    176     *fLog << endl;
    177 
    178     Int_t count = 0;
    179 
    180     for (Int_t i=0; i<GetSize(); i++)
    181     {
    182         if (!(*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    183         {
    184             *fLog << i << " ";
    185             count ++;
    186         }
    187 
    188         if (count == 0)
    189             continue;
    190 
    191         if (!(count % 25))
    192             *fLog << endl;
    193     }
    194     *fLog << endl;
    195     *fLog << count << " normal pixels :-))" << endl;
    196     *fLog << endl;
    197     count = 0;
    198 
    199 
    200     *fLog << "Pixels unsuited for the whole run:" << endl;
    201     *fLog << endl;
    202 
    203     for (Int_t i=0; i<GetSize(); i++)
    204     {
    205         if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    206         {
    207             *fLog << i << " ";
    208             count ++;
    209         }
    210 
    211         if (count == 0)
    212             continue;
    213 
    214         if (!(count % 25))
    215             *fLog << endl;
    216     }
    217     *fLog << endl;
    218     *fLog << count << " unsuited pixels :-(" << endl;
    219     *fLog << endl;
    220 
    221     count = 0;
    222 
    223     *fLog << all << "Pixels unreliable for the whole run:" << endl;
    224     *fLog << all << endl;
    225 
    226     for (Int_t i=0; i<GetSize(); i++)
    227     {
    228         if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
    229         {
    230             *fLog << i << " ";
    231             count ++;
    232         }
    233 
    234         if (count == 0)
    235             continue;
    236 
    237         if (!(count % 25))
    238           *fLog << endl;
    239     }
    240 
    241     *fLog << endl;
    242     *fLog << count << " unreliable pixels :-(" << endl;
    243     *fLog << endl;
     178  Int_t count = 0;
     179 
     180  for (Int_t i=0; i<GetSize(); i++)
     181    {
     182      if (!(*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     183        {
     184          *fLog << i << " ";
     185          count ++;
     186        }
     187     
     188      if (count == 0)
     189        continue;
     190     
     191      if (!(count % 25))
     192        *fLog << endl;
     193    }
     194  *fLog << endl;
     195  *fLog << count << " normal pixels :-))" << endl;
     196  *fLog << endl;
     197  count = 0;
     198 
     199 
     200  *fLog << "Pixels unsuited for the whole run:" << endl;
     201  *fLog << endl;
     202 
     203  for (Int_t i=0; i<GetSize(); i++)
     204    {
     205      if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     206        {
     207          *fLog << i << " ";
     208          count ++;
     209        }
     210     
     211      if (count == 0)
     212        continue;
     213     
     214      if (!(count % 25))
     215        *fLog << endl;
     216    }
     217  *fLog << endl;
     218  *fLog << count << " unsuited pixels :-(" << endl;
     219  *fLog << endl;
     220 
     221  count = 0;
     222 
     223  *fLog << all << "Pixels unreliable for the whole run:" << endl;
     224  *fLog << all << endl;
     225 
     226  for (Int_t i=0; i<GetSize(); i++)
     227    {
     228      if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
     229        {
     230          *fLog << i << " ";
     231          count ++;
     232        }
     233     
     234      if (count == 0)
     235        continue;
     236     
     237      if (!(count % 25))
     238        *fLog << endl;
     239    }
     240 
     241  *fLog << endl;
     242  *fLog << count << " unreliable pixels :-(" << endl;
     243  *fLog << endl;
     244
     245  count = 0;
     246 
     247  *fLog << all << "Charge is Pedestal:" << endl;
     248  *fLog << all << endl;
     249 
     250  for (Int_t i=0; i<GetSize(); i++)
     251    {
     252      if ((*this)[i].IsUncalibrated(MBadPixelsPix::kChargeIsPedestal))
     253        {
     254          *fLog << i << " ";
     255          count ++;
     256        }
     257     
     258      if (count == 0)
     259        continue;
     260     
     261      if (!(count % 25))
     262        *fLog << endl;
     263    }
     264 
     265  *fLog << endl;
     266  *fLog << count << " ChargeIsPedestal :-(" << endl;
     267  *fLog << endl;
     268
     269  count = 0;
     270 
     271  *fLog << all << "Charge Sigma not valid:" << endl;
     272  *fLog << all << endl;
     273 
     274  for (Int_t i=0; i<GetSize(); i++)
     275    {
     276      if ((*this)[i].IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid))
     277        {
     278          *fLog << i << " ";
     279          count ++;
     280        }
     281     
     282      if (count == 0)
     283        continue;
     284     
     285      if (!(count % 25))
     286        *fLog << endl;
     287    }
     288 
     289  *fLog << endl;
     290  *fLog << count << " ChargeSigmaNotValid :-(" << endl;
     291  *fLog << endl;
     292
     293  count = 0;
     294 
     295  *fLog << all << "Rel. Error Charge not valid:" << endl;
     296  *fLog << all << endl;
     297 
     298  for (Int_t i=0; i<GetSize(); i++)
     299    {
     300      if ((*this)[i].IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid))
     301        {
     302          *fLog << i << " ";
     303          count ++;
     304        }
     305     
     306      if (count == 0)
     307        continue;
     308     
     309      if (!(count % 25))
     310        *fLog << endl;
     311    }
     312 
     313  *fLog << endl;
     314  *fLog << count << " ChargeRelErrNotValid :-(" << endl;
     315  *fLog << endl;
     316
     317
     318  count = 0;
     319 
     320  *fLog << all << " Deviating number photo-electrons:" << endl;
     321  *fLog << all << endl;
     322 
     323  for (Int_t i=0; i<GetSize(); i++)
     324    {
     325      if ((*this)[i].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes))
     326        {
     327          *fLog << i << " ";
     328          count ++;
     329        }
     330     
     331      if (count == 0)
     332        continue;
     333     
     334      if (!(count % 25))
     335        *fLog << endl;
     336    }
     337 
     338  *fLog << endl;
     339  *fLog << count << " DeviatingNumPhes :-(" << endl;
     340  *fLog << endl;
     341
     342  count = 0;
     343 
     344  *fLog << all << " Deviating F-Factor:" << endl;
     345  *fLog << all << endl;
     346 
     347  for (Int_t i=0; i<GetSize(); i++)
     348    {
     349      if ((*this)[i].IsUncalibrated(MBadPixelsPix::kDeviatingFFactor))
     350        {
     351          *fLog << i << " ";
     352          count ++;
     353        }
     354     
     355      if (count == 0)
     356        continue;
     357     
     358      if (!(count % 25))
     359        *fLog << endl;
     360    }
     361 
     362  *fLog << endl;
     363  *fLog << count << " DeviatingFFactor :-(" << endl;
     364  *fLog << endl;
     365
    244366}
    245367
  • trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc

    r4190 r4342  
    4343#include "MExtractBlindPixel.h"
    4444
    45 #include <fstream>
    46 
    4745#include "MLog.h"
    4846#include "MLogManip.h"
     
    5149
    5250#include "MRawEvtData.h"
     51#include "MRawRunHeader.h"
    5352#include "MRawEvtPixelIter.h"
    5453
     
    6261using namespace std;
    6362
    64 const Int_t  MExtractBlindPixel::fgBlindPixelIdx  = 559;
    65 const Int_t  MExtractBlindPixel::fgNSBFilterLimit = 100;
    66 const Byte_t MExtractBlindPixel::fgHiGainFirst    =  10;
    67 const Byte_t MExtractBlindPixel::fgHiGainLast     =  29;
    68 const Byte_t MExtractBlindPixel::fgLoGainFirst    =  0;
    69 const Byte_t MExtractBlindPixel::fgLoGainLast     =  7;
     63const Int_t   MExtractBlindPixel::fgBlindPixelIdx  = 559;
     64const Int_t   MExtractBlindPixel::fgNSBFilterLimit =  70;
     65const Byte_t  MExtractBlindPixel::fgHiGainFirst    =  10;
     66const Byte_t  MExtractBlindPixel::fgHiGainLast     =  29;
     67const Byte_t  MExtractBlindPixel::fgLoGainFirst    =   0;
     68const Byte_t  MExtractBlindPixel::fgLoGainLast     =   6;
     69const Float_t MExtractBlindPixel::fgResolution    = 0.003;
    7070// --------------------------------------------------------------------------
    7171//
     
    7575// - fBlindPixelIdx to fgBlindPixelIdx
    7676// - fNSBFilterLimit to fgNSBFilterLimit
     77// - fResolution to fgResolution
    7778//
    7879// Calls:
     
    8081//
    8182MExtractBlindPixel::MExtractBlindPixel(const char *name, const char *title)
     83    : fHiGainSignal(NULL),
     84      fHiGainFirstDeriv(NULL),
     85      fHiGainSecondDeriv(NULL)
    8286{
    8387 
     
    8690 
    8791  AddToBranchList("MRawEvtData.*");
     92
     93  fBlindPixelIdx.Set(1);
    8894 
    8995  SetBlindPixelIdx();
     96  SetResolution();
    9097  SetNSBFilterLimit();
    9198  SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast);
     
    93100}
    94101
     102MExtractBlindPixel::~MExtractBlindPixel()
     103{
     104
     105  if (fHiGainSignal)
     106    delete fHiGainSignal;
     107  if (fHiGainFirstDeriv)
     108    delete fHiGainFirstDeriv;
     109  if (fHiGainSecondDeriv)
     110    delete fHiGainSecondDeriv;
     111
     112}
     113
    95114void MExtractBlindPixel::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
    96115{
     
    104123  fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 
    105124 
     125  fHiLoFirst = 0;
     126  fHiLoLast  = 0;
    106127}
    107128
     
    126147    return kFALSE;
    127148
    128   fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx);
     149  fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx.At(0));
    129150  fBlindPixel->SetUsedFADCSlices(fHiGainFirst, fHiGainLast);
    130151 
    131   MPedestalPix &pedpix  = (*fPedestals)[fBlindPixelIdx];   
     152  MPedestalPix &pedpix  = (*fPedestals)[fBlindPixelIdx.At(0)];   
    132153 
    133154  if (&pedpix)
     
    141162 
    142163  return kTRUE;
     164}
     165
     166// -------------------------------------------------------------------------- //
     167//
     168// The ReInit searches for:
     169// -  MRawRunHeader::GetNumSamplesHiGain()
     170// -  MRawRunHeader::GetNumSamplesLoGain()
     171//
     172// In case that the variables fHiGainLast and fLoGainLast are smaller than
     173// the even part of the number of samples obtained from the run header, a
     174// warning is given an the range is set back accordingly. A call to: 
     175// - SetRange(fHiGainFirst, fHiGainLast-diff, fLoGainFirst, fLoGainLast) or
     176// - SetRange(fHiGainFirst, fHiGainLast, fLoGainFirst, fLoGainLast-diff)
     177// is performed in that case. The variable diff means here the difference
     178// between the requested range (fHiGainLast) and the available one. Note that
     179// the functions SetRange() are mostly overloaded and perform more checks,
     180// modifying the ranges again, if necessary.
     181//
     182Bool_t MExtractBlindPixel::ReInit(MParList *pList)
     183{
     184 
     185  if (fHiGainSignal)
     186    delete fHiGainSignal;
     187  if (fHiGainFirstDeriv)
     188    delete fHiGainFirstDeriv;
     189  if (fHiGainSecondDeriv)
     190    delete fHiGainSecondDeriv;
     191
     192  const Int_t firstdesired   = (Int_t)fHiGainFirst;
     193  Int_t lastavailable  = (Int_t)fRunHeader->GetNumSamplesHiGain()-1;
     194 
     195  if (firstdesired > lastavailable)
     196    {
     197      const Int_t diff = firstdesired - lastavailable;
     198      *fLog << endl;
     199      *fLog << warn << GetDescriptor()
     200            << Form("%s%2i%s%2i%s",": Selected First Hi Gain FADC slice ",
     201                    (int)fHiGainFirst,
     202                    " ranges out of the available limits: [0,",lastavailable,"].") << endl;
     203      *fLog << warn << GetDescriptor()
     204            << Form("%s%2i%s",": Will start with slice ",diff," of the Low-Gain for the High-Gain extraction")
     205            << endl;
     206     
     207      fHiLoFirst   = diff;
     208    }
     209
     210  Int_t lastdesired   = (Int_t)fHiGainLast;
     211  lastavailable = (Int_t)fRunHeader->GetNumSamplesHiGain()-1;
     212 
     213  if (lastdesired > lastavailable)
     214    {
     215      Int_t diff = lastdesired - lastavailable;
     216      lastavailable += (Int_t)fRunHeader->GetNumSamplesLoGain()-1;
     217     
     218      if (lastdesired > lastavailable)
     219        {
     220          *fLog << endl;
     221          *fLog << warn << GetDescriptor()
     222                << Form("%s%2i%s%2i%s",": Selected Last Hi Gain FADC slice ",
     223                        (int)fHiGainLast,
     224                        " ranges out of the available limits: [0,",lastavailable,"].") << endl;
     225          *fLog << warn << GetDescriptor()
     226                << Form("%s%2i",": Will reduce upper limit by ",diff)
     227                << endl;
     228          fHiGainLast = (Int_t)fRunHeader->GetNumSamplesLoGain() - 1;
     229          diff        = (Int_t)fRunHeader->GetNumSamplesLoGain() - 1;
     230        }
     231
     232      fHiLoLast = diff;
     233    }
     234
     235  const Int_t range = fHiLoFirst ? fHiLoLast - fHiLoFirst + 1 : fHiGainLast - fHiGainFirst + fHiLoLast + 1;
     236
     237  fHiGainSignal = new Float_t[range];
     238  memset(fHiGainSignal,0,range*sizeof(Float_t));
     239  fHiGainFirstDeriv = new Float_t[range];
     240  memset(fHiGainFirstDeriv,0,range*sizeof(Float_t));
     241  fHiGainSecondDeriv = new Float_t[range];
     242  memset(fHiGainSecondDeriv,0,range*sizeof(Float_t));
     243
     244
     245  *fLog << endl;
     246  *fLog << inf << GetDescriptor() << ": Taking " << range
     247        << " FADC samples from "
     248        << Form("%s%2i",fHiLoFirst ? "Low Gain slice " : " High Gain slice ",
     249                fHiLoFirst ? (Int_t)fHiLoFirst : (Int_t)fHiGainFirst)
     250        << " to (including)  "
     251        << Form("%s%2i",fHiLoLast ? "Low Gain slice " : " High Gain slice ",
     252                fHiLoLast ?  (Int_t)fHiLoLast : (Int_t)fHiGainLast )
     253        << endl;
     254
     255  return kTRUE;
     256
    143257}
    144258
     
    153267// - Add contents of *logain to sum
    154268//
    155 void MExtractBlindPixel::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const
    156 {
    157 
     269void MExtractBlindPixel::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const
     270{
     271
     272  Int_t summ = 0;
     273  Byte_t *p     = ptr;
    158274  Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1;
    159  
    160   while (ptr<end)
    161     {
    162       sum += *ptr;
    163      
    164       if (*ptr++ >= fSaturationLimit)
    165         sat++;
    166     }
    167 
    168   if (fHiLoLast == 0)
     275
     276  if (fHiLoFirst == 0)
     277    {
     278
     279      while (p<end)
     280        {
     281          summ += *ptr;
     282         
     283          if (*p++ >= fSaturationLimit)
     284            sat++;
     285        }
     286     
     287    }
     288 
     289  p   = logain + fHiLoFirst; 
     290  end = logain + fHiLoLast;
     291  while (p<end)
     292    {
     293      summ += *p;
     294
     295      if (*p++ >= fSaturationLimit)
     296            sat++;
     297    }
     298  sum = (Float_t)summ;
     299}
     300
     301// --------------------------------------------------------------------------
     302//
     303// FindSignalPhe:
     304//
     305// - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst)
     306// - Sum up contents of *ptr
     307// - If *ptr is greater than fSaturationLimit, raise sat by 1
     308// - If fHiLoLast is set, loop from logain to (logain+fHiLoLast)
     309// - Add contents of *logain to sum
     310//
     311void MExtractBlindPixel::FindAmplitude(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const
     312{
     313
     314  Int_t range   = 0;
     315  Int_t count   = 0;
     316  Float_t abmaxpos = 0.;
     317  Byte_t *p     = ptr;
     318  Byte_t *end;
     319  Byte_t max    = 0;
     320  Byte_t maxpos = 0;
     321  Int_t summ   = 0;
     322
     323  if (fHiLoFirst == 0)
     324    {
     325
     326      range = fHiGainLast - fHiGainFirst + 1;
     327      end   = ptr + range;
     328      //
     329      // Check for saturation in all other slices
     330      //
     331      while (++p<end)
     332        {
     333         
     334          fHiGainSignal[count] = (Float_t)*p;
     335          summ += *p;
     336
     337          if (*p > max)
     338            {
     339              max    = *p;
     340              maxpos =  count;
     341            }
     342         
     343          range++;
     344          count++;
     345
     346          if (*p >= fSaturationLimit)
     347            {
     348              sat++;
     349              break;
     350            }
     351        }
     352    }
     353 
     354  if (fHiLoLast != 0)
     355    {
     356     
     357      p    = logain + fHiLoFirst;
     358      end  = logain + fHiLoLast + 1;
     359     
     360      while (p<end)
     361        {
     362         
     363          fHiGainSignal[count] = (Float_t)*p;
     364          summ += *p;
     365
     366          if (*p > max)
     367            {
     368              max    = *p;
     369              maxpos =  count;
     370            }
     371         
     372          range++;
     373          count++;
     374
     375          if (*p++ >= fSaturationLimit)
     376            {
     377              sat++;
     378              break;
     379            }
     380        }
     381    }
     382
     383  //  sum = (Float_t)summ;
     384  //  return;
     385 
     386  //
     387  // allow one saturated slice
     388  //
     389  if (sat > 1)
    169390    return;
    170391
    171  
    172   end = logain + fHiLoLast;
    173   while (logain<end)
    174     {
    175       sum += *logain;
    176 
    177       if (*logain++ >= fSaturationLimit)
    178             sat++;
    179     }
    180 
     392  //
     393  // Don't start if the maxpos is too close to the left limit.
     394  //
     395  if (maxpos < 2)
     396    return;
     397
     398  Float_t pp;
     399  fHiGainSecondDeriv[0] = 0.;
     400  fHiGainFirstDeriv[0]  = 0.;
     401
     402  for (Int_t i=1;i<range-1;i++)
     403    {
     404      pp = fHiGainSecondDeriv[i-1] + 4.;
     405      fHiGainSecondDeriv[i] = -1.0/pp;
     406      fHiGainFirstDeriv [i] = fHiGainSignal[i+1] - fHiGainSignal[i] - fHiGainSignal[i] + fHiGainSignal[i-1];
     407      fHiGainFirstDeriv [i] = (6.0*fHiGainFirstDeriv[i]-fHiGainFirstDeriv[i-1])/pp;
     408      p++;
     409    }
     410
     411  fHiGainSecondDeriv[range-1] = 0.;
     412  for (Int_t k=range-2;k>=0;k--)
     413    fHiGainSecondDeriv[k] = (fHiGainSecondDeriv[k]*fHiGainSecondDeriv[k+1] + fHiGainFirstDeriv[k])/6.;
     414 
     415  //
     416  // Now find the maximum 
     417  //
     418  Float_t step  = 0.2; // start with step size of 1ns and loop again with the smaller one
     419  Float_t lower = (Float_t)maxpos-1.;
     420  Float_t upper = (Float_t)maxpos;
     421  Float_t x     = lower;
     422  Float_t y     = 0.;
     423  Float_t a     = 1.;
     424  Float_t b     = 0.;
     425  Int_t   klo = maxpos-1;
     426  Int_t   khi = maxpos;
     427  Float_t klocont = fHiGainSignal[klo];
     428  Float_t khicont = fHiGainSignal[khi];
     429  sum       = (Float_t)khicont;
     430  abmaxpos  = lower;
     431
     432  //
     433  // Search for the maximum, starting in interval maxpos-1. If no maximum is found, go to
     434  // interval maxpos+1.
     435  //
     436  while (x<upper-0.3)
     437    {
     438
     439      x += step;
     440      a -= step;
     441      b += step;
     442
     443      y = a*klocont
     444        + b*khicont
     445        + (a*a*a-a)*fHiGainSecondDeriv[klo]
     446        + (b*b*b-b)*fHiGainSecondDeriv[khi];
     447
     448      if (y > sum)
     449        {
     450          sum      = y;
     451          abmaxpos = x;
     452        }
     453    }
     454
     455  if (abmaxpos > upper-0.1)
     456    {
     457     
     458      upper = (Float_t)maxpos+1;
     459      lower = (Float_t)maxpos;
     460      x     = lower;
     461      a     = 1.;
     462      b     = 0.;
     463      khi   = maxpos+1;
     464      klo   = maxpos;
     465      klocont = fHiGainSignal[klo];
     466      khicont = fHiGainSignal[khi];
     467
     468      while (x<upper-0.3)
     469        {
     470
     471          x += step;
     472          a -= step;
     473          b += step;
     474         
     475          y = a* klocont
     476            + b* khicont
     477            + (a*a*a-a)*fHiGainSecondDeriv[klo]
     478            + (b*b*b-b)*fHiGainSecondDeriv[khi];
     479         
     480          if (y > sum)
     481            {
     482              sum    = y;
     483              abmaxpos = x;
     484            }
     485        }
     486    }
     487
     488 const Float_t up = abmaxpos+step-0.055;
     489 const Float_t lo = abmaxpos-step+0.055;
     490 const Float_t maxpossave = abmaxpos;
     491 
     492 x     = abmaxpos;
     493 a     = upper - x;
     494 b     = x - lower;
     495
     496  step  = 0.04; // step size of 83 ps
     497
     498  while (x<up)
     499    {
     500
     501      x += step;
     502      a -= step;
     503      b += step;
     504     
     505      y = a* klocont
     506        + b* khicont
     507        + (a*a*a-a)*fHiGainSecondDeriv[klo]
     508        + (b*b*b-b)*fHiGainSecondDeriv[khi];
     509     
     510      if (y > sum)
     511        {
     512          sum    = y;
     513          abmaxpos = x;
     514        }
     515    }
     516
     517 if (abmaxpos < klo + 0.02)
     518    {
     519      klo--;
     520      khi--;
     521      klocont = fHiGainSignal[klo];
     522      khicont = fHiGainSignal[khi];
     523      upper--;
     524      lower--;
     525    }
     526 
     527  x     = maxpossave;
     528  a     = upper - x;
     529  b     = x - lower;
     530
     531  while (x>lo)
     532    {
     533
     534      x -= step;
     535      a += step;
     536      b -= step;
     537     
     538      y = a* klocont
     539        + b* khicont
     540        + (a*a*a-a)*fHiGainSecondDeriv[klo]
     541        + (b*b*b-b)*fHiGainSecondDeriv[khi];
     542     
     543      if (y > sum)
     544        {
     545          sum    = y;
     546          abmaxpos = x;
     547        }
     548    }
    181549}
    182550
     
    215583  fBlindPixel->Clear();
    216584 
    217   pixel.Jump(fBlindPixelIdx);
    218  
    219   Int_t sum   = 0;
    220   Byte_t sat  = 0;
    221 
    222   FindSignalFilter(pixel.GetHiGainSamples()+fLoGainFirst, sum, sat);
    223 
    224   if (sum > fNSBFilterLimit)
    225     {
    226       sum = -1;
    227       fBlindPixel->SetExtractedSignal(sum);
    228       fBlindPixel->SetNumSaturated(sat);
    229       fBlindPixel->SetReadyToSave();
    230       return kTRUE;
    231     }
    232 
    233   sum = 0;
    234   sat = 0;
    235 
    236   FindSignalHiGain(pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), sum, sat);
    237  
    238   fBlindPixel->SetExtractedSignal(sum);
    239   fBlindPixel->SetNumSaturated(sat);
     585  for (Int_t id=0;id<fBlindPixelIdx.GetSize();id++)
     586    {
     587 
     588      pixel.Jump(fBlindPixelIdx.At(id));
     589     
     590      Int_t sum   = 0;
     591      Byte_t sat  = 0;
     592
     593      FindSignalFilter(pixel.GetHiGainSamples()+fLoGainFirst, sum, sat);
     594
     595      if (sum > fNSBFilterLimit)
     596        {
     597          fBlindPixel->SetExtractedSignal(-1.);
     598          fBlindPixel->SetNumSaturated(sat);
     599          fBlindPixel->SetReadyToSave();
     600          continue;
     601        }
     602     
     603      Float_t newsum = 0.;
     604      sat = 0;
     605     
     606      FindSignalHiGain(pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat);
     607 
     608      fBlindPixel->SetExtractedSignal(newsum,id);
     609      fBlindPixel->SetNumSaturated(sat,id);
     610    }
     611 
    240612  fBlindPixel->SetReadyToSave();
    241  
    242613  return kTRUE;
    243614}
  • trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h

    r4341 r4342  
    4343  Int_t   fNSBFilterLimit; 
    4444
    45   void FindSignalPhe(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const;
     45  void FindAmplitude(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const;
     46  void FindSignalHiGain(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const;
    4647  void FindSignalFilter(Byte_t *ptr, Int_t &sum, Byte_t &sat) const;
    4748 
Note: See TracChangeset for help on using the changeset viewer.