Changeset 3714 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/13/04 14:40:18 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r3683 r3714  
    2626// MCalibrationChargeCam                                               
    2727//                                                               
    28 // Storage container for charge calibration results of the whole camera.
     28// Storage container for charge calibration results from the signal distribution
     29// fits (see MHCalibrationChargeCam and MHCalibrationChargePix), the calculation
     30// of reduced sigmas and number of photo-electrons (this class) and conversion
     31// factors sum FADC slices to photo-electrons (see MCalibrationChargeCalc)
    2932//
    3033// Individual pixels have to be cast when retrieved e.g.:
    3134// MCalibrationChargePix &avpix = (MCalibrationChargePix&)(*fChargeCam)[i]
    3235//
    33 // The following calibration constants can be retrieved from each pixel:
     36// Averaged values over one whole area index (e.g. inner or outer pixels for
     37// the MAGIC camera), can be retrieved via:
     38// MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageArea(i)
     39//
     40// Averaged values over one whole camera sector can be retrieved via:
     41// MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageSector(i)
     42//
     43// Note the averageing has been done on an event-by-event basis. Resulting
     44// Sigma's of the Gauss fit have been multiplied with the square root of the number
     45// of involved pixels in order to make a direct comparison possible with the mean of
     46// sigmas.
     47//
     48// The following "calibration" constants are used for the calibration of each pixel
     49// (see MCalibrate and MCalibrateData):
     50//
     51// - MCalibrationQEPix::GetMeanConvFADC2Phe(): The mean conversion factor from the
     52//   summed FADC slices to the number of photo-electrons (in first order independent
     53//   on colour and intensity)
     54// - MCalibrationQEPix::GetMeanFFactorFADC2Phot(): The mean F-Factor of the total 
     55//   readout chain dividing the signal to noise of the incoming number of photons
     56//   (= sqrt(number photons)) by the signal to noise of the outgoing summed FADC slices
     57//   signal (= MCalibrationPix::GetMean() / MCalibrationChargePix::GetRSigma() )
     58//
     59// The following calibration constants can be retrieved directly from this class:
    3460//
    3561// - GetConversionFactorFFactor    ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
    36 // - GetConversionFactorBlindPixel ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
    37 // - GetConversionFactorPINDiode   ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
    38 // - GetConversionFactorCombined   ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
    3962//
    4063// where:
     
    4871// Note, Conversion is ALWAYS (included the F-Factor method!) from summed FADC slices to PHOTONS.
    4972//
    50 // Averaged values over one whole area index (e.g. inner or outer pixels for
    51 // the MAGIC camera), can be retrieved via:
    52 // MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageArea(i)
    53 //
    54 // Averaged values over one whole camera sector can be retrieved via:
    55 // MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageSector(i)
    56 //
    57 // Note the averageing has been done on an event-by-event basis. Resulting
    58 // Sigma's of the Gauss fit have been multiplied with the square root of the number
    59 // of involved pixels in order to make a direct comparison possible with the mean of
    60 // sigmas.
    61 //
    62 // See also: MCalibrationChargePix, MCalibrationChargeCalc
     73// See also: MCalibrationChargePix, MCalibrationChargeCalc, MCalibrationQECam
    6374//           MHCalibrationChargePix, MHCalibrationChargeCam             
    64 //
    65 // The types of GetPixelContent() are as follows:
    66 //
    67 // Fitted values:
    68 // ==============
    69 //
    70 // 0: Fitted Charge                              (see MCalibrationPix::GetMean())
    71 // 1: Error of fitted Charge                     (see MCalibrationPix::GetMeanErr())
    72 // 2: Sigma of fitted Charge                     (see MCalibrationPix::GetSigma())
    73 // 3: Error of Sigma of fitted Charge            (see MCalibrationPix::GetSigmaErr())
    74 //
    75 // Useful variables derived from the fit results:
    76 // =============================================
    77 //
    78 // 4: Probability Gauss fit Charge distribution  (see MCalibrationPix::GetProb())
    79 // 5: Reduced Sigma of fitted Charge             (see MCalibrationChargePix::GetRSigma())
    80 // 6: Error Reduced Sigma of fitted Charge       (see MCalibrationChargePix::GetRSigmaErr())
    81 // 7: Reduced Sigma per Charge                 
    82 // 8: Error of Reduced Sigma per Charge
    83 //
    84 // Results of the different calibration methods:
    85 // =============================================
    86 //
    87 //  9: Nr. Photo-electrons from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethod())
    88 // 10: Error Nr. Photo-el. from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethodErr())
    89 // 11: Conversion factor   from F-Factor Method   (see MCalibrationChargePix::GetMeanConversionFFactorMethod())
    90 // 12: Error conv. factor  from F-Factor Method   (see MCalibrationChargePix::GetConversionFFactorMethodErr())
    91 // 13: Overall F-Factor    from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethod())
    92 // 14: Error F-Factor      from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethodErr())
    93 // 15: Pixels valid calibration F-Factor-Method   (see MCalibrationChargePix::IsFFactorMethodValid())           
    94 // 16: Conversion factor   from BlindPixel Method (see MCalibrationChargePix::GetMeanConversionBlindPixelMethod())
    95 // 17: Error conv. factor  from BlindPixel Method (see MCalibrationChargePix::GetConversionBlindPixelMethodErr()) 
    96 // 18: Overall F-Factor    from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethod())   
    97 // 19: Error F-Factor      from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr())
    98 // 20: Pixels valid calibration BlindPixel-Method (see MCalibrationChargePix::IsBlindPixelMethodValid())           
    99 // 21: Conversion factor   from PINDiode Method   (see MCalibrationChargePix::GetMeanConversionPINDiodeMethod())
    100 // 22: Error conv. factor  from PINDiode Method   (see MCalibrationChargePix::GetConversionPINDiodeMethodErr()) 
    101 // 23: Overall F-Factor    from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethod())   
    102 // 24: Error F-Factor      from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr())
    103 // 25: Pixels valid calibration PINDiode-Method   (see MCalibrationChargePix::IsPINDiodeMethodValid())           
    104 //                                               
    105 // Localized defects:                             
    106 // ==================
    107 //
    108 // 26: Excluded Pixels
    109 // 27: Number of pickup events in the Hi Gain     (see MCalibrationPix::GetHiGainNumPickup())
    110 // 28: Number of pickup events in the Lo Gain     (see MCalibrationPix::GetLoGainNumPickup())
    111 //
    112 // Other classifications of pixels:
    113 // ================================
    114 //
    115 // 29: Pixels with saturated Hi-Gain              (see MCalibrationPix::IsHighGainSaturation())
    116 //
    117 // Used Pedestals:
    118 // ===============
    119 //
    120 // 30: Pedestal for entire signal extr. range     (see MCalibrationChargePix::Ped())
    121 // 31: Error Pedestal entire signal extr. range   (see MCalibrationChargePix::PedErr())
    122 // 32: Ped. RMS entire signal extraction range    (see MCalibrationChargePix::PedRms())
    123 // 33: Error Ped. RMS entire signal extr. range   (see MCalibrationChargePix::PedRmsErr())
    124 //
    125 // Calculated absolute arrival times (very low precision!):
    126 // ========================================================
    127 //
    128 // 34: Absolute Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeMean())
    129 // 35: RMS Ab.  Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeRms())
     75//           MCalibrationChargeBlindPix, MCalibrationChargePINDiode
    13076//
    13177/////////////////////////////////////////////////////////////////////////////
     
    13379#include "MCalibrationCam.h"
    13480
    135 #include <TH2.h>
    136 #include <TCanvas.h>
    13781#include <TClonesArray.h>
    13882
     
    175119//
    176120MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title)
    177     : fOffsets(NULL),
    178       fSlopes(NULL),
    179       fOffvsSlope(NULL)
    180121{
    181122  fName  = name  ? name  : "MCalibrationChargeCam";
     
    187128 
    188129  Clear();
    189 }
    190 
    191 // --------------------------------------------------------------------------
    192 //
    193 // Deletes the histograms if they exist
    194 //
    195 MCalibrationChargeCam::~MCalibrationChargeCam()
    196 {
    197 
    198   if (fOffsets)
    199     delete fOffsets;
    200   if (fSlopes)
    201     delete fSlopes;
    202   if (fOffvsSlope)
    203     delete fOffvsSlope;
    204130}
    205131
     
    341267// 5: Reduced Sigma of fitted Charge             (see MCalibrationChargePix::GetRSigma())
    342268// 6: Error Reduced Sigma of fitted Charge       (see MCalibrationChargePix::GetRSigmaErr())
    343 // 7: Reduced Sigma per Charge                 
    344 // 8: Error of Reduced Sigma per Charge
    345 //
    346 // Results of the different calibration methods:
    347 // =============================================
    348 //
    349 //  9: Nr. Photo-electrons from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethod())
    350 // 10: Error Nr. Photo-el. from F-Factor Method   (see MCalibrationChargePix::GetPheFFactorMethodErr())
    351 // 11: Conversion factor   from F-Factor Method   (see MCalibrationChargePix::GetMeanConversionFFactorMethod())
    352 // 12: Error conv. factor  from F-Factor Method   (see MCalibrationChargePix::GetConversionFFactorMethodErr())
    353 // 13: Overall F-Factor    from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethod())
    354 // 14: Error F-Factor      from F-Factor Method   (see MCalibrationChargePix::GetTotalFFactorFFactorMethodErr())
    355 // 15: Pixels valid calibration F-Factor-Method   (see MCalibrationChargePix::IsFFactorMethodValid())           
    356 // 16: Conversion factor   from BlindPixel Method (see MCalibrationChargePix::GetMeanConversionBlindPixelMethod())
    357 // 17: Error conv. factor  from BlindPixel Method (see MCalibrationChargePix::GetConversionBlindPixelMethodErr()) 
    358 // 18: Overall F-Factor    from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethod())   
    359 // 19: Error F-Factor      from BlindPixel Method (see MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr())
    360 // 20: Pixels valid calibration BlindPixel-Method (see MCalibrationChargePix::IsBlindPixelMethodValid())           
    361 // 21: Conversion factor   from PINDiode Method   (see MCalibrationChargePix::GetMeanConversionPINDiodeMethod())
    362 // 22: Error conv. factor  from PINDiode Method   (see MCalibrationChargePix::GetConversionPINDiodeMethodErr()) 
    363 // 23: Overall F-Factor    from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethod())   
    364 // 24: Error F-Factor      from PINDiode Method   (see MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr())
    365 // 25: Pixels valid calibration PINDiode-Method   (see MCalibrationChargePix::IsPINDiodeMethodValid())           
     269// 7: Reduced Sigma per Charge                   (see MCalibrationChargePix::GetRSigmaPerCharge())
     270// 8: Error of Reduced Sigma per Charge          (see MCalibrationChargePix::GetRSigmaPerChargeErr())
     271//
     272// Results of the F-Factor calibration Method:
     273// ===========================================
     274//
     275//  9: Nr. Photo-electrons from F-Factor Method  (see MCalibrationChargePix::GetPheFFactorMethod())
     276// 10: Error Nr. Photo-el. from F-Factor Method  (see MCalibrationChargePix::GetPheFFactorMethodErr())
     277// 11: Conversion factor   from F-Factor Method  (see MCalibrationChargePix::GetMeanConversionFFactorMethod())
     278// 12: Error conv. factor  from F-Factor Method  (see MCalibrationChargePix::GetConversionFFactorMethodErr())
     279// 13: Overall F-Factor    from F-Factor Method  (see MCalibrationChargePix::GetTotalFFactorFFactorMethod())
     280// 14: Error F-Factor      from F-Factor Method  (see MCalibrationChargePix::GetTotalFFactorFFactorMethodErr())
     281// 15: Pixels valid calibration F-Factor-Method  (see MCalibrationChargePix::IsFFactorMethodValid())           
     282//
     283// Results of the Low-Gain vs. High-Gain Conversion:
     284// =================================================
     285//
     286// 16: Mean Signal Hi-Gain / Mean Signal Lo-Gain (see MCalibrationPix::GetHiLoMeansDivided())
     287// 17: Error Signal High-Gain / Signal Low Gain  (see MCalibrationPix::GetHiLoMeansDividedErr())
     288// 18: Sigma High-Gain / Sigma Low Gain          (see MCalibrationPix::GetHiLoSigmasDivided())
     289// 19: Error Sigma High-Gain / Sigma Low Gain    (see MCalibrationPix::GetHiLoSigmasDividedErr())
    366290//                                               
    367291// Localized defects:                             
    368292// ==================
    369293//
    370 // 26: Excluded Pixels
    371 // 27: Number of pickup events in the Hi Gain     (see MCalibrationPix::GetHiGainNumPickup())
    372 // 28: Number of pickup events in the Lo Gain     (see MCalibrationPix::GetLoGainNumPickup())
     294// 20: Excluded Pixels
     295// 21: Number of pickup   events in the Hi Gain  (see MCalibrationPix::GetHiGainNumPickup())
     296// 22: Number of pickup   events in the Lo Gain  (see MCalibrationPix::GetLoGainNumPickup())
     297// 23: Number of blackout events in the Hi Gain  (see MCalibrationPix::GetHiGainNumBlackout())
     298// 24: Number of blackout events in the Lo Gain  (see MCalibrationPix::GetLoGainNumBlackout())
    373299//
    374300// Other classifications of pixels:
    375301// ================================
    376302//
    377 // 29: Pixels with saturated Hi-Gain              (see MCalibrationPix::IsHighGainSaturation())
     303// 25: Pixels with saturated High-Gain           (see MCalibrationPix::IsHiGainSaturation())
     304//
     305// Calculated absolute arrival times (very low precision!):
     306// ========================================================
     307//
     308// 26: Absolute Arrival time of the signal       (see MCalibrationChargePix::GetAbsTimeMean())
     309// 27: RMS Ab.  Arrival time of the signal       (see MCalibrationChargePix::GetAbsTimeRms())
    378310//
    379311// Used Pedestals:
    380312// ===============
    381313//
    382 // 30: Pedestal for entire signal extr. range     (see MCalibrationChargePix::Ped())
    383 // 31: Error Pedestal entire signal extr. range   (see MCalibrationChargePix::PedErr())
    384 // 32: Ped. RMS entire signal extraction range    (see MCalibrationChargePix::PedRms())
    385 // 33: Error Ped. RMS entire signal extr. range   (see MCalibrationChargePix::PedRmsErr())
    386 //
    387 // Calculated absolute arrival times (very low precision!):
    388 // ========================================================
    389 //
    390 // 34: Absolute Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeMean())
    391 // 35: RMS Ab.  Arrival time of the signal        (see MCalibrationChargePix::GetAbsTimeRms())
     314// 28: Pedestal for entire signal extr. range    (see MCalibrationChargePix::Ped())
     315// 29: Error Pedestal entire signal extr. range  (see MCalibrationChargePix::PedErr())
     316// 30: Ped. RMS entire signal extraction range   (see MCalibrationChargePix::PedRms())
     317// 31: Error Ped. RMS entire signal extr. range  (see MCalibrationChargePix::PedRmsErr())
    392318//
    393319Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
     
    448374      if (pix.IsExcluded())
    449375        return kFALSE;
    450       if (pix.GetRSigma() == -1.)
    451         return kFALSE;
    452       if (pix.GetMean() == 0.)
    453         return kFALSE;
    454       val = pix.GetRSigma() / pix.GetMean();
     376      val = pix.GetRSigmaPerCharge();
    455377      break;
    456378    case 8:
    457379      if (pix.IsExcluded())
    458380        return kFALSE;
    459       if (pix.GetRSigmaRelVar() <= 0.)
    460         return kFALSE;
    461       if (pix.GetMeanRelVar() <= 0.)
    462         return kFALSE;
    463       // relative error Rsigma square
    464       val =  pix.GetRSigmaRelVar() + pix.GetMeanRelVar();
    465       //a calculate relative error out of squares
    466       if (val < 0)
    467         val = -1.;
    468       else
    469         val  =   TMath::Sqrt(val) * pix.GetRSigma() / pix.GetMean();
     381      val =  pix.GetRSigmaPerChargeErr();
    470382      break;
    471383    case 9:
     
    508420      break;
    509421    case 16:
    510       return kFALSE;
     422      if (pix.IsExcluded())
     423        return kFALSE;
     424      val = pix.GetHiLoMeansDivided();
    511425      break;
    512426    case 17:
    513       return kFALSE;
     427      if (pix.IsExcluded())
     428        return kFALSE;
     429      val = pix.GetHiLoMeansDividedErr();
    514430      break;
    515431    case 18:
    516       return kFALSE;
     432      if (pix.IsExcluded())
     433        return kFALSE;
     434      val = pix.GetHiLoSigmasDivided();
    517435      break;
    518436    case 19:
    519       return kFALSE;
     437      if (pix.IsExcluded())
     438        return kFALSE;
     439      val = pix.GetHiLoSigmasDividedErr();
    520440      break;
    521441    case 20:
    522       return kFALSE;
    523       break;
    524     case 21:
    525       return kFALSE;
    526       break;
    527     case 22:
    528       return kFALSE;
    529       break;
    530     case 23:
    531       return kFALSE;
    532       break;
    533     case 24:
    534       return kFALSE;
    535       break;
    536     case 25:
    537       return kFALSE;
    538       break;
    539     case 26:
    540442      if (pix.IsExcluded())
    541443        val = 1.;
     
    543445        return kFALSE;
    544446      break;
     447    case 21:
     448      if (pix.IsExcluded())
     449        return kFALSE;
     450      val = pix.GetHiGainNumPickup();
     451      break;
     452    case 22:
     453      if (pix.IsExcluded())
     454        return kFALSE;
     455      val = pix.GetLoGainNumPickup();
     456      break;
     457    case 23:
     458      if (pix.IsExcluded())
     459        return kFALSE;
     460      val = pix.GetHiGainNumBlackout();
     461      break;
     462    case 24:
     463      if (pix.IsExcluded())
     464        return kFALSE;
     465      val = pix.GetLoGainNumBlackout();
     466      break;
     467    case 25:
     468      if (pix.IsExcluded())
     469        return kFALSE;
     470      val = pix.IsHiGainSaturation();
     471      break;
     472    case 26:
     473      if (pix.IsExcluded())
     474        return kFALSE;
     475      val = pix.GetAbsTimeMean();
     476      break;
    545477    case 27:
    546478      if (pix.IsExcluded())
    547479        return kFALSE;
    548       val = pix.GetHiGainNumPickup();
     480      val = pix.GetAbsTimeRms();
    549481      break;
    550482    case 28:
    551483      if (pix.IsExcluded())
    552484        return kFALSE;
    553       val = pix.GetLoGainNumPickup();
     485      val = pix.GetPed();
    554486      break;
    555487    case 29:
    556488      if (pix.IsExcluded())
    557489        return kFALSE;
    558       val = pix.IsHiGainSaturation();
     490      val = pix.GetPedErr();
    559491      break;
    560492    case 30:
    561493      if (pix.IsExcluded())
    562494        return kFALSE;
    563       val = pix.GetPed();
     495      val = pix.GetPedRms();
    564496      break;
    565497    case 31:
    566498      if (pix.IsExcluded())
    567499        return kFALSE;
    568       val = pix.GetPedErr();
    569       break;
    570     case 32:
    571       if (pix.IsExcluded())
    572         return kFALSE;
    573       val = pix.GetPedRms();
    574       break;
    575     case 33:
    576       if (pix.IsExcluded())
    577         return kFALSE;
    578500      val = pix.GetPedErr()/2.;
    579       break;
    580     case 34:
    581       if (pix.IsExcluded())
    582         return kFALSE;
    583       val = pix.GetAbsTimeMean();
    584       break;
    585     case 35:
    586       if (pix.IsExcluded())
    587         return kFALSE;
    588       val = pix.GetAbsTimeRms();
    589501      break;
    590502    default:
     
    593505
    594506  return val!=-1.;
    595 
    596507}
    597508
     
    626537
    627538
    628 /*
    629 void MCalibrationChargeCam::DrawHiLoFits()
    630 {
    631 
    632   if (!fOffsets)
    633     fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
    634   if (!fSlopes)
    635     fSlopes  = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
    636   if (!fOffvsSlope)
    637     fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
    638 
    639   TIter Next(fPixels);
    640   MCalibrationPix *pix;
    641   MHCalibrationPixel *hist;
    642   while ((pix=(MCalibrationPix*)Next()))
    643     {
    644       hist = pix->GetHist();
    645       hist->FitHiGainvsLoGain();
    646       fOffsets->Fill(hist->GetOffset(),1.);
    647       fSlopes->Fill(hist->GetSlope(),1.);
    648       fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
    649     }
    650 
    651    TCanvas *c1 = new TCanvas();
    652 
    653    c1->Divide(1,3);
    654    c1->cd(1);
    655    fOffsets->Draw();
    656    gPad->Modified();
    657    gPad->Update();
    658 
    659    c1->cd(2);
    660   fSlopes->Draw();
    661   gPad->Modified();
    662   gPad->Update();
    663 
    664   c1->cd(3);
    665   fOffvsSlope->Draw("col1");
    666   gPad->Modified();
    667   gPad->Update();
    668 }
    669 
    670 */
Note: See TracChangeset for help on using the changeset viewer.