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

Legend:

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

    r3650 r3654  
    3838//
    3939// The following variables are calculated inside this class:
    40 // -  fLoGainPedRmsSquare and LoGainPedRmsSquareVar (see CalcLoGainPedestal())
    41 // -  fRSigmaSquare and fRSigmaSquareVar            (see CalcReducedSigma() )
    42 // -  fPheFFactorMethod and fPheFFactorMethodVar    see CalcFFactorMethod() )
     40// -  fLoGainPedRmsSquare and fLoGainPedRmsSquareVar (see CalcLoGainPedestal())
     41// -  fRSigmaSquare and fRSigmaSquareVar             (see CalcReducedSigma() )
     42// -  fPheFFactorMethod and fPheFFactorMethodVar     (see CalcFFactorMethod() )
    4343//
    4444// The following variables are set by MHCalibrationChargeCam:
     
    5252// - fConversionFFactorMethodVar, fConversionBlindPixelMethodVar
    5353//   fConversionPINDiodeMethodVar and fConversionCombinedMethodVar
    54 // - fSigmaConversionFFactorMethodm, fSigmaConversionBlindPixelMethod
     54// - fSigmaConversionFFactorMethod, fSigmaConversionBlindPixelMethod
    5555//   fSigmaConversionPINDiodeMethod and fSigmaConversionCombinedMethod 
    5656// - fTotalFFactorFFactorMethod, fTotalFFactorBlindPixelMethod   
     
    9595// - fCalibFlags to 0
    9696// - fConversionHiLo to fgConversionHiLo
    97 // - fConversionHiLoErr to fgConversionHiLoErr
    98 // - PheFFactorMethodLimit to fgPheFFactorMethodLimit
     97// - fConversionHiLoVar to square of fgConversionHiLoErr
     98// - fPheFFactorMethodLimit to fgPheFFactorMethodLimit
    9999//
    100100// Calls:
     
    180180// --------------------------------------------------------------------------
    181181//
    182 // Set the conversion factors Blind Pixel Method from outside (only for MC)
     182// Set conversion factors Blind Pixel Method from outside (only for MC)
    183183//
    184184void MCalibrationChargePix::SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig)
     
    192192// --------------------------------------------------------------------------
    193193//
    194 // Set the conversion factors Combined Method from outside (only for MC)
     194// Set conversion factors Combined Method from outside (only for MC)
    195195//
    196196void MCalibrationChargePix::SetConversionCombinedMethod(Float_t c, Float_t err, Float_t sig)
     
    204204// --------------------------------------------------------------------------
    205205//
    206 // Set the conversion factors F-Factor Method from outside (only for MC)
     206// Set conversion factors F-Factor Method from outside (only for MC)
    207207//
    208208void MCalibrationChargePix::SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig)
     
    215215// --------------------------------------------------------------------------
    216216//
    217 // Set the conversion factors PIN Diode Method from outside (only for MC)
     217// Set conversion factors PIN Diode Method from outside (only for MC)
    218218//
    219219void MCalibrationChargePix::SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig)
     
    226226// --------------------------------------------------------------------------
    227227//
    228 // Set the BlindPixelMethod Validity Bit from outside
     228// Set Blind Pixel Method Validity Bit from outside
    229229//
    230230void MCalibrationChargePix::SetBlindPixelMethodValid(const Bool_t b )
     
    235235// --------------------------------------------------------------------------
    236236//
    237 // Set the CombinedMethod Validity Bit from outside
     237// Set Combined Method Validity Bit from outside
    238238//
    239239void MCalibrationChargePix::SetCombinedMethodValid(const Bool_t b ) 
     
    244244// --------------------------------------------------------------------------
    245245//
    246 // Set the FFactorMethod Validity Bit from outside
     246// Set F-Factor Method Validity Bit from outside
    247247//
    248248void MCalibrationChargePix::SetFFactorMethodValid(const Bool_t b )
     
    253253// --------------------------------------------------------------------------
    254254//
    255 // Set the PINDiodeMethod Validity Bit from outside
     255// Set PIN Diode Method Validity Bit from outside
    256256//
    257257void MCalibrationChargePix::SetPINDiodeMethodValid(const Bool_t b ) 
     
    262262// --------------------------------------------------------------------------
    263263//
    264 // Set the pedestals from outside
     264// Set pedestals from outside (done by MCalibrationChargeCalc)
    265265//
    266266void MCalibrationChargePix::SetPedestal(const Float_t ped, const Float_t pedrms, const Float_t pederr)
     
    306306// Get the Error of the pedestals RMS:
    307307// - Test bit kHiGainSaturation:
    308 //   If yes, return kLoGainPedRms, else fPedRms
     308//   If yes, return square root of (0.25*fLoGainPedRmsSquareVar/ fLoGainPedRmsSquare) (if greater than 0, otherwise -1.)
     309//   If no , return square root of (fPedVar) (if greater than 0, otherwise -1.), divided by 2.
    309310//
    310311Float_t  MCalibrationChargePix::GetPedRmsErr()  const
     
    336337//
    337338// Get the Error of the Low Gain Mean:
    338 // Returns the quadratic sum of the relative low Gain Mean error and the
    339 // the relative conversion High-to-Low error, mulitplied with GetLoGainMean()
     339//
     340// Returns -1 if the variable fLoGainMean or fLoGainMeanVar are smaller than 0.
     341//
     342// Returns the square root of the quadratic sum of the relative variances of
     343// the fLoGainMean and fConversionHiLo, mulitplied with GetLoGainMean()
    340344//
    341345Float_t MCalibrationChargePix::GetLoGainMeanErr()  const
    342346{
     347 
     348  if (fLoGainMeanVar < 0.)
     349    return -1.;
     350
     351  if (fLoGainMean < 0.)
     352    return -1.;
    343353
    344354  const Float_t chargeRelVar     =  fLoGainMeanVar
     
    361371//
    362372// Get the Error of the Low Gain Sigma:
    363 // Returns the quadratic sum of the relative low Gain Sigma error and the
    364 // the relative conversion High-to-Low error, mulitplied with GetLoGainSigma()
     373//
     374// Returns -1 if the variable fLoGainSigma or fLoGainSigmaVar are smaller than 0.
     375//
     376// Returns the square root of the quadratic sum of the relative variances of
     377// the fLoGainSigma and fConversionHiLo, mulitplied with GetLoGainSigma()
    365378//
    366379Float_t MCalibrationChargePix::GetLoGainSigmaErr()  const
    367380{
     381
     382  if (fLoGainSigmaVar < 0.)
     383    return -1.;
     384
     385  if (fLoGainSigma < 0.)
     386    return -1.;
    368387
    369388  const Float_t sigmaRelVar     =  fLoGainSigmaVar
     
    396415// - If fRSigmaSquareVar is smaller than 0 (i.e. has not yet been set), return -1.
    397416// - Calculate the absolute variance of the reduced sigma with the formula:
    398 //   sigma variance = 0.25 * fRSigmaSquareVar / fRSigmaSquare
     417//   reduced sigma variance = 0.25 * fRSigmaSquareVar / fRSigmaSquare
    399418// - Test bit kHiGainSaturation:
    400 //   If yes, returns the quadratic sum of the relative reduced Sigma error and the
    401 //    the relative conversion High-to-Low error, mulitplied with GetRSigma()
     419//   If yes, returns the square root of the quadratic sum of the relative variances of the
     420//           reduced sigma and fConversionHiLo, mulitplied with GetRSigma()
    402421//   Else returns the square root of rel. (0.25*fRSigmaSquareVar / fRSigmaSquare)
    403422//
     
    593612// - If fPedRms is smaller than 0 (i.e. has not yet been set), return kFALSE
    594613//
    595 // Calculate the reduced sigma:
     614// Calculate the reduced sigma of the low-Gain FADC slices:
    596615// - Test bit IsHiGainSaturation() for the Sigma:
    597616//   If yes, take fLoGainSigma and fLoGainSigmaVar
     
    600619// - Test bit IsHiGainSaturation() for the pedRMS:
    601620//   If yes, take fLoGainPedRmsSquare and fLoGainPedRmsSquareVar
    602 //   If no , take fPedRms and fPedRmsVar
     621//   If no , take fPedRms and fPedVar
    603622//
    604623// - Calculate the reduced sigma with the formula:
    605624//   fRSigmaSquare = Sigma*Sigma - pedRMS*pedRMS
    606625//
     626// - If fRSigmaSquare is smaller than 0, give a warning and return kFALSE
     627//
    607628// - Calculate the variance of the reduced sigma with the formula:
    608629//   fRSigmaSquareVar = 4.* (sigmaVar*Sigma*Sigma + pedRmsVar*pedRMS*pedRMS)
    609630//
     631// A back-transformation to the corr. amplification factor of the High-Gain is done
     632// in GetRSigma() and GetRSigmaErr()
     633//
    610634Bool_t MCalibrationChargePix::CalcReducedSigma()
    611635{
     
    617641    return kFALSE;
    618642
    619   const Float_t sigma    = IsHiGainSaturation() ? fLoGainSigma    : fHiGainSigma   ;
    620   const Float_t sigmavar = IsHiGainSaturation() ? fLoGainSigmaVar : fHiGainSigmaVar;
     643  const Float_t sigma           = IsHiGainSaturation() ? fLoGainSigma           : fHiGainSigma   ;
     644  const Float_t sigmavar        = IsHiGainSaturation() ? fLoGainSigmaVar        : fHiGainSigmaVar;
    621645  const Float_t pedRmsSquare    = IsHiGainSaturation() ? fLoGainPedRmsSquare    : fPedRms*fPedRms;
    622646  const Float_t pedRmsSquareVar = IsHiGainSaturation() ? fLoGainPedRmsSquareVar : 0.25*fPedVar*pedRmsSquare;
     
    654678// - Test bit IsHiGainSaturation() for the pedRMS:
    655679//   If yes, take fLoGainPedRmsSquare and fLoGainPedRmsSquareVar
    656 //   If no , take fPedRms and fPedRmsVar
     680//   If no , take fPedRms and fPedVar
    657681//
    658682// - Calculate the number of photo-electrons with the formula:
    659 //   fPheFFactorMethod   = gkFFactor*gkFFactor * mean * mean  / fRSigmaSquare
     683//   fPheFFactorMethod   = gkFFactor*gkFFactor * Mean * Mean  / fRSigmaSquare
    660684//
    661685// - Calculate the Variance on the photo-electrons with the formula:
    662686//   fPheFFactorMethodVar =  (  4. * gkFFactorErr * gkFFactorErr / ( gkFFactor * gkFFactor )
    663 //                            + 4. * fMeanVar                    / ( mean      * mean      )
    664 //                            + 4. * fRSigmaVar                  / ( fRSigma   * fRSigma   )
    665 //                            ) * fPheFFactor * fPheFFactor
    666 // - if fPheFFactorMethod is less than fPheFFactorMethodLimit,
    667 //   Set kFFactorMethodValid to kFALSE and return kFALSE
     687//                            + 4. * Mean Var.   / ( Mean * Mean )
     688//                            + fRSigmaSquareVar / fRSigmaSquare
     689//                            ) * fPheFFactorMethod * fPheFFactorMethod
     690//
     691// - If fPheFFactorMethod is less than fPheFFactorMethodLimit,
     692//   set kFFactorMethodValid to kFALSE and return kFALSE
    668693//   else: Set kFFactorMethodValid to kTRUE and return kTRUE
    669694//
     
    722747//  - elec. pedestal = gkElectronicPedRms * sqrt(logainsamples)
    723748//
    724 // Calculate the LONS ped. RMS contribution in the high-gain
     749// Calculate the night sky background ped. RMS contribution ("NSB") in the high-gain
    725750// from the high gain Pedestal RMS with the formula:
    726751// - HiGain NSB square      = fPedRms * fPedRms - elec.ped.* elec.ped.
    727752// - Var(HiGain NSB square) = fPedVar * fPedRms * fPedRms + 4.*elecPedRmsVar * elec.ped.* elec.ped.
    728753//
    729 // If PedRMS (LONS,lowgain) square is smaller than 0., set it to zero. (but not the error!)
    730 //
    731 // Convert the LONS ped. RMS contribution to the low-gain with the formula:
     754// If HiGain NSB square is smaller than 0., set it to zero. (but not the error!)
     755//
     756// Convert the NSB ped. RMS contribution to the low-gain with the formula:
    732757// - LoGain NSB square      = - HiGain NSB square / (fConversionHiLo*fConversionHiLo)
    733758// - Var(LoGain NSB square) = ( Var(HiGain NSB square) / (HiGain NSB square * HiGain NSB square)
    734 //                              + GetConversionHiLoRelVar()   )
    735 //                            * LoGain NSB square * LoGain NSB square
     759//                              + GetConversionHiLoRelVar()   
     760//                            ) * LoGain NSB square * LoGain NSB square
    736761//
    737762// - Low Gain Ped RMS Square       = LoGain NSB square      + elec.ped. square
     
    784809}
    785810 
     811// --------------------------------------------------------------------------
     812//
     813// Get the relative variance of the conversion factor between higain and logain:
     814// - If fConversionHiLo is smaller than 0, return -1.
     815// - Else returns: fConversionHiLoVar / (fConversionHiLo * fConversionHiLo)
     816//
    786817const Float_t MCalibrationChargePix::GetConversionHiLoRelVar() const
    787818{
Note: See TracChangeset for help on using the changeset viewer.