Changeset 3662 for trunk


Ignore:
Timestamp:
04/05/04 23:10:30 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3658 r3662  
    3030       (instead of inside the containers)
    3131
     32   * mcalib/MCalibrationChargeBlindPix.[h,cc]
     33   * mcalib/MCalibrationChargePINDiode.[h,cc]
     34     - updated and enlarged documentation
    3235
    3336 2004/04/05: Nadia Tonello
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.cc

    r3620 r3662  
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 // MCalibrationChargeBlindPix                                              //
    28 //                                                                         //
    29 // This is the storage container to hold informations about the calibration//
    30 // blind pixel                                                             //
    31 //                                                                         //
     26//                               
     27// MCalibrationChargeBlindPix   
     28//
     29// Storage container of the fit results of the Blind Pixel signal
     30// (from MHCalibrationChargeBlindPix).
     31//
     32// The Flux is calculated in photons per mm^2 in the camera plane.
     33//
     34// Currently, the following numbers are implemented:
     35// - gkBlindPixelArea: 100 mm^2
     36// - Average QE of Blind Pixel:
     37//    gkBlindPixelQEGreen: 0.154
     38//    gkBlindPixelQEBlue : 0.226
     39//    gkBlindPixelQEUV   : 0.247
     40//    gkBlindPixelQECT1  : 0.247
     41// - Average QE Error of Blind Pixel:
     42//    gkBlindPixelQEGreenErr: 0.015;
     43//    gkBlindPixelQEBlueErr : 0.02;
     44//    gkBlindPixelQEUVErr   : 0.02;
     45//    gkBlindPixelQECT1Err  : 0.02;
     46// - Attenuation factor Blind Pixel:
     47//    gkBlindPixelAttGreen :  1.97;
     48//    gkBlindPixelAttBlue  :  1.96;
     49//    gkBlindPixelAttUV    :  1.95;
     50//    gkBlindPixelAttCT1   :  1.95;
     51//
     52//
    3253/////////////////////////////////////////////////////////////////////////////
    3354#include "MCalibrationChargeBlindPix.h"
     
    4162
    4263using namespace std;
    43 const Float_t MCalibrationChargeBlindPix::gkBlindPixelArea = 100;
    44 // Average QE of Blind Pixel (three colours)
    45 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreen = 0.154;
    46 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlue  = 0.226;
    47 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUV    = 0.247;
    48 const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1   = 0.247;
    49 // Average QE Error of Blind Pixel (three colours)
     64const Float_t MCalibrationChargeBlindPix::gkBlindPixelArea       = 100;
     65const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttGreen   = 1.97;
     66const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttBlue    = 1.96;
     67const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttUV      = 1.95;
     68const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttCT1     = 1.95;
     69const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreen    = 0.154;
     70const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlue     = 0.226;
     71const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUV       = 0.247;
     72const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1      = 0.247;
    5073const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEGreenErr = 0.015;
    5174const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEBlueErr  = 0.02;
    5275const Float_t MCalibrationChargeBlindPix::gkBlindPixelQEUVErr    = 0.02;
    5376const Float_t MCalibrationChargeBlindPix::gkBlindPixelQECT1Err   = 0.02;
    54 // Attenuation factor Blind Pixel (three colours)
    55 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttGreen = 1.97;
    56 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttBlue  = 1.96;
    57 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttUV    = 1.95;
    58 const Float_t MCalibrationChargeBlindPix::gkBlindPixelAttCT1   = 1.95;
    59 
    60 const Float_t MCalibrationChargeBlindPix::fgLambdaCheckLimit   = 0.2;
    61 const Float_t MCalibrationChargeBlindPix::fgLambdaErrLimit     = 0.2;
    6277// --------------------------------------------------------------------------
    6378//
    6479// Default Constructor.
     80//
     81// Calls:
     82// - Clear()
    6583//
    6684MCalibrationChargeBlindPix::MCalibrationChargeBlindPix(const char *name, const char *title)
     
    7088  fTitle = title ? title : "Container of the fit results of the blind pixel";
    7189
    72   SetLambdaCheckLimit();
    73   SetLambdaErrLimit();
    74 
    7590  Clear();
    7691}
     
    7994// ------------------------------------------------------------------------
    8095//
    81 // Invalidate values
     96// Sets:
     97// - all flags to kFALSE
     98// - all variables to -1.
     99//
     100// Calls:
     101// - MCalibrationChargePix::Clear()
    82102//
    83103void MCalibrationChargeBlindPix::Clear(Option_t *o)
    84104{
    85105
    86   fLambda      = -1.;
    87   fLambdaCheck = -1.;
    88   fMu0         = -1.;
    89   fMu1         = -1.;
    90   fSigma0      = -1.;
    91   fSigma1      = -1.;
    92   fLambdaErr   = -1.;
    93   fMu0Err      = -1.;
    94   fMu1Err      = -1.;
    95   fSigma0Err   = -1.;
    96   fSigma1Err   = -1.;
    97 
    98   fMeanFluxInsidePlexiglass          = -1.;
    99   fMeanFluxErrInsidePlexiglass       = -1.;
     106  fFluxInsidePlexiglass    = -1.;
     107  fFluxInsidePlexiglassVar = -1.;
     108  fLambda                  = -1.;
     109  fLambdaCheck             = -1.;
     110  fLambdaVar               = -1.;
     111  fMu0                     = -1.;
     112  fMu0Err                  = -1.;
     113  fMu1                     = -1.;
     114  fMu1Err                  = -1.;
     115  fSigma0                  = -1.;
     116  fSigma0Err               = -1.;
     117  fSigma1                  = -1.;
     118  fSigma1Err               = -1.;
    100119
    101120  SetOscillating                   ( kFALSE );
     
    105124  SetSinglePheFitOK                ( kFALSE );
    106125  SetFluxInsidePlexiglassAvailable ( kFALSE );
    107 
     126 
     127  MCalibrationChargePix::Clear();
    108128}
    109129
     
    113133}
    114134
     135// --------------------------------------------------------------------------
     136//
     137// Set the Oscillating Bit from outside
     138//
    115139void  MCalibrationChargeBlindPix::SetOscillating( const Bool_t b)
    116140{
     
    118142}
    119143
     144// --------------------------------------------------------------------------
     145//
     146// Set the ChargeFitValid Bit from outside
     147//
    120148void  MCalibrationChargeBlindPix::SetChargeFitValid( const Bool_t b)
    121149{
    122150    b ? SETBIT(fFlags,kChargeFitValid) : CLRBIT(fFlags,kChargeFitValid);
    123151}
     152
     153// --------------------------------------------------------------------------
     154//
     155// Set the PedestalFitValid Bit from outside
     156//
    124157void  MCalibrationChargeBlindPix::SetPedestalFitOK( const Bool_t b)
    125158{
     
    127160}
    128161
     162// --------------------------------------------------------------------------
     163//
     164// Set the SinglePheFitValid Bit from outside
     165//
    129166void  MCalibrationChargeBlindPix::SetSinglePheFitOK( const Bool_t b)
    130167{
     
    132169}
    133170
    134 void  MCalibrationChargeBlindPix::SetExcluded( const Bool_t b)
    135 {
    136     b ? SETBIT(fFlags,kExcluded) : CLRBIT(fFlags,kExcluded);
    137 }
    138 
    139 Bool_t MCalibrationChargeBlindPix::IsExcluded()       const
    140 {
    141    return TESTBIT(fFlags,kExcluded); 
    142 }
    143 
     171// --------------------------------------------------------------------------
     172//
     173// Return -1 if fFluxInsidePlexiglassVar is smaller than 0.
     174// Return square root of fFluxInsidePlexiglassVar
     175//
     176Float_t MCalibrationChargeBlindPix::GetFluxInsidePlexiglassErr() const
     177{
     178  if (fFluxInsidePlexiglassVar < 0.)
     179    return -1.;
     180 
     181  return TMath::Sqrt(fFluxInsidePlexiglassVar);
     182}
     183
     184// --------------------------------------------------------------------------
     185//
     186// Return -1 if fLambdaVar is smaller than 0.
     187// Return square root of fLambdaVar
     188//
     189Float_t MCalibrationChargeBlindPix::GetLambdaErr() const
     190{
     191  if (fLambdaVar < 0.)
     192    return -1.;
     193 
     194  return TMath::Sqrt(fLambdaVar);
     195}
     196
     197// --------------------------------------------------------------------------
     198//
     199// Test bit kChargeFitValid
     200//
     201Bool_t MCalibrationChargeBlindPix::IsChargeFitValid()  const
     202{
     203    return TESTBIT(fFlags,kChargeFitValid);
     204}
     205
     206// --------------------------------------------------------------------------
     207//
     208// Test bit kOscillating
     209//
    144210Bool_t MCalibrationChargeBlindPix::IsOscillating()  const
    145211{
     
    147213}
    148214
    149 Bool_t MCalibrationChargeBlindPix::IsChargeFitValid()  const
    150 {
    151     return TESTBIT(fFlags,kChargeFitValid);
    152 }
    153 
     215// --------------------------------------------------------------------------
     216//
     217// Test bit kPedestalFitValid
     218//
    154219Bool_t MCalibrationChargeBlindPix::IsPedestalFitOK()  const
    155220{
     
    157222}
    158223
     224// --------------------------------------------------------------------------
     225//
     226// Test bit kSinglePheFitValid
     227//
    159228Bool_t MCalibrationChargeBlindPix::IsSinglePheFitOK()  const
    160229{
     
    162231}
    163232
     233// --------------------------------------------------------------------------
     234//
     235// Test bit kFluxInsidePlexiglassAvailable
     236//
    164237Bool_t  MCalibrationChargeBlindPix::IsFluxInsidePlexiglassAvailable()   const
    165238{
     
    168241
    169242
    170 //
    171 // The check return kTRUE if:
    172 //
    173 // 1) fLambda and fLambdaCheck are separated relatively by fLambdaCheckLimit
    174 // 2) BlindPixel has an fLambdaErr smaller than  fLambdaErrLimit
    175 //
    176 Bool_t MCalibrationChargeBlindPix::CheckChargeFitValidity()
    177 {
    178 
    179   if (2.*(fLambdaCheck-fLambda)/(fLambdaCheck+fLambda) < fLambdaCheckLimit)
    180     {
    181       *fLog << warn << "WARNING: Lambda and Lambda-Check differ by more than "
    182             << fLambdaCheckLimit << " in the Blind Pixel " << endl;
    183       return kFALSE;
    184     }
    185  
    186   if (fLambdaErr < fLambdaErrLimit)
    187     {
    188       *fLog << warn << "WARNING: Error of Fitted Lambda is greater than "
    189             << fLambdaErrLimit << " in Blind Pixel " << endl;
    190       return kFALSE;
    191     }
    192      
    193   return kTRUE;
    194 }
    195 
    196 // --------------------------------------------------------------------------
    197 //
    198 //
     243// --------------------------------------------------------------------------
     244//
     245// Return kFALSE if IsChargeFitValid() is kFALSE
     246//
     247// Calculate fFluxInsidePlexiglass with the formula:
     248// - fFluxInsidePlexiglass    = fLambda * gkBlindPixelArea / gkBlindPixelQE * 10**gkBlindPixelAtt
     249// - fFluxInsidePlexiglassVar = sqrt( fLambdaVar / ( fLambda * fLambda )
     250//                             + ( gkBlindPixelQEErr * gkBlindPixelQEErr / gkBlindPixelQE / gkBlindPixelQE )
     251//                               ) * fFluxInsidePlexiglass * * fFluxInsidePlexiglass
     252//
     253// If the fFluxInsidePlexiglass is smaller than 0., return kFALSE
     254// If the Variance is smaller than 0., return kFALSE
     255//
     256// SetFluxInsidePlexiglassAvailable() and return kTRUE
    199257//
    200258Bool_t MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass()
     
    207265  //
    208266  // Start calculation of number of photons
    209   //
    210267  // The blind pixel has exactly 100 mm^2 area (with negligible error),
    211268  //
    212   fMeanFluxInsidePlexiglass    = fLambda*gkBlindPixelArea;
    213 
     269  fFluxInsidePlexiglass      = fLambda*gkBlindPixelArea;
     270
     271  //
    214272  // Start calculation of number of photons relative Variance
    215   fMeanFluxErrInsidePlexiglass  = fLambdaErr*fLambdaErr/fLambda/fLambda;
    216  
     273  //
     274  const Float_t lambdaRelVar = fLambdaVar / ( fLambda * fLambda );
     275  fFluxInsidePlexiglassVar   = lambdaRelVar;
     276
    217277  switch (fColor)
    218278    {
    219279    case kGREEN:
    220       fMeanFluxInsidePlexiglass    /= gkBlindPixelQEGreen;   
    221       fMeanFluxErrInsidePlexiglass += gkBlindPixelQEGreenErr*gkBlindPixelQEGreenErr
    222                                     / gkBlindPixelQEGreen  /   gkBlindPixelQEGreen;   
    223 
    224       fMeanFluxInsidePlexiglass  *= TMath::Power(10,gkBlindPixelAttGreen); // correct for absorption
     280      fFluxInsidePlexiglass    /= gkBlindPixelQEGreen;   
     281      fFluxInsidePlexiglassVar +=  gkBlindPixelQEGreenErr * gkBlindPixelQEGreenErr
     282                               / ( gkBlindPixelQEGreen    * gkBlindPixelQEGreen   );   
     283
     284      fFluxInsidePlexiglass  *= TMath::Power(10,gkBlindPixelAttGreen); // correct for absorption
    225285      // attenuation has negligible error
    226286      break;
    227287    case kBLUE:
    228       fMeanFluxInsidePlexiglass    /= gkBlindPixelQEBlue;   
    229       fMeanFluxErrInsidePlexiglass += gkBlindPixelQEBlueErr*gkBlindPixelQEBlueErr
    230                                     / gkBlindPixelQEBlue  /   gkBlindPixelQEBlue;   
    231 
    232       fMeanFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttBlue); // correct for absorption
     288      fFluxInsidePlexiglass    /= gkBlindPixelQEBlue;   
     289      fFluxInsidePlexiglassVar +=  gkBlindPixelQEBlueErr * gkBlindPixelQEBlueErr
     290                               / ( gkBlindPixelQEBlue    * gkBlindPixelQEBlue    );   
     291
     292      fFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttBlue); // correct for absorption
    233293      // attenuation has negligible error
    234294      break;
    235295    case kUV:
    236       fMeanFluxInsidePlexiglass    /= gkBlindPixelQEUV;   
    237       fMeanFluxErrInsidePlexiglass += gkBlindPixelQEUVErr*gkBlindPixelQEUVErr
    238                                     / gkBlindPixelQEUV  /   gkBlindPixelQEUV;   
    239 
    240       fMeanFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttUV); // correct for absorption
     296      fFluxInsidePlexiglass    /= gkBlindPixelQEUV;   
     297      fFluxInsidePlexiglassVar +=  gkBlindPixelQEUVErr* gkBlindPixelQEUVErr
     298                               / ( gkBlindPixelQEUV   * gkBlindPixelQEUV    );   
     299
     300      fFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttUV); // correct for absorption
    241301      // attenuation has negligible error
    242302      break;
    243303    case kCT1:
    244304    default:
    245       fMeanFluxInsidePlexiglass    /= gkBlindPixelQECT1;   
    246       fMeanFluxErrInsidePlexiglass += gkBlindPixelQECT1Err*gkBlindPixelQECT1Err
    247                                     / gkBlindPixelQECT1  /   gkBlindPixelQECT1;   
    248 
    249       fMeanFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttCT1); // correct for absorption
     305      fFluxInsidePlexiglass    /= gkBlindPixelQECT1;   
     306      fFluxInsidePlexiglassVar +=  gkBlindPixelQECT1Err * gkBlindPixelQECT1Err
     307                               / ( gkBlindPixelQECT1    * gkBlindPixelQECT1    );   
     308
     309      fFluxInsidePlexiglass *= TMath::Power(10,gkBlindPixelAttCT1); // correct for absorption
    250310      // attenuation has negligible error
    251311      break;
     
    254314  *fLog << inf << endl;
    255315  *fLog << inf << " Photon flux [ph/mm^2] inside Plexiglass: "
    256         << fMeanFluxInsidePlexiglass << endl;
    257 
    258   if (fMeanFluxInsidePlexiglass < 0.)
     316        << fFluxInsidePlexiglass << endl;
     317
     318  if (fFluxInsidePlexiglass < 0.)
    259319      return kFALSE;
    260320
    261   if (fMeanFluxErrInsidePlexiglass < 0.)
     321  if (fFluxInsidePlexiglassVar < 0.)
    262322      return kFALSE;
    263323
    264324  SetFluxInsidePlexiglassAvailable(kTRUE); 
    265325
    266   // Finish calculation of errors -> convert from relative variance to absolute error
    267   fMeanFluxErrInsidePlexiglass = TMath::Sqrt(fMeanFluxErrInsidePlexiglass);
    268   fMeanFluxErrInsidePlexiglass *= fMeanFluxInsidePlexiglass;
     326  //
     327  // Finish calculation of errors -> convert from relative variance to absolute variance
     328  //
     329  fFluxInsidePlexiglassVar *= fFluxInsidePlexiglass * fFluxInsidePlexiglass;
    269330
    270331  *fLog << inf << " Error on photon flux [ph/mm^2] inside Plexiglass: "
    271         << fMeanFluxErrInsidePlexiglass << endl;
     332        << GetFluxInsidePlexiglass() << endl;
    272333  *fLog << inf << endl;
    273334
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindPix.h

    r3315 r3662  
    1010private:
    1111
    12   static const Float_t fgLambdaCheckLimit;  // The default limit (in units of PedRMS) for acceptance of the fitted mean charge
    13   static const Float_t fgLambdaErrLimit;    // The default limit (in units of PedRMS) for acceptance of the fitted charge sigma
     12  static const Float_t gkBlindPixelArea;        //! The Blind Pixel area in mm^2
     13  static const Float_t gkBlindPixelAttGreen;    //! Attenuation Filter at 520 nm
     14  static const Float_t gkBlindPixelAttBlue ;    //! Attenuation Filter at 460 nm
     15  static const Float_t gkBlindPixelAttUV   ;    //! Attenuation Filter at 370 nm
     16  static const Float_t gkBlindPixelAttCT1  ;    //! Attenuation Filter at 370 nm
     17  static const Float_t gkBlindPixelQEGreen;     //! Quantum Efficiency at 520 nm
     18  static const Float_t gkBlindPixelQEBlue ;     //! Quantum Efficiency at 460 nm
     19  static const Float_t gkBlindPixelQEUV   ;     //! Quantum Efficiency at 370 nm
     20  static const Float_t gkBlindPixelQECT1  ;     //! Quantum Efficiency at 370 nm
     21  static const Float_t gkBlindPixelQEGreenErr;  //! Uncertainty QE at 520 nm
     22  static const Float_t gkBlindPixelQEBlueErr ;  //! Uncertainty QE at 460 nm
     23  static const Float_t gkBlindPixelQEUVErr   ;  //! Uncertainty QE at 370 nm
     24  static const Float_t gkBlindPixelQECT1Err  ;  //! Uncertainty QE at 370 nmu
    1425
    15   static const Float_t gkBlindPixelArea;       // The Blind Pixel area in mm^2
     26  Float_t fLambda;                  // Mean Poisson fit
     27  Float_t fLambdaCheck;             // Mean Pedestal Check (Gauss) fit
     28  Float_t fLambdaCheckErr;          // Error mean pedestal Check fit
     29  Float_t fLambdaVar;               // Variance lambda Poisson fit
     30  Float_t fFluxInsidePlexiglass;    // Number photons in INNER PIXEL inside the plexiglass
     31  Float_t fFluxInsidePlexiglassVar; // Variance number of photons in INNER PIXEL
     32  Float_t fMu0;                     // Position pedestal peak
     33  Float_t fMu0Err;                  // Error pos. pedestal-peak
     34  Float_t fMu1;                     // Position first photo-electron peak
     35  Float_t fMu1Err;                  // Error pos. first photo-electon peak
     36  Float_t fSigma0;                  // Width pedestal peak
     37  Float_t fSigma0Err;               // Error width pedestal peak
     38  Float_t fSigma1;                  // Width first photo-electron peak 
     39  Float_t fSigma1Err;               // Error width first photo-electron peak 
    1640
    17   static const Float_t gkBlindPixelQEGreen;
    18   static const Float_t gkBlindPixelQEBlue ;
    19   static const Float_t gkBlindPixelQEUV   ;
    20   static const Float_t gkBlindPixelQECT1  ;
    21 
    22   static const Float_t gkBlindPixelQEGreenErr;
    23   static const Float_t gkBlindPixelQEBlueErr ;
    24   static const Float_t gkBlindPixelQEUVErr   ;
    25   static const Float_t gkBlindPixelQECT1Err  ;
    26  
    27   static const Float_t gkBlindPixelAttGreen;
    28   static const Float_t gkBlindPixelAttBlue ;
    29   static const Float_t gkBlindPixelAttUV   ;
    30   static const Float_t gkBlindPixelAttCT1  ;
    31 
    32   Float_t fLambdaCheckLimit; // The rel. limit for the rel difference between lambda and lambda check
    33   Float_t fLambdaErrLimit;   // The limit for acceptance of the fitted lambda
    34 
    35   Float_t fLambda;           // The mean of the Poisson fit
    36   Float_t fLambdaCheck;      // The mean of the pedestal Check fit
    37   Float_t fMu0;              // The position of the pedestal-peak
    38   Float_t fMu1;              // The position of the first phe-peak
    39   Float_t fSigma0;           // The width of the pedestal-peak
    40   Float_t fSigma1;           // The width of the first phe-peak 
    41 
    42   Float_t fLambdaErr;        // The error of the mean charge after the fit
    43   Float_t fLambdaCheckErr;   // The error of the mean of the pedestal Check fit
    44   Float_t fMu0Err;           // The error of the position of the pedestal-peak
    45   Float_t fMu1Err;           // The error of the position of the first phe-peak
    46   Float_t fSigma0Err;        // The error of the width of the pedestal-peak
    47   Float_t fSigma1Err;        // The error of the width of the first phe-peak 
    48 
    49   Float_t fProb;             // The probability of the fit
    50  
    51   Float_t fMeanFluxInsidePlexiglass;          //  The mean number of photons in an INNER PIXEL inside the plexiglass
    52   Float_t fMeanFluxErrInsidePlexiglass;       //  The uncertainty about the number of photons in an INNER PIXEL 
    53 
    54   Byte_t fFlags;
    55 
    56   enum { kOscillating, kPedestalFitOK, kSinglePheFitOK, kChargeFitValid, kExcluded,
     41  enum { kOscillating, kPedestalFitOK, kSinglePheFitOK, kChargeFitValid,
    5742         kFluxInsidePlexiglassAvailable };
    5843
     
    6752
    6853  // Setters
    69   void SetColor       ( const PulserColor_t color )  {  fColor = color;  }
     54  void SetColor            ( const PulserColor_t color )          { fColor        = color; }
     55  void SetLambda           ( const Float_t f )                    { fLambda           = f; }
     56  void SetLambdaErr        ( const Float_t f )                    { fLambdaVar        = f*f; }
     57  void SetLambdaCheck      ( const Float_t f )                    { fLambdaCheck      = f; }
     58  void SetLambdaCheckErr   ( const Float_t f )                    { fLambdaCheckErr   = f; }
     59  void SetMu0              ( const Float_t f )                    { fMu0              = f; }
     60  void SetMu0Err           ( const Float_t f )                    { fMu0Err           = f; }
     61  void SetMu1              ( const Float_t f )                    { fMu1              = f; }
     62  void SetMu1Err           ( const Float_t f )                    { fMu1Err           = f; }
     63  void SetSigma0           ( const Float_t f )                    { fSigma0           = f; }
     64  void SetSigma0Err        ( const Float_t f )                    { fSigma0Err        = f; }
     65  void SetSigma1           ( const Float_t f )                    { fSigma1           = f; }
     66  void SetSigma1Err        ( const Float_t f )                    { fSigma1Err        = f; }
    7067
    71   void SetLambda      ( const Float_t f ) { fLambda      = f;  }
    72   void SetLambdaCheck ( const Float_t f ) { fLambdaCheck = f;  }
    73   void SetMu0         ( const Float_t f ) { fMu0         = f;  }
    74   void SetMu1         ( const Float_t f ) { fMu1         = f;  }
    75   void SetSigma0      ( const Float_t f ) { fSigma0      = f;  }
    76   void SetSigma1      ( const Float_t f ) { fSigma1      = f;  }
    77 
    78   void SetLambdaErr       ( const Float_t f ) { fLambdaErr    = f;  }
    79   void SetLambdaCheckErr  ( const Float_t f ) { fLambdaCheck = f;   }
    80   void SetMu0Err          ( const Float_t f ) { fMu0Err       = f;  }
    81   void SetMu1Err          ( const Float_t f ) { fMu1Err       = f;  }
    82   void SetSigma0Err       ( const Float_t f ) { fSigma0Err    = f;  }
    83   void SetSigma1Err       ( const Float_t f ) { fSigma1Err    = f;  }
    84 
    85   void SetProb            ( const Float_t f ) { fProb         = f;  }
    86 
    87   void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit  ) { fLambdaCheckLimit  = f; }
    88   void SetLambdaErrLimit   ( const Float_t f=fgLambdaErrLimit    ) { fLambdaErrLimit    = f; }
    89 
    90   void SetOscillating     ( const Bool_t b=kTRUE);
    91   void SetChargeFitValid  ( const Bool_t b=kTRUE);
    92   void SetPedestalFitOK   ( const Bool_t b=kTRUE);
    93   void SetSinglePheFitOK ( const Bool_t b=kTRUE);
    94   void SetFluxInsidePlexiglassAvailable  ( const Bool_t b=kTRUE);
    95   void SetExcluded        ( const Bool_t b=kTRUE);
     68  void SetOscillating      ( const Bool_t  b=kTRUE);
     69  void SetChargeFitValid   ( const Bool_t  b=kTRUE);
     70  void SetPedestalFitOK    ( const Bool_t  b=kTRUE);
     71  void SetSinglePheFitOK   ( const Bool_t  b=kTRUE);
     72  void SetFluxInsidePlexiglassAvailable( const Bool_t b=kTRUE);
    9673 
    9774  // Getters
    98   Float_t GetLambda()      const    { return fLambda;      }
    99   Float_t GetLambdaCheck() const    { return fLambdaCheck; }
    100   Float_t GetMu0()         const    { return fMu0;         }
    101   Float_t GetMu1()         const    { return fMu1;         }
    102   Float_t GetSigma0()      const    { return fSigma0;      }
    103   Float_t GetSigma1()      const    { return fSigma1;      }
    104 
    105   Float_t GetLambdaErr()      const    { return fLambdaErr;      }
    106   Float_t GetLambdaCheckErr() const    { return fLambdaCheckErr; }
    107   Float_t GetMu0Err()         const    { return fMu0Err;         }
    108   Float_t GetMu1Err()         const    { return fMu1Err;         }
    109   Float_t GetSigma0Err()      const    { return fSigma0Err;      }
    110   Float_t GetSigma1Err()      const    { return fSigma1Err;      }
    111 
    112   Float_t GetMeanFluxInsidePlexiglass()     const { return fMeanFluxInsidePlexiglass;     }
    113   Float_t GetMeanFluxErrInsidePlexiglass()  const { return fMeanFluxErrInsidePlexiglass;  }
     75  Float_t GetLambda()                  const { return fLambda;               }
     76  Float_t GetLambdaErr()               const;
     77  Float_t GetLambdaCheck()             const { return fLambdaCheck;          }
     78  Float_t GetLambdaCheckErr()          const { return fLambdaCheckErr;       }
     79  Float_t GetFluxInsidePlexiglass()    const { return fFluxInsidePlexiglass; }
     80  Float_t GetFluxInsidePlexiglassErr() const;
     81  Float_t GetMu0()                     const { return fMu0;                  }
     82  Float_t GetMu0Err()                  const { return fMu0Err;               }
     83  Float_t GetMu1()                     const { return fMu1;                  }
     84  Float_t GetMu1Err()                  const { return fMu1Err;               }
     85  Float_t GetSigma0()                  const { return fSigma0;               }
     86  Float_t GetSigma0Err()               const { return fSigma0Err;            }
     87  Float_t GetSigma1()                  const { return fSigma1;               }
     88  Float_t GetSigma1Err()               const { return fSigma1Err;            }
    11489
    11590  Bool_t  IsOscillating()                    const;
     
    11792  Bool_t  IsPedestalFitOK()                  const;
    11893  Bool_t  IsSinglePheFitOK()                 const;
    119   Bool_t  IsExcluded()                       const;
    12094  Bool_t  IsFluxInsidePlexiglassAvailable()  const;
    12195 
    12296  Bool_t CalcFluxInsidePlexiglass();
    123   Bool_t CheckChargeFitValidity();
    12497
    125   ClassDef(MCalibrationChargeBlindPix, 1)       // Container for Calibration ChargeBlind Pixel
     98  ClassDef(MCalibrationChargeBlindPix, 1)       // Container Charge Calibration Results Blind Pixel
    12699};
    127100
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r3655 r3662  
    213213using namespace std;
    214214
    215 const Float_t MCalibrationChargeCalc::fgChargeLimit              = 3.;
    216 const Float_t MCalibrationChargeCalc::fgChargeErrLimit           = 0.;
    217 const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit        = 1.;
    218 const Float_t MCalibrationChargeCalc::fgTimeLowerLimit           = 1.;
    219 const Float_t MCalibrationChargeCalc::fgTimeUpperLimit           = 2.;
     215const Float_t MCalibrationChargeCalc::fgChargeLimit        = 3.;
     216const Float_t MCalibrationChargeCalc::fgChargeErrLimit     = 0.;
     217const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit  = 1.;
     218const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit   = 0.2;
     219const Float_t MCalibrationChargeCalc::fgLambdaErrLimit     = 0.2;
     220const Float_t MCalibrationChargeCalc::fgTimeLowerLimit     = 1.;
     221const Float_t MCalibrationChargeCalc::fgTimeUpperLimit     = 2.;
    220222// --------------------------------------------------------------------------
    221223//
    222224// Default constructor.
     225//
     226// Sets all pointers to NULL
     227//
     228// Calls AddToBranchList for:
     229// - MRawEvtData.fHiGainPixId   
     230// - MRawEvtData.fLoGainPixId   
     231// - MRawEvtData.fHiGainFadcSamples
     232// - MRawEvtData.fLoGainFadcSamples
     233//
     234// Initializes:
     235// - fChargeLimit       to fgChargeLimit
     236// - fChargeErrLimit    to fgChargeErrLimit   
     237// - fChargeRelErrLimit to fgChargeRelErrLimit
     238// - fLambdaCheckLimit  to fgLambdaCheckLimit
     239// - fLambdaErrLimit    to fgLambdaErrLimit
     240// - fTimeLowerLimit    to fgTimeLowerLimit
     241// - fTimeUpperLimit    to fgTimeUpperLimit
     242//
     243// Calls:
     244// - Clear()
    223245//
    224246MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
     
    230252{
    231253
    232     fName  = name  ? name  : "MCalibrationChargeCalc";
    233     fTitle = title ? title : "Task to calculate the calibration constants and MCalibrationCam ";
    234 
    235     AddToBranchList("MRawEvtData.fHiGainPixId");
    236     AddToBranchList("MRawEvtData.fLoGainPixId");
    237     AddToBranchList("MRawEvtData.fHiGainFadcSamples");
    238     AddToBranchList("MRawEvtData.fLoGainFadcSamples");
    239 
    240     Clear();
    241 
    242     SetChargeLimit();
    243     SetChargeErrLimit(); 
    244    
    245     SetChargeRelErrLimit();
    246     SetTimeLowerLimit();
    247     SetTimeUpperLimit();
     254  fName  = name  ? name  : "MCalibrationChargeCalc";
     255  fTitle = title ? title : "Task to calculate the calibration constants and MCalibrationCam ";
     256 
     257  AddToBranchList("MRawEvtData.fHiGainPixId");
     258  AddToBranchList("MRawEvtData.fLoGainPixId");
     259  AddToBranchList("MRawEvtData.fHiGainFadcSamples");
     260  AddToBranchList("MRawEvtData.fLoGainFadcSamples");
     261 
     262  SetChargeLimit();
     263  SetChargeErrLimit(); 
     264  SetChargeRelErrLimit();
     265  SetLambdaCheckLimit();
     266  SetLambdaErrLimit();
     267  SetTimeLowerLimit();
     268  SetTimeUpperLimit();
     269
     270  Clear();
     271 
    248272}
    249273
     
    254278    SETBIT(fFlags, kHiLoGainCalibration);
    255279
    256     fNumHiGainSamples  = 0.;
    257     fNumLoGainSamples  = 0.;
    258     fSqrtHiGainSamples = 0.;
    259     fSqrtLoGainSamples = 0.;
    260     fConversionHiLo    = 0;
     280    fNumHiGainSamples        = 0.;
     281    fNumLoGainSamples        = 0.;
     282    fSqrtHiGainSamples       = 0.;
     283    fSqrtLoGainSamples       = 0.;
     284    fConversionHiLo          = 0 ;
    261285    SkipQualityChecks      ( kFALSE );
    262286    SkipHiLoGainCalibration( kFALSE );   
    263 
    264287}
    265288
     
    611634// Returns kFALSE if pointer to MCalibrationChargePINDiode is NULL
    612635//
    613 // The check return kTRUE if:
    614 //
    615 // 1) PINDiode has a fitted charge greater than fChargeLimit*PedRMS
    616 // 2) PINDiode has a fit error greater than fChargeErrLimit
    617 // 3) PINDiode has a fitted charge greater its fChargeRelErrLimit times its charge error
    618 // 4) PINDiode has a charge sigma bigger than its Pedestal RMS
    619 // 5) The mean arrival time is at least fTimeLowerLimit slices from the lower edge
     636// The check returns kFALSE if:
     637//
     638// 1) PINDiode has a fitted charge smaller than fChargeLimit*PedRMS
     639// 2) PINDiode has a fit error smaller than fChargeErrLimit
     640// 3) PINDiode has a fitted charge smaller its fChargeRelErrLimit times its charge error
     641// 4) PINDiode has a charge sigma smaller than its Pedestal RMS
     642// 5) The mean arrival time is in fTimeLowerLimit slices from the lower edge
    620643//    and fUpperLimit slices from the upper edge
    621644//
     645// Calls:
     646// - MCalibrationChargePINDiode::CalcFluxOutsidePlexiglass()
     647//
    622648Bool_t MCalibrationChargeCalc::FinalizePINDiode()
    623649{
     
    686712  return kTRUE;
    687713}
     714
     715// ------------------------------------------------------------------------
     716//
     717// Returns kFALSE if pointer to MExtractedSignalBlindPixel is NULL
     718// Returns kFALSE if pointer to MCalibrationChargeBlindPix is NULL
     719//
     720// The check returns kFALSE if:
     721//
     722// 1) fLambda and fLambdaCheck are separated relatively to each other by more than fLambdaCheckLimit
     723// 2) BlindPixel has an fLambdaErr greater than fLambdaErrLimit
     724//
     725// Calls:
     726// - MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass()
     727//
     728Bool_t MCalibrationChargeCalc::FinalizeBlindPixel()
     729{
     730
     731  if (!fSigBlind)
     732    return kFALSE;
     733 
     734  if (!fBlindPixel)
     735    return kFALSE; 
     736
     737  const Float_t lambda      = fBlindPixel->GetLambda();
     738  const Float_t lambdaerr   = fBlindPixel->GetLambdaErr();
     739  const Float_t lambdacheck = fBlindPixel->GetLambdaCheck();
     740
     741  if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) < fLambdaCheckLimit)
     742    {
     743      *fLog << warn << "WARNING: Lambda and Lambda-Check differ by more than "
     744            << fLambdaCheckLimit << " in the Blind Pixel " << endl;
     745      return kFALSE;
     746    }
     747 
     748  if (lambdaerr < fLambdaErrLimit)
     749    {
     750      *fLog << warn << "WARNING: Error of Fitted Lambda is greater than "
     751            << fLambdaErrLimit << " in Blind Pixel " << endl;
     752      return kFALSE;
     753    }
     754     
     755  if (!fBlindPixel->CalcFluxInsidePlexiglass())
     756    {
     757      *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, "
     758            << "will skip Blind Pixel Calibration " << endl;
     759      return kFALSE;
     760    }
     761 
     762  return kTRUE;
     763}
     764
    688765
    689766
     
    788865  // Blind Pixel calibration
    789866  //
    790   if (!fBlindPixel->CheckChargeFitValidity())
    791   {
    792       *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, "
    793             << "charge fit not valid " << endl;
    794       fCam->SetBlindPixelMethodValid(kFALSE);
    795   }
     867  if (!FinalizeBlindPixel())
     868    fCam->SetBlindPixelMethodValid(kFALSE);
    796869  else
    797   {
    798       if (!fBlindPixel->CalcFluxInsidePlexiglass())
    799       {
    800           *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, "
    801                 << "will skip PIN Diode Calibration " << endl;
    802           fCam->SetBlindPixelMethodValid(kFALSE);
    803       }
    804       else
    805       {
    806           fCam->SetBlindPixelMethodValid(kTRUE);
    807           fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels, *fBlindPixel);
    808       }
    809   }
     870    {
     871      fCam->SetBlindPixelMethodValid(kTRUE);
     872      fCam->ApplyBlindPixelCalibration(*fGeom,*fBadPixels, *fBlindPixel);
     873    }
    810874
    811875  //
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r3655 r3662  
    3939private:
    4040
    41   static const Float_t fgChargeLimit;       // Default for fChargeLimit        (now set to: 3.)
    42   static const Float_t fgChargeErrLimit;    // Default for fChargeErrLimit     (now set to: 0.)
    43   static const Float_t fgChargeRelErrLimit; // Default for fChargeRelErrLimit  (now set to: 1.)
    44   static const Float_t fgTimeLowerLimit;    // Default for fTimeLowerLimit     (now set to: 1.)
    45   static const Float_t fgTimeUpperLimit;    // Default for fTimeUpperLimit     (now set to: 2.)
     41  static const Float_t fgChargeLimit;       //! Default for fChargeLimit       (now set to: 3.)
     42  static const Float_t fgChargeErrLimit;    //! Default for fChargeErrLimit    (now set to: 0.)
     43  static const Float_t fgChargeRelErrLimit; //! Default for fChargeRelErrLimit (now set to: 1.)
     44  static const Float_t fgLambdaCheckLimit;  //! Default for fLambdaCheckLimit  (now set to: 0.2)
     45  static const Float_t fgLambdaErrLimit;    //! Default for fLabmdaErrLimit    (now set to: 0.2)
     46  static const Float_t fgTimeLowerLimit;    //! Default for fTimeLowerLimit    (now set to: 1.)
     47  static const Float_t fgTimeUpperLimit;    //! Default for fTimeUpperLimit    (now set to: 2.)
    4648 
    4749  Float_t fChargeLimit;          // Limit (in units of PedRMS) for acceptance of mean charge
    4850  Float_t fChargeErrLimit;       // Limit (in units of PedRMS) for acceptance of charge sigma square
    4951  Float_t fChargeRelErrLimit;    // Limit (in units of Sigma of fitted charge) for acceptance of mean 
     52  Float_t fLambdaCheckLimit;     // Limit for rel. diff. lambda and lambdacheck blind pixel
     53  Float_t fLambdaErrLimit;       // Limit for acceptance of lambda error blind pixel
    5054  Float_t fTimeLowerLimit;       // Limit (in units of FADC slices) for dist. to first signal slice
    5155  Float_t fTimeUpperLimit;       // Limit (in units of FADC slices) for dist. to last signal slice
     
    8993  Bool_t FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad);
    9094  Bool_t FinalizePINDiode();
     95  Bool_t FinalizeBlindPixel();
    9196 
    9297  void PrintUnsuitable(MBadPixelsPix::UnsuitableType_t typ, const char *text) const;   
     
    102107  void SetChargeErrLimit (   const Float_t f=fgChargeErrLimit    ) { fChargeErrLimit    = f; }
    103108  void SetChargeRelErrLimit( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f; }
     109  void SetLambdaErrLimit   ( const Float_t f=fgLambdaErrLimit   ) { fLambdaErrLimit   = f; }
     110  void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; }
    104111
    105112  void SetTimeLowerLimit (   const Float_t f=fgTimeLowerLimit    ) { fTimeLowerLimit  = f;   }
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r3660 r3662  
    994994{
    995995
    996   Float_t flux    = blindpix.GetMeanFluxInsidePlexiglass();
    997   Float_t fluxerr = blindpix.GetMeanFluxErrInsidePlexiglass();
     996  Float_t flux    = blindpix.GetFluxInsidePlexiglass();
     997  Float_t fluxerr = blindpix.GetFluxInsidePlexiglassErr();
    998998
    999999  TIter Next(fPixels);
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.cc

    r3661 r3662  
    3131// is the documentation for the moment.
    3232//
     33// The Flux is calculated in photons per mm^2 in the camera plane.
     34//
    3335// Currently, the following numbers are implemented:
    3436//
    35 // Area of Inner Pixel Ai: 779.423 +- 0  mm^2
    3637// Area of PIN Diode   Ap: 100.000 +- 10 mm^2
    3738//
     
    4142// Distance of Inner Pixel to pulser D2: 18.0 +- 0.5 m
    4243//
    43 //                         Ai*D1*D1
    44 // gkSolidAngleRatio   =   -------- = 0.054
     44//                          D1*D1
     45// gkSolidAngleRatio   =   -------- = 0.00007
    4546//                         Ap*D2*D2
    4647//
    47 // gkSolidAngleRatioErr = 0.01
    48 //
    49 //
     48// gkSolidAngleRatioErr = 0.00002
     49//
    5050/////////////////////////////////////////////////////////////////////////////
    5151#include "MCalibrationChargePINDiode.h"
     
    6161const Float_t MCalibrationChargePINDiode::fgChargeToPhotons    = -1.;
    6262const Float_t MCalibrationChargePINDiode::fgChargeToPhotonsErr = -1.;
    63 const Float_t MCalibrationChargePINDiode::gkSolidAngleRatio      = 0.055;
    64 const Float_t MCalibrationChargePINDiode::gkSolidAngleRatioErr   = 0.01;
    65 //
    66 // Average QE of the PIN Diode
    67 //
     63const Float_t MCalibrationChargePINDiode::gkSolidAngleRatio      = 0.00007;
     64const Float_t MCalibrationChargePINDiode::gkSolidAngleRatioErr   = 0.00002;
    6865const Float_t MCalibrationChargePINDiode::gkPINDiodeQEGreen    = -1.0;
    6966const Float_t MCalibrationChargePINDiode::gkPINDiodeQEBlue     = -1.0;
    7067const Float_t MCalibrationChargePINDiode::gkPINDiodeQEUV       = -1.0;
    7168const Float_t MCalibrationChargePINDiode::gkPINDiodeQECT1      = -1.0;
    72 //
    73 // Average QE of the PIN Diode
    74 //
    7569const Float_t MCalibrationChargePINDiode::gkPINDiodeQEGreenErr = -1.0;
    7670const Float_t MCalibrationChargePINDiode::gkPINDiodeQEBlueErr  = -1.0;
     
    211205// --------------------------------------------------------------------------
    212206//
     207// Test bit kFluxOutsidePlexiglassAvailable
     208//
     209Bool_t  MCalibrationChargePINDiode::IsFluxOutsidePlexiglassAvailable()   const
     210{
     211  return TESTBIT(fFlags,kFluxOutsidePlexiglassAvailable);
     212}
     213
     214
     215// --------------------------------------------------------------------------
     216//
    213217// Test bit kTimeFitValid
    214218//
     
    216220{
    217221  return TESTBIT(fCalibFlags, kTimeFitValid); 
     222}
     223
     224// --------------------------------------------------------------------------
     225//
     226// Test bit kOscillating
     227//
     228Bool_t MCalibrationChargePINDiode::IsOscillating()   const
     229{
     230  return TESTBIT(fCalibFlags, kOscillating); 
    218231}
    219232
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.h

    r3661 r3662  
    8282  Bool_t  IsChargeFitValid()    const;
    8383  Bool_t  IsTimeFitValid()      const;
    84 
     84  Bool_t  IsOscillating()       const;
     85  Bool_t  IsFluxOutsidePlexiglassAvailable() const;
     86 
    8587  Bool_t  CalcFluxOutsidePlexiglass();
    8688
Note: See TracChangeset for help on using the changeset viewer.