Ignore:
Timestamp:
12/12/03 15:00:48 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MMcCalibrationCalc.cc

    r2648 r2669  
    2828//
    2929//  This task looks for the ìnformation about FADC pedestals in
    30 //  MMcFadcHeader and translates it to the pedestal mean and rms,
     30//  MMcFadcHeader and translates it to the pedestal mean and rms (in adc counts),
    3131//  and in the conversion factor between photons and ADC counts in
    3232//  MCalibrationCam.
     33//  Then we create and fill also the MPedPhotCam object containing the pedestal
     34//  rms in units of photons.
    3335//
    3436//  Input Containers:
     
    3840//  Output Containers:
    3941//   MCalibrationCam
     42//   MPedPhotCam
    4043//
    4144/////////////////////////////////////////////////////////////////////////////
     
    4952#include "MCalibrationPix.h"
    5053#include "MCalibrationCam.h"
     54#include "MExtractedSignalCam.h"
     55#include "MExtractedSignalPix.h"
     56#include "MPedPhotCam.h"
     57#include "MPedPhotPix.h"
    5158
    5259#include "MRawRunHeader.h"
     
    6168    fName  = name  ? name  : "MMcCalibrationCalc";
    6269    fTitle = title ? title : "Write MC pedestals and conversion factors into MCalibration Container";
     70
     71    fADC2PheInner = 1.;
     72    fADC2PheOuter = 1.;
    6373
    6474}
     
    94104    return kTRUE;
    95105
    96   return pList->FindCreateObj(AddSerialNumber("MCalibrationCam")) ? kTRUE : kFALSE;
     106  if ( ! pList->FindCreateObj(AddSerialNumber("MCalibrationCam")))
     107    {
     108      *fLog << err << dbginf << "Cannot create MCalibrationCam... aborting." << endl;
     109      return kFALSE;
     110    }
     111
     112  fSignalCam = (MExtractedSignalCam*) pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
     113  if ( ! fSignalCam)
     114    {
     115      *fLog << err << dbginf << "Cannot find MExtractedSignalCam... aborting." << endl;
     116      return kFALSE;
     117    }
     118
     119  return kTRUE;
     120
    97121}
    98122
     
    122146    }
    123147
    124     fCalCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationCam"));
     148    fCalCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationCam"));
    125149
    126150    if (!fCalCam)
     
    144168    for (int i=0; i<num; i++)
    145169    {
    146         MCalibrationPix &pix = (*fCalCam)[i];
     170        MCalibrationPix &calpix = (*fCalCam)[i];
     171        MExtractedSignalPix &sigpix = (*fSignalCam)[i];
    147172
    148         const Float_t pedestmean = fHeaderFadc->GetPedestal(i);
    149         const Float_t pedestrms  = fHeaderFadc->GetPedestalRmsHigh(i);
    150         // per slice
     173        const Float_t pedestmean = sigpix.IsLoGainUsed()?
     174          fSignalCam->GetNumUsedLoGainFADCSlices()*fHeaderFadc->GetPedestal(i) :
     175          fSignalCam->GetNumUsedHiGainFADCSlices()*fHeaderFadc->GetPedestal(i);
    151176
    152         pix.SetPedestal(pedestmean, pedestrms);
     177        const Float_t pedestrms  = sigpix.IsLoGainUsed()?
     178          sqrt((Double_t)(fSignalCam->GetNumUsedLoGainFADCSlices())) * fHeaderFadc->GetPedestalRmsLow(i) :
     179          sqrt((Double_t)(fSignalCam->GetNumUsedHiGainFADCSlices())) * fHeaderFadc->GetPedestalRmsHigh(i);
     180
     181        // ped mean and rms per pixel, according to signal calculation:
     182
     183        calpix.SetPedestal(pedestmean, pedestrms);
     184
     185        if (i < 397) // FIXME!
     186          calpix.SetConversionBlindPixelMethod(fADC2PheInner, 0., 0.);
     187        else
     188          calpix.SetConversionBlindPixelMethod(fADC2PheOuter, 0., 0.);
     189
    153190    }
    154191
Note: See TracChangeset for help on using the changeset viewer.