Changeset 4452 for trunk/MagicSoft


Ignore:
Timestamp:
08/04/04 11:19:34 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4450 r4452  
    4646     - fixed some errors in the documentation
    4747     - changed ClassDef to 1
    48      - changed the new algorithms such that any number of different pixel-
    49        sizes are supported
     48     - changed the new algorithms such that any number of different
     49       pixel-sizes are supported
    5050     - small modifications to the sanity checks
    5151
  • trunk/MagicSoft/Mars/manalysis/MCameraData.h

    r4444 r4452  
    4545                                     const MGeomCam &geom);
    4646
    47 /*
    48     void Calc(const MCerPhotEvt &evt, const MGeomCam &geom)
    49     {
    50         CalcCleaningLevel(evt, 1, geom);
    51     }
    52  */
    5347    const TArrayD &GetData() const { return fData; }
    5448    const TArrayC &GetValidity() const  { return fValidity; }
     
    5953    void DrawPixelContent(Int_t num) const;
    6054
    61     ClassDef(MCameraData, 2)    // class for an event containing cerenkov photons
     55    ClassDef(MCameraData, 1) // Generalized storage class for camera data
    6256};
    6357
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h

    r3892 r4452  
    5656        b ? SETBIT(fFlags, kProcessRMS) : CLRBIT(fFlags, kProcessRMS);
    5757    }
    58     void SetNumMinNeighbors(UShort_t num) { fNumMinNeighbors=num; }
     58    void SetNumMinNeighbors(Byte_t num) { fNumMinNeighbors=num; }
    5959
    6060
  • trunk/MagicSoft/Mars/mbase/MArgs.cc

    r2728 r4452  
    1818!   Author(s): Thomas Bretz, 7/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2003
     20!   Copyright: MAGIC Software Development, 2003-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r4368 r4452  
    952952    }
    953953
     954    fLog->ReadEnv(env, prefix, print);
     955
    954956    return kTRUE;
    955957}
     
    10031005    }
    10041006
     1007    fLog->WriteEnv(env, prefix, print);
     1008
    10051009    return kTRUE;
    10061010}
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r4253 r4452  
    108108
    109109#include "MLogPlugin.h"
     110#include "MParContainer.h"
     111#include "MArgs.h"
    110112
    111113ClassImp(MLog);
     
    509511// --------------------------------------------------------------------------
    510512//
     513// Setup MLog and global debug output from command line arguments.
     514//
     515//    gLog << "     -v#                              Verbosity level # [default=2]" << endl;
     516//    gLog << "     -a, --no-colors                  Do not use Ansii color codes" << endl;
     517//    gLog << "     --debug[=n]                      Enable root debugging (Default: gDebug=1)" << endl;
     518//
     519void MLog::Setup(MArgs &arg)
     520{
     521    if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a"))
     522        SetNoColors();
     523
     524    SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
     525
     526    gDebug = arg.HasOption("--debug=") ? arg.GetIntAndRemove("--debug=") : 0;
     527    if (gDebug==0 && arg.HasOnlyAndRemove("--debug"))
     528        gDebug=1;
     529}
     530
     531// --------------------------------------------------------------------------
     532//
     533// Read the setup from a TEnv:
     534//   MLog.VerbosityLevel: 0, 1, 2, 3, 4
     535//   MLog.DebugLevel: 0, 1, 2, 3, 4
     536//   MLog.NoColors
     537//
     538// Depending on your setup it might be correct to use something like:
     539//   Job1.MLog.VerbosityLevel: 1
     540//   Job1.DebugLevel: 2
     541//   Job1.MLog.NoColors
     542//
     543void MLog::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     544{
     545    if (!prefix.IsNull())
     546        prefix += ".";
     547    prefix += "MLog";
     548
     549    MParContainer mlog("MLog");
     550
     551    if (mlog.IsEnvDefined(env, prefix, "VerbosityLevel", print))
     552        SetDebugLevel(mlog.GetEnvValue(env, prefix, "VerbosityLevel", 2));
     553
     554    if (mlog.IsEnvDefined(env, prefix, "DebugLevel", print))
     555        gDebug = mlog.GetEnvValue(env, prefix, "DebugLevel", 0);
     556
     557    if (mlog.IsEnvDefined(env, prefix, "NoColors", print))
     558        if (mlog.GetEnvValue(env, prefix, "NoColors", 1)>0)
     559            SetNoColors();
     560}
     561
     562// --------------------------------------------------------------------------
     563//
     564// Read the setup from a TEnv:
     565//   MLog.VerbosityLevel: 0, 1, 2, 3, 4
     566//   MLog.DebugLevel: 0, 1, 2, 3, 4
     567//   MLog.NoColors
     568//
     569// Depending on your setup it might be correct to use something like:
     570//   Job1.MLog.VerbosityLevel: 1
     571//   Job1.DebugLevel: 2
     572//   Job1.MLog.NoColors
     573//
     574void MLog::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
     575{
     576    if (!prefix.IsNull())
     577        prefix += ".";
     578    prefix += "MLog";
     579
     580    cout << "MLog::WriteEnv: not yet implemented!" << endl;
     581}
     582
     583// --------------------------------------------------------------------------
     584//
    511585// Create a new instance of an file output stream
    512586// an set the corresponding flag
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r4253 r4452  
    1313#define bsz    160 // two standard lines
    1414
     15class MArgs;
     16
     17class TEnv;
    1518class TMutex;
    1619class TGTextView;
     
    181184    void SetNoColors(Bool_t flag=kTRUE) { flag ? SetBit(eNoColors) : ResetBit(eNoColors); }
    182185
     186    void Setup(MArgs &arg);
     187
     188    void ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);
     189    void WriteEnv(TEnv &env, TString prefix="", Bool_t print=kFALSE) const;
     190
    183191    void Separator(TString str="", int outlvl=0)
    184192    {
  • trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc

    r2206 r4452  
    3434// This is a simple way to develop new code in a macro without need
    3535// to compile it.
     36//
     37// Example:
     38//    Int_t Process()
     39//    {
     40//       gLog << "Processing..." << endl;
     41//       return kTRUE;
     42//    }
     43//
     44//    void main()
     45//    {
     46//       MTaskInteractive task;
     47//       task.SetProcess(Process);
     48//       MTaskList list;
     49//       list.AddToList(&task);
     50//    }
     51//
    3652//
    3753//  Input Containers:
  • trunk/MagicSoft/Mars/mbase/MTaskInteractive.h

    r2206 r4452  
    11#ifndef MARS_MTaskInteractive
    22#define MARS_MTaskInteractive
    3 
    4 /////////////////////////////////////////////////////////////////////////////
    5 //                                                                         //
    6 // MTaskInteractive                                                               //
    7 //                                                                         //
    8 // Does nothing than return kCONTINUE in the Process-fucntion              //
    9 // (use with filters)                                                      //
    10 //                                                                         //
    11 /////////////////////////////////////////////////////////////////////////////
    123
    134#ifndef MARS_MTask
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r4358 r4452  
    157157// strange offsets. You can get rid of this by calling:
    158158//    TAxis::SetTimeFormat("[your-format] %F1995-01-01 00:00:00");
     159//
     160// Be carefull: It seems that root takes sommer and winter time into account!
     161//              In some circumstances you may need
     162//    TAxis::SetTimeFormat("[your-format] %F1995-01-00 23:00:00");
    159163//
    160164Double_t MTime::GetAxisTime() const
  • trunk/MagicSoft/Mars/merpp.cc

    r3800 r4452  
    116116    }
    117117
    118     if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a"))
    119         gLog.SetNoColors();
     118    gLog.Setup(arg);
    120119
    121120    const Int_t kComprlvl = arg.HasOption("-c") ? arg.GetIntAndRemove("-c") : 2;
     
    124123    const Bool_t kForce = arg.HasOnlyAndRemove("-f");
    125124    const Bool_t kForceProc = arg.HasOnlyAndRemove("-ff");
    126 
    127     gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
    128 
    129     gDebug = arg.HasOption("--debug=") ? arg.GetIntAndRemove("--debug=") : 0;
    130     if (gDebug==0 && arg.HasOnlyAndRemove("--debug"))
    131         gDebug=1;
    132125
    133126    MTime kTimeStart;
     
    145138    if (kTimeStop)
    146139        gLog << inf << "Stop  Time: " << kTimeStop << endl;
     140
     141    if (arg.GetNumOptions()>0)
     142    {
     143        gLog << warn << "WARNING - Unknown commandline options..." << endl;
     144        arg.Print("options");
     145        gLog << endl;
     146    }
    147147
    148148    //
  • 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; //!
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r3926 r4452  
    6969#include "MHillasCalc.h"          // MHillasCalc
    7070#include "MHillasSrcCalc.h"       // MHillasSrcCalc
    71 #include "MBlindPixelCalc.h"      // MBlindPixelCalc
     71//#include "MBlindPixelCalc.h"      // MBlindPixelCalc
    7272#include "MArrivalTimeCalc.h"     // MArrivalTimeCalc
    7373#include "MFillH.h"               // MFillH
     
    254254    MFillH            *fill5 = new MFillH(evt5, "MCameraData", "MFillH5");
    255255    MFillH            *fill6 = new MFillH(evt6, "MCameraData", "MFillH6");
    256     MBlindPixelCalc   *blind = new MBlindPixelCalc;
     256//    MBlindPixelCalc   *blind = new MBlindPixelCalc;
    257257    MHillasCalc       *hcalc = new MHillasCalc;
    258258    MHillasSrcCalc    *scalc = new MHillasSrcCalc;
     
    316316    tlist->AddToList(fill5);
    317317    tlist->AddToList(fill6);
    318     tlist->AddToList(blind);
     318//    tlist->AddToList(blind);
    319319    tlist->AddToList(hcalc);
    320320    tlist->AddToList(scalc);
Note: See TracChangeset for help on using the changeset viewer.