Ignore:
Timestamp:
04/16/04 19:17:36 (20 years ago)
Author:
moralejo
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r3688 r3768  
    3535//
    3636//  Output Containers:
     37//  (containers mus exist already, they are filled with new values).
    3738//   MCalibrationChargeCam
     39//   MCalibrationQECam 
    3840//
    3941/////////////////////////////////////////////////////////////////////////////
     
    6971{
    7072    fName  = name  ? name  : "MMcCalibrationCalc";
    71     fTitle = title ? title : "Calculate and write conversion factors into MCalibrationCam Container";
    72 
    73     fHistRatio = new TH1F(AddSerialNumber("HistRatio"), "log10(fPassPhotCone/fSize)", 1500, -3., 3.);
    74     fHistRatio->SetXTitle("log_{10}(fPassPhotCone / fSize) [phot/ADC count]");
     73    fTitle = title ? title : "Calculate and write conversion factors into MCalibrationChargeCam and MCalibrationQECam containers";
     74
     75    fHistRatio = new TH1F(AddSerialNumber("HistRatio"), "log10(fPhotElfromShower/fSize)", 1500, -3., 3.);
     76    fHistRatio->SetXTitle("log_{10}(fPhotElfromShower / fSize) [photel/ADC count]");
    7577}
    7678
     
    100102{
    101103    fHistRatio->Reset();
    102     fADC2Phot = 0;
     104    fADC2PhotEl = 0;
     105    fPhot2PhotEl = 0;
    103106
    104107    fCalCam = (MCalibrationChargeCam*) pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
     
    204207    // FIXME? The present cut (1000 "inner-pixel-counts") is somehow
    205208    // arbitrary. Might it be optimized?
    206     //
    207     if (fHillas->GetSize()<1000)
     209    //   
     210
     211    const Float_t size = fHillas->GetSize();
     212    // Size will at this point be in ADC counts (still uncalibrated)
     213
     214    if (size < 1000)
    208215        return kTRUE;
    209216
    210     fADC2Phot += fMcEvt->GetPassPhotCone()/fHillas->GetSize();
    211 
    212     fHistRatio->Fill(TMath::Log10(fMcEvt->GetPassPhotCone()/fHillas->GetSize()));
     217    fPhot2PhotEl += (Float_t) fMcEvt->GetPhotElfromShower() /
     218      (Float_t) fMcEvt->GetPassPhotCone();
     219
     220    fHistRatio->Fill(TMath::Log10(fMcEvt->GetPhotElfromShower()/size));
    213221
    214222    return kTRUE;
     
    228236    }
    229237
    230     fADC2Phot /= n;
    231 
    232     //
    233     // For the calibration we no longer use the mean,
    234     // but the peak of the distribution:
     238    fPhot2PhotEl /= n;   // Average quantum efficiency
     239
     240    //
     241    // Find peak of log10(photel/Size) histogram:
    235242    //
    236243    const Int_t reach = 2;
    237 
    238244    Stat_t summax = 0;
    239245    Int_t  mode   = 0;
    240 
    241     // FIXME: Is this necessary? We could use GetMaximumBin instead..
    242246    for (Int_t ibin = 1+reach; ibin <= fHistRatio->GetNbinsX()-reach; ibin++)
    243247    {
     
    251255    }
    252256
    253     fADC2Phot = TMath::Power(10, fHistRatio->GetBinCenter(mode));
     257    fADC2PhotEl = TMath::Power(10, fHistRatio->GetBinCenter(mode));
    254258
    255259    const Int_t num = fCalCam->GetSize();
     
    257261    for (int i=0; i<num; i++)
    258262    {
    259 
    260263        MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i];
    261         //        MCalibrationQEPix     &qepix  = (MCalibrationQEPix&)    (*fQECam) [i];
    262 
    263         const Float_t qe     = MCalibrationQEPix::gkDefaultAverageQE;
    264         const Float_t factor = fADC2Phot/qe*calpix.GetMeanConvFADC2Phe();
    265         //
    266         // FIXME: Now, only the conversion to PHe is stored, need also the quantum efficiency simulated!!!
    267         //
     264        MCalibrationQEPix     &qepix  = (MCalibrationQEPix&)    (*fQECam) [i];
     265
     266        qepix.SetAverageQE(fPhot2PhotEl);
     267
     268        qepix.SetAvNormFFactor(1.);
     269        // This factor should convert the default average QE for different colors to
     270        // average QE for a spectrum like that of Cherenkov light (see the documentration
     271        // of MCalibrationQEPix).
     272        // Here we obtain average QE using already a Cherenkov spectrum so AvNormFFacto
     273        // must be 1.
     274
     275       
     276        Float_t factor = fADC2PhotEl;
     277
     278        //
     279        // We take into account the (possibly) different gain of outer pixels:
     280        //
     281        if (fGeom->GetPixRatio(i) < 1.)
     282          factor *= fHeaderFadc->GetAmplitud()/fHeaderFadc->GetAmplitudOuter();
     283
    268284        calpix.SetMeanConvFADC2Phe(factor);
    269285        calpix.SetMeanConvFADC2PheVar(0.);
     286
    270287        calpix.SetMeanFFactorFADC2Phot(0.);
    271288    }
Note: See TracChangeset for help on using the changeset viewer.