Ignore:
Timestamp:
08/23/04 11:41:30 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mimage
Files:
3 edited

Legend:

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

    r4608 r4702  
    250250#include <fstream>        // ofstream, SavePrimitive
    251251
     252#include <TEnv.h>
     253
    252254#include <TGFrame.h>      // TGFrame
    253255#include <TGLabel.h>      // TGLabel
     
    279281static const TString gsDefName  = "MImgCleanStd";
    280282static const TString gsDefTitle = "Task to perform image cleaning";
     283
     284const TString MImgCleanStd::gsNamePedPhotCam="MPedPhotCam"; // default name of the 'MPedPhotCam' container
    281285
    282286// --------------------------------------------------------------------------
     
    291295                           const char *name, const char *title)
    292296    : fCleaningMethod(kStandard), fCleanLvl1(lvl1),
    293       fCleanLvl2(lvl2), fCleanRings(1), fNamePedPhotContainer("MPedPhotCam")
     297      fCleanLvl2(lvl2), fCleanRings(1), fNamePedPhotCam(gsNamePedPhotCam)
    294298
    295299{
     
    499503    if (!fCam)
    500504    {
    501         *fLog << dbginf << "MGeomCam not found (no geometry information available)... aborting." << endl;
     505        *fLog << err << "MGeomCam not found (no geometry information available)... aborting." << endl;
    502506        return kFALSE;
    503507    }
     
    506510    if (!fEvt)
    507511    {
    508         *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
     512        *fLog << err << "MCerPhotEvt not found... aborting." << endl;
    509513        return kFALSE;
    510514    }
    511515
    512     fPed = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotContainer), "MPedPhotCam");
     516    fPed = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam");
    513517    if (!fPed)
    514518    {
    515         *fLog << dbginf << "MPedPhotCam not found... aborting." << endl;
     519        *fLog << err << "MPedPhotCam not found... aborting." << endl;
    516520        return kFALSE;
    517521    }
     522
     523    fTime = (MArrivalTime*)pList->FindObject(AddSerialNumber("MArrivalTime"));
     524    if (!fTime && fCleaningMethod==kProbability)
     525        *fLog << warn << "MArrivalTime not found... probability cleaning done with signal only!" << endl;
    518526
    519527    fData = (MCameraData*)pList->FindCreateObj(AddSerialNumber("MCameraData"));
     
    541549        fData->CalcCleaningLevelDemocratic(*fEvt, *fPed, *fCam);
    542550        break;
     551        /*
     552    case kProbability:
     553        fData->CalcCleaningProbability(*fEvt, *fPed, *fCam, fTime);
     554        break;*/
     555    default:
     556        break;
    543557    }
    544558
     
    556570    // For speed reasons skip the rest of the cleaning if no
    557571    // action will be taken!
    558     if (fCleanLvl1<=fCleanLvl2)
    559         return kTRUE;
    560 
     572    if (fCleanLvl1>fCleanLvl2)
     573    {
    561574#ifdef DEBUG
    562     *fLog << all << "CleanStep 3" << endl;
     575        *fLog << all << "CleanStep 3" << endl;
    563576#endif
    564     CleanStep3();
     577        CleanStep3();
     578    }
     579
     580#ifdef DEBUG
     581        *fLog << all << "Calc Islands" << endl;
     582#endif
     583    // Takes roughly 10% of the time
     584    fEvt->CalcIslands(*fCam);
     585
    565586#ifdef DEBUG
    566587    *fLog << all << "Done." << endl;
     
    587608    case kScaled:
    588609        *fLog << "scaled";
     610        break;
     611    case kProbability:
     612        *fLog << "probability";
    589613        break;
    590614    }
     
    711735    out << ");" << endl;
    712736
    713     if (fCleaningMethod!=kDemocratic)
    714         return;
    715 
    716     out << "   " << GetUniqueName() << ".SetMethod(MImgCleanStd::kDemocratic);" << endl;
    717 
    718     if (fCleanRings==1)
    719         return;
    720 
    721     out << "   " << GetUniqueName() << ".SetCleanRings(" << fCleanRings << ");" << endl;
    722 }
     737    if (fCleaningMethod!=kStandard)
     738    {
     739        out << "   " << GetUniqueName() << ".SetMethod(MImgCleanStd::k";
     740        switch (fCleaningMethod)
     741        {
     742        case kScaled:      out << "Scaled";      break;
     743        case kDemocratic:  out << "Democratic";  break;
     744        case kProbability: out << "Probability"; break;
     745        default:
     746            break;
     747        }
     748        out << ");" << endl;
     749    }
     750    if (fCleanRings!=1)
     751        out << "   " << GetUniqueName() << ".SetCleanRings(" << fCleanRings << ");" << endl;
     752
     753    if (gsNamePedPhotCam!=fNamePedPhotCam)
     754        out << "   " << GetUniqueName() << ".SetNamePedPhotCam(\"" << fNamePedPhotCam << "\");" << endl;
     755}
     756
     757// --------------------------------------------------------------------------
     758//
     759// Read the setup from a TEnv, eg:
     760//   MImgCleanStd.CleanLevel1: 3.0
     761//   MImgCleanStd.CleanLevel2: 2.5
     762//   MImgCleanStd.CleanMethod: Standard, Scaled, Democratic, Probability
     763//   MImgCleanStd.CleanRings:  1
     764//
     765Int_t MImgCleanStd::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     766{
     767    Bool_t rc = kFALSE;
     768    if (IsEnvDefined(env, prefix, "CleanRings", print))
     769    {
     770        rc = kTRUE;
     771        SetCleanRings(GetEnvValue(env, prefix, "CleanRings", fCleanRings));
     772    }
     773    if (IsEnvDefined(env, prefix, "CleanLevel1", print))
     774    {
     775        rc = kTRUE;
     776        fCleanLvl1 = GetEnvValue(env, prefix, "CleanLevel1", fCleanLvl1);
     777    }
     778    if (IsEnvDefined(env, prefix, "CleanLevel2", print))
     779    {
     780        rc = kTRUE;
     781        fCleanLvl2 = GetEnvValue(env, prefix, "CleanLevel2", fCleanLvl2);
     782    }
     783
     784    if (IsEnvDefined(env, prefix, "CleanMethod", print))
     785    {
     786        rc = kTRUE;
     787        TString s = GetEnvValue(env, prefix, "CleanMethod", "");
     788        s.ToLower();
     789        if (s.BeginsWith("standard"))
     790            SetMethod(kStandard);
     791        if (s.BeginsWith("scaled"))
     792            SetMethod(kScaled);
     793        if (s.BeginsWith("democratic"))
     794            SetMethod(kDemocratic);
     795        if (s.BeginsWith("probability"))
     796            SetMethod(kProbability);
     797    }
     798
     799    return rc;
     800}
  • trunk/MagicSoft/Mars/mimage/MImgCleanStd.h

    r4586 r4702  
    1111class MCerPhotEvt;
    1212class MPedPhotCam;
     13class MArrivalTime;
    1314class MCameraData;
    1415
     
    2122        kStandard,
    2223        kScaled,
    23         kDemocratic
     24        kDemocratic,
     25        kProbability
    2426    } CleaningMethod_t;
    2527
    2628private:
    27     const MGeomCam    *fCam;  //!
    28           MCerPhotEvt *fEvt;  //!
    29           MPedPhotCam *fPed;  //!
    30           MCameraData *fData; //!
     29    static const TString gsNamePedPhotCam; // default name of the 'MPedPhotCam' container
     30
     31    const MGeomCam     *fCam;  //!
     32          MCerPhotEvt  *fEvt;  //!
     33          MPedPhotCam  *fPed;  //!
     34          MArrivalTime *fTime; //!
     35          MCameraData  *fData; //!
    3136
    3237    CleaningMethod_t fCleaningMethod;
    3338
    34     Float_t fCleanLvl1;
    35     Float_t fCleanLvl2;
     39    Float_t  fCleanLvl1;
     40    Float_t  fCleanLvl2;
    3641
    3742    UShort_t fCleanRings;
    3843
    39     Float_t fInnerNoise;      //!
    40     TString fNamePedPhotContainer; // name of the 'MPedPhotCam' container
     44    TString  fNamePedPhotCam; // name of the 'MPedPhotCam' container
    4145
    4246
    43     void CreateGuiElements(MGGroupFrame *f);
    44     void StreamPrimitive(ofstream &out) const;
     47    void  CreateGuiElements(MGGroupFrame *f);
     48    void  StreamPrimitive(ofstream &out) const;
     49    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    4550
    46     void   CleanStep3b(MCerPhotPix &pix);
    47     void   CleanStep4(UShort_t r, MCerPhotPix &pix);
     51    void  CleanStep3b(MCerPhotPix &pix);
     52    void  CleanStep4(UShort_t r, MCerPhotPix &pix);
    4853
    4954    void  CleanStep1();
     
    5661public:
    5762    MImgCleanStd(const Float_t lvl1=3.0, const Float_t lvl2=2.5,
    58               const char *name=NULL, const char *title=NULL);
     63                 const char *name=NULL, const char *title=NULL);
    5964    void Print(Option_t *o="") const;
    6065
     
    6772
    6873    Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
    69     void SetNamePedPhotContainer(const char *name)    { fNamePedPhotContainer = name; }
     74    void SetNamePedPhotCam(const char *name)  { fNamePedPhotCam = name; }
    7075
    7176    ClassDef(MImgCleanStd, 2)    // task doing the image cleaning
  • trunk/MagicSoft/Mars/mimage/Makefile

    r3927 r4702  
    2020#
    2121INCLUDES = -I. -I../mbase -I../mhbase -I../mgeom -I../manalysis \
    22            -I../mgui -I../mmc -I../mpointing -I../mpedestal
     22           -I../mgui -I../mmc -I../mpointing -I../mpedestal \
     23           -I../mhist
     24
     25# mhist: MHHillas (MHCamera)
     26
    2327
    2428SRCFILES = MImgCleanStd.cc \
Note: See TracChangeset for help on using the changeset viewer.