Ignore:
Timestamp:
04/20/07 14:59:58 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r8417 r8428  
    7171#include "MGeomPix.h"
    7272
    73 #include "MCalibrationIntensityRelTimeCam.h"
    7473#include "MCalibrationRelTimeCam.h"
    7574#include "MCalibrationRelTimePix.h"
     
    122121void MCalibrationRelTimeCalc::Clear(const Option_t *o)
    123122{
    124 
    125   fBadPixels  = NULL;
    126   fCam        = NULL;
    127   fIntensCam  = NULL;
    128 
     123    fBadPixels  = NULL;
     124    fCam        = NULL;
    129125}
    130126
     
    133129// Search for the following input containers and abort if not existing:
    134130//  - MGeomCam
    135 //  - MCalibrationIntensityRelTimeCam or MCalibrationRelTimeCam
     131//  - MCalibrationRelTimeCam
    136132//  - MBadPixelsCam
    137133//
     
    161157  }
    162158
    163   fIntensCam = (MCalibrationIntensityRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam"));
    164   if (fIntensCam)
    165     *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl;
    166   else
    167     {
    168       fCam = (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam"));
    169       if (!fCam)
    170         {
    171           *fLog << err << "Cannot find MCalibrationRelTimeCam ... abort." << endl;
    172           *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationRelTimeCam before..." << endl;
    173           return kFALSE;
    174         }
    175     }
    176  
    177   UInt_t npixels     = fGeom->GetNumPixels();
    178  
    179   MCalibrationRelTimeCam *relcam = fIntensCam
    180     ? (MCalibrationRelTimeCam*)fIntensCam->GetCam()  : fCam;
    181 
     159  fCam = (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam"));
     160  if (!fCam)
     161  {
     162      *fLog << err << "Cannot find MCalibrationRelTimeCam ... abort." << endl;
     163      return kFALSE;
     164  }
     165
     166  const UInt_t npixels = fGeom->GetNumPixels();
    182167  for (UInt_t i=0; i<npixels; i++)
    183     {
    184      
    185       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
     168  {
     169      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
    186170
    187171      if ((*fBadPixels)[i].IsBad())
    188         {
     172      {
    189173          pix.SetExcluded();
    190174          continue;
    191         }
     175      }
    192176
    193177      if (IsDebug())
    194         pix.SetDebug();
    195     }
     178          pix.SetDebug();
     179  }
    196180
    197181  return kTRUE;
     
    242226  FinalizeUnsuitablePixels();
    243227
    244   if (fIntensCam)
    245     fIntensCam->SetReadyToSave();
    246   else
    247     fCam      ->SetReadyToSave();
    248 
     228  fCam->SetReadyToSave();
    249229  fBadPixels->SetReadyToSave();
    250230
     
    277257{
    278258
    279   MCalibrationRelTimeCam *relcam = fIntensCam
    280     ? (MCalibrationRelTimeCam*)fIntensCam->GetCam()  : fCam;
    281 
    282259  const UInt_t npixels  = fGeom->GetNumPixels();
    283260  const UInt_t nareas   = fGeom->GetNumAreas();
     
    286263  TArrayF upplim       (nareas);
    287264  TArrayF areasum      (nareas);
    288   //  Float_t areasum2     [nareas];
    289265  TArrayI numareavalid (nareas);
    290266  TArrayI useunreliable(nareas);
     
    306282      numareavalid[aidx] ++;
    307283    }
    308  
     284
    309285  for (UInt_t aidx=0; aidx<nareas; aidx++)
    310286    if (numareavalid[aidx] < 100)
     
    318294  for (UInt_t i=0; i<npixels; i++)
    319295    {
    320      
    321       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
     296
     297      const MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
    322298
    323299      if (pix.IsExcluded())
     
    349325          continue;
    350326        }
    351  
     327
    352328      // Calculate the rms out of sum2:
    353329      /*
     
    358334      lowlim  [aidx]  = 0;
    359335      upplim  [aidx]  = areasum [aidx] + fRelTimeResolutionLimit;
    360      
     336
    361337    }
    362338  *fLog << endl; 
     
    365341  for (UInt_t i=0; i<npixels; i++)
    366342    {
    367      
    368       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
    369      
     343
     344      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
     345
    370346      if (pix.IsExcluded())
    371347        continue;
    372      
     348
    373349      MBadPixelsPix &bad = (*fBadPixels)[i];
    374350      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    375351        continue;
    376      
     352
    377353      const Float_t res    = pix.GetTimePrecision();
    378354      const Int_t   aidx   = (*fGeom)[i].GetAidx();
    379      
     355
    380356      if ( res < lowlim[aidx] || res > upplim[aidx] )
    381357        {
     
    401377void MCalibrationRelTimeCalc::FinalizeBadPixels()
    402378{
    403  
    404   MCalibrationRelTimeCam *relcam = fIntensCam
    405     ? (MCalibrationRelTimeCam*)fIntensCam->GetCam()  : fCam;
    406379
    407380  for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    408381    {
    409      
    410       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
    411382
    412383      MBadPixelsPix &bad = (*fBadPixels)[i];
     
    425396
    426397      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     398      {
     399          MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
    427400          pix.SetExcluded();
     401      }
    428402    }
    429403
     
    442416    *fLog << dec;
    443417
    444     MCalibrationRelTimeCam *relcam = fIntensCam ? (MCalibrationRelTimeCam*)fIntensCam->GetCam() : fCam;
    445 
    446418    const Int_t nareas = fGeom->GetNumAreas();
    447419
     
    453425        unsuit[aidx] += fBadPixels->GetNumUnsuitable(MBadPixelsPix::kUnsuitableRun, fGeom, aidx);
    454426        unrel[aidx]  += fBadPixels->GetNumUnsuitable(MBadPixelsPix::kUnreliableRun, fGeom, aidx);
    455         relcam->SetNumUnsuitable(unsuit[aidx], aidx);
    456         relcam->SetNumUnreliable(unrel[aidx],  aidx);
     427        fCam->SetNumUnsuitable(unsuit[aidx], aidx);
     428        fCam->SetNumUnreliable(unrel[aidx],  aidx);
    457429    }
    458430
Note: See TracChangeset for help on using the changeset viewer.