Ignore:
Timestamp:
08/27/04 18:09:50 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r4672 r4774  
    741741  PrintUncalibrated(MBadPixelsPix::kChargeRelErrNotValid,
    742742                    Form("%s%2.1f%s","Signal Error bigger than ",fChargeRelErrLimit," times Mean Signal:   "));
    743   PrintUncalibrated(MBadPixelsPix::kChargeSigmaNotValid,
    744                     "Signal Sigma smaller than Pedestal RMS:           ");
    745743  PrintUncalibrated(MBadPixelsPix::kLoGainSaturation,   
    746744                    "Pixels with Low Gain Saturation:                  ");
     
    757755  *fLog << GetDescriptor() << ": Unreliable errors statistics:" << endl; 
    758756
     757  PrintUncalibrated(MBadPixelsPix::kChargeSigmaNotValid,
     758                    "Signal Sigma smaller than Pedestal RMS:           ");
    759759  PrintUncalibrated(MBadPixelsPix::kHiGainOscillating,   
    760760                    "Pixels with changing Hi Gain signal over time:    ");
     
    824824//
    825825// Calls MCalibrationChargePix::CalcReducedSigma() and sets flag:  MBadPixelsPix::kChargeIsPedestal
    826 //       if not succesful.
    827 //
    828 // Calls MCalibrationChargePix::CalcFFactorMethod() and sets flag: MBadPixelsPix::kDeviatingNumPhes)
    829 //       if not succesful.
     826//       and returns kFALSE if not succesful.
     827//
     828// Calls MCalibrationChargePix::CalcFFactor() and sets flag: MBadPixelsPix::kDeviatingNumPhes)
     829//       and returns kFALSE if not succesful.
     830//
     831// Calls MCalibrationChargePix::CalcConvFFactor()and sets flag: MBadPixelsPix::kDeviatingNumPhes)
     832//       and returns kFALSE if not succesful.
    830833//
    831834Bool_t MCalibrationChargeCalc::FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what)
     
    857860            << Form(" Ped. RMS: %5.2f in %s%4i",cal.GetPedRms(),what,cal.GetPixId()) << endl;
    858861      bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
     862      return kFALSE;
    859863    }
    860864
     
    865869            << Form("         %4i",cal.GetPixId())
    866870            << endl;
    867       bad.SetUncalibrated(MBadPixelsPix::kChargeIsPedestal);
     871      bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
    868872      return kFALSE;
    869873    }
    870874
    871   if (!cal.CalcFFactorMethod())
     875  if (!cal.CalcFFactor())
    872876    {
    873877      *fLog << warn << GetDescriptor()
     
    879883    }
    880884
     885  if (!cal.CalcConvFFactor())
     886    {
     887      *fLog << warn << GetDescriptor()
     888            << Form(": Could not calculate the Conv. FADC counts to Phes in %s:  ",what)
     889            << Form("         %4i",cal.GetPixId())
     890            << endl;
     891      bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
     892      return kFALSE;
     893    }
     894
    881895  return kTRUE;
    882896}
     
    889903// - MBadPixelsPix::kChargeIsPedestal
    890904// - MBadPixelsPix::kChargeRelErrNotValid
    891 // - MBadPixelsPix::kChargeSigmaNotValid
    892905// - MBadPixelsPix::kMeanTimeInFirstBin
    893906// - MBadPixelsPix::kMeanTimeInLast2Bins
     
    895908//
    896909// - Call MCalibrationPix::SetExcluded() for the bad pixels
     910//
     911// Sets pixel to MBadPixelsPix::kUnreliableRun, if one of the following flags is set:
     912// - MBadPixelsPix::kChargeSigmaNotValid
    897913//
    898914void MCalibrationChargeCalc::FinalizeBadPixels()
     
    914930        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    915931 
    916       if (bad.IsUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ))
    917         bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    918 
    919932      if (bad.IsUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin ))
    920933        bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
     
    929942        pix.SetExcluded();
    930943
     944      if (bad.IsUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ))
     945        bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun    );
    931946    }
    932947}
     
    936951//
    937952// First loop: Calculate a mean and mean RMS of photo-electrons per area index
    938 //             Include only pixels which are not MBadPixelsPix::kUnsuitableRun or
    939 //             MBadPixelsPix::kUnreliableRun (see FinalizeBadPixels()) and set
     953//             Include only pixels which are not MBadPixelsPix::kUnsuitableRun nor
     954//             MBadPixelsPix::kChargeSigmaNotValid (see FinalizeBadPixels()) and set
    940955//             MCalibrationChargePix::SetFFactorMethodValid(kFALSE) in that case.
    941956//             
    942 // Second loop: Get weighted mean number of photo-electrons and its RMS including
     957// Second loop: Get mean number of photo-electrons and its RMS including
    943958//              only pixels with flag MCalibrationChargePix::IsFFactorMethodValid()
    944959//              and further exclude those deviating by more than fPheErrLimit mean
    945960//              sigmas from the mean (obtained in first loop). Set
    946961//              MBadPixelsPix::kDeviatingNumPhes if excluded.
     962//
     963//              For the suitable pixels with flag MBadPixelsPix::kChargeSigmaNotValid
     964//              set the number of photo-electrons as the mean number of photo-electrons
     965//              calculated in that area index.
    947966//
    948967//              Set weighted mean and variance of photo-electrons per area index in:
     
    953972//              average sector pixels of MCalibrationChargeCam (obtained from:
    954973//              MCalibrationChargeCam::GetAverageSector() )
     974//
     975//
     976// Third loop: Set mean number of photo-electrons and its RMS in the pixels
     977//             only excluded as: MBadPixelsPix::kChargeSigmaNotValid
    955978//
    956979Bool_t MCalibrationChargeCalc::FinalizeFFactorMethod()
     
    9991022        }
    10001023
    1001       // if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun))
    1002       //        continue;
     1024      if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid))
     1025        continue;
    10031026     
    10041027      const Float_t nphe  = pix.GetPheFFactorMethod();
     
    11091132        continue;
    11101133
     1134      MBadPixelsPix         &bad = (*fBadPixels)[i];
     1135
     1136      if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid))
     1137        continue;
     1138
    11111139      const Float_t nvar  = pix.GetPheFFactorMethodVar();
    11121140
     
    11171145        }
    11181146     
    1119       MBadPixelsPix         &bad = (*fBadPixels)[i];
    1120 
    11211147      const Int_t   aidx   = (*fGeom)[i].GetAidx();
    11221148      const Int_t   sector = (*fGeom)[i].GetSector();
     
    12321258    }
    12331259
     1260  //
     1261  // Third loop: Set mean number of photo-electrons and its RMS in the pixels
     1262  //             only excluded as: MBadPixelsPix::kChargeSigmaNotValid
     1263  //
     1264  for (UInt_t i=0; i<npixels; i++)
     1265    {
     1266     
     1267      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1268      MBadPixelsPix         &bad = (*fBadPixels)[i];
     1269
     1270      if (!pix.IsFFactorMethodValid())
     1271        continue;
     1272     
     1273      const Int_t   aidx   = (*fGeom)[i].GetAidx();
     1274
     1275      if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid))
     1276        {
     1277          MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
     1278          pix.SetPheFFactorMethod   ( apix.GetPheFFactorMethod()    );
     1279          pix.SetPheFFactorMethodVar( apix.GetPheFFactorMethodVar() );
     1280          if (!pix.CalcConvFFactor())
     1281            {
     1282              *fLog << warn << GetDescriptor()
     1283                    << ": Could not calculate the Conv. FADC counts to Phes in pixel:  "
     1284                    << Form("         %4i",pix.GetPixId())
     1285                    << endl;
     1286              bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
     1287              bad.SetUnsuitable  ( MBadPixelsPix::kUnsuitableRun    );
     1288            }
     1289        }
     1290    }
     1291 
    12341292  return kTRUE;
    12351293}
     
    15231581      const Float_t qe      = pix.GetPheFFactorMethod() / photons ;
    15241582
    1525       if (!pix.CalcMeanFFactor( photons , avphotrelvar ))
    1526         {
    1527           (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
    1528           continue;
    1529         }
    1530 
    15311583      const Float_t qerelvar = avphotrelvar +  pix.GetPheFFactorMethodRelVar();
    15321584
     
    15381590        *fLog << warn << GetDescriptor()
    15391591              << ": Cannot update Quantum efficiencies with the F-Factor Method" << endl;
     1592
     1593      //
     1594      // The following pixels are those with deviating sigma, but otherwise OK,
     1595      // probably those with stars during the pedestal run, but not the cal. run.
     1596      //
     1597      if (!pix.CalcMeanFFactor( photons , avphotrelvar ))
     1598        {
     1599          (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingFFactor );
     1600          (*fBadPixels)[i].SetUnsuitable  ( MBadPixelsPix::kUnreliableRun    );
     1601          continue;
     1602        }
    15401603
    15411604      const Int_t aidx = (*fGeom)[i].GetAidx();
     
    19291992}
    19301993
     1994// --------------------------------------------------------------------------
     1995//
     1996// Set the output file
     1997//
    19311998void MCalibrationChargeCalc::SetOutputFile(TString file)
    19321999{
    1933   fOutputFile        = file;
     2000  fOutputFile = file;
    19342001}
    19352002
     
    19432010}
    19442011
     2012// --------------------------------------------------------------------------
     2013//
     2014// Read the environment for the following data members:
     2015// - fChargeLimit
     2016// - fChargeErrLimit
     2017// - fChargeRelErrLimit
     2018// - fDebug
     2019// - fFFactorErrLimit
     2020// - fLambdaErrLimit
     2021// - fLambdaCheckErrLimit
     2022// - fPheErrLimit
     2023//
    19452024Int_t MCalibrationChargeCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    19462025{
    1947     Bool_t rc = kFALSE;
    1948     if (IsEnvDefined(env, prefix, "ChargeLimit", print))
    1949     {
    1950         SetChargeLimit(GetEnvValue(env, prefix, "ChargeLimit", fChargeLimit));
    1951         rc = kTRUE;
    1952     }
    1953 
    1954     if (IsEnvDefined(env, prefix, "ChargeErrLimit", print))
    1955     {
    1956         SetChargeErrLimit(GetEnvValue(env, prefix, "ChargeErrLimit", fChargeErrLimit));
    1957         rc = kTRUE;
    1958     }
    1959 
    1960     if (IsEnvDefined(env, prefix, "ChargeRelErrLimit", print))
    1961     {
    1962         SetChargeRelErrLimit(GetEnvValue(env, prefix, "ChargeRelErrLimit", fChargeRelErrLimit));
    1963         rc = kTRUE;
    1964     }
    1965     if (IsEnvDefined(env, prefix, "Debug", print))
    1966     {
    1967         SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug()));
    1968         rc = kTRUE;
    1969     }
    1970     if (IsEnvDefined(env, prefix, "FFactorErrLimit", print))
    1971     {
    1972         SetFFactorErrLimit(GetEnvValue(env, prefix, "FFactorErrLimit", fFFactorErrLimit));
    1973         rc = kTRUE;
    1974     }
    1975     if (IsEnvDefined(env, prefix, "LambdaErrLimit", print))
    1976     {
    1977         SetLambdaErrLimit(GetEnvValue(env, prefix, "LambdaErrLimit", fLambdaErrLimit));
    1978         rc = kTRUE;
    1979     }
    1980     if (IsEnvDefined(env, prefix, "LambdaCheckLimit", print))
    1981     {
    1982         SetLambdaCheckLimit(GetEnvValue(env, prefix, "LambdaCheckLimit", fLambdaCheckLimit));
    1983         rc = kTRUE;
    1984     }
    1985     if (IsEnvDefined(env, prefix, "PheErrLimit", print))
    1986     {
    1987         SetPheErrLimit(GetEnvValue(env, prefix, "PheErrLimit", fPheErrLimit));
    1988         rc = kTRUE;
    1989     }
    1990     // void SetPulserColor(const MCalibrationCam::PulserColor_t col) { fPulserColor = col; }
    1991 
    1992     return rc;
    1993 }
     2026
     2027  Bool_t rc = kFALSE;
     2028  if (IsEnvDefined(env, prefix, "ChargeLimit", print))
     2029    {
     2030      SetChargeLimit(GetEnvValue(env, prefix, "ChargeLimit", fChargeLimit));
     2031      rc = kTRUE;
     2032    }
     2033  if (IsEnvDefined(env, prefix, "ChargeErrLimit", print))
     2034    {
     2035      SetChargeErrLimit(GetEnvValue(env, prefix, "ChargeErrLimit", fChargeErrLimit));
     2036      rc = kTRUE;
     2037    }
     2038  if (IsEnvDefined(env, prefix, "ChargeRelErrLimit", print))
     2039    {
     2040      SetChargeRelErrLimit(GetEnvValue(env, prefix, "ChargeRelErrLimit", fChargeRelErrLimit));
     2041      rc = kTRUE;
     2042    }
     2043  if (IsEnvDefined(env, prefix, "Debug", print))
     2044    {
     2045      SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug()));
     2046      rc = kTRUE;
     2047    }
     2048  if (IsEnvDefined(env, prefix, "FFactorErrLimit", print))
     2049    {
     2050      SetFFactorErrLimit(GetEnvValue(env, prefix, "FFactorErrLimit", fFFactorErrLimit));
     2051      rc = kTRUE;
     2052    }
     2053  if (IsEnvDefined(env, prefix, "LambdaErrLimit", print))
     2054    {
     2055      SetLambdaErrLimit(GetEnvValue(env, prefix, "LambdaErrLimit", fLambdaErrLimit));
     2056      rc = kTRUE;
     2057    }
     2058  if (IsEnvDefined(env, prefix, "LambdaCheckLimit", print))
     2059    {
     2060      SetLambdaCheckLimit(GetEnvValue(env, prefix, "LambdaCheckLimit", fLambdaCheckLimit));
     2061      rc = kTRUE;
     2062    }
     2063  if (IsEnvDefined(env, prefix, "PheErrLimit", print))
     2064    {
     2065      SetPheErrLimit(GetEnvValue(env, prefix, "PheErrLimit", fPheErrLimit));
     2066      rc = kTRUE;
     2067    }
     2068  // void SetPulserColor(const MCalibrationCam::PulserColor_t col) { fPulserColor = col; }
     2069 
     2070  return rc;
     2071}
Note: See TracChangeset for help on using the changeset viewer.