Ignore:
Timestamp:
04/09/04 17:05:05 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r3694 r3697  
    2828//
    2929//   Task to calculate the calibration conversion factors and quantum efficiencies
    30 //   from the FADC time slices. The integrated time slices have to be delivered by an
    31 //   MExtractedSignalCam, pedestals by an MPedestalCam.
    32 //
    33 //   The output container MCalibrationCam holds one entry of type MCalibrationChargePix
    34 //   for every pixel. It is filled in the following way:
    35 //
    36 //   PreProcess(): Initialize MCalibrationCam
     30//   from the fit results to the summed FADC slice distributions delivered by
     31//   MCalibrationChargeCam, MCalibrationChargePix, MCalibrationChargeBlindPix and
     32//   MCalibrationChargePINDiode, calculated and filled by MHCalibrationChargeCam,
     33//   MHCalibrationChargePix, MHCalibrationChargeBlindPix and MHCalibrationChargePINDiode.
     34//
     35//   PreProcess(): Initialize pointers to MCalibrationChargeCam, MCalibrationChargeBlindPix
     36//                 MCalibrationChargePINDiode and  MCalibrationQECam
     37//
    3738//                 Initialize pulser light wavelength
    3839//               
     
    231232const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit       = 0.2;
    232233const Float_t MCalibrationChargeCalc::fgPheErrLimit            = 5.;
    233 const Float_t MCalibrationChargeCalc::fgTimeLowerLimit         = 1.;
    234 const Float_t MCalibrationChargeCalc::fgTimeUpperLimit         = 2.;
    235234// --------------------------------------------------------------------------
    236235//
     
    251250// - fLambdaCheckLimit  to fgLambdaCheckLimit
    252251// - fLambdaErrLimit    to fgLambdaErrLimit
    253 // - fTimeLowerLimit    to fgTimeLowerLimit
    254 // - fTimeUpperLimit    to fgTimeUpperLimit
    255252// - fPheErrLimit       to fgPheErrLimit 
    256253// - fPulserColor       to MCalibrationCam::kCT1
     
    261258MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
    262259    : fBadPixels(NULL), fCam(NULL), fBlindPixel(NULL), fPINDiode(NULL),
    263       fQECam(NULL), fSignals(NULL), fSigBlind(NULL), fSigPIN(NULL),
    264       fGeom(NULL), fPedestals(NULL), fEvtTime(NULL)
     260      fQECam(NULL), fGeom(NULL), fPedestals(NULL), fEvtTime(NULL)
    265261      {
    266262
     
    280276  SetPheErrLimit();
    281277  SetPulserColor(MCalibrationCam::kCT1);
    282   SetTimeLowerLimit();
    283   SetTimeUpperLimit();
    284278
    285279  Clear();
     
    302296// The following container are searched for and execution aborted if not in MParList:
    303297//  - MPedestalCam
    304 //  - MExtractedSignalCam
    305 //  - MCalibrationChargeCam
    306298//
    307299// The following containers are searched and created if they were not found:
     
    313305// cannot be found, the corresponding calibration part is only skipped.
    314306//
    315 //  - MExtractedSignalBlindPixel and MCalibrationChargeBlindPix
    316 //  - MExtractedSignalPINDiode   and MCalibrationChargePINDiode
     307//  - MCalibrationChargeBlindPix
     308//  - MCalibrationChargePINDiode
    317309//  - MTime
    318310//
     
    336328    }
    337329 
    338   fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
    339   if (!fSignals)
    340     {
    341       *fLog << err << "MExtractedSignalCam not found... aborting" << endl;
    342       return kFALSE;
    343     }
    344  
    345   fCam = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam");
    346   if (!fCam)
    347     {
    348       *fLog << err << "Cannot find MCalibrationChargeCam... aborting" << endl;
    349       *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
    350       return kFALSE;
    351     }
    352 
    353330  //
    354331  // Containers that are created in case that they are not there.
     
    368345    }
    369346
    370   //
    371   // Optional Containers
    372   //
    373   fSigBlind = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
    374   if (!fSigBlind)
    375     *fLog << warn << "MExtractedSignalBlindPixel not found... no blind pixel method! " << endl;
    376   else
    377     {
    378       fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix");
    379       if (!fBlindPixel)
    380         {
    381           *fLog << err << "Cannot find nor create MCalibrationChargeBlindPix... aborting" << endl;
    382           return kFALSE;
    383         }
    384     }
    385  
    386   fSigPIN  = (MExtractedSignalPINDiode*)pList->FindObject("MExtractedSignalPINDiode");
    387   if (!fSigPIN)
    388     *fLog << warn << "MExtractedSignalPINDiode not found... no PIN Diode method! " << endl;
    389   else
    390     {
    391       fPINDiode = (MCalibrationChargePINDiode*)pList->FindCreateObj("MCalibrationChargePINDiode");
    392       if (!fPINDiode)
    393         {
    394           *fLog << err << "Cannot find nor create MCalibrationChargePINDiode... aborting" << endl;
    395           return kFALSE;
    396         }
    397     }
    398347 
    399348  fEvtTime = (MTime*)pList->FindObject("MTime");
     
    418367// The ReInit searches for the following input containers:
    419368//  - MGeomCam
    420 //
    421 // It retrieves the following variables from MExtractedSignalCam:
     369//  - MCalibrationChargeCam
     370//
     371// It retrieves the following variables from MCalibrationChargeCam:
    422372//
    423373//  - fNumHiGainSamples
     
    446396    }
    447397 
    448   fNumHiGainSamples  =  fSignals->GetNumUsedHiGainFADCSlices();
    449   fNumLoGainSamples  =  fSignals->GetNumUsedLoGainFADCSlices();
     398  fCam = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam");
     399  if (!fCam)
     400    {
     401      *fLog << err << "Cannot find MCalibrationChargeCam... aborting" << endl;
     402      *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
     403      return kFALSE;
     404    }
     405
     406  //
     407  // Optional Containers
     408  //
     409  fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindObject("MCalibrationChargeBlindPix");
     410  if (!fBlindPixel)
     411    {
     412      *fLog << warn << GetDescriptor()
     413            << ": MCalibrationChargeBlindPix not found... no blind pixel method! " << endl;
     414      return kFALSE;
     415    }
     416 
     417  fPINDiode = (MCalibrationChargePINDiode*)pList->FindCreateObj("MCalibrationChargePINDiode");
     418  if (!fPINDiode)
     419    {
     420      *fLog << warn << GetDescriptor()
     421            << "MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
     422      return kFALSE;
     423    }
     424
     425  fNumHiGainSamples  =  fCam->GetNumHiGainFADCSlices();
     426  fNumLoGainSamples  =  fCam->GetNumLoGainFADCSlices();
    450427  fSqrtHiGainSamples =  TMath::Sqrt(fNumHiGainSamples);
    451428  fSqrtLoGainSamples =  TMath::Sqrt(fNumLoGainSamples);
     
    565542// Finalize charges per pixel:
    566543// - Check chage validity
    567 // - Check absolute time validity
    568544// - Calculate the reduced sigma
    569545// - Calculate the number of photo-electrons
     
    609585    }
    610586
    611   //
    612   // The check returns kTRUE if:
    613   //
    614   // The mean arrival time is at least fTimeLowerLimit slices from the lower edge
    615   // and fUpperLimit slices from the upper edge
    616   //
    617   const Byte_t loweredge  = cal.IsHiGainSaturation() ? fSignals->GetFirstUsedSliceLoGain()
    618                                                      : fSignals->GetFirstUsedSliceHiGain();
    619   const Byte_t upperedge  = cal.IsHiGainSaturation() ? fSignals->GetLastUsedSliceLoGain()
    620                                                      : fSignals->GetLastUsedSliceHiGain();
    621 
    622   const Float_t lowerlimit = (Float_t)loweredge + fTimeLowerLimit;
    623   const Float_t upperlimit = (Float_t)upperedge + fTimeUpperLimit; 
    624 
    625   if ( cal.GetAbsTimeMean() < lowerlimit)
    626     {
    627       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit
    628             << " extraction bin of the Pixel " << cal.GetPixId() << endl;
    629       *fLog << cal.GetAbsTimeMean() << "   " << lowerlimit << endl;
    630       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
    631     }
    632  
    633   if ( cal.GetAbsTimeMean() > upperlimit )
    634     {
    635       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit
    636             << " two extraction bins of the Pixel " << cal.GetPixId() << endl;
    637       *fLog << cal.GetAbsTimeMean() << "   " << upperlimit << endl;
    638       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
    639     }
    640      
    641587  if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    642588    return kFALSE;
     
    671617// 3) PINDiode has a fitted charge smaller its fChargeRelErrLimit times its charge error
    672618// 4) PINDiode has a charge sigma smaller than its Pedestal RMS
    673 // 5) The mean arrival time is in fTimeLowerLimit slices from the lower edge
    674 //    and fUpperLimit slices from the upper edge
    675619//
    676620// Calls:
     
    680624{
    681625
    682   if (!fSigPIN)
    683     return kFALSE;
    684  
    685626  if (!fPINDiode)
    686627    return kFALSE; 
     
    709650  if (fPINDiode->GetSigma() < fPINDiode->GetPedRms())
    710651    {
    711       *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
    712     }
    713       return kFALSE;
    714 
    715   const Byte_t  loweredge  = fSigPIN->GetFirstUsedSlice();
    716   const Byte_t  upperedge  = fSigPIN->GetLastUsedSlice();
    717   const Float_t lowerlimit = (Float_t)loweredge + fTimeLowerLimit;
    718   const Float_t upperlimit = (Float_t)upperedge + fTimeUpperLimit; 
    719 
    720   if (fPINDiode->GetAbsTimeMean() < lowerlimit)
    721     {
    722       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit
    723             << " extraction bin in PIN Diode " << endl;
    724       *fLog << fPINDiode->GetAbsTimeMean() << "   " << lowerlimit << endl;
    725       return kFALSE;
    726     }
    727  
    728   if ( fPINDiode->GetAbsTimeMean() > upperlimit )
    729     {
    730       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit
    731             << " two extraction bins in PIN Diode " << endl;
    732       *fLog << fPINDiode->GetAbsTimeMean() << "   " << upperlimit << endl;
    733       return kFALSE;
    734     }
     652      *fLog << warn << GetDescriptor()
     653            << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
     654      return kFALSE;
     655    }
     656
    735657
    736658  if (!fPINDiode->CalcFluxOutsidePlexiglass())
     
    760682{
    761683
    762   if (!fSigBlind)
    763     return kFALSE;
    764  
    765684  if (!fBlindPixel)
    766685    return kFALSE; 
     
    13401259                    "Pixels with Low Gain Saturation:                  ");
    13411260  PrintUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin,
    1342                     Form("%s%2.1f%s","Mean Abs. Arr. Time in First ",fTimeLowerLimit," Bin(s):          "));
     1261                    Form("%s%2.1f%s","Mean Abs. Arr. Time in First ",1," Bin(s):          "));
    13431262  PrintUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins,
    1344                     Form("%s%2.1f%s","Mean Abs. Arr. Time in Last ",fTimeUpperLimit," Bin(s):           "));
     1263                    Form("%s%2.1f%s","Mean Abs. Arr. Time in Last ",2," Bin(s):           "));
    13451264  PrintUncalibrated(MBadPixelsPix::kHiGainOscillating,   
    13461265                    "Pixels with changing Hi Gain signal over time:    ");
Note: See TracChangeset for help on using the changeset viewer.