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

Legend:

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

    r3662 r3672  
    193193}
    194194
     195// --------------------------------------------------------------------------
     196//
     197// Return -1 if fNumPhotonsVar is smaller than 0.
     198// Return square root of fNumPhotonsVar
     199//
     200Float_t MCalibrationChargePINDiode::GetNumPhotonsErr() const
     201{
     202  if (fNumPhotonsVar < 0.)
     203    return -1.;
     204 
     205  return TMath::Sqrt(fNumPhotonsVar);
     206}
     207
     208// --------------------------------------------------------------------------
     209//
     210// Return -1 if fNumPhotonsVar is smaller than 0.
     211// Return -1 if fNumPhotons    is 0.
     212// Return fNumPhotonsVar / (fNumPhotons^2 )
     213//
     214Float_t MCalibrationChargePINDiode::GetNumPhotonsRelVar() const
     215{
     216  if (fNumPhotonsVar < 0.)
     217    return -1.;
     218 
     219  if (fNumPhotons  == 0.)
     220    return -1.;
     221 
     222  return  fNumPhotonsVar / fNumPhotons / fNumPhotons ;
     223}
     224
     225
     226// --------------------------------------------------------------------------
     227//
     228// Return -1 if gkPINDiodeQEGreenErr is smaller than 0.
     229// Return -1 if gkPINDiodeQEGreen    is 0.
     230// Return gkPINDiodeQEGreenErr^2 / (gkPINDiodeQEGreen^2 )
     231//
     232const Float_t MCalibrationChargePINDiode::GetPINDiodeQEGreenRelVar() const
     233{
     234  if (gkPINDiodeQEGreenErr < 0.)
     235    return -1.;
     236 
     237  if (gkPINDiodeQEGreen  == 0.)
     238    return -1.;
     239 
     240  return gkPINDiodeQEGreenErr * gkPINDiodeQEGreenErr / gkPINDiodeQEGreen / gkPINDiodeQEGreen ;
     241}
     242
     243// --------------------------------------------------------------------------
     244//
     245// Return -1 if gkPINDiodeQEBlueErr is smaller than 0.
     246// Return -1 if gkPINDiodeQEBlue    is 0.
     247// Return gkPINDiodeQEBlueErr^2 / gkPINDiodeQEBlue^2
     248//
     249const Float_t MCalibrationChargePINDiode::GetPINDiodeQEBlueRelVar() const
     250{
     251  if (gkPINDiodeQEBlueErr < 0.)
     252    return -1.;
     253 
     254  if (gkPINDiodeQEBlue  == 0.)
     255    return -1.;
     256 
     257  return gkPINDiodeQEBlueErr * gkPINDiodeQEBlueErr / gkPINDiodeQEBlue / gkPINDiodeQEBlue ;
     258}
     259
     260// --------------------------------------------------------------------------
     261//
     262// Return -1 if gkPINDiodeQEUVErr is smaller than 0.
     263// Return -1 if gkPINDiodeQEUV    is 0.
     264// Return gkPINDiodeQEUVErr ^2 / gkPINDiodeQEUV^2
     265//
     266const Float_t MCalibrationChargePINDiode::GetPINDiodeQEUVRelVar() const
     267{
     268  if (gkPINDiodeQEUVErr < 0.)
     269    return -1.;
     270 
     271  if (gkPINDiodeQEUV  == 0.)
     272    return -1.;
     273 
     274  return gkPINDiodeQEUVErr * gkPINDiodeQEUVErr / gkPINDiodeQEUV / gkPINDiodeQEUV ;
     275}
     276
     277// --------------------------------------------------------------------------
     278//
     279// Return -1 if gkPINDiodeQECT1Err is smaller than 0.
     280// Return -1 if gkPINDiodeQECT1    is 0.
     281// Return gkPINDiodeQECT1Err ^2 / gkPINDiodeQECT1^2
     282//
     283const Float_t MCalibrationChargePINDiode::GetPINDiodeQECT1RelVar() const
     284{
     285  if (gkPINDiodeQECT1Err < 0.)
     286    return -1.;
     287 
     288  if (gkPINDiodeQECT1  == 0.)
     289    return -1.;
     290 
     291  return gkPINDiodeQECT1Err * gkPINDiodeQECT1Err / gkPINDiodeQECT1 / gkPINDiodeQECT1 ;
     292}
     293
     294// --------------------------------------------------------------------------
     295//
     296// Return -1 if gkSolidAngleRatioErr is smaller than 0.
     297// Return -1 if gkSolidAngleRatio    is 0.
     298// Return gkSolidAngleRatioErr ^2 / gkSolidAngleRatio^2
     299//
     300const Float_t MCalibrationChargePINDiode::GetSolidAngleRatioRelVar() const
     301{
     302  if (gkSolidAngleRatioErr < 0.)
     303    return -1.;
     304 
     305  if (gkSolidAngleRatio  == 0.)
     306    return -1.;
     307 
     308  return gkSolidAngleRatioErr * gkSolidAngleRatioErr / gkSolidAngleRatio / gkSolidAngleRatio ;
     309}
     310
    195311
    196312// --------------------------------------------------------------------------
     
    257373  // Correct for the distance between camera and PIN Diode and for different areas.
    258374  //
    259   fFluxOutsidePlexiglass  = fNumPhotons * gkSolidAngleRatio;
    260 
    261   //
    262   // Start calculation of number of photons relative Variance (!!)
    263   //
    264   const Float_t numphotRelVar    = fNumPhotonsVar / ( fNumPhotons * fNumPhotons  )  ;
    265   const Float_t solidangleRelVar = gkSolidAngleRatioErr* gkSolidAngleRatioErr
    266                               / ( gkSolidAngleRatio    * gkSolidAngleRatio   );
    267   Float_t fluxRelVar            = numphotRelVar + solidangleRelVar ;
    268 
    269375  switch (fColor)
    270376    {
    271377    case kGREEN:
    272       fFluxOutsidePlexiglass /=  gkPINDiodeQEGreen;
    273       fluxRelVar             +=  gkPINDiodeQEGreenErr* gkPINDiodeQEGreenErr
    274                              / ( gkPINDiodeQEGreen   * gkPINDiodeQEGreen    );
     378      fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio           * gkPINDiodeQEGreen;
     379      fFluxOutsidePlexiglassVar = GetNumPhotonsRelVar() + GetSolidAngleRatioRelVar()  + GetPINDiodeQEGreenRelVar();
    275380      break;
    276381    case kBLUE:
    277       fFluxOutsidePlexiglass /=  gkPINDiodeQEBlue;
    278       fluxRelVar             +=  gkPINDiodeQEBlueErr* gkPINDiodeQEBlueErr
    279                              / ( gkPINDiodeQEBlue   * gkPINDiodeQEBlue   );
     382      fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio           * gkPINDiodeQEBlue;
     383      fFluxOutsidePlexiglassVar = GetNumPhotonsRelVar() + GetSolidAngleRatioRelVar()  + GetPINDiodeQEBlueRelVar();
    280384      break;
    281385    case kUV:
    282       fFluxOutsidePlexiglass /=  gkPINDiodeQEUV;
    283       fluxRelVar             +=  gkPINDiodeQEUVErr* gkPINDiodeQEUVErr
    284                              / ( gkPINDiodeQEUV   * gkPINDiodeQEUV    );
     386      fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio          * gkPINDiodeQEUV;
     387      fFluxOutsidePlexiglassVar = GetNumPhotonsRelVar() + GetSolidAngleRatioRelVar() + GetPINDiodeQEUVRelVar();
    285388      break;
    286389    case kCT1:
    287390    default:
    288       fFluxOutsidePlexiglass /=  gkPINDiodeQECT1;
    289       fluxRelVar             +=  gkPINDiodeQECT1Err* gkPINDiodeQECT1Err
    290                              / ( gkPINDiodeQECT1   * gkPINDiodeQECT1    );
     391      fFluxOutsidePlexiglass    = fNumPhotons           * gkSolidAngleRatio          * gkPINDiodeQECT1;
     392      fFluxOutsidePlexiglassVar = GetNumPhotonsRelVar() + GetSolidAngleRatioRelVar() + GetPINDiodeQECT1RelVar();
    291393      break;
    292394    }
    293 
    294 
    295   *fLog << inf << endl;
    296   *fLog << inf << " Mean Photon flux [ph/mm^2] outside Plexiglass: "
    297         << fFluxOutsidePlexiglass << endl;
    298 
    299   if (fFluxOutsidePlexiglass < 0.)
    300       return kFALSE;
    301 
    302   if (fluxRelVar < 0.)
    303       return kFALSE;
    304 
    305   SetFluxOutsidePlexiglassAvailable(); 
    306395
    307396  //
    308397  // Finish calculation of errors -> convert from relative variance to absolute variance
    309398  //
    310   fFluxOutsidePlexiglassVar *= fluxRelVar * fFluxOutsidePlexiglass * fFluxOutsidePlexiglass;
    311 
    312   *fLog << inf << " Error on Photon flux [ph/mm^2] outside Plexiglass: "
    313         << GetFluxOutsidePlexiglassErr() << endl;
     399  fFluxOutsidePlexiglassVar *= fFluxOutsidePlexiglass * fFluxOutsidePlexiglass;
     400
     401  if (fFluxOutsidePlexiglass < 0.)
     402      return kFALSE;
     403
     404  if (fFluxOutsidePlexiglassVar < 0.)
     405      return kFALSE;
     406
     407  SetFluxOutsidePlexiglassAvailable(); 
     408
    314409  *fLog << inf << endl;
     410  *fLog << inf << " Mean Photon flux [ph/mm^2] outside Plexiglass: "
     411        << Form("%5.3f%s%5.3f",fFluxOutsidePlexiglass," +- ",GetFluxOutsidePlexiglassErr()) << endl;
    315412
    316413  return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.