Changeset 2347


Ignore:
Timestamp:
09/16/03 14:17:22 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2333 r2347  
    11                                                 -*-*- END OF LINE -*-*-
     2
     3 2003/09/16: Abelardo Moralejo
     4
     5   * manalysis MCerPhotCalc.[h,cc]:
     6     - added the low gain treatment. It has first been implemented by
     7       TB, and the version I submit is a slightly modified one. If any
     8       high gain FADC slice is saturated, we switch to low gain. If low
     9       gain is also saturated, the signal is nevertheless calculated
     10       ("truncated" of course), and a warning is displayed reporting
     11       the number of saturated pixels in the current event.
     12       Fixed also the calculation of the mean pixel pedestal (added
     13       variable fSumWeights), which previously would not work correctly
     14       in the case that one sets weights different from 0 or 1 in the
     15       array fWeight (which was anyway not done up to now, as far as I
     16       know). It would be necessary to add to the parameters of the
     17       analyzed events the number of saturated pixels in some way.
     18       In the MC files produced with camera versions 0.6 or earlier, no
     19       low gain is simulated, and saturation of high gain is not
     20       correctly implemented, so this should not introduce any change
     21       in the analysis of present or old MC files.
    222
    323 2003/09/12: Thomas Bretz
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc

    r2325 r2347  
    116116        return kFALSE;
    117117
    118     // Calculate quadratic sum of weights:
     118    // Calculate sum and quadratic sum of weights:
     119    fSumWeights = 0;
    119120    fSumQuadWeights = 0;
    120121    for (Int_t i=0; i<fWeight.GetSize(); i++)
    121       fSumQuadWeights += fWeight[i]*fWeight[i];
     122      {
     123        fSumWeights += fWeight[i];
     124        fSumQuadWeights += fWeight[i]*fWeight[i];
     125      }
    122126
    123127    fSumQuadWeights = sqrt(fSumQuadWeights);
     
    182186        const Double_t offset = fEnableFix ? ped.GetPedestal()-0.5 : ped.GetPedestal();
    183187
    184         ped.Set(offset*fSumQuadWeights*fSumQuadWeights,
     188        ped.Set(offset*fSumWeights,
    185189                ped.GetPedestalRms()*fSumQuadWeights);
    186190    }
     
    202206
    203207    MRawEvtPixelIter pixel(fRawEvt);
     208
     209    Int_t SaturatedPixels = 0;
    204210
    205211    while (pixel.Next())
     
    222228        Byte_t *ptr = pixel.GetHiGainSamples();
    223229
    224         Float_t nphot = 0;
    225         for(Int_t i=0; i<fWeight.GetSize(); i++)
     230        Int_t i;
     231        Double_t nphot = 0;
     232        for (i=0; i<fWeight.GetSize(); i++)
     233        {
     234            if (ptr[i]==0xff)
     235                break;
    226236            nphot += ptr[i]*fWeight[i];
    227 
    228         nphot -= ped.GetPedestal();
     237        }
     238
     239        Bool_t SaturatedLG = kFALSE;
     240
     241        if (i<fWeight.GetSize())
     242        {
     243            nphot = 0;
     244
     245            ptr = pixel.GetLoGainSamples();
     246            if (ptr==NULL)
     247            {
     248                *fLog << warn << "WARNING - Pixel #" << idx << " saturated but has no lo gains.. skipping!" << endl;
     249                return kCONTINUE;
     250            }
     251
     252            for (i=0; i<fWeight.GetSize(); i++)
     253            {
     254              if (ptr[i]==0xff)
     255                SaturatedLG = kTRUE;
     256
     257              nphot += ptr[i]*fWeight[i];
     258            }
     259
     260            nphot -= ped.GetPedestal();
     261            nphot *= 10;
     262        }
     263        else
     264            nphot -= ped.GetPedestal();
    229265
    230266        fCerPhotEvt->AddPixel(idx, nphot, 0);
    231267
    232         // FIXME! Handling of Lo Gains is missing!
    233     }
     268        if (SaturatedLG)
     269          SaturatedPixels ++;
     270    }
     271
     272    if (SaturatedPixels > 0)
     273      *fLog << warn << "WARNING " << SaturatedPixels << "pixels had saturating low gains..." << endl;
    234274
    235275    fCerPhotEvt->FixSize();
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h

    r2251 r2347  
    3535    TArrayF         fWeight;  // Weights for adding up the ADC slices
    3636    Float_t         fSumQuadWeights;
     37    Float_t         fSumWeights;
    3738
    3839    void SetDefaultWeights();
Note: See TracChangeset for help on using the changeset viewer.