Ignore:
Timestamp:
08/04/04 11:19:34 (20 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

    r3415 r4452  
    128128// the terms commonly used in the class.
    129129//
     130//
    130131// STANDARD CLEANING:
    131132// =================
     
    165166// // add the image cleaning to the main task list
    166167//
     168//
    167169// DEMOCRATIC CLEANING:
    168170// ===================
    169171// You use this cleaning method when you want to compare the number of
    170 // photo-electons of each pixel with the average pedestal RMS
    171 // (fInnerNoise = fSgb->GetSigmabarInner()) of the inner pixels (for the
    172 // MAGIC camera they are the smaller ones):
     172// photo-electons of each pixel with the average pedestal RMS of the
     173// inner pixels (for the MAGIC camera they are the smaller ones):
    173174//Begin_Html
    174175//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/MImgCleanStd-f2.png">
     
    178179// have a different area) are compared to the same pedestal RMS, coming
    179180// from the inner pixels.
    180 // To calculate the average pedestal RMS of the inner pixels, you have to
    181 // add to the main task list an object of type MSigmabarCalc before the
    182 // MImgCleanStd object. To know how the calculation of fInnerNoise is done
    183 // look at the MSigmabarCalc Class.
    184 //
    185 // Example:
    186 //
    187 // MSigmabarCalc   sbcalc;
    188 // //creates an object that calcutates the average pedestal RMS
    189 // MImgCleanStd clean;
    190 // ...
    191 // tlist.AddToList(&sbcalc);
    192 // tlist.AddToList(&clean);
     181//
     182// Make sure that you used a class calculating the MPedPhotCam which also
     183// updated the contents of the mean values (Recalc) correctly.
     184//
    193185//
    194186// Member Function:  SetMethod()
     
    206198// clean.SetMethod(MImgCleanStd::kDemocratic);
    207199// //now the method of cleaning is changed to Democratic
     200//
    208201//
    209202// FIRST AND SECOND CLEANING LEVEL
     
    245238//  Input Containers:
    246239//   MGeomCam
     240//   MPedPhotCam
    247241//   MCerPhotEvt
    248 //   [MSigmabar]
    249242//
    250243//  Output Containers:
     
    265258
    266259#include "MParList.h"
    267 #include "MSigmabar.h"
    268260#include "MCameraData.h"
    269261
     
    298290MImgCleanStd::MImgCleanStd(const Float_t lvl1, const Float_t lvl2,
    299291                           const char *name, const char *title)
    300     : fSgb(NULL), fCleaningMethod(kStandard), fCleanLvl1(lvl1),
     292    : fCleaningMethod(kStandard), fCleanLvl1(lvl1),
    301293    fCleanLvl2(lvl2), fCleanRings(1)
    302294
     
    358350
    359351    while ((pix=static_cast<MCerPhotPix*>(Next())))
    360           {
     352    {
    361353        // get pixel id of this entry
    362354        const Int_t idx = pix->GetPixId();
     
    391383    Next.Reset();
    392384    while ((pix=static_cast<MCerPhotPix*>(Next())))
    393       {
    394         if ( pix->IsPixelUsed())
    395         pix->SetPixelCore();}
     385    {
     386        if (pix->IsPixelUsed())
     387            pix->SetPixelCore();
     388    }
    396389}
    397390
     
    434427    //
    435428    if (pix.GetRing() != 0)
    436       { 
    437         return;
    438       }
     429        return;
    439430
    440431    //
     
    480471        MCerPhotEvtIter NextAll(fEvt, kFALSE);
    481472        while ((pix=static_cast<MCerPhotPix*>(NextAll())))
    482           {
     473        {
    483474            //
    484475            // if pixel is a core pixel or unmapped, go to the next pixel
    485476            //
    486           if (pix->IsPixelCore())
    487             {
    488             continue;}
    489           if (pix->IsPixelUnmapped())
    490             {
    491             continue;}
    492          
    493           if (data[pix->GetPixId()] <= fCleanLvl2)
    494             {
    495               continue;}
    496 
    497           if (r==1)
    498             {
    499             CleanStep3b(*pix);}
    500           else
    501             {
    502             CleanStep4(r, *pix);}
    503          
     477            if (pix->IsPixelCore() || pix->IsPixelUnmapped())
     478                continue;
     479
     480            if (data[pix->GetPixId()] <= fCleanLvl2)
     481                continue;
     482
     483            if (r==1)
     484                CleanStep3b(*pix);
     485            else
     486                CleanStep4(r, *pix);
    504487        }
    505488    }
     
    527510    }
    528511
    529     if (fCleaningMethod == kDemocratic)
    530     {
    531         fSgb = (MSigmabar*)pList->FindObject(AddSerialNumber("MSigmabar"));
    532         if (!fSgb)
    533         {
    534             *fLog << dbginf << "MSigmabar not found... aborting." << endl;
    535             return kFALSE;
    536         }
    537     }
    538     else
    539     {
    540         fPed = (MPedPhotCam*)pList->FindObject(AddSerialNumber("MPedPhotCam"));
    541         if (!fPed)
    542         {
    543             *fLog << dbginf << "MPedPhotCam not found... aborting." << endl;
    544             return kFALSE;
    545         }
     512    fPed = (MPedPhotCam*)pList->FindObject(AddSerialNumber("MPedPhotCam"));
     513    if (!fPed)
     514    {
     515        *fLog << dbginf << "MPedPhotCam not found... aborting." << endl;
     516        return kFALSE;
    546517    }
    547518
     
    559530Int_t MImgCleanStd::Process()
    560531{
    561     if (fSgb)
    562         fData->CalcCleaningLevel(*fEvt, *fSgb, *fCam);
    563     else
     532    switch (fCleaningMethod)
     533    {
     534    case kStandard:
    564535        fData->CalcCleaningLevel(*fEvt, *fPed, *fCam);
     536        break;
     537    case kScaled:
     538        fData->CalcCleaningLevel2(*fEvt, *fPed, *fCam);
     539        break;
     540    case kDemocratic:
     541        fData->CalcCleaningLevelDemocratic(*fEvt, *fPed, *fCam);
     542        break;
     543    }
    565544
    566545#ifdef DEBUG
     
    568547#endif
    569548    CleanStep1();
     549
     550    // For speed reasons skip the rest of the cleaning if no
     551    // action will be taken!
     552    if (fCleanLvl1>=fCleanLvl2)
     553        return kTRUE;
    570554
    571555#ifdef DEBUG
     
    599583        *fLog << "standard";
    600584        break;
     585    case kScaled:
     586        *fLog << "scaled";
     587        break;
    601588    }
    602589    *fLog << " cleaning initialized with noise level " << fCleanLvl1 << " and " << fCleanLvl2;
     
    611598void MImgCleanStd::CreateGuiElements(MGGroupFrame *f)
    612599{
    613   //
    614   // Create a frame for line 3 and 4 to be able
    615   // to align entry field and label in one line
    616   //
    617   TGHorizontalFrame *f1 = new TGHorizontalFrame(f, 0, 0);
    618   TGHorizontalFrame *f2 = new TGHorizontalFrame(f, 0, 0);
     600    //
     601    // Create a frame for line 3 and 4 to be able
     602    // to align entry field and label in one line
     603    //
     604    TGHorizontalFrame *f1 = new TGHorizontalFrame(f, 0, 0);
     605    TGHorizontalFrame *f2 = new TGHorizontalFrame(f, 0, 0);
     606   
     607    /*
     608     * --> use with root >=3.02 <--
     609     *
     610     
     611     TGNumberEntry *fNumEntry1 = new TGNumberEntry(frame, 3.0, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
     612     TGNumberEntry *fNumEntry2 = new TGNumberEntry(frame, 2.5, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
    619613 
    620   /*
    621    * --> use with root >=3.02 <--
    622    *
    623    
    624    TGNumberEntry *fNumEntry1 = new TGNumberEntry(frame, 3.0, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
    625    TGNumberEntry *fNumEntry2 = new TGNumberEntry(frame, 2.5, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
    626 
    627   */
    628   TGTextEntry *entry1 = new TGTextEntry(f1, "****", kImgCleanLvl1);
    629   TGTextEntry *entry2 = new TGTextEntry(f2, "****", kImgCleanLvl2);
    630  
    631   // --- doesn't work like expected (until root 3.02?) --- fNumEntry1->SetAlignment(kTextRight);
    632   // --- doesn't work like expected (until root 3.02?) --- fNumEntry2->SetAlignment(kTextRight);
    633  
    634   entry1->SetText("3.0");
    635   entry2->SetText("2.5");
    636  
    637   entry1->Associate(f);
    638   entry2->Associate(f);
    639  
    640   TGLabel *l1 = new TGLabel(f1, "Cleaning Level 1");
    641   TGLabel *l2 = new TGLabel(f2, "Cleaning Level 2");
    642  
    643   l1->SetTextJustify(kTextLeft);
    644   l2->SetTextJustify(kTextLeft);
    645  
    646   //
    647   // Align the text of the label centered, left in the row
    648   // with a left padding of 10
    649   //
    650   TGLayoutHints *laylabel = new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 10);
    651   TGLayoutHints *layframe = new TGLayoutHints(kLHintsCenterY|kLHintsLeft,  5, 0, 10);
    652  
    653   //
    654   // Add one entry field and the corresponding label to each line
    655   //
    656   f1->AddFrame(entry1);
    657   f2->AddFrame(entry2);
    658  
    659   f1->AddFrame(l1, laylabel);
    660   f2->AddFrame(l2, laylabel);
    661  
    662   f->AddFrame(f1, layframe);
    663   f->AddFrame(f2, layframe);
    664  
    665   f->AddToList(entry1);
    666   f->AddToList(entry2);
    667   f->AddToList(l1);
    668   f->AddToList(l2);
    669   f->AddToList(laylabel);
    670   f->AddToList(layframe);
     614    */
     615    TGTextEntry *entry1 = new TGTextEntry(f1, "****", kImgCleanLvl1);
     616    TGTextEntry *entry2 = new TGTextEntry(f2, "****", kImgCleanLvl2);
     617   
     618    // --- doesn't work like expected (until root 3.02?) --- fNumEntry1->SetAlignment(kTextRight);
     619    // --- doesn't work like expected (until root 3.02?) --- fNumEntry2->SetAlignment(kTextRight);
     620   
     621    entry1->SetText("3.0");
     622    entry2->SetText("2.5");
     623   
     624    entry1->Associate(f);
     625    entry2->Associate(f);
     626   
     627    TGLabel *l1 = new TGLabel(f1, "Cleaning Level 1");
     628    TGLabel *l2 = new TGLabel(f2, "Cleaning Level 2");
     629   
     630    l1->SetTextJustify(kTextLeft);
     631    l2->SetTextJustify(kTextLeft);
     632   
     633    //
     634    // Align the text of the label centered, left in the row
     635    // with a left padding of 10
     636    //
     637    TGLayoutHints *laylabel = new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 10);
     638    TGLayoutHints *layframe = new TGLayoutHints(kLHintsCenterY|kLHintsLeft,  5, 0, 10);
     639   
     640    //
     641    // Add one entry field and the corresponding label to each line
     642    //
     643    f1->AddFrame(entry1);
     644    f2->AddFrame(entry2);
     645   
     646    f1->AddFrame(l1, laylabel);
     647    f2->AddFrame(l2, laylabel);
     648   
     649    f->AddFrame(f1, layframe);
     650    f->AddFrame(f2, layframe);
     651   
     652    f->AddToList(entry1);
     653    f->AddToList(entry2);
     654    f->AddToList(l1);
     655    f->AddToList(l2);
     656    f->AddToList(laylabel);
     657    f->AddToList(layframe);
    671658}
    672659
  • trunk/MagicSoft/Mars/mimage/MImgCleanStd.h

    r2781 r4452  
    2020    typedef enum {
    2121        kStandard,
     22        kScaled,
    2223        kDemocratic
    2324    } CleaningMethod_t;
     
    2627    const MGeomCam    *fCam;  //!
    2728          MCerPhotEvt *fEvt;  //!
    28           MSigmabar   *fSgb;  //!
    2929          MPedPhotCam *fPed;  //!
    3030          MCameraData *fData; //!
Note: See TracChangeset for help on using the changeset viewer.