Changeset 3768 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/16/04 19:17:36 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3764 r3768  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2004/04/16: Abelardo Moralejo
     22   * mcalib/MCalibrationQEPix.[h,cc]
     23     - Added fAverageQE. Same role as gkDefaultAverageQE, but can be
     24       changed via SetAverageQE. Made public GetAverageQE and
     25       GetAverageQERelVar (this changes needed for MC).
     26
     27   * mcalib/MMcCalibrationCalc.[h,cc]
     28   * manalysis/MMcCalibrationUpdate.[h,cc]
     29     - Adapted to M. Gaug's changes in calibration classes. Behaviour
     30       has been tested to be the same as before those changes. Now the
     31       conversion factor from ADC counts to photoelectrons, and the
     32       average QE (photons->photoelectrons) are calculated independently
     33       (and later combined by MCalibrate to obtain the conversion
     34       ADC->photons).
     35
     36   * mmain/MEventDisplay.cc, macros/mccalibrate.C, starmc.C
     37     - Added call to MExtractSignal::SetSaturationLimit(240)  Affects
     38       only MC display. This was necessary because if electronic noise
     39       is simulated in the FADC, sometimes saturated slices look not
     40       saturated due to negative fluctuations, so it is better to set
     41       the saturation limit at a safe value (240 ADC counts). Changed
     42       signal integration range (only for MC), now from slices 5 to 10.
     43
     44
    2045 2004/04/16: Markus Gaug
    2146
     
    3358       into the "low-gain samples" and mislead thus sliding window to
    3459       be maximized on the tail of the high-gain pulse.
    35 
    3660
    3761 2004/04/15: Markus Gaug
  • trunk/MagicSoft/Mars/macros/mccalibrate.C

    r3744 r3768  
    4646  // ------------- user change -----------------
    4747  TString* CalibrationFilename;
    48   CalibrationFilename = new TString("nonoise/Gamma_zbin0_0*.root");
     48  CalibrationFilename = new TString("../../gammas_nonoise/Gamma_zbin0_0*.root");
    4949  // File to be used for the calibration (must be a camera file without added noise)
    5050
     
    5454
    5555
    56   Int_t BinsHigh[2] = {5, 9}; // First and last FADC bin of the range to be integrated,
    57   Int_t BinsLow[2]  = {5, 9}; // for high and low gain respectively.
     56  Int_t BinsHigh[2] = {5, 10}; // First and last FADC bin of the range to be integrated,
     57  Int_t BinsLow[2]  = {5, 10}; // for high and low gain respectively.
    5858
    5959  // -------------------------------------------
     
    9595
    9696  MExtractSignal    sigextract;
     97  sigextract.SetSaturationLimit(240);
     98
    9799  // Define ADC slices to be integrated in high and low gain:
    98100  sigextract.SetRange(BinsHigh[0], BinsHigh[1], BinsLow[0], BinsLow[1]);
     
    101103
    102104  MCalibrate calib; // Transforms signals from ADC counts into photons.
    103   calib.SetCalibrationMode(MCalibrate::kDummy);
     105  calib.SetCalibrationMode(MCalibrate::kFfactor);
    104106
    105107  //    MBlindPixelCalc   blind;
     
    170172    }
    171173
    172   calib.SetCalibrationMode(MCalibrate::kFfactor);
    173 
    174174  //
    175175  // Second loop: analysis loop
  • trunk/MagicSoft/Mars/macros/starmc.C

    r3534 r3768  
    5252  // differences in gain of outer pixels)
    5353  //
    54   CalibrationFilename = new TString("nonoise/Gamma_zbin0_90_*.root");
     54  CalibrationFilename = new TString("../../gammas_nonoise/Gamma_zbin0_90_*.root");
    5555  // File to be used in the calibration (must be a camera file without added noise)
    5656
    5757  Char_t* AnalysisFilename = "Gamma_zbin*.root";  // File to be analyzed
     58
    5859
    5960  // ------------- user change -----------------
     
    7374  Float_t CleanLev[2] = {4., 3.}; // Tail cuts for image analysis
    7475
    75   Int_t BinsHigh[2] = {5, 9}; // First and last FADC bin of the range to be integrated,
    76   Int_t BinsLow[2]  = {5, 9}; // for high and low gain respectively.
     76  Int_t BinsHigh[2] = {5, 10}; // First and last FADC bin of the range to be integrated,
     77  Int_t BinsLow[2]  = {5, 10}; // for high and low gain respectively.
    7778
    7879  // -------------------------------------------
     
    114115
    115116  MExtractSignal    sigextract;
     117  sigextract.SetSaturationLimit(240);
    116118  // Define ADC slices to be integrated in high and low gain:
    117119  sigextract.SetRange(BinsHigh[0], BinsHigh[1], BinsLow[0], BinsLow[1]);
     
    120122
    121123  MCalibrate calib; // Transforms signals from ADC counts into photons.
     124  calib.SetCalibrationMode(MCalibrate::kFfactor);
    122125
    123126  //    MBlindPixelCalc   blind;
  • trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc

    r3689 r3768  
    3939//   MMcFadcHeader
    4040//   MRawRunHeader
    41 //  [MCalibrationCam] (if it existed previously)
     41//  [MCalibrationChargeCam] (if it existed previously)
     42//  [MCalibrationQECam] (if it existed previously)
    4243//
    4344//  Output Containers:
    4445//   MPedPhotCam
    45 //  [MCalibrationCam] (if it did not exist previously)
     46//  [MCalibrationChargeCam] (if it did not exist previously)
     47//  [MCalibrationQECam] (if it did not exist previously)
    4648//
    4749/////////////////////////////////////////////////////////////////////////////
     
    7880    fTitle = title ? title : "Write MC pedestals and conversion factors into MCalibration Container";
    7981
    80     fADC2PhInner = 1.;
    81     fADC2PhOuter = 1.;
     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;
    8289
    8390    fAmplitude = -1.;
     
    114121{
    115122    fCalCam = (MCalibrationChargeCam*) pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
    116     if (!fCalCam)
     123    fQECam = (MCalibrationQECam*) pList->FindObject(AddSerialNumber("MCalibrationQECam"));
     124
     125    if (!fCalCam || !fQECam)
    117126    {
    118127        fCalCam = (MCalibrationChargeCam*) pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam"));
    119         if (!fCalCam)
     128        fQECam = (MCalibrationQECam*) pList->FindCreateObj(AddSerialNumber("MCalibrationQECam"));
     129        if (!fCalCam || !fQECam)
    120130            return kFALSE;
    121131    }
     
    123133    {
    124134        fFillCalibrationCam = kFALSE;
    125         *fLog << inf << AddSerialNumber("MCalibrationChargeCam") << " already exists... " << endl;
    126     }
    127 
    128     fQECam = (MCalibrationQECam*) pList->FindObject(AddSerialNumber("MCalibrationQECam"));
    129     if (!fQECam)
    130     {
    131         fQECam = (MCalibrationQECam*) pList->FindCreateObj(AddSerialNumber("MCalibrationQECam"));
    132         if (!fQECam)
    133             return kFALSE;
    134     }
    135     else
    136     {
    137         fFillQECam = kFALSE;
    138         *fLog << inf << AddSerialNumber("MCalibrationQECam") << " already exists... " << endl;
    139     }
    140 
     135        *fLog << inf << AddSerialNumber("MCalibrationChargeCam") << " and " <<
     136          AddSerialNumber("MCalibrationQECam") << " already exist... " << endl;
     137    }
    141138
    142139    fPedPhotCam = (MPedPhotCam*) pList->FindCreateObj(AddSerialNumber("MPedPhotCam"));
     
    246243
    247244    if (fOuterPixelsGainScaling)
    248       fADC2PhOuter = fADC2PhInner * (fAmplitude / fAmplitudeOuter);
     245      fADC2PhElOuter = fADC2PhElInner * (fAmplitude / fAmplitudeOuter);
    249246    else
    250       fADC2PhOuter = fADC2PhInner;
     247      fADC2PhElOuter = fADC2PhElInner;
    251248
    252249
     
    272269        // and outer pixels).
    273270        //
    274         Float_t adc2phot = (fGeom->GetPixRatio(i) < fGeom->GetPixRatio(0))?
    275           fADC2PhOuter : fADC2PhInner;
    276 
    277         //
    278         // FIXME: This has now to be split into a adc2phe part and a phe2phot (==QE) part
    279         //
    280         const Float_t qe = MCalibrationQEPix::gkDefaultAverageQE;
    281         calpix.SetMeanConvFADC2Phe(adc2phot*qe); // here, the FADC to phe part should go.
     271        Float_t adc2photel = (fGeom->GetPixRatio(i) < fGeom->GetPixRatio(0))?
     272          fADC2PhElOuter : fADC2PhElInner;
     273
     274        calpix.SetMeanConvFADC2Phe(adc2photel);
    282275        calpix.SetMeanConvFADC2PheVar(0.);
    283276        calpix.SetMeanFFactorFADC2Phot(0.);
     
    334327
    335328        MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i];
    336         //        MCalibrationQEPix     &qepix  = (MCalibrationQEPix&)    (*fQECam) [i];
    337 
    338         Float_t qe       = MCalibrationQEPix::gkDefaultAverageQE;
     329        MCalibrationQEPix &qepix = (MCalibrationQEPix&)(*fQECam)[i];
     330
     331        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.
     334
     335        Float_t qe       = qepix.GetAverageQE();
    339336        Float_t adc2phot = calpix.GetMeanConvFADC2Phe() / qe;
    340337        Float_t hi2lo    = calpix.GetConversionHiLo();
  • trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h

    r3689 r3768  
    2828    MExtractedSignalCam   *fSignalCam;
    2929
    30     Float_t fADC2PhInner; // Conversion factor from ADC counts to photo-electrons
    31     Float_t fADC2PhOuter; // for inner and outer pixels.
     30    Float_t fADC2PhElInner; // Conversion factor from ADC counts to photo-electrons
     31    Float_t fADC2PhElOuter; // for inner and outer pixels.
    3232
    3333    Bool_t  fFillCalibrationCam;
    34     Bool_t  fFillQECam;   
    3534    Bool_t  fOuterPixelsGainScaling;
    3635
  • trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.cc

    r3759 r3768  
    177177       fQEFFactorVar    ( MCalibrationCam::gkNumPulserColors ), 
    178178       fQEPINDiode      ( MCalibrationCam::gkNumPulserColors ),   
    179        fQEPINDiodeVar   ( MCalibrationCam::gkNumPulserColors ),
     179       fQEPINDiodeVar   ( MCalibrationCam::gkNumPulserColors ),
     180       fAverageQE       ( gkDefaultAverageQE ),
    180181       fValidFlags      ( MCalibrationCam::gkNumPulserColors )
    181182{
     
    368369const Float_t MCalibrationQEPix::GetAverageQE( const Float_t zenith ) const
    369370{
    370   return gkDefaultAverageQE ;
     371  //  return gkDefaultAverageQE ;
     372  return fAverageQE;
    371373}
    372374
  • trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.h

    r3755 r3768  
    4848  Float_t fAvNormPINDiode;                   // Normalization w.r.t. default QE (PIN Diode Method)
    4949  Float_t fAvNormPINDiodeVar;                // Variance norm. w.r.t. def. QE (PIN Diode Method)
    50                                              
     50  Float_t fAverageQE;                        // Average QE for Cascade spectrum (default 0.18)
     51
    5152  TArrayC fValidFlags;                       // Bit-field for valid flags, one array entry for each color
    5253  Byte_t  fAvailableFlags;                   // Bit-field for available flags
     
    6263  void  AddAveragePINDiodeQEs  ( const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw );
    6364
    64   const Float_t GetAverageQE     ( const Float_t zenith=0. ) const; 
    65   const Float_t GetAverageQERelVar( const Float_t zenith=0. ) const;
    66  
    6765  const Float_t GetAvNormBlindPixelRelVar()  const;
    6866  const Float_t GetAvNormCombinedRelVar()  const;
     
    8179 
    8280  // Getters
     81
     82  const Float_t GetAverageQE     ( const Float_t zenith=0. ) const; 
     83  const Float_t GetAverageQERelVar( const Float_t zenith=0. ) const;
     84 
    8385  Float_t GetDefaultQE                   ( const MCalibrationCam::PulserColor_t col ) const;
    8486  Float_t GetDefaultQERelVar             ( const MCalibrationCam::PulserColor_t col ) const; 
     
    122124
    123125  // Setters
     126  void SetAverageQE            ( const Float_t f )  { fAverageQE            = f; }
    124127  void SetAvNormBlindPixel     ( const Float_t f )  { fAvNormBlindPixel     = f; }     
    125128  void SetAvNormBlindPixelVar  ( const Float_t f )  { fAvNormBlindPixelVar  = f; }   
  • 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    }
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h

    r3687 r3768  
    2727    MMcFadcHeader             *fHeaderFadc;
    2828
    29     Float_t fADC2Phot;
     29    Float_t fADC2PhotEl;   // Conversion factor (photel / ADC count)
     30    Float_t fPhot2PhotEl;  // Conversion factor (photons / photoelectron) = average QE
    3031    Long_t  fEvents;
    3132
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r3753 r3768  
    265265
    266266        MExtractSignal* extra = new MExtractSignal();
    267         extra->SetRange(5, 9, 5, 9);
     267        extra->SetRange(5, 10, 5, 10);
     268        extra->SetSaturationLimit(240);
    268269
    269270        MMcCalibrationUpdate* mcupd = new MMcCalibrationUpdate;
     
    271272
    272273        MCalibrate* mccal = new MCalibrate;
    273         mccal->SetCalibrationMode(MCalibrate::kDummy);
     274        mccal->SetCalibrationMode(MCalibrate::kFfactor);
    274275
    275276        // MC
Note: See TracChangeset for help on using the changeset viewer.