Ignore:
Timestamp:
11/07/03 19:03:41 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mimage
Files:
2 edited

Legend:

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

    r2470 r2488  
    266266#include "MParList.h"
    267267#include "MSigmabar.h"
     268#include "MCameraData.h"
    268269
    269270#include "MGeomPix.h"
     
    312313// --------------------------------------------------------------------------
    313314//
    314 //  NT 28/04/2003: now the option to use the standard method or the
     315// The first step of cleaning defines the CORE pixels. All the other pixels
     316// are set as UNUSED and belong to RING 0.
     317// After this point, only the CORE pixels are set as USED, with RING
     318// number 1.
     319//
     320//  NT 28/04/2003: now the option to use the standard method or the
    315321//  democratic method is implemented:
    316322//
    317 //  KStandard: This method looks for all pixels with an entry (photons)
    318 //             that is three times bigger than the noise of the pixel
    319 //             (default: 3 sigma, clean level 1)
    320 //
    321 // --------------------------------------------------------------------------
    322 //
    323 //  Returns the maximum Pixel Id (used for ispixused in CleanStep2)
    324 //
    325 void MImgCleanStd::CleanStep1Std()
     323//  kStandard:   This method looks for all pixels with an entry (photons)
     324//               that is three times bigger than the noise of the pixel
     325//               (default: 3 sigma, clean level 1)
     326//
     327//  kDemocratic: this method looks for all pixels with an entry (photons)
     328//               that is n times bigger than the noise of the mean of the
     329//               inner pixels (default: 3 sigmabar, clean level 1)
     330//
     331//
     332void MImgCleanStd::CleanStep1()
    326333{
    327334    const Int_t entries = fEvt->GetNumPixels();
    328 
    329     //
    330     // check the number of all pixels against the noise level and
    331     // set them to 'unused' state if necessary
    332     //
    333 
    334     for (Int_t i=0; i<entries; i++ )
    335     {
    336         MCerPhotPix &pix = (*fEvt)[i];
    337 
    338         const Int_t idx = pix.GetPixId();
    339 
    340         const Float_t entry = pix.GetNumPhotons();
    341         const Float_t noise = (*fPed)[idx].GetPedestalRms();
    342 
    343         //
    344         // We calculate a correction factor which accounts for the
    345         // fact that pixels have different size (see TDAS 02-14).
    346         //
    347         const Double_t factor = fCam->GetPixRatioSqrt(idx);
    348 
    349         // COBB: '<=' to skip entry=noise=0
    350         if (entry * factor <= fCleanLvl1 * noise)
    351             pix.SetPixelUnused();
    352     }
    353 }
    354 
    355 // --------------------------------------------------------------------------
    356 //
    357 //  NT 28/04/2003: now the option to use the standard method or the
    358 //  democratic method is implemented:
    359 //
    360 //  "KDemocratic": this method looks for all pixels with an entry (photons)
    361 //                 that is n times bigger than the noise of the mean of the
    362 //                 inner pixels (default: 3 sigmabar, clean level 1)
    363 //
    364 //  Returns the maximum Pixel Id (used for ispixused in CleanStep2)
    365 //
    366 void MImgCleanStd::CleanStep1Dem()
    367 {
    368     const Int_t entries = fEvt->GetNumPixels();
     335    const TArrayD &data = fData->GetData();
    369336
    370337    //
     
    376343        MCerPhotPix &pix = (*fEvt)[i];
    377344
    378         const Int_t idx = pix.GetPixId();
    379 
    380         const Float_t  entry = pix.GetNumPhotons();
    381         const Double_t ratio = fCam->GetPixRatio(idx);
    382 
    383         // COBB: '<=' to skip entry=noise=0
    384         if (entry * ratio <= fCleanLvl1 * fInnerNoise)
     345        if (data[pix.GetPixId()] <= fCleanLvl1)
    385346            pix.SetPixelUnused();
    386     }
    387 }
    388 
    389 // --------------------------------------------------------------------------
    390 // The first step of cleaning defines the CORE pixels. All the other pixels
    391 // are set as UNUSED and belong to RING 0.               
    392 // After this point, only the CORE pixels are set as USED, with RING     
    393 // number 1.                                                             
    394 // Returns the maximum Pixel Id (used for ispixused in CleanStep2)
    395 //
    396 void MImgCleanStd::CleanStep1()
    397 {
    398    switch (fCleaningMethod)
    399     {
    400     case kStandard:
    401         CleanStep1Std();
    402         return;
    403     case kDemocratic:
    404         CleanStep1Dem();
    405         return;
    406347    }
    407348}
     
    487428}
    488429
    489 
    490 // --------------------------------------------------------------------------
    491 //
    492 //   Look for the boundary pixels around the core pixels
    493 //   if a pixel has more than 2.5 (clean level 2.5) sigma, and
    494 //   a core neigbor it is declared as used.
    495 //
    496 Bool_t MImgCleanStd::CleanStep3Std(const MCerPhotPix &pix)
    497 {
    498     //
    499     // get pixel id of this entry
    500     //
    501     const Int_t idx = pix.GetPixId();
    502 
    503     //
    504     // check the num of photons against the noise level
    505     //
    506     const Float_t entry = pix.GetNumPhotons();
    507     const Float_t noise = (*fPed)[idx].GetPedestalRms();
    508 
    509     //
    510     // We calculate a correction factor which accounts for the
    511     // fact that pixels have different size (see TDAS 02-14).
    512     //
    513     const Double_t factor = fCam->GetPixRatioSqrt(idx);
    514 
    515     return (entry * factor <= fCleanLvl2 * noise);
    516 }
    517 
    518 // --------------------------------------------------------------------------
    519 //
    520 //   Look for the boundary pixels around the core pixels
    521 //   if a pixel has more than 2.5 (clean level 2.5) sigmabar and
    522 //   a core neighbor, it is declared as used.
    523 //
    524 Bool_t MImgCleanStd::CleanStep3Dem(const MCerPhotPix &pix)
    525 {
    526     //
    527     // get pixel id of this entry
    528     //
    529     const Int_t idx = pix.GetPixId();
    530 
    531     //
    532     // check the num of photons against the noise level
    533     //
    534     const Float_t  entry = pix.GetNumPhotons();
    535     const Double_t ratio = fCam->GetPixRatio(idx);
    536 
    537     return (entry * ratio <= fCleanLvl2 * fInnerNoise);
    538 }
    539 
    540430void MImgCleanStd::CleanStep3b(MCerPhotPix &pix)
    541431{
     
    598488// --------------------------------------------------------------------------
    599489//
    600 //   Look for the boundary pixels around the core pixels
    601 //   if a pixel has more than 2.5 (clean level 2.5) sigma, and
    602 //   a core neigbor, it is declared as used.
     490//  Look for the boundary pixels around the core pixels
     491//  if a pixel has more than 2.5 (clean level 2.5) sigma, and
     492//  a core neigbor, it is declared as used.
    603493//
    604494void MImgCleanStd::CleanStep3()
    605495{
    606496    const Int_t entries = fEvt->GetNumPixels();
     497    const TArrayD &data = fData->GetData();
    607498
    608499    for (UShort_t r=1; r<fCleanRings+1; r++)
     
    621512                continue;
    622513
    623             switch (fCleaningMethod)
    624             {
    625             case kStandard:
    626                 if (CleanStep3Std(pix))
    627                     continue;
    628                 break;
    629             case kDemocratic:
    630                 if (CleanStep3Dem(pix))
    631                     continue;
    632                 break;
    633             }
     514            if (data[pix.GetPixId()] <= fCleanLvl2)
     515                continue;
    634516
    635517            if (r==1)
     
    681563    }
    682564
     565    fData = (MCameraData*)pList->FindCreateObj(AddSerialNumber("MCameraData"));
     566    if (!fData)
     567        return kFALSE;
     568
    683569    return kTRUE;
    684570}
     
    691577{
    692578    if (fSgb)
    693         fInnerNoise = fSgb->GetSigmabarInner();
     579        fData->Calc(*fEvt, *fSgb, *fCam);
     580    else
     581        fData->Calc(*fEvt, *fPed, *fCam);
     582
    694583#ifdef DEBUG
    695584    *fLog << all << "CleanStep 1" << endl;
  • trunk/MagicSoft/Mars/mimage/MImgCleanStd.h

    r2237 r2488  
    1111class MCerPhotEvt;
    1212class MPedestalCam;
     13class MCameraData;
    1314
    1415class MGGroupFrame;
     
    2728          MSigmabar    *fSgb;  //!
    2829          MPedestalCam *fPed;  //!
     30          MCameraData  *fData; //!
    2931
    3032    CleaningMethod_t fCleaningMethod;
     
    4042    void StreamPrimitive(ofstream &out) const;
    4143
    42     void   CleanStep1Dem();
    43     void   CleanStep1Std();
    44     Bool_t CleanStep3Dem(const MCerPhotPix &pix);
    45     Bool_t CleanStep3Std(const MCerPhotPix &pix);
    4644    void   CleanStep3b(MCerPhotPix &pix);
    4745    void   CleanStep4(UShort_t r, MCerPhotPix &pix);
Note: See TracChangeset for help on using the changeset viewer.