Ignore:
Timestamp:
06/14/04 14:23:25 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
2 edited

Legend:

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

    r3831 r4291  
    7070#include "MMcRunHeader.hxx"
    7171#include "MMcFadcHeader.hxx"
     72#include "MMcConfigRunHeader.h"
    7273
    7374ClassImp(MMcCalibrationUpdate);
     
    8081    fTitle = title ? title : "Write MC pedestals and conversion factors into MCalibration Container";
    8182
    82     //
    83     // As default we set 1 photon = 1 ADC count.
    84     // (this will make Size to be in ADC counts if no previous calibration has been made)
    85     // Hence:
    86     //
    87     fADC2PhElInner = MCalibrationQEPix::gkDefaultAverageQE;
    88     fADC2PhElOuter = MCalibrationQEPix::gkDefaultAverageQE;
    8983
    9084    fAmplitude = -1.;
     
    224218    }
    225219
    226 
    227 
    228     //
    229     // If MCalibrationCam already existed in the parameter list before
    230     // MMcCalibrationUpdate::PreProcess was executed (from a
    231     // previous calibration loop) we must not fill it, hence nothing
    232     // else has to be done in ReInit:
     220    //
     221    // If MCalibrationChargeCam and MCalibrationQECam already existed
     222    // in the parameter list before MMcCalibrationUpdate::PreProcess was
     223    // executed (from a previous calibration loop) we must not fill it,
     224    // hence nothing else has to be done in ReInit:
    233225    //
    234226    if (!fFillCalibrationCam)
    235227        return kTRUE;
     228
     229    // Now check the light collection for inner and outer pixels to
     230    // calculate the ratio between the two. FIXME! Light collection
     231    // depends on the incidence angle of the light w.r.t. the camera
     232    // plane. For the moment we take the ratio for light impinging
     233    // perpendicular to the camera plane.
     234    //
     235    // FIXME! We should look for AddSerialNumber("MMcConfigRunHeader") but
     236    // for the moment the stereo version of camera does not write one such
     237    // header per telescope (it should!)
     238    //
     239    MMcConfigRunHeader* mcconfig = (MMcConfigRunHeader*) pList->FindObject("MMcConfigRunHeader");
     240    if (!mcconfig)
     241    {
     242        *fLog << err << "MMcConfigRunHeader" << " not found... aborting." << endl;
     243        return kFALSE;
     244    }
     245    TArrayF innerlightcoll = mcconfig->GetLightCollectionFactor();
     246    TArrayF outerlightcoll = mcconfig->GetLightCollectionFactorOuter();
     247
     248    // In principle outer pixels seem to have a different average light
     249    // collection efficiency than outer ones. We set here the factor between
     250    // the two.
     251
     252    fOuterPixelsLightCollection = outerlightcoll[90] / innerlightcoll[90];
     253    // (at angle = 90 deg)
     254
     255    // Set now the conversion from ADC counts to photoelectrons (in case
     256    // no previous calibration existed in the parameter list).
     257    // As default we want 1 photon = 1 inner pixel ADC count
     258    // (this will make Size to be in ADC counts which is what we want for
     259    // the MC calibration loop. To achieve this we set the ADC to
     260    // photoelectron conversion equal to the QE, which will later make the
     261    // ADC to photon conversion factor to be = 1.
     262    //
     263    fADC2PhElInner = MCalibrationQEPix::gkDefaultAverageQE;
    236264
    237265    //
     
    240268    // inner and outer pixels, (fOuterPixelsGainScaling = kFALSE),
    241269    // which may be useful for display purposes.
     270    // If we apply the factor, we must take into account the different
     271    // gain photoelectrons->ADC counts, and also apply the correct QE
     272    // (see comment above) for the outer pixels through the factor
     273    // fOuterPixelsLightCollection.
    242274    //
    243275
    244276    if (fOuterPixelsGainScaling)
    245       fADC2PhElOuter = fADC2PhElInner * (fAmplitude / fAmplitudeOuter);
     277      fADC2PhElOuter =  MCalibrationQEPix::gkDefaultAverageQE
     278          * fOuterPixelsLightCollection
     279          * (fAmplitude / fAmplitudeOuter);
    246280    else
    247281      fADC2PhElOuter = fADC2PhElInner;
    248282
    249283
    250     const int num = fCalCam->GetSize();
     284    Int_t num = fCalCam->GetSize();
    251285
    252286    fCalCam->SetFFactorMethodValid   ( kTRUE );
     
    256290    fQECam->SetPINDiodeMethodValid   ( kTRUE ); 
    257291   
    258     for (int i=0; i<num; i++)
     292    for (Int_t i=0; i<num; i++)
    259293    {
    260294        MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i];
     
    274308        calpix.SetMeanConvFADC2Phe(adc2photel);
    275309        calpix.SetMeanConvFADC2PheVar(0.);
    276         calpix.SetMeanFFactorFADC2Phot(0.);
    277 
    278     }
    279 
     310        calpix.SetMeanFFactorFADC2Phot(0.); // Not used for now.
     311
     312    }
     313
     314    //
     315    // Now set the average QE for each type of pixels. Correct outer pixels
     316    // by different light collection efficiency.
     317    //
     318    num = fQECam->GetSize();
     319    for (Int_t i=0; i<num; i++)
     320    {
     321        MCalibrationQEPix &qepix = (MCalibrationQEPix&)(*fQECam)[i];
     322        Float_t avqe =
     323            (fGeom->GetPixRatio(i) < fGeom->GetPixRatio(0))?
     324            MCalibrationQEPix::gkDefaultAverageQE*fOuterPixelsLightCollection:
     325            MCalibrationQEPix::gkDefaultAverageQE;
     326
     327        qepix.SetAverageQE(avqe);
     328    }
    280329
    281330    return kTRUE;
     
    289338Int_t MMcCalibrationUpdate::Process()
    290339{
    291     const int num = fCalCam->GetSize();
    292 
    293     for (int i=0; i<num; i++)
     340    const Int_t num = fCalCam->GetSize();
     341
     342    for (Int_t i=0; i<num; i++)
    294343    {
    295344        MExtractedSignalPix &sigpix = (*fSignalCam)[i];
     
    330379
    331380        qepix.SetAvNormFFactor(1.);
    332         // This factor should convert the default average QE to average QE for a spectrum
    333         // like that of Cherenkov light. See the documentration of MCalibrationQEPix.
     381        // This factor should convert the default average QE to average QE
     382        // for a spectrum like that of Cherenkov light. See the documentation
     383        // of MCalibrationQEPix. Here it is 1 because we calibrate using
     384        // Cherenkov light.
    334385
    335386        Float_t qe       = qepix.GetAverageQE();
  • trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h

    r3768 r4291  
    3838    Float_t fConversionHiLo; // Ratio of high to low gain.
    3939
     40    Float_t fOuterPixelsLightCollection;
     41    // Photon collection efficiency of outer pixels w.r.t. inner ones.
     42
    4043public:
    4144    MMcCalibrationUpdate(const char *name=NULL, const char *title=NULL);
Note: See TracChangeset for help on using the changeset viewer.