Ignore:
Timestamp:
05/25/04 20:30:33 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
2 edited

Legend:

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

    r4163 r4186  
    6262//  Low-Gain variables are stored internally unconverted, i.e. directly from the summed
    6363//  FADC slices extraction results, but can be retrieved converted to High-Gain amplifications
    64 //  by calls to: GetConvertedLoGainMean() or GetConvertedLoGainSigma()
     64//  by calls to: GetConvertedMean() or GetConvertedSigma()
    6565//
    6666// See also: MCalibrationChargeCam, MCalibrationChargeCalc,
     
    306306// --------------------------------------------------------------------------
    307307//
    308 // Get the Low Gain Mean converted to High Gain amplification:
    309 // Returns fLoGainMean multiplied with fConversionHiLo
    310 //
    311 Float_t MCalibrationChargePix::GetConvertedLoGainMean()  const
    312 {
    313   return fLoGainMean * fConversionHiLo;
     308// Get the Low Gain Mean Charge converted to High Gain amplification:
     309// Returns fLoGainMean multiplied with fConversionHiLo if IsHiGainSaturation(),
     310//         else return fHiGainMean
     311//
     312Float_t MCalibrationChargePix::GetConvertedMean()  const
     313{
     314
     315  if (IsHiGainSaturation())
     316    return fLoGainMean * fConversionHiLo;
     317
     318  return fHiGainMean;
    314319}
    315320
     
    321326//
    322327// Returns the square root of the quadratic sum of the relative variances of
    323 // the fLoGainMean and fConversionHiLo, mulitplied with GetConvertedLoGainMean()
    324 //
    325 Float_t MCalibrationChargePix::GetConvertedLoGainMeanErr()  const
    326 {
    327 
    328   const Float_t logainrelvar = GetLoGainMeanRelVar();
    329  
    330   if (logainrelvar < 0.)
    331     return -1.;
    332 
    333   return TMath::Sqrt(logainrelvar + GetConversionHiLoRelVar()) * GetConvertedLoGainMean();
     328// the fLoGainMean and fConversionHiLo, mulitplied with GetConvertedMean()
     329// in case of HiGain Saturation,
     330// else return GetMeanErr()
     331//
     332Float_t MCalibrationChargePix::GetConvertedMeanErr()  const
     333{
     334
     335  if (IsHiGainSaturation())
     336    {
     337      const Float_t logainrelvar = GetLoGainMeanRelVar();
     338     
     339      if (logainrelvar < 0.)
     340        return -1.;
     341
     342      return TMath::Sqrt(logainrelvar + GetConversionHiLoRelVar()) * GetConvertedMean();
     343    }
     344  else
     345    return GetMeanErr();
     346
    334347}
    335348
     
    337350//
    338351// Get the Low Gain Sigma converted to High Gain amplification:
    339 // Returns fLoGainSigma multiplied with fConversionHiLo
    340 //
    341 Float_t MCalibrationChargePix::GetConvertedLoGainSigma()  const
    342 {
    343   return fLoGainSigma * fConversionHiLo;
    344 }
    345 
    346 // --------------------------------------------------------------------------
    347 //
    348 // Get the Error of the converted Low Gain Sigma:
     352// Returns fLoGainSigma multiplied with fConversionHiLo if IsHiGainSaturation()
     353// else return fHiGainSigma
     354//
     355Float_t MCalibrationChargePix::GetConvertedSigma()  const
     356{
     357 
     358  if (IsHiGainSaturation())
     359    return fLoGainSigma * fConversionHiLo;
     360  else
     361    return fHiGainSigma;
     362}
     363
     364// --------------------------------------------------------------------------
     365//
     366// Get the Error of the converted Sigma:
    349367//
    350368// Returns -1 if the variable fLoGainSigma or fLoGainSigmaVar are smaller than 0.
    351369//
    352 // Returns the square root of the quadratic sum of the relative variances of
    353 // the fLoGainSigma and fConversionHiLo, mulitplied with GetConvertedLoGainSigma()
    354 //
    355 Float_t MCalibrationChargePix::GetConvertedLoGainSigmaErr()  const
    356 {
    357 
    358   if (fLoGainSigmaVar < 0.)
    359     return -1.;
    360 
    361   if (fLoGainSigma < 0.)
    362     return -1.;
    363 
    364   const Float_t sigmaRelVar     =  fLoGainSigmaVar
     370// if IsHiGainSaturatio()
     371// returns the square root of the quadratic sum of the relative variances of
     372// the fLoGainSigma and fConversionHiLo, mulitplied with GetConvertedSigma()
     373// else returns GetSigmaErr()
     374//
     375Float_t MCalibrationChargePix::GetConvertedSigmaErr()  const
     376{
     377
     378  if (IsHiGainSaturation())
     379    {
     380      if (fLoGainSigmaVar < 0.)
     381        return -1.;
     382     
     383      if (fLoGainSigma < 0.)
     384        return -1.;
     385     
     386      const Float_t sigmaRelVar =  fLoGainSigmaVar
    365387                                /( fLoGainSigma * fLoGainSigma );
    366388
    367   return TMath::Sqrt(sigmaRelVar+GetConversionHiLoRelVar()) * GetConvertedLoGainSigma();
    368 }
    369 
    370 
     389      return TMath::Sqrt(sigmaRelVar+GetConversionHiLoRelVar()) * GetConvertedSigma();
     390    }
     391  else
     392    return GetSigmaErr();
     393
     394
     395}
     396
     397// --------------------------------------------------------------------------
     398//
     399// Get the converted reduced Sigma:
     400// - If fRSigmaSquare is smaller than 0 (i.e. has not yet been set), return -1.
     401// - Test bit kHiGainSaturation:
     402//   If yes, return square root of fRSigmaSquare, multiplied with fConversionHiLo,
     403//   If no , return square root of fRSigmaSquare
     404//
     405Float_t MCalibrationChargePix::GetConvertedRSigma()  const
     406{
     407  if (fRSigmaSquare < 0)
     408    return -1;
     409
     410  const Float_t rsigma = TMath::Sqrt(fRSigmaSquare);
     411 
     412  return IsHiGainSaturation() ? rsigma*fConversionHiLo : rsigma ;
     413}
     414
     415// --------------------------------------------------------------------------
     416//
     417// Get the error of the converted reduced Sigma:
     418// - If fRSigmaSquareVar is smaller than 0 (i.e. has not yet been set), return -1.
     419// - Calculate the absolute variance of the reduced sigma with the formula:
     420//   reduced sigma variance = 0.25 * fRSigmaSquareVar / fRSigmaSquare
     421// - Test bit kHiGainSaturation:
     422//   If yes, returns the square root of the quadratic sum of the relative variances of the
     423//           reduced sigma and fConversionHiLo, mulitplied with GetRSigma()
     424//   Else returns the square root of rel. (0.25*fRSigmaSquareVar / fRSigmaSquare)
     425//
     426Float_t MCalibrationChargePix::GetConvertedRSigmaErr()  const
     427{
     428
     429  if (fRSigmaSquareVar < 0)
     430    return -1;
     431
     432  //
     433  // SigmaSquareVar = 4. * Sigma * Sigma * Var(sigma)
     434  // ==> Var(sigma) = 0.25 * SigmaSquareVar / (Sigma * Sigma)
     435  //
     436  const Float_t rsigmaVar = 0.25 * fRSigmaSquareVar / fRSigmaSquare;
     437
     438  if (IsHiGainSaturation())
     439    return TMath::Sqrt(rsigmaVar/fRSigmaSquare + GetConversionHiLoRelVar()) * GetRSigma();
     440  else
     441    return TMath::Sqrt(rsigmaVar);
     442
     443}
    371444
    372445// --------------------------------------------------------------------------
     
    383456    return -1;
    384457
    385   const Float_t rsigma = TMath::Sqrt(fRSigmaSquare);
    386  
    387   return IsHiGainSaturation() ? rsigma*fConversionHiLo : rsigma ;
     458  return TMath::Sqrt(fRSigmaSquare);
     459 
    388460}
    389461
     
    409481  // ==> Var(sigma) = 0.25 * SigmaSquareVar / (Sigma * Sigma)
    410482  //
    411   const Float_t rsigmaVar = 0.25 * fRSigmaSquareVar / fRSigmaSquare;
    412 
    413   if (IsHiGainSaturation())
    414     return TMath::Sqrt(rsigmaVar/fRSigmaSquare + GetConversionHiLoRelVar()) * GetRSigma();
    415   else
    416     return TMath::Sqrt(rsigmaVar);
     483  return TMath::Sqrt(0.25 * fRSigmaSquareVar / fRSigmaSquare);
    417484
    418485}
     
    475542//   If no , return fRSigmaSquare
    476543//
    477 Float_t MCalibrationChargePix::GetRSigmaSquare()  const
     544Float_t MCalibrationChargePix::GetConvertedRSigmaSquare()  const
    478545{
    479546  if (fRSigmaSquare < 0)
     
    503570  // ==> Var(sigma) = 0.25 * SigmaSquareVar / (Sigma * Sigma)
    504571  //
    505   const Float_t rsigmaRelVar = 0.25 * fRSigmaSquareVar / ( fRSigmaSquare * fRSigmaSquare );
    506 
    507   if (IsHiGainSaturation())
    508     return rsigmaRelVar + GetConversionHiLoRelVar();
    509   else
    510     return rsigmaRelVar;
     572  return 0.25 * fRSigmaSquareVar / ( fRSigmaSquare * fRSigmaSquare );
     573
    511574}
    512575
     
    699762    return kFALSE;
    700763
    701   fMeanConvFADC2Phe    =  fPheFFactorMethod / GetMean();
     764  fMeanConvFADC2Phe    =  fPheFFactorMethod / GetConvertedMean();
    702765 
    703766  if (fMeanConvFADC2Phe < 0. )
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h

    r4130 r4186  
    7575  Float_t GetConversionHiLo          () const { return fConversionHiLo;          }
    7676  Float_t GetConversionHiLoErr       () const;
    77   Float_t GetConvertedLoGainMean     () const;
    78   Float_t GetConvertedLoGainMeanErr  () const;
    79   Float_t GetConvertedLoGainSigma    () const;
    80   Float_t GetConvertedLoGainSigmaErr () const;
     77  Float_t GetConvertedMean           () const;
     78  Float_t GetConvertedMeanErr        () const;
     79  Float_t GetConvertedSigma          () const;
     80  Float_t GetConvertedSigmaErr       () const;
     81  Float_t GetConvertedRSigma         () const;
     82  Float_t GetConvertedRSigmaErr      () const;
     83  Float_t GetConvertedRSigmaSquare   () const; 
    8184  Float_t GetMeanConvFADC2Phe        () const { return fMeanConvFADC2Phe;        }
    8285  Float_t GetMeanConvFADC2PheErr     () const;
     
    9598  Float_t GetRSigma                  () const;
    9699  Float_t GetRSigmaErr               () const;
     100  Float_t GetRSigmaRelVar            () const;
    97101  Float_t GetRSigmaPerCharge         () const;
    98102  Float_t GetRSigmaPerChargeErr      () const;
    99   Float_t GetRSigmaSquare            () const; 
    100   Float_t GetRSigmaRelVar            () const;
    101103
    102104  Bool_t IsFFactorMethodValid        () const;
Note: See TracChangeset for help on using the changeset viewer.