Changeset 3687


Ignore:
Timestamp:
04/08/04 20:36:48 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3686 r3687  
    8383   * mcalib/MCalibrate.[h,cc]
    8484   * mcalib/MCalibrateData.[h,cc]
     85   * mcalib/MMcCalibrationCalc.[h,cc]
    8586     - conversion factors now separated into FADC2phe and then into
    8687       call to average Quantum efficiency.
  • trunk/MagicSoft/Mars/mcalib/MCalibrate.cc

    r3638 r3687  
    7070#include "MCalibrationChargePix.h"
    7171
     72#include "MCalibrationQECam.h"
     73#include "MCalibrationQEPix.h"
     74
    7275#include "MExtractedSignalCam.h"
    7376#include "MExtractedSignalPix.h"
     
    8689//
    8790MCalibrate::MCalibrate(CalibrationMode_t calmode,const char *name, const char *title)
    88     : fGeomCam(NULL), fCalibrations(NULL), fBadPixels(NULL), fSignals(NULL),
     91    : fGeomCam(NULL), fCalibrations(NULL), fQEs(NULL), fBadPixels(NULL), fSignals(NULL),
    8992      fCerPhotEvt(NULL), fCalibrationMode(calmode)
    9093{
     
    131134          }
    132135
     136        fQEs = (MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam"));
     137        if (!fQEs)
     138          {
     139            *fLog << err << AddSerialNumber("MCalibrationQECam") << " not found ... aborting." << endl;
     140            return kFALSE;
     141          }
     142       
    133143      }
    134144
     
    148158{
    149159
    150   if(fCalibrationMode == kBlindPixel && !fCalibrations->IsBlindPixelMethodValid())
    151     {
    152       *fLog << warn << GetDescriptor() << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl;
     160  if(fCalibrationMode == kBlindPixel && !fQEs->IsBlindPixelMethodValid())
     161    {
     162      *fLog << warn << GetDescriptor()
     163            << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl;
    153164      fCalibrationMode = kFfactor;
    154165    }
    155 
    156   if(fCalibrationMode == kPinDiode && !fCalibrations->IsPINDiodeMethodValid())
     166 
     167  if(fCalibrationMode == kPinDiode && !fQEs->IsPINDiodeMethodValid())
    157168    {
    158       *fLog << warn << GetDescriptor() << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl;
     169      *fLog << warn << GetDescriptor()
     170            << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl;
     171      fCalibrationMode = kFfactor;
     172    }
     173
     174  if(fCalibrationMode == kCombined && !fQEs->IsCombinedMethodValid())
     175    {
     176      *fLog << warn << GetDescriptor()
     177            << "Warning: Combined calibration method not valid, switching to F-factor method" << endl;
    159178      fCalibrationMode = kFfactor;
    160179    }
     
    200219Int_t MCalibrate::Process()
    201220{
     221
     222  //
     223  // For the moment, we use only a dummy zenith for the calibration:
     224  //
     225  const Float_t zenith = 0;
     226
    202227  /*
    203228    if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
     
    216241  Float_t hiloconv      = 0.;
    217242  Float_t hiloconverr   = 0.;
    218   Float_t calibrationConversionFactor    = 0.;
    219   Float_t calibrationConversionFactorErr = 0.;
     243  Float_t calibConv     = 0.;
     244  Float_t calibConvVar  = 0.;
     245  Float_t calibFFactor  = 0.;
     246  Float_t calibQE       = 0.;
     247  Float_t calibQEVar    = 0.;
    220248 
    221249  for (UInt_t pixidx=0; pixidx<npix; pixidx++)
     
    227255         
    228256          MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx];
     257          MCalibrationQEPix     &qe  = (MCalibrationQEPix&)    (*fQEs         )[pixidx];
    229258          MBadPixelsPix         &bad = (*fBadPixels)[pixidx];
    230259
     
    233262              continue;
    234263
     264          calibConv      = pix.GetMeanConvFADC2Phe();
     265          calibConvVar   = pix.GetMeanConvFADC2PheVar();
     266          calibFFactor   = pix.GetMeanFFactorFADC2Phot();
     267
    235268          switch(fCalibrationMode)
    236269            {
    237270            case kBlindPixel:
    238                 if (pix.IsBlindPixelMethodValid())
     271              if (qe.IsBlindPixelMethodValid())
    239272                {
    240                     calibrationConversionFactor      = pix.GetMeanConversionBlindPixelMethod();
    241                     calibrationConversionFactorErr   = pix.GetConversionBlindPixelMethodErr();
     273                  calibQE      = qe.GetQECascadesBlindPixel   ( zenith );
     274                  calibQEVar   = qe.GetQECascadesBlindPixelVar( zenith );
     275                }
     276              else
     277                continue;
     278              break;
     279            case kPinDiode:
     280              if (qe.IsPINDiodeMethodValid())
     281                {
     282                  calibQE      = qe.GetQECascadesPINDiode   ( zenith );
     283                  calibQEVar   = qe.GetQECascadesPINDiodeVar( zenith );
    242284                }
    243285                else
    244                     continue;
    245               break;
    246             case kPinDiode:
    247                 if (pix.IsPINDiodeMethodValid())
    248                 {
    249                     calibrationConversionFactor      = pix.GetMeanConversionPINDiodeMethod();
    250                     calibrationConversionFactorErr   = pix.GetConversionPINDiodeMethodErr();
    251                 }
    252                 else
    253                     continue;
     286                  continue;
    254287              break;
    255288            case kFfactor:
    256                 if (pix.IsFFactorMethodValid())
     289              if (pix.IsFFactorMethodValid())
    257290                {
    258                     calibrationConversionFactor      = pix.GetMeanConversionFFactorMethod();
    259                     calibrationConversionFactorErr   = pix.GetConversionFFactorMethodErr();
     291                  calibQE      = qe.GetQECascadesFFactor   ( zenith );
     292                  calibQEVar   = qe.GetQECascadesFFactorVar( zenith );
    260293                }
    261                 else
    262                     continue;
     294              else
     295                continue;
    263296              break;
    264297            case kCombined:
    265                 if (pix.IsCombinedMethodValid())
     298              if (qe.IsCombinedMethodValid())
    266299                {
    267                     calibrationConversionFactor      = pix.GetMeanConversionCombinedMethod();
    268                     calibrationConversionFactorErr   = pix.GetConversionCombinedMethodErr();
     300                  calibQE      = qe.GetQECascadesCombined   ( zenith );
     301                  calibQEVar   = qe.GetQECascadesCombinedVar( zenith );
    269302                }
    270                 else
    271                     continue;
    272                 break;
     303              else
     304                continue;
     305              break;
    273306            case kDummy:
    274               hiloconv                         = 1.;
    275               hiloconverr                      = 0.;
    276               calibrationConversionFactor      = 1.;
    277               calibrationConversionFactorErr   = 0.;
     307              hiloconv     = 1.;
     308              hiloconverr  = 0.;
     309              calibQE      = 1.;
     310              calibQEVar   = 0.;
    278311              break;
    279312
    280313            } /* switch calibration mode */
    281314         
    282           hiloconv   = pix.GetConversionHiLo();
     315          hiloconv   = pix.GetConversionHiLo   ();
    283316          hiloconverr= pix.GetConversionHiLoErr();
    284317         
     
    286319      else
    287320      {
    288           hiloconv                         = 1.;
    289           hiloconverr                      = 0.;
    290           calibrationConversionFactor      = 1.;
    291           calibrationConversionFactorErr   = 0.;
     321          hiloconv       = 1.;
     322          hiloconverr    = 0.;
     323          calibConv      = 1.;
     324          calibConvVar   = 0.;
     325          calibFFactor   = 0.;
     326          calibQE        = 1.;
     327          calibQEVar     = 0.;
    292328      }     
    293329      MExtractedSignalPix &sig =  (*fSignals)[pixidx];
     
    306342          if (sig.GetExtractedSignalHiGain() > 9999.)
    307343            {
    308               signal = 0.;
     344              signal    = 0.;
    309345              signalErr = 0.;
    310346            }
     
    313349        }
    314350     
    315       nphot    = signal*calibrationConversionFactor;
    316       nphotErr = signal*calibrationConversionFactorErr
    317                 *signal*calibrationConversionFactorErr
    318                + signalErr*calibrationConversionFactor
    319                 *signalErr*calibrationConversionFactor;
    320      
    321       nphotErr  = TMath::Sqrt(nphotErr);
    322      
     351      nphot    = signal*calibConv/calibQE;
     352      nphotErr = calibFFactor*TMath::Sqrt(nphot);
     353
     354      //
     355      // The following part is the outcommented first version of the error calculation
     356      // Contact Markus Gaug for questions (or wait for the next documentation update...)
     357      //
     358      /*
     359        nphotErr = signal    > 0 ? signalErr*signalErr / (signal * signal)  : 0.
     360                 + calibConv > 0 ? calibConvVar  / (calibConv * calibConv ) : 0.
     361                 + calibQE   > 0 ? calibQEVar    / (calibQE   * calibQE   ) : 0.;
     362        nphotErr  = TMath::Sqrt(nphotErr) * nphot;
     363      */
     364
    323365      MCerPhotPix *cpix = fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
    324366
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r3638 r3687  
    1919!   Author(s): Javier Rico     01/2004 <mailto:jrico@ifae.es>
    2020!   Author(s): Wolfgang Wittek 02/2004 <mailto:wittek@mppmu.mpg.de>
     21!   Author(s): Markus Gaug     04/2004 <mailto:markus@ifae.es>
    2122!
    2223!   Copyright: MAGIC Software Development, 2000-2004
     
    4041//    MPedestalCam
    4142//    MExtractedSingalCam
    42 //    MCalibrationCam
     43//    MCalibrationChargeCam
     44//    MCalibrationQECam
    4345//
    4446//   Output Containers:
     
    6264#include "MCalibrationChargeCam.h"
    6365#include "MCalibrationChargePix.h"
     66
     67#include "MCalibrationQECam.h"
     68#include "MCalibrationQEPix.h"
    6469
    6570#include "MExtractedSignalCam.h"
     
    95100//  - MPedestalCam
    96101//  - MCalibrationChargeCam
     102//  - MCalibrationQECam
    97103//  - MExtractedSignalCam
    98104//
     
    136142            return kFALSE;
    137143        }
     144        fQEs = (MCalibrationQECam*)pList->FindObject(AddSerialNumber("MCalibrationQECam"));
     145        if (!fQEs)
     146        {
     147            *fLog << err << AddSerialNumber("MCalibrationQECam") << " not found ... aborting." << endl;
     148            return kFALSE;
     149        }
    138150    }
    139151
     
    161173{
    162174
    163   if(fCalibrationMode == kBlindPixel && !fCalibrations->IsBlindPixelMethodValid())
     175  if(fCalibrationMode == kBlindPixel && !fQEs->IsBlindPixelMethodValid())
    164176    {
    165177      *fLog << warn << GetDescriptor() << "Warning: Blind pixel calibration method not valid, switching to F-factor method" << endl;
     
    167179    }
    168180
    169   if(fCalibrationMode == kPinDiode && !fCalibrations->IsPINDiodeMethodValid())
     181  if(fCalibrationMode == kPinDiode && !fQEs->IsPINDiodeMethodValid())
    170182    {
    171183      *fLog << warn << GetDescriptor() << "Warning: PIN diode calibration method not valid, switching to F-factor method" << endl;
     
    201213
    202214    //----------------------------------
    203     // get photon/ADC conversion factor
     215    // get phe/ADC conversion factor
    204216
    205217    Float_t hiloconv;
    206218    Float_t hiloconverr;
    207     Float_t calibrationConversionFactor;
    208     Float_t calibrationConversionFactorErr;
     219    Float_t calibConv;
     220    Float_t calibFFactor;
    209221
    210222    if ( !GetConversionFactor(pixid, hiloconv, hiloconverr,
    211                               calibrationConversionFactor, calibrationConversionFactorErr ))
     223                              calibConv, calibFFactor ))
    212224      continue;
    213225
     
    215227
    216228    // pedestals/(used FADC slices)   in [number of photons]
    217     Float_t pedphot    = pedes  * calibrationConversionFactor;
    218     Float_t pedphotrms = pedrms * calibrationConversionFactor;
     229    Float_t pedphot    = pedes  * calibConv;
     230    Float_t pedphotrms = pedrms * calibConv;
    219231
    220232    (*fPedPhot)[pixid].Set(pedphot, pedphotrms);
    221233
    222     *fLog << all << pixid << ",  " << calibrationConversionFactor << ",  "
     234    *fLog << all << pixid << ",  " << calibConv << ",  "
    223235          << ped.GetPedestal() << ",  " << ped.GetPedestalRms() << ",  "
    224236          << pedphot << ",  " << pedphotrms << endl;
     
    239251Bool_t MCalibrateData::GetConversionFactor(UInt_t pixidx,
    240252 Float_t &hiloconv, Float_t &hiloconverr,
    241  Float_t &calibrationConversionFactor, Float_t &calibrationConversionFactorErr)
    242 {
    243   hiloconv    = 1.;
    244   hiloconverr = 0.;
    245   calibrationConversionFactor      = 1.;
    246   calibrationConversionFactorErr   = 0.;
     253 Float_t &calibConv, Float_t &calibFFactor)
     254{
     255
     256  //
     257  // For the moment, we use only a dummy zenith for the calibration:
     258  //
     259  const Float_t zenith = -1.;
     260
     261  hiloconv     = 1.;
     262  hiloconverr  = 0.;
     263  calibConv    = 1.;
     264  calibFFactor = 0.;
    247265
    248266  if(fCalibrationMode!=kNone)
    249267  {
    250     MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx];       
    251     MBadPixelsPix         &bad = (*fBadPixels)[pixidx];
     268    MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*fCalibrations)[pixidx];       
     269    MCalibrationQEPix     &qepix = (MCalibrationQEPix&)    (*fQEs)         [pixidx];       
     270    MBadPixelsPix         &bad   = (*fBadPixels)[pixidx];
    252271   
    253272    if (!bad.IsCalibrationResultOK())
     
    256275    hiloconv   = pix.GetConversionHiLo();
    257276    hiloconverr= pix.GetConversionHiLoErr();
    258          
     277
     278    const Float_t pheConv = pix.GetMeanConvFADC2Phe();
     279    calibFFactor          = pix.GetMeanFFactorFADC2Phot();
     280    Float_t calibQE       = 1.;
     281   
    259282    switch(fCalibrationMode)
    260283    {
    261284      case kBlindPixel:
    262       calibrationConversionFactor      = pix.GetMeanConversionBlindPixelMethod();
    263       calibrationConversionFactorErr   = pix.GetConversionBlindPixelMethodErr();
     285        calibQE      = qepix.GetQECascadesBlindPixel   ( zenith );
     286        //        calibQEVar   = qepix.GetQECascadesBlindPixelVar( zenith );
    264287      break;
    265288      case kFfactor:
    266       calibrationConversionFactor      = pix.GetMeanConversionFFactorMethod();
    267       calibrationConversionFactorErr   = pix.GetConversionFFactorMethodErr();
     289        calibQE      = qepix.GetQECascadesFFactor   ( zenith );
     290        //        calibQEVar   = qepix.GetQECascadesFFactorVar( zenith );
    268291      break;
    269292      default:
     
    271294              break;
    272295    }
     296    calibConv = pheConv / calibQE;
     297
    273298  }
    274299
    275300  return kTRUE;
    276301}
     302
    277303
    278304// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.h

    r3437 r3687  
    2626class MPedestalCam;
    2727class MCalibrationChargeCam;
     28class MCalibrationQECam;
    2829class MExtractedSignalCam;
    2930
     
    3738    MPedestalCam          *fPedestal;     // Pedestals/slice [ADC counts]
    3839    MBadPixelsCam         *fBadPixels;    // Bad Pixels information
    39     MCalibrationChargeCam *fCalibrations; // Calibration constants
     40    MCalibrationChargeCam *fCalibrations; // Calibration constants
     41    MCalibrationQECam     *fQEs;          // Quantum efficiencies
    4042    MExtractedSignalCam   *fSignals;      // Integrated charge in FADCs counts
    4143
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h

    r3249 r3687  
    77
    88class MCalibrationChargeCam;
     9class MCalibrationQECam;
    910class MGeomCam;
    1011class MHillas;
     
    1920private:
    2021    MCalibrationChargeCam     *fCalCam;
     22    MCalibrationQECam         *fQECam;   
    2123    MGeomCam                  *fGeom;
    2224    MHillas                   *fHillas;
Note: See TracChangeset for help on using the changeset viewer.