Ignore:
Timestamp:
05/11/07 11:25:46 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc

    r8361 r8490  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.37 2007-03-04 12:00:30 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.38 2007-05-11 10:25:45 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    2626!   Author(s): Nepomuk Otte 10/2004 <mailto:otte@mppmu.mpg.de>
    2727!
    28 !   Copyright: MAGIC Software Development, 2000-2006
     28!   Copyright: MAGIC Software Development, 2000-2007
    2929!
    3030!
     
    145145#include "MRawEvtPixelIter.h"
    146146
    147 #include "MPedestalPix.h"
    148147#include "MPedestalCam.h"
    149 
    150 #include "MGeomPix.h"
    151 #include "MGeomCam.h"
    152 
    153 #include "MExtractPedestal.h"
    154 #include "MPedestalSubtractedEvt.h"
    155148
    156149ClassImp(MPedCalcFromLoGain);
     
    177170    SetPedestalUpdate(kTRUE);
    178171    SetNumDump();
    179 }
    180 
    181 // --------------------------------------------------------------------------
    182 //
    183 // Call MExtractPedestl::ResetArrays aand reset fNumAventsUsed and
    184 // fTotalCounter
    185 //
    186 void MPedCalcFromLoGain::ResetArrays()
    187 {
    188     MExtractPedestal::ResetArrays();
    189 
    190     fNumEventsUsed.Reset();
    191     fTotalCounter.Reset();
    192172}
    193173
     
    203183Bool_t MPedCalcFromLoGain::ReInit(MParList *pList)
    204184{
    205     // If the size is not yet set, set the size
    206     if (fSumx.GetSize()==0)
    207     {
    208         const Int_t npixels = fPedestalsOut->GetSize();
    209         fNumEventsUsed.Set(npixels);
    210         fTotalCounter.Set(npixels);
    211     }
    212 
    213185    if (!MExtractPedestal::ReInit(pList))
    214186        return kFALSE;
     
    232204    const Int_t nlo = fRunHeader->GetNumSamplesLoGain();
    233205
     206    const Int_t offset = nlo>0?nhi:0;
     207
    234208    // Real Process
    235209    MRawEvtPixelIter pixel(fRawEvt);
    236210    while (pixel.Next())
    237211    {
     212        if (!CalcPixel(pixel, offset))
     213            continue;
     214
    238215        const UInt_t idx = pixel.GetPixelId();
    239 
    240         if (!CheckVariation(idx))
    241             continue;
    242 
    243         //extract pedestal
    244         UInt_t ab[2];
    245         const Float_t sum = fExtractor ?
    246             CalcExtractor(pixel, nlo>0?nhi:0) :
    247             CalcSums(pixel, nlo>0?nhi:0, ab[0], ab[1]);
    248 
    249         const UInt_t aidx   = (*fGeom)[idx].GetAidx();
    250         const UInt_t sector = (*fGeom)[idx].GetSector();
    251 
    252         const Float_t sqrsum = sum*sum;
    253 
    254         fSumx[idx]           += sum;
    255         fSumx2[idx]          += sqrsum;
    256         fAreaSumx[aidx]      += sum;
    257         fAreaSumx2[aidx]     += sqrsum;
    258         fSectorSumx[sector]  += sum;
    259         fSectorSumx2[sector] += sqrsum;
    260 
    261         if (fIntermediateStorage)
    262             (*fPedestalsInter)[idx].Set(sum, 0, 0, fNumEventsUsed[idx]);
    263 
    264         fNumEventsUsed[idx]   ++;
    265         fAreaFilled   [aidx]  ++;
    266         fSectorFilled [sector]++;
    267 
    268         if (!fExtractor && pixel.IsABFlagValid())
    269         {
    270             fSumAB0[idx]        += ab[0];
    271             fSumAB1[idx]        += ab[1];
    272             fAreaSumAB0[aidx]   += ab[0];
    273             fAreaSumAB1[aidx]   += ab[1];
    274             fSectorSumAB0[aidx] += ab[0];
    275             fSectorSumAB1[aidx] += ab[1];
    276         }
    277 
    278216        if (!fPedestalUpdate || (UInt_t)fNumEventsUsed[idx]<fNumEventsDump)
    279217            continue;
    280218
    281         CalcPixResults(fNumEventsDump, idx);
    282         fTotalCounter[idx]++;
     219        CalcPixResults(idx);
    283220
    284221        fNumEventsUsed[idx]=0;
     
    289226    }
    290227
    291     if (!(GetNumExecutions() % fNumAreasDump))
     228    if (fNumAreasDump>0 && !(GetNumExecutions() % fNumAreasDump))
     229    {
    292230        CalcAreaResult();
    293 
    294     if (!(GetNumExecutions() % fNumSectorsDump))
     231        fAreaFilled.Reset();
     232    }
     233
     234    if (fNumSectorsDump>0 && !(GetNumExecutions() % fNumSectorsDump))
     235    {
    295236        CalcSectorResult();
     237        fSectorFilled.Reset();
     238    }
    296239
    297240    if (fPedestalUpdate)
     
    299242
    300243  return kTRUE;
    301 }
    302 
    303 // --------------------------------------------------------------------------
    304 //
    305 // Loop over the sector indices to get the averaged pedestal per sector
    306 //
    307 void MPedCalcFromLoGain::CalcSectorResult()
    308 {
    309     for (UInt_t sector=0; sector<fSectorFilled.GetSize(); sector++)
    310         if (fSectorValid[sector]>0)
    311             CalcSectorResults(fSectorFilled[sector], fSectorValid[sector], sector);
    312 }
    313 
    314 // --------------------------------------------------------------------------
    315 //
    316 // Loop over the (two) area indices to get the averaged pedestal per aidx
    317 //
    318 void MPedCalcFromLoGain::CalcAreaResult()
    319 {
    320     for (UInt_t aidx=0; aidx<fAreaFilled.GetSize(); aidx++)
    321         if (fAreaValid[aidx]>0)
    322             CalcAreaResults(fAreaFilled[aidx], fAreaValid[aidx], aidx);
    323 
    324244}
    325245
     
    336256    *fLog << flush << inf << "Calculating Pedestals..." << flush;
    337257
    338     const Int_t npix = fGeom->GetNumPixels();
    339     for (Int_t idx=0; idx<npix; idx++)
    340     {
    341         const ULong_t n = fNumEventsUsed[idx];
    342         if (n>1)
    343         {
    344             CalcPixResults(n, idx);
    345             fTotalCounter[idx]++;
    346         }
    347     }
    348 
     258    CalcPixResult();
    349259    CalcAreaResult();
    350260    CalcSectorResult();
Note: See TracChangeset for help on using the changeset viewer.