Ignore:
Timestamp:
03/18/05 17:21:58 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc

    r6489 r6855  
    6161//
    6262// When an event is read, before the image cleaning, all the pixels that
    63 // are in MCerPhotEvt are set as USED and NOT CORE. All the pixels belong
     63// are in MSignalCam are set as USED and NOT CORE. All the pixels belong
    6464// to RING number 1 (like USED pixels).
    65 // Look at MCerPhotPix.h to see how these informations of the pixel are
     65// Look at MSignalPix.h to see how these informations of the pixel are
    6666// stored.
    6767// The default  cleaning METHOD is the STANDARD one and the number of the
     
    8484// This avoids problems of deformations of the shower images.
    8585// The signal S_i and the pedestal RMS Prms_i of the pixel are called from
    86 // the object MCerPhotPix.
     86// the object MSignalPix.
    8787// If (default method = kStandard)
    8888//Begin_Html
     
    281281//   MGeomCam
    282282//   MPedPhotCam
    283 //   MCerPhotEvt
     283//   MSignalCam
    284284//
    285285//  Output Containers:
    286 //   MCerPhotEvt
     286//   MSignalCam
    287287//
    288288/////////////////////////////////////////////////////////////////////////////
     
    307307#include "MGeomCam.h"
    308308
    309 #include "MCerPhotPix.h"
    310 #include "MCerPhotEvt.h"
     309#include "MSignalPix.h"
     310#include "MSignalCam.h"
    311311
    312312#include "MGGroupFrame.h" // MGGroupFrame
     
    325325
    326326const TString MImgCleanStd::gsNamePedPhotCam="MPedPhotCam"; // default name of the 'MPedPhotCam' container
    327 const TString MImgCleanStd::gsNameCerPhotEvt="MCerPhotEvt"; // default name of the 'MCerPhotEvt' container
     327const TString MImgCleanStd::gsNameSignalCam ="MSignalCam"; // default name of the 'MSignalCam' container
    328328const TString MImgCleanStd::gsNameGeomCam   ="MGeomCam";    // default name of the 'MGeomCam' container
    329329
     
    341341    fCleanLvl2(lvl2), fCleanRings(1), fKeepSinglePixels(kFALSE),
    342342    fNamePedPhotCam(gsNamePedPhotCam), fNameGeomCam(gsNameGeomCam),
    343     fNameCerPhotEvt(gsNameCerPhotEvt)
     343    fNameSignalCam(gsNameSignalCam)
    344344{
    345345    fName  = name  ? name  : gsDefName.Data();
     
    374374    // set them to 'unused' state if necessary
    375375    //
    376     MCerPhotPix *pix;
    377 
    378     // Loop over all pixels
    379     MCerPhotEvtIter Next(fEvt, kFALSE);
    380     while ((pix=static_cast<MCerPhotPix*>(Next())))
    381         if (!pix->IsPixelUnmapped() && data[pix->GetPixId()] <= fCleanLvl1)
    382             pix->SetPixelUnused();
     376    const UInt_t npixevt = fEvt->GetNumPixels();
     377    for (UInt_t idx=0; idx<npixevt; idx++)
     378    {
     379        if (data[idx]>fCleanLvl1)
     380            continue;
     381
     382        MSignalPix &pix = (*fEvt)[idx];
     383        if (!pix.IsPixelUnmapped())
     384            pix.SetPixelUnused();
     385    }
    383386}
    384387
     
    395398    size = 0;
    396399
    397     MCerPhotPix *pix;
    398 
    399     // Loop over used pixels only
    400     TIter Next(*fEvt);
    401 
    402     while ((pix=static_cast<MCerPhotPix*>(Next())))
    403     {
    404         // get pixel id of this entry
    405         const Int_t idx = pix->GetPixId();
     400    const UInt_t npixevt = fEvt->GetNumPixels();
     401    for (UInt_t idx=0; idx<npixevt; idx++)
     402    {
     403        MSignalPix &pix = (*fEvt)[idx];
     404        if (!pix.IsPixelUsed())
     405            continue;
    406406 
    407407        // check for 'used' neighbors of this pixel
     
    427427        {
    428428            if (!fKeepSinglePixels)
    429                 pix->SetPixelUnused();
    430             size += pix->GetNumPhotons();
     429                pix.SetPixelUnused();
     430            size += pix.GetNumPhotons();
    431431            n++;
    432432        }
    433433    }
    434434
    435     Next.Reset();
    436     while ((pix=static_cast<MCerPhotPix*>(Next())))
    437     {
    438         if (pix->IsPixelUsed())
    439             pix->SetPixelCore();
     435    for (UInt_t idx=0; idx<npixevt; idx++)
     436    {
     437        MSignalPix &pix = (*fEvt)[idx];
     438        if (pix.IsPixelUsed())
     439            pix.SetPixelCore();
    440440    }
    441441
     
    443443}
    444444
    445 void MImgCleanStd::CleanStep3b(MCerPhotPix &pix)
    446 {
    447     const Int_t idx = pix.GetPixId();
     445void MImgCleanStd::CleanStep3b(Int_t idx)
     446{
     447    MSignalPix &pix = (*fEvt)[idx];
    448448
    449449    //
     
    475475//   If a value<2 for fCleanRings is used, no CleanStep4 is done.
    476476//
    477 void MImgCleanStd::CleanStep4(UShort_t r, MCerPhotPix &pix)
    478 {
     477void MImgCleanStd::CleanStep4(UShort_t r, Int_t idx/*MSignalPix &pix*/)
     478{
     479    MSignalPix &pix = (*fEvt)[idx];
     480
    479481    //
    480482    // Skip events that have already a defined status;
     
    488490    // and tell to which ring it belongs to.
    489491    //
    490     const Int_t idx = pix.GetPixId();
    491 
    492492    MGeomPix  &gpix  = (*fCam)[idx];
    493493
     
    498498        const Int_t idx2 = gpix.GetNeighbor(j);
    499499
    500         MCerPhotPix *npix = fEvt->GetPixById(idx2);
     500        MSignalPix *npix = fEvt->GetPixById(idx2);
    501501        if (!npix || !npix->IsPixelUsed() || npix->GetRing()>r-1 )
    502502            continue;
     
    519519    for (UShort_t r=1; r<fCleanRings+1; r++)
    520520    {
    521         MCerPhotPix *pix;
    522 
    523521        // Loop over all pixels
    524 
    525         MCerPhotEvtIter NextAll(fEvt, kFALSE);
    526         while ((pix=static_cast<MCerPhotPix*>(NextAll())))
     522        const UInt_t npixevt = fEvt->GetNumPixels();
     523        for (UInt_t idx=0; idx<npixevt; idx++)
    527524        {
     525            MSignalPix &pix = (*fEvt)[idx];
     526
    528527            //
    529528            // if pixel is a core pixel or unmapped, go to the next pixel
    530529            //
    531             if (pix->IsPixelCore() || pix->IsPixelUnmapped())
     530            if (pix.IsPixelCore() || pix.IsPixelUnmapped())
    532531                continue;
    533532
    534             if (data[pix->GetPixId()] <= fCleanLvl2)
     533            if (data[idx] <= fCleanLvl2)
    535534                continue;
    536535
    537536            if (r==1)
    538                 CleanStep3b(*pix);
     537                CleanStep3b(idx);
    539538            else
    540                 CleanStep4(r, *pix);
     539                CleanStep4(r, idx);
    541540        }
    542541    }
     
    557556    }
    558557
    559     fEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber(fNameCerPhotEvt), "MCerPhotEvt");
     558    fEvt = (MSignalCam*)pList->FindObject(AddSerialNumber(fNameSignalCam), "MSignalCam");
    560559    if (!fEvt)
    561560    {
    562         *fLog << err << fNameCerPhotEvt << " [MCerPhotEvt] not found... aborting." << endl;
     561        *fLog << err << fNameSignalCam << " [MSignalCam] not found... aborting." << endl;
    563562        return kFALSE;
    564563    }
     
    570569        return kFALSE;
    571570    }
    572 
    573     fTime = (MArrivalTime*)pList->FindObject(AddSerialNumber("MArrivalTime"));
    574     if (!fTime && fCleaningMethod==kProbability)
    575         *fLog << warn << "MArrivalTime not found... probability cleaning done with signal only!" << endl;
    576571
    577572    fData = (MCameraData*)pList->FindCreateObj(AddSerialNumber("MCameraData"));
     
    602597        break;
    603598    case kProbability:
    604         fData->CalcCleaningProbability(*fEvt, *fPed, *fCam, fTime);
     599        fData->CalcCleaningProbability(*fEvt, *fPed, *fCam);
    605600        break;
    606601    case kAbsolute:
     
    819814    if (gsNameGeomCam!=fNameGeomCam)
    820815        out << "   " << GetUniqueName() << ".SetNameGeomCam(\"" << fNameGeomCam << "\");" << endl;
    821     if (gsNameCerPhotEvt!=fNameCerPhotEvt)
    822         out << "   " << GetUniqueName() << ".SetNameCerPhotEvt(\"" << fNameCerPhotEvt << "\");" << endl;
     816    if (gsNameSignalCam!=fNameSignalCam)
     817        out << "   " << GetUniqueName() << ".SetNameSignalCam(\"" << fNameSignalCam << "\");" << endl;
    823818    if (fKeepSinglePixels)
    824819        out << "   " << GetUniqueName() << ".SetKeepSinglePixels();" << endl;
Note: See TracChangeset for help on using the changeset viewer.