Ignore:
Timestamp:
12/16/04 17:32:32 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc

    r5371 r5609  
    413413  MBadPixelsCam   *badcam = fIntensBad ? fIntensBad->GetCam() : fBadPixels;
    414414
     415  const Int_t nareas = fAverageHiGainAreas->GetSize();
     416  const Int_t nsectors = fAverageHiGainSectors->GetSize();
     417
     418  TArrayI satarea(nareas);
     419  TArrayI satsect(nsectors);
     420  fNumareahi  .Reset();
     421  fNumsectorhi.Reset();
     422
    415423  for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
    416424    {
    417425     
    418426      MHCalibrationPix &histhi = (*this)[i];
    419      
     427
    420428      if (histhi.IsExcluded())
    421429        continue;
    422430     
     431      const Int_t aidx   = (*fGeom)[i].GetAidx();
     432      const Int_t sector = (*fGeom)[i].GetSector();
     433
    423434      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i] ;
    424435
     436      fNumareahi[aidx]++;
     437      fNumsectorhi[sector]++;
     438      //
     439      // Check saturation
     440      //
    425441      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
     442        {
     443          pix.SetHiGainSaturation();
     444          histhi.SetExcluded();
     445          satarea[aidx]++;
     446          satsect[sector]++;
     447        }
     448      else
     449        if (IsLoGain())
     450          (*this)(i).SetExcluded();
     451
     452      //
     453      // Check histogram overflow
     454      //
     455      CheckOverflow(histhi);
     456      if (IsLoGain())
     457        CheckOverflow((*this)(i));
     458
     459    }
     460
     461  for (Int_t j=0; j<nareas; j++)
     462    {
     463     
     464      MHCalibrationPix     &histhi = GetAverageHiGainArea(j);     
     465      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)relcam->GetAverageArea(j);
     466
     467      if (satarea[j] > 0.5*fNumareahi[j])
    426468        {
    427469          pix.SetHiGainSaturation();
     
    430472      else
    431473        if (IsLoGain())
    432           (*this)(i).SetExcluded();
    433 
    434       Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1);
    435       if (overflow > 0.1)
    436         {
    437           *fLog << warn << "HiGain Hist-overflow occurred " << overflow
    438                 << " times in pix: " << i << " (w/o saturation!) " << endl;
    439           //          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
    440         }
    441 
    442       overflow = histhi.GetHGausHist()->GetBinContent(0);
    443       if (overflow > 0.1)
    444         {
    445           *fLog << warn << "HiGain Hist-underflow occurred " << overflow
    446                 << " times in pix: " << i << " (w/o saturation!) " << endl;
    447           //          bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
    448         }
    449     }
    450 
    451   for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
    452     {
    453      
    454       MHCalibrationPix &histhi = GetAverageHiGainArea(j);     
    455 
    456       if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
    457         {
    458           MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)relcam->GetAverageArea(j);
    459           pix.SetHiGainSaturation();
    460           histhi.SetExcluded();
    461         }
    462       else
    463         if (IsLoGain())
    464474          GetAverageLoGainArea(j).SetExcluded();
    465475
     476      //
     477      // Check histogram overflow
     478      //
     479      CheckOverflow(histhi);
     480      if (IsLoGain())
     481        CheckOverflow(GetAverageLoGainArea(j));
    466482   }
    467483 
     
    472488      MCalibrationRelTimePix  &pix = (MCalibrationRelTimePix&)relcam->GetAverageSector(j) ;
    473489
    474       if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
     490      if (satsect[j] > 0.5*fNumsectorhi[j])
    475491        {
    476492          pix.SetHiGainSaturation();
     
    480496        if (IsLoGain())       
    481497          GetAverageLoGainSector(j).SetExcluded();
     498
     499      //
     500      // Check histogram overflow
     501      //
     502      CheckOverflow(histhi);
     503      if (IsLoGain())
     504        CheckOverflow(GetAverageLoGainSector(j));
    482505    }
    483506
     
    632655       // Ask for Hi-Gain saturation
    633656       //
    634        if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() && IsLoGain())
    635          {
     657       if (hipix.IsExcluded() && IsLoGain())
     658        {
    636659           MHCalibrationPix &lopix = GetAverageLoGainArea(i);
    637660           DrawDataCheckPixel(lopix,0.);
     
    641664    }     
    642665}
     666
     667void MHCalibrationRelTimeCam::CheckOverflow( MHCalibrationPix &pix )
     668{
     669
     670  if (pix.IsExcluded())
     671    return;
     672
     673  TH1F *hist = pix.GetHGausHist();
     674 
     675  Stat_t overflow = hist->GetBinContent(hist->GetNbinsX()+1);
     676  if (overflow > 0.0005*hist->GetEntries())
     677    {
     678      *fLog << warn << "HiGain Hist-overflow occurred " << overflow
     679            << " times in " << pix.GetName() << " (w/o saturation!) " << endl;
     680    }
     681 
     682  overflow = hist->GetBinContent(0);
     683  if (overflow > 0.0005*hist->GetEntries())
     684    {
     685      *fLog << warn << "HiGain Hist-underflow occurred " << overflow
     686            << " times in " << pix.GetName() << " (w/o saturation!) " << endl;
     687    }
     688}
     689
    643690
    644691// -----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.