Changeset 1540


Ignore:
Timestamp:
10/15/02 17:02:46 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1539 r1540  
    8585     - added some comments
    8686
     87   * manalysis/MImgCleanStd.cc:
     88     - pixels with to many 'used' neighbors are left used
    8789
    8890
  • trunk/MagicSoft/Mars/NEWS

    r1503 r1540  
    7676   - PrintStatistics can now be instructud to print also the title, too:
    7777     use PrintStatistics(0, kTRUE)
     78
     79   - Changed the image cleaning so that pixels with to many 'used'
     80     neighbors are left used (to get rid of 'holes' in events)
     81
    7882
    7983
  • trunk/MagicSoft/Mars/macros/readMagic.C

    r1325 r1540  
    4646}
    4747
    48 void readMagic(const char *fname="~/data/camera.root")
     48void readMagic(const char *fname="~/data/Gamma_0_7*.root")
    4949{
    5050    MParList plist;
    5151
    5252    MGeomCamMagic geomcam;
    53     MHillas       hillas;
     53    MHillasExt    hillas;
    5454    MTaskList     tlist;
    5555
     
    5959
    6060    MReadMarsFile     read("Events", fname);
     61    read.DisableAutoScheme();
    6162
     63    MPrint            print("MMcEvt");
    6264    MMcPedestalCopy   pcopy;
    6365    MMcPedestalNSBAdd pnsb;
    6466    MCerPhotCalc      ncalc;
     67    MBlindPixelCalc   blind;
     68    blind.SetUseInterpolation();
    6569    MClone            clone("MCerPhotEvt");
    6670    MImgCleanStd      clean;
    67     MBlindPixelCalc   blind;
    6871    MHillasCalc       hcalc;
    6972
    7073
    7174    tlist.AddToList(&read);
     75    tlist.AddToList(&print);
    7276    tlist.AddToList(&pcopy);
    7377    tlist.AddToList(&pnsb);
    7478    tlist.AddToList(&ncalc);
     79    tlist.AddToList(&blind);
    7580    tlist.AddToList(&clone);
    7681    tlist.AddToList(&clean);
    77     tlist.AddToList(&blind);
    7882    tlist.AddToList(&hcalc);
    7983
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc

    r1438 r1540  
    3434
    3535#include "MGeomCam.h"
    36 #include "MGeomPix.h"
    3736
    3837ClassImp(MCerPhotEvt);
     
    159158        return -5.;
    160159
    161     const Float_t A0 = geom ? (*geom)[0].GetA() : 0;
    162 
    163160    Float_t minval = (*this)[0].GetNumPhotons();
    164161
     
    170167
    171168        if (geom)
    172             testval *= A0/(*geom)[pix.GetPixId()].GetA();
     169            testval *= geom->GetPixRatio(pix.GetPixId());
    173170
    174171        if (testval < minval)
     
    190187        return 50.;
    191188
    192     const Float_t A0 = geom ? (*geom)[0].GetA() : 0;
    193189    Float_t maxval = (*this)[0].GetNumPhotons();
    194190
     
    200196
    201197        if (geom)
    202             testval *= A0/(*geom)[pix.GetPixId()].GetA();
     198            testval *= geom->GetPixRatio(pix.GetPixId());
    203199
    204200        if (testval > maxval)
     
    208204}
    209205
     206// --------------------------------------------------------------------------
     207//
     208// get the minimum ratio of photons/error
     209//
     210Float_t MCerPhotEvt::GetRatioMin() const
     211{
     212    if (fNumPixels <= 0)
     213        return -5.;
     214
     215    Float_t minval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot();
     216
     217    for (UInt_t i=1; i<fNumPixels; i++)
     218    {
     219        const MCerPhotPix &pix = (*this)[i];
     220
     221        Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
     222        if (testval < minval)
     223            minval = testval;
     224    }
     225
     226    return minval;
     227}
     228
     229// --------------------------------------------------------------------------
     230//
     231// get the maximum ratio of photons/error
     232//
     233Float_t MCerPhotEvt::GetRatioMax() const
     234{
     235    if (fNumPixels <= 0)
     236        return -5.;
     237
     238    Float_t maxval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot();
     239
     240    for (UInt_t i=1; i<fNumPixels; i++)
     241    {
     242        const MCerPhotPix &pix = (*this)[i];
     243
     244        Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot();
     245        if (testval > maxval)
     246            maxval = testval;
     247    }
     248
     249    return maxval;
     250}
     251
     252// --------------------------------------------------------------------------
     253//
     254// get the minimum of error
     255// If you specify a geometry the number of photons is weighted with the
     256// area of the pixel
     257//
     258Float_t MCerPhotEvt::GetErrorPhotMin(const MGeomCam *geom) const
     259{
     260    if (fNumPixels <= 0)
     261        return 50.;
     262
     263    Float_t minval = (*this)[0].GetErrorPhot();
     264
     265    for (UInt_t i=1; i<fNumPixels; i++)
     266    {
     267        const MCerPhotPix &pix = (*this)[i];
     268
     269        Float_t testval = pix.GetErrorPhot();
     270
     271        if (geom)
     272            testval *= geom->GetPixRatio(pix.GetPixId());
     273
     274        if (testval < minval)
     275            minval = testval;
     276    }
     277    return minval;
     278}
     279
     280// --------------------------------------------------------------------------
     281//
     282// get the maximum ratio of photons/error
     283// If you specify a geometry the number of photons is weighted with the
     284// area of the pixel
     285//
     286Float_t MCerPhotEvt::GetErrorPhotMax(const MGeomCam *geom) const
     287{
     288    if (fNumPixels <= 0)
     289        return 50.;
     290
     291    Float_t maxval = (*this)[0].GetErrorPhot();
     292
     293    for (UInt_t i=1; i<fNumPixels; i++)
     294    {
     295        const MCerPhotPix &pix = (*this)[i];
     296
     297        Float_t testval = pix.GetErrorPhot();
     298
     299        if (geom)
     300            testval *= geom->GetPixRatio(pix.GetPixId());
     301
     302        if (testval > maxval)
     303            maxval = testval;
     304    }
     305    return maxval;
     306}
     307
  • trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h

    r1268 r1540  
    3838    Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
    3939
     40    Float_t GetRatioMin() const;
     41    Float_t GetRatioMax() const;
     42
     43    Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
     44    Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
     45
    4046    MCerPhotPix &operator[](int i)       { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
    4147    MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
  • trunk/MagicSoft/Mars/manalysis/MHillas.cc

    r1528 r1540  
    220220// In case you don't call Calc from within an eventloop make sure, that
    221221// you call the Reset member function before.
    222 //
    223 Bool_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
     222// Returns:
     223//   0  no error
     224//   1  number of pixels < 3
     225//   2  size==0
     226//   3  number of used pixel < 3
     227//   4  CorrXY == 0
     228//
     229Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
    224230{
    225231    const UInt_t npixevt = evt.GetNumPixels();
     
    228234    // sanity check
    229235    //
    230     if (npixevt <= 2)
    231     {
    232         *fLog << warn << "MHillas::Calc: Event has less than two pixels... skipped." << endl;
    233         return kFALSE;
     236    if (npixevt < 3)
     237    {
     238        //*fLog << warn << "MHillas::Calc: Event has less than three pixels... skipped." << endl;
     239        return 1;
    234240    }
    235241
     
    280286    {
    281287        //*fLog << inf << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl;
    282         return kFALSE;
     288        return 2;
    283289    }
    284290
     
    286292    {
    287293        //*fLog << inf << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl;
    288         return kFALSE;
     294        return 3;
    289295    }
    290296
     
    334340    if (corrxy==0)
    335341    {
    336         *fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
    337         return kFALSE;
     342        //*fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
     343        return 4;
    338344    }
    339345
     
    375381    SetReadyToSave();
    376382
    377     return kTRUE;
     383    return 0;
    378384}
    379385
  • trunk/MagicSoft/Mars/manalysis/MHillas.h

    r1524 r1540  
    4545    void Reset();
    4646
    47     virtual Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
     47    virtual Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
    4848
    4949    virtual void Print(Option_t *opt=NULL) const;
  • trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc

    r1211 r1540  
    8888        return kFALSE;
    8989
     90    memset(fErrors, 0, sizeof(fErrors));
     91
    9092    return kTRUE;
    9193}
     
    100102Bool_t MHillasCalc::Process()
    101103{
    102     return fHillas->Calc(*fGeomCam, *fCerPhotEvt) ? kTRUE : kCONTINUE;
     104    const Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt);
     105    if (rc<0 || rc>4)
     106    {
     107        *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl;
     108        return kFALSE;
     109    }
     110    fErrors[rc]++;
     111
     112    return rc==0 ? kTRUE : kCONTINUE;
    103113}
    104114
     115// --------------------------------------------------------------------------
     116//
     117//  Prints some statistics about the hillas calculation. The percentage
     118//  is calculated with respect to the number of executions of this task.
     119//
     120Bool_t MHillasCalc::PostProcess()
     121{
     122    if (GetNumExecutions()==0)
     123        return kTRUE;
     124
     125    *fLog << inf << endl;
     126    *fLog << GetDescriptor() << " execution statistics:" << endl;
     127    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Event has less than 3 pixels" << endl;
     128    *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Calculated Size == 0" << endl;
     129    *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Number of used pixels < 3" << endl;
     130    *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3) << (int)(fErrors[4]*100/GetNumExecutions()) << "%) Evts skipped due to: CorrXY==0" << endl;
     131    *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl;
     132    *fLog << endl;
     133
     134    return kTRUE;
     135}
  • trunk/MagicSoft/Mars/manalysis/MHillasCalc.h

    r1203 r1540  
    2424          MHillas     *fHillas;     // ouput container to store result
    2525
    26     TString fHilName;
    27 public:
    28     MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL);
     26          TString      fHilName;
     27          Int_t        fErrors[5];
    2928
    3029    Bool_t PreProcess(MParList *pList);
    3130    Bool_t Process();
     31    Bool_t PostProcess();
     32
     33public:
     34    MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL);
    3235
    3336    ClassDef(MHillasCalc, 0)   // Task to calculate Hillas parameters
  • trunk/MagicSoft/Mars/manalysis/MHillasExt.cc

    r1524 r1540  
    111111// and the cerenkov photon event
    112112//
    113 Bool_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
    114 {
    115     if (!MHillas::Calc(geom, evt))
    116         return kFALSE;
     113Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
     114{
     115    const Int_t rc = MHillas::Calc(geom, evt);
     116    if (rc>0)
     117        return rc;
    117118
    118119    //
     
    237238    SetReadyToSave();
    238239
    239     return kTRUE;
     240    return 0;
    240241}
    241242
  • trunk/MagicSoft/Mars/manalysis/MHillasExt.h

    r1524 r1540  
    3030    Float_t GetM3Trans() const { return fM3Trans; }
    3131
    32     Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
     32    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
    3333
    3434    void Print(Option_t *opt=NULL) const;
  • trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc

    r1524 r1540  
    113113    if (dist==0)
    114114    {
    115         *fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;
     115        //*fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;
    116116        return kFALSE;
    117117    }
  • trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc

    r1487 r1540  
    9191    fHillasSrc->SetSrcPos(fSrcPos);
    9292
     93    fErrors = 0;
     94
    9395    return kTRUE;
    9496}
     
    98100Bool_t MHillasSrcCalc::Process()
    99101{
    100     return fHillasSrc->Calc(fHillas) ? kTRUE : kCONTINUE;
     102
     103    if (!fHillasSrc->Calc(fHillas))
     104    {
     105        fErrors++;
     106        return kCONTINUE;
     107
     108    }
     109    return kTRUE;
    101110}
    102111
     112// --------------------------------------------------------------------------
     113//
     114//  Prints some statistics about the hillas calculation. The percentage
     115//  is calculated with respect to the number of executions of this task.
     116//
     117Bool_t MHillasSrcCalc::PostProcess()
     118{
     119    if (GetNumExecutions()==0)
     120        return kTRUE;
     121
     122    *fLog << inf << endl;
     123    *fLog << GetDescriptor() << " execution statistics:" << endl;
     124    *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions()) << "%) Evts skipped due to: Dist==0" << endl;
     125    *fLog << endl;
     126
     127    return kTRUE;
     128}
    103129
    104130// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h

    r1487 r1540  
    2020    TString     fHillasName;
    2121
     22    Int_t       fErrors;
     23
    2224    void StreamPrimitive(ofstream &out) const;
     25
     26    Bool_t PreProcess(MParList *plist);
     27    Bool_t Process();
     28    Bool_t PostProcess();
    2329
    2430public:
     
    2632                   const char *name=NULL, const char *title=NULL);
    2733
    28     Bool_t PreProcess(MParList *plist);
    29     Bool_t Process();
    30 
    3134    ClassDef(MHillasSrcCalc, 1) // task to calculate the source position depandant hillas parameters
    3235};
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc

    r1503 r1540  
    159159        // check if pixel is in use, if not goto next pixel in list
    160160        //
     161#if 0
    161162        if (!pix.IsPixelUsed())
    162163            continue;
     164#endif
    163165
    164166        //
     
    168170
    169171        //
    170         // count number of next neighbors of this pixel which
    171         // state is 'used'
     172        // check for 'used' neighbors this pixel which
    172173        //
    173174        const MGeomPix &gpix  = (*fCam)[id];
    174175        const Int_t     nnmax = gpix.GetNumNeighbors();
    175176
     177#if 0
    176178        Bool_t cnt = kFALSE;
    177179        for (Int_t j=0; j<nnmax; j++)
     
    179181            const Int_t id2 = gpix.GetNeighbor(j);
    180182
    181             if (!ispixused[id2])
     183            if (id2>max || !ispixused[id2])
    182184                continue;
    183185
     
    187189        if (cnt)
    188190            continue;
     191#else
     192        Int_t cnt = 0;
     193        for (Int_t j=0; j<nnmax; j++)
     194        {
     195            const Int_t id2 = gpix.GetNeighbor(j);
     196
     197            if (id2>max || !ispixused[id2])
     198                continue;
     199
     200            if (cnt++>nnmax-4)
     201                break;
     202        }
     203        if (cnt==nnmax-2 && nnmax>=4)
     204        {
     205            pix.SetPixelUsed();
     206            continue;
     207        }
     208        if (cnt>0)
     209            continue;
     210#endif
    189211
    190212        //
     
    238260        const Float_t noise = pix.GetErrorPhot();
    239261
    240         if (entry <= fCleanLvl2 * noise )
     262        if (entry <= fCleanLvl2 * noise)
    241263            continue;
    242264
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h

    r1477 r1540  
    3636    void Print(Option_t *o="") const;
    3737
     38    Float_t GetCleanLvl1() const { return fCleanLvl1; }
     39    Float_t GetCleanLvl2() const { return fCleanLvl2; }
     40
    3841    Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
    3942
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc

    r1173 r1540  
    4646#include "MLogManip.h"
    4747
     48#include "MPedestalPix.h"
    4849#include "MPedestalCam.h"
     50
    4951#include "MRawRunHeader.h"
    5052#include "MMcFadcHeader.hxx"
     
    113115// --------------------------------------------------------------------------
    114116//
    115 // Check for the runtype. (not yet: If the check fails the eventloop is
    116 // stopped.)
     117// Check for the runtype.
    117118// Initialize the size of MPedestalCam to the number of pixels from
    118119// MMcFadcHeader.
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc

    r1186 r1540  
    2626//                                                                         //
    2727//  MMcPedestalNSBAdd                                                      //
     28//  -----------------                                                      //
    2829//                                                                         //
    2930//  This Task adds the contribution of the diffuse NSB to the FADC         //
    3031//  pedestals. We assume that NSB introduces larger fluctuation but does   //
    3132//  not change the mean value.                                             //
    32 //  To be precise we add quadratically to the rms that is already in       //
    33 //  MPedestalCam the NSB contribution.                                     //
     33//  To be precise we add quadratically to the rms, which is already in     //
     34//  MPedestalCam, the NSB contribution.                                    //
    3435//  The number of photons from the diffuse NSB follows a poisson           //
    3536//  distribution with expected mean value X, then its standard deviation   //
     
    5051//                                                                         //
    5152/////////////////////////////////////////////////////////////////////////////
    52 
    5353#include "MMcPedestalNSBAdd.h"
    5454
     
    5858#include "MLogManip.h"
    5959
     60#include "MGeomCam.h"
     61#include "MGeomPix.h"
     62
     63#include "MPedestalPix.h"
    6064#include "MPedestalCam.h"
     65
    6166#include "MRawRunHeader.h"
    6267#include "MMcRunHeader.hxx"
    6368#include "MMcFadcHeader.hxx"
    64 #include "MGeomCam.h"
    65 #include "MGeomPix.h"
    6669
    6770ClassImp(MMcPedestalNSBAdd);
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc

    r1155 r1540  
    3131/////////////////////////////////////////////////////////////////////////////
    3232#include "MPedestalCam.h"
     33#include "MPedestalPix.h"
     34
     35#include <TClonesArray.h>
    3336
    3437#include "MLog.h"
     38#include "MLogManip.h"
     39
     40#include "MGeomCam.h"
     41
    3542
    3643ClassImp(MPedestalCam);
     
    6269// --------------------------------------------------------------------------
    6370//
     71// Set the size of the camera
     72//
     73inline void MPedestalCam::InitSize(const UInt_t i)
     74{
     75    fArray->ExpandCreate(i);
     76}
     77
     78// --------------------------------------------------------------------------
     79//
     80// Get the size of the MPedestalCam
     81//
     82inline Int_t MPedestalCam::GetSize() const
     83{
     84    return fArray->GetEntries();
     85}
     86
     87// --------------------------------------------------------------------------
     88//
     89// Get i-th pixel (pixel number)
     90//
     91inline MPedestalPix &MPedestalCam::operator[](Int_t i)
     92{
     93    return *(MPedestalPix*)fArray->UncheckedAt(i);
     94}
     95
     96// --------------------------------------------------------------------------
     97//
     98// Get i-th pixel (pixel number)
     99//
     100inline MPedestalPix &MPedestalCam::operator[](Int_t i) const
     101{
     102    return *(MPedestalPix*)fArray->UncheckedAt(i);
     103}
     104
     105// --------------------------------------------------------------------------
     106//
    64107// Check if position i is inside bounds
    65108//
     
    69112}
    70113
     114void MPedestalCam::Clear(Option_t *o)
     115{
     116    fArray->ForEach(TObject, Clear)();
     117}
    71118
     119void MPedestalCam::Print(Option_t *o="") const
     120{
     121    *fLog << all << GetDescriptor() << ":" << endl;
     122    int id = 0;
     123
     124    TIter Next(fArray);
     125    MPedestalPix *pix;
     126    while ((pix=(MPedestalPix*)Next()))
     127    {
     128        id++;
     129
     130        if (!pix->IsValid())
     131            continue;
     132
     133        *fLog << id-1 << ": ";
     134        *fLog << pix->GetMean() << " " << pix->GetSigma() << " ";
     135        *fLog << pix->GetMeanRms() << " " << pix->GetSigmaRms() << endl;
     136    }
     137}
     138
     139Float_t MPedestalCam::GetMeanMin(const MGeomCam *geom) const
     140{
     141    if (fArray->GetEntries() <= 0)
     142        return 50.;
     143
     144    Float_t minval = (*this)[0].GetMean();
     145
     146    for (Int_t i=1; i<fArray->GetEntries(); i++)
     147    {
     148        const MPedestalPix &pix = (*this)[i];
     149
     150        Float_t testval = pix.GetMean();
     151
     152        if (geom)
     153            testval *= geom->GetPixRatio(i);
     154
     155        if (testval < minval)
     156            minval = testval;
     157    }
     158    return minval;
     159}
     160
     161Float_t MPedestalCam::GetMeanMax(const MGeomCam *geom) const
     162{
     163    if (fArray->GetEntries() <= 0)
     164        return 50.;
     165
     166    Float_t maxval = (*this)[0].GetMean();
     167
     168    for (Int_t i=1; i<fArray->GetEntries(); i++)
     169    {
     170        const MPedestalPix &pix = (*this)[i];
     171
     172        Float_t testval = pix.GetMean();
     173
     174        if (geom)
     175            testval *= geom->GetPixRatio(i);
     176
     177        if (testval > maxval)
     178            maxval = testval;
     179    }
     180    return maxval;
     181}
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.h

    r1268 r1540  
    66#endif
    77
    8 #ifndef MARS_MPedestalPix
    9 #include "MPedestalPix.h"
    10 #endif
     8class TClonesArray;
    119
    12 #ifndef ROOT_TClonesArray
    13 #include <TClonesArray.h>
    14 #endif
     10class MGeomCam;
     11class MPedestalPix;
    1512
    1613class MPedestalCam : public MParContainer
     
    2320    ~MPedestalCam();
    2421
    25     void InitSize(const UInt_t i) { fArray->ExpandCreate(i); }
     22    void Clear(Option_t *o="");
    2623
    27     MPedestalPix &operator[](Int_t i)       { return *(MPedestalPix*)fArray->UncheckedAt(i); }
    28     MPedestalPix &operator[](Int_t i) const { return *(MPedestalPix*)fArray->UncheckedAt(i); }
     24    void InitSize(const UInt_t i);
     25    Int_t GetSize() const;
     26
     27    MPedestalPix &operator[](Int_t i);
     28    MPedestalPix &operator[](Int_t i) const;
     29
     30    Float_t GetMeanMin(const MGeomCam *cam) const;
     31    Float_t GetMeanMax(const MGeomCam *cam) const;
    2932
    3033    Bool_t CheckBounds(Int_t i);
     34
     35    void Print(Option_t *o="") const;
    3136
    3237    ClassDef(MPedestalCam, 1)   // Storage Container for all pedestal information of the camera
  • trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc

    r1081 r1540  
    3838
    3939MPedestalPix::MPedestalPix()
    40     : fMean(0.0), fSigma(0.0), fMeanRms(0.0), fSigmaRms(0.0)
    4140{
     41    Clear();
    4242}
    4343
     44// ------------------------------------------------------------------------
     45//
     46// Invalidate values
     47//
     48void MPedestalPix::Clear(Option_t *o)
     49{
     50    fMean = -1;
     51    fSigma = -1;
     52    fMeanRms = -1;
     53    fSigmaRms = -1;
     54}
     55
  • trunk/MagicSoft/Mars/manalysis/MPedestalPix.h

    r1014 r1540  
    1717    MPedestalPix();
    1818
     19    void Clear(Option_t *o="");
     20
    1921    Float_t GetMean() const     { return fMean;     }
    2022    Float_t GetSigma() const    { return fSigma;    }
     
    3032    void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; }
    3133
     34    Bool_t IsValid() const { return fMean>=0||fSigma>=0||fMeanRms>=0||fSigmaRms>=0; }
     35
    3236    ClassDef(MPedestalPix, 1)   // Storage Container for Pedestal information of one pixel
    3337};
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r1492 r1540  
    3535#pragma link C++ class MClone+;
    3636#pragma link C++ class MPrint+;
     37#pragma link C++ class MContinue+;
    3738
    3839#pragma link C++ class MArray;
  • trunk/MagicSoft/Mars/mbase/MClone.h

    r1014 r1540  
    3030    Bool_t Process();
    3131
    32     TObject *GetClone() const { return fClone; }
     32    TObject *GetClone() const  { return fClone; }
     33    const TObject *GetObject() const { return fObject; }
    3334
    3435    void Clear(Option_t *opt=NULL);
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r1528 r1540  
    8686#ifdef __MARS__
    8787#include "MReadTree.h"       // for setting progress bar
     88#include "MProgressBar.h"    // MProgressBar::GetBar
    8889#endif
    8990
     
    126127    enable ? SetBit(kIsOwner) : ResetBit(kIsOwner);
    127128}
     129
     130#ifdef __MARS__
     131// --------------------------------------------------------------------------
     132//
     133//  Specify an existing MProgressBar object. It will display the progress
     134//  graphically. This will make thing about 1-2% slower.
     135//
     136void MEvtLoop::SetProgressBar(MProgressBar *bar)
     137{
     138    fProgress = bar->GetBar();
     139}
     140#endif
    128141
    129142// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r1526 r1540  
    1717class MTaskList;
    1818class TGProgressBar;
     19#ifdef __MARS__
     20class MProgressBar;
     21#endif
    1922
    2023class MEvtLoop : public MParContainer
     
    4447
    4548    void SetProgressBar(TGProgressBar *bar) { fProgress = bar; }
     49#ifdef __MARS__
     50    void SetProgressBar(MProgressBar *bar);
     51#endif
    4652
    4753    Bool_t PreProcess(const char *tlist="MTaskList");
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r1501 r1540  
    252252// --------------------------------------------------------------------------
    253253//
    254 // Prints the number of times this task has been processed.
    255 // For convinience the lvl argument results in a number of spaces at the
    256 // beginning of the line. So that the structur of a tasklist can be
    257 // identified.
     254//  Prints the number of times all the tasks in the list has been.
     255//  For convinience the lvl argument results in a number of spaces at the
     256//  beginning of the line. So that the structur of a tasklist can be
     257//  identified. If a Tasklist or task has filter applied the name of the
     258//  filter is printer in <>-brackets behind the number of executions.
     259//  Use MTaskList::PrintStatistics without an argument.
    258260//
    259261void MTask::PrintStatistics(const Int_t lvl, Bool_t title) const
     
    261263    *fLog << all << setw(lvl) << " " << GetDescriptor() << "\t";
    262264    *fLog << dec << fNumExecutions;
     265    if (fFilter)
     266        *fLog << " <" << fFilter->GetName() << ">";
    263267    if (title)
    264268        *fLog << "\t" << fTitle;
     
    280284    /*
    281285     If we don't stream filter which are not in the task list itself
    282      (which means: alrteady streamed) we may be able to use the
    283      primitive streamer as some kind of validity check for the macros
     286     (which means: already streamed) we may be able to use
     287     SavePrimitive as some kind of validity check for the macros
    284288
    285289     fFilter->SavePrimitive(out);
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1527 r1540  
    6666#include "MLogManip.h"
    6767
     68#include "MFilter.h"
    6869#include "MParList.h"
    6970#include "MInputStreamID.h"
     
    7172ClassImp(MTaskList);
    7273
    73 static const TString gsDefName  = "MTaskList";
    74 static const TString gsDefTitle = "A list for tasks to be executed";
     74const TString MTaskList::gsDefName  = "MTaskList";
     75const TString MTaskList::gsDefTitle = "A list for tasks to be executed";
     76
    7577// --------------------------------------------------------------------------
    7678//
     
    492494//  For convinience the lvl argument results in a number of spaces at the
    493495//  beginning of the line. So that the structur of a tasklist can be
    494 //  identified. Use MTaskList::PrintStatistics without an argument.
     496//  identified. If a Tasklist or task has filter applied the name of the
     497//  filter is printer in <>-brackets behind the number of executions.
     498//  Use MTaskList::PrintStatistics without an argument.
    495499//
    496500void MTaskList::PrintStatistics(const Int_t lvl, Bool_t title) const
     
    502506        *fLog << "---------------------" << endl;
    503507        *fLog << GetDescriptor();
     508        if (GetFilter())
     509            *fLog << " <" << GetFilter()->GetName() << ">";
    504510        if (title)
    505511            *fLog << "\t" << fTitle;
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r1501 r1540  
    2121{
    2222private:
    23     TList    *fTasks;       // Container for the ordered list of different tasks
    24     TList    fTasksProcess; //!
    25     MParList *fParList;     //!
     23    static const TString gsDefName;  // default name
     24    static const TString gsDefTitle; // default title
    2625
    27     UInt_t *fCntContinue;   //!
    28     UInt_t *fCntTrue;       //!
     26    TList    *fTasks;        // Container for the ordered list of different tasks
     27    TList     fTasksProcess; //! Task which overload the Process function
     28    MParList *fParList;      //! The parameter list given in PreProcess
    2929
    3030    enum { kIsOwner = BIT(14) };
  • trunk/MagicSoft/Mars/mbase/Makefile

    r1528 r1540  
    2020# @endcode
    2121
    22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio
     22INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain
    2323
    2424# @code
     
    4848           MTime.cc \
    4949           MClone.cc \
     50           MContinue.cc \
    5051           MPrint.cc \
    5152           MLogManip.cc
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc

    r1384 r1540  
    3232#include "MGTask.h"              // MGTask::CreateGui
    3333#include "MClone.h"              // MClone
    34 #include "MHillas.h"             // MHillas
     34#include "MHillasExt.h"          // MHillasExt
    3535#include "MParList.h"            // MParList::AddToList
    3636#include "MEvtLoop.h"            // MEvtLoop::GetParList
     
    8181     WARNING:
    8282     Bacause of some strage and hidden dependencies the
    83      GetMaiFrame call in the destructor of TGButton may fail if some
     83     GetMainFrame call in the destructor of TGButton may fail if some
    8484     of the other gui elements are deleted first.
    8585     AddFirst adds the buttons at the beginning of the deletion list,
     
    134134    MGeomCamMagic *geom   = new MGeomCamMagic;
    135135    MPedestalCam  *pedest = new MPedestalCam;
     136    MHillasExt    *hext   = new MHillasExt;
    136137
    137138    plist->AddToList(geom);
    138139    plist->AddToList(pedest);
     140    plist->AddToList(hext);
    139141
    140142    return geom;
     
    160162    AddSetupElements();
    161163
     164    TCanvas *canv2 = AddTab("Errors");
     165    TCanvas *canv3 = AddTab("Phot/Err");
     166    TCanvas *canv4 = AddTab("Levels");
     167    TCanvas *canv5 = AddTab("Pedestals");
     168
    162169    //
    163170    // Show camera display for the actual geometry
    164171    //
     172    fDisplay  = new MCamDisplay(geom);
     173    fDisplay2 = new MCamDisplay(geom);
     174    fDisplay3 = new MCamDisplay(geom);
     175    fDisplay4 = new MCamDisplay(geom);
     176    fDisplay5 = new MCamDisplay(geom);
     177
     178    fList->Add(fDisplay);
     179    fList->Add(fDisplay2);
     180    fList->Add(fDisplay3);
     181    fList->Add(fDisplay4);
     182    fList->Add(fDisplay5);
     183
    165184    fCanvas->cd();
    166     fDisplay = new MCamDisplay(geom);
    167185    fDisplay->Draw();
    168     fList->Add(fDisplay);
     186    canv2->cd();
     187    fDisplay2->Draw();
     188    canv3->cd();
     189    fDisplay3->Draw();
     190    canv4->cd();
     191    fDisplay4->Draw();
     192    canv5->cd();
     193    fDisplay5->Draw();
     194
    169195
    170196    ReadFirstEvent();
     
    213239    // Display the requested event. This does a Canvas update, too.
    214240    //
    215     MCerPhotEvt *evt = NULL;
     241    MCerPhotEvt  *evt = NULL;
    216242    if (fDisplayRaw)
    217243    {
     
    230256    }
    231257
     258    const MImgCleanStd *clean = (MImgCleanStd*)GetTaskList()->FindObject("MImgCleanStd");
     259    const MPedestalCam *ped   = (MPedestalCam*)plist->FindObject("MPedestalCam");
     260
    232261    fDisplay->DrawPhotNum(evt);
     262    fDisplay2->DrawErrorPhot(evt);
     263    fDisplay3->DrawRatio(evt);
     264    fDisplay4->DrawLevels(evt, *clean);
     265    fDisplay5->DrawPedestals(ped);
    233266}
    234267
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h

    r1015 r1540  
    1818
    1919    TGListBox   *fPixelList;
     20
    2021    MCamDisplay *fDisplay;
     22    MCamDisplay *fDisplay2;
     23    MCamDisplay *fDisplay3;
     24    MCamDisplay *fDisplay4;
     25    MCamDisplay *fDisplay5;
    2126
    2227    void AddSetupElements();
  • trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc

    r1385 r1540  
    208208// --------------------------------------------------------------------------
    209209//
     210//  Add a tab with an embedded canvas for an camera display and return the
     211//  pointer to the canvas
     212//
     213TCanvas *MGEvtDisplay::AddTab(TString name)
     214{
     215    TGLayoutHints *laycanvas = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY);
     216    fList->Add(laycanvas);
     217
     218    TGCompositeFrame *frame = fEvtDisplay->AddTab(name);
     219    TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas(name+"Display", frame, 400, 400);
     220    frame->AddFrame(canvas, laycanvas);
     221    fList->Add(canvas);
     222    return canvas->GetCanvas();
     223}
     224
     225// --------------------------------------------------------------------------
     226//
    210227//  Add the mid frame: This are the two tabs with the canvas in the right one
    211228//
     
    230247    //
    231248    // Create second part of frame
    232     //
    233     TGTab *tabdisp = new TGTab(frame, 300, 300);
    234 
    235     TGLayoutHints *laycanvas = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY);
    236 
    237     TGCompositeFrame *tab2 = tabdisp->AddTab("Event Display");
    238     TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas("EventDisplay", tab2, 400, 400);
    239     tab2->AddFrame(canvas, laycanvas);
    240     fList->Add(canvas);
    241 
    242     fCanvas = canvas->GetCanvas();
    243 
    244     TGCompositeFrame *tab3 = tabdisp->AddTab("Geometry");
    245     canvas = new TRootEmbeddedCanvas("CamDisplay", tab3, 400, 400);
    246     tab3->AddFrame(canvas, laycanvas);
    247     fList->Add(canvas);
    248 
     249    //
     250    fEvtDisplay = new TGTab(frame, 300, 300);
     251
     252    fCanvas=AddTab("Photons");
     253
     254    AddTab("Geometry");
    249255    MGeomCamMagic geom;
    250256    MCamDisplay *display = new MCamDisplay(&geom);
     
    257263    //
    258264    TGLayoutHints *laydisp = new TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX, 10, 10, 10, 10);
    259     frame->AddFrame(tabdisp, laydisp);
     265    frame->AddFrame(fEvtDisplay, laydisp);
    260266
    261267    //
    262268    // Now add all gui elements to 'autodel'-list
    263269    //
    264     fList->Add(tabdisp);
    265     fList->Add(laycanvas);
     270    fList->Add(fEvtDisplay);
    266271    fList->Add(laydisp);
    267272    fList->Add(laytabs);
     
    475480    txt += "m  ZA=";
    476481    txt += (int)(evt->GetTheta()*180/TMath::Pi()+.5);
    477     txt += "°     ";
     482    txt += "°  ";
     483    txt += evt->GetPhotElfromShower();
     484    txt += "PhEl";
    478485
    479486    fEvtInfo->SetText(txt);
     
    640647    return kTRUE;
    641648}
     649
  • trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h

    r1385 r1540  
    1010#endif
    1111
     12class TGTab;
    1213class TList;
    1314class TCanvas;
     
    2930    TGLabel     *fEvtInfo;
    3031    TGTextEntry *fTxtEvtNr;
     32
     33    TGTab       *fEvtDisplay;
    3134
    3235    void AddMenuBar();
     
    6063    MReadTree *GetReader() const;
    6164
     65    TCanvas *AddTab(TString name);
     66
    6267    void   ReadFirstEvent();
    6368    Bool_t IsInitOk() { return fInitOk; }
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadAscii.cc

    r1381 r1540  
    5151#include "MParList.h"
    5252#include "MCerPhotEvt.h"
     53
     54#include "MPedestalPix.h"
    5355#include "MPedestalCam.h"
    5456
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.cc

    r1458 r1540  
    112112// --------------------------------------------------------------------------
    113113//
     114//  returns the ratio of the area of the given pixel to the pixel with
     115//  the id 0 to scale variables with the pixel size.
     116//
     117inline Float_t MGeomCam::GetPixRatio(Int_t i) const
     118{
     119    return (*this)[0].GetA()/(*this)[i].GetA();
     120}
     121
     122// --------------------------------------------------------------------------
     123//
    114124//  Prints the Geometry information of all pixels in the camera
    115125//
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.h

    r1458 r1540  
    3131    virtual ~MGeomCam();
    3232
    33     Float_t GetCameraDist() const { return fCamDist; }
    34     Float_t GetConvMm2Deg() const { return fConvMm2Deg; }
     33    Float_t GetCameraDist() const      { return fCamDist; }
     34    Float_t GetConvMm2Deg() const      { return fConvMm2Deg; }
    3535
    36     UInt_t  GetNumPixels() const { return fNumPixels; }
    37     Float_t GetMaxRadius() const { return fMaxRadius; }
     36    UInt_t  GetNumPixels() const       { return fNumPixels; }
     37    Float_t GetMaxRadius() const       { return fMaxRadius; }
     38    Float_t GetPixRatio(Int_t i) const;
    3839
    3940    MGeomPix &operator[](Int_t i)       { return *(MGeomPix*)fPixels->UncheckedAt(i); }
    4041    MGeomPix &operator[](Int_t i) const { return *(MGeomPix*)fPixels->UncheckedAt(i); }
     42
     43
    4144
    4245    virtual void Print(Option_t *opt=NULL) const;
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.cc

    r1426 r1540  
    2828// MCamDisplay
    2929//
    30 // Camera Display
     30// Camera Display. The Pixels are displayed in
     31// contents/area [somthing/mm^2]
    3132//
    3233////////////////////////////////////////////////////////////////////////////
     
    3839#include <TBox.h>
    3940#include <TText.h>
     41#include <TArrow.h>
    4042#include <TStyle.h>
    4143#include <TCanvas.h>
     
    4547#include "MHexagon.h"
    4648
    47 #include "MGeomPix.h"
    4849#include "MGeomCam.h"
    4950
     
    5152#include "MCerPhotEvt.h"
    5253
     54#include "MPedestalPix.h"
     55#include "MPedestalCam.h"
     56
     57#include "MImgCleanStd.h"
     58
    5359#define kItemsLegend 50 // see SetPalette(1,0)
    5460
     
    6066//
    6167MCamDisplay::MCamDisplay(MGeomCam *geom)
    62     : fAutoScale(kTRUE), fMinPhe(-2), fMaxPhe(50), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)
     68    : fAutoScale(kTRUE), fW(0), fH(0), fDrawingPad(NULL), fIsAllocated(kFALSE)
    6369{
    6470    fGeomCam = (MGeomCam*)geom; // FIXME: Clone doesn't work! (MGeomCam*)geom->Clone();
     
    108114        newtxt->SetTextAlign(12);
    109115    }
     116
     117    fArrowX = new TArrow(-fRange*.9, -fRange*.9, -fRange*.6, -fRange*.9, 0.025);
     118    fArrowY = new TArrow(-fRange*.9, -fRange*.9, -fRange*.9, -fRange*.6, 0.025);
     119
     120    TString text;
     121    text += (int)(fRange*.3);
     122    text += "mm";
     123
     124    fLegRadius = new TText(-fRange*.85, -fRange*.85, text);
     125    text = "";
     126    text += (float)((int)(fRange*.3*geom->GetConvMm2Deg()*10))/10;
     127    text += "°";
     128    text = text.Strip(TString::kLeading);
     129    fLegDegree = new TText(-fRange*.85, -fRange*.75, text);
     130    fLegRadius->SetTextSize(0.04);
     131    fLegDegree->SetTextSize(0.04);
    110132}
    111133
     
    124146    delete fLegText;
    125147
     148    delete fArrowX;
     149    delete fArrowY;
     150
     151    delete fLegRadius;
     152    delete fLegDegree;
     153
    126154    // delete fGeomCam;
    127155
    128     if (fDrawingPad->GetListOfPrimitives()->FindObject(this)==this &&
    129         fIsAllocated)
     156    // Maybe harmfull! Don't exchange the order!
     157    if (fIsAllocated && fDrawingPad->GetListOfPrimitives()->FindObject(this)==this)
    130158    {
    131159        fDrawingPad->RecursiveRemove(this);
     
    134162}
    135163
    136 inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix, const Int_t i)
    137 {
    138     //
    139     // Fixme: Divide pnum by the (real) area of the pixel
    140     //
    141     const Float_t ratio = (*fGeomCam)[0].GetA()/(*fGeomCam)[i].GetA();
     164inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max)
     165{
     166    //
     167    // Fixme: Use absolute value per mm^2. Needs another scaling algorithm.
     168    //
     169    const Float_t ratio = fGeomCam->GetPixRatio(i);
    142170    const Float_t pnum  = ratio*pix.GetNumPhotons();
    143171
    144     (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum));
     172    (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum, min, max));
     173}
     174
     175inline void MCamDisplay::SetPixColorPedestal(const MPedestalPix &pix, const Int_t i, Float_t min, Float_t max)
     176{
     177    //
     178    // Fixme: Use absolute value per mm^2. Needs another scaling algorithm.
     179    //
     180    const Float_t ratio = fGeomCam->GetPixRatio(i);
     181    const Float_t pnum  = ratio*pix.GetMean();
     182
     183    (*this)[i].SetFillColor(GetColor(pnum, min, max));
     184}
     185
     186inline void MCamDisplay::SetPixColorError(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max)
     187{
     188    //
     189    // Fixme: Use absolute value per mm^2. Needs another scaling algorithm.
     190    //
     191    const Float_t ratio = fGeomCam->GetPixRatio(i);
     192    const Float_t pnum  = ratio*pix.GetErrorPhot();
     193
     194    (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum, min, max));
     195}
     196
     197inline void MCamDisplay::SetPixColorRatio(const MCerPhotPix &pix, Float_t min, Float_t max)
     198{
     199    //
     200    // Fixme: Use absolute value per mm^2. Needs another scaling algorithm.
     201    //
     202    const Float_t pnum  = pix.GetNumPhotons()/pix.GetErrorPhot();
     203    (*this)[pix.GetPixId()].SetFillColor(GetColor(pnum, min, max));
     204}
     205
     206inline void MCamDisplay::SetPixColorLevel(const MCerPhotPix &pix, Float_t lvl1, Float_t lvl2)
     207{
     208    const Int_t maxcolidx = kItemsLegend-1;
     209
     210    MHexagon &hex = (*this)[pix.GetPixId()];
     211
     212    const Float_t r = pix.GetNumPhotons()/pix.GetErrorPhot();
     213
     214    if (r>lvl1)
     215        hex.SetFillColor(fColors[4*maxcolidx/5]);
     216    else
     217        if (r>lvl2)
     218            hex.SetFillColor(fColors[maxcolidx/2]);
     219        else
     220            hex.SetFillColor(fColors[maxcolidx/5]);
    145221}
    146222
     
    189265    //
    190266    gPad->Range(-fRange, -y, x, y);
     267
     268    //
     269    // Make sure, that the correct aspect is always displayed also
     270    // if - by chance - there is not update for the pad after the
     271    // Paint function was called.
     272    //
     273    gPad->Update();
    191274}
    192275
     
    359442    }
    360443
     444    fArrowX->Draw();
     445    fArrowY->Draw();
     446
     447    fLegRadius->Draw();
     448    fLegDegree->Draw();
     449
    361450    //
    362451    // initialize and draw legend
     
    433522        return;
    434523
     524    Draw();
     525
     526    fDrawingPad->cd();
     527
     528    for (int i=0; i<kItemsLegend; i++)
     529        GetBox(i)->SetFillColor(fColors[i]);
     530
     531    //
     532    // Reset pixel colors to default value
     533    //
     534    Reset();
     535
     536    //
     537    //  if the autoscale is true, set the values for the range for
     538    //  each event
     539    //
     540    Float_t min = 0;
     541    Float_t max = 50;
     542    if (fAutoScale)
     543    {
     544        min = event->GetNumPhotonsMin(fGeomCam);
     545        max = event->GetNumPhotonsMax(fGeomCam);
     546
     547        if (max < 20.)
     548            max = 20.;
     549
     550        UpdateLegend(min, max);
     551    }
     552
     553    //
     554    //   update the colors in the picture
     555    //
     556    const Int_t entries = event->GetNumPixels();
     557
     558    for (Int_t i=0; i<entries; i++)
     559    {
     560        const MCerPhotPix &pix = (*event)[i];
     561
     562        if (!pix.IsPixelUsed())
     563            continue;
     564
     565        SetPixColor(pix, i, min, max);
     566    }
     567
     568    //
     569    // Update display physically
     570    //
     571    fDrawingPad->Modified();
     572    fDrawingPad->Update();
     573}
     574
     575// ------------------------------------------------------------------------
     576//
     577// Call this function to draw the number of photo electron into the
     578// camera.
     579//
     580void MCamDisplay::DrawPedestals(const MPedestalCam *event)
     581{
     582    if (!event)
     583        return;
     584
     585    Draw();
     586
     587    fDrawingPad->cd();
     588
     589    for (int i=0; i<kItemsLegend; i++)
     590        GetBox(i)->SetFillColor(fColors[i]);
     591
     592    //
     593    // Reset pixel colors to default value
     594    //
     595    Reset();
     596
     597    //
     598    //  if the autoscale is true, set the values for the range for
     599    //  each event
     600    //
     601    Float_t min = 0;
     602    Float_t max = 50;
     603    if (fAutoScale)
     604    {
     605        min = event->GetMeanMin(fGeomCam);
     606        max = event->GetMeanMax(fGeomCam);
     607
     608        if (max < 20.)
     609            max = 20.;
     610
     611        UpdateLegend(min, max);
     612    }
     613
     614    //
     615    //   update the colors in the picture
     616    //
     617    const Int_t entries = event->GetSize();
     618
     619    for (Int_t i=0; i<entries; i++)
     620        SetPixColorPedestal((*event)[i], i, min, max);
     621
     622    //
     623    // Update display physically
     624    //
     625    fDrawingPad->Modified();
     626    fDrawingPad->Update();
     627}
     628
     629// ------------------------------------------------------------------------
     630//
     631// Call this function to draw the error of number of photo electron
     632// into the camera.
     633//
     634void MCamDisplay::DrawErrorPhot(const MCerPhotEvt *event)
     635{
     636    if (!event)
     637        return;
     638
    435639    if (!fDrawingPad)
    436640        Draw();
     
    450654    //  each event
    451655    //
     656    Float_t min = 0;
     657    Float_t max = 50;
    452658    if (fAutoScale)
    453659    {
    454         fMinPhe = event->GetNumPhotonsMin(fGeomCam);
    455         fMaxPhe = event->GetNumPhotonsMax(fGeomCam);
    456 
    457         if (fMaxPhe < 20.)
    458             fMaxPhe = 20.;
    459 
    460         UpdateLegend();
     660        min = event->GetErrorPhotMin(fGeomCam);
     661        max = event->GetErrorPhotMax(fGeomCam);
     662
     663        if (max < 20.)
     664            max = 20.;
     665
     666        UpdateLegend(min, max);
    461667    }
    462668
     
    473679            continue;
    474680
    475         SetPixColor(pix, i);
     681        SetPixColorError(pix, i, min, max);
    476682    }
    477683
     
    481687    fDrawingPad->Modified();
    482688    fDrawingPad->Update();
     689}
     690
     691// ------------------------------------------------------------------------
     692//
     693// Call this function to draw the ratio of the number of photons
     694// divided by its error
     695//
     696void MCamDisplay::DrawRatio(const MCerPhotEvt *event)
     697{
     698    if (!event)
     699        return;
     700
     701    if (!fDrawingPad)
     702        Draw();
     703
     704    fDrawingPad->cd();
     705
     706    for (int i=0; i<kItemsLegend; i++)
     707        GetBox(i)->SetFillColor(fColors[i]);
     708
     709    //
     710    // Reset pixel colors to default value
     711    //
     712    Reset();
     713
     714    //
     715    //  if the autoscale is true, set the values for the range for
     716    //  each event
     717    //
     718    Float_t min = 0;
     719    Float_t max = 20;
     720    if (fAutoScale)
     721    {
     722        min = event->GetRatioMin();
     723        max = event->GetRatioMax();
     724
     725        UpdateLegend(min, max);
     726    }
     727
     728    //
     729    //   update the colors in the picture
     730    //
     731    const Int_t entries = event->GetNumPixels();
     732
     733    for (Int_t i=0; i<entries; i++)
     734    {
     735        const MCerPhotPix &pix = (*event)[i];
     736
     737        if (!pix.IsPixelUsed())
     738            continue;
     739
     740        SetPixColorRatio(pix, min, max);
     741    }
     742
     743    //
     744    // Update display physically
     745    //
     746    fDrawingPad->Modified();
     747    fDrawingPad->Update();
     748}
     749
     750// ------------------------------------------------------------------------
     751//
     752// Draw the colors in respect to the cleaning levels
     753//
     754void MCamDisplay::DrawLevels(const MCerPhotEvt *event, Float_t lvl1, Float_t lvl2)
     755{
     756    if (!event)
     757        return;
     758
     759    if (!fDrawingPad)
     760        Draw();
     761
     762    fDrawingPad->cd();
     763
     764    for (int i=0; i<kItemsLegend; i++)
     765        GetBox(i)->SetFillColor(fColors[i]);
     766
     767    //
     768    // Reset pixel colors to default value
     769    //
     770    Reset();
     771
     772    //
     773    //   update the colors in the picture
     774    //
     775    const Int_t entries = event->GetNumPixels();
     776
     777    for (Int_t i=0; i<entries; i++)
     778    {
     779        const MCerPhotPix &pix = (*event)[i];
     780
     781        if (!pix.IsPixelUsed())
     782            continue;
     783
     784        SetPixColorLevel(pix, lvl1, lvl2);
     785    }
     786
     787    //
     788    // Update display physically
     789    //
     790    fDrawingPad->Modified();
     791    fDrawingPad->Update();
     792}
     793
     794// ------------------------------------------------------------------------
     795//
     796// Draw the colors in respect to the cleaning levels
     797//
     798void MCamDisplay::DrawLevels(const MCerPhotEvt *event, const MImgCleanStd &clean)
     799{
     800    DrawLevels(event, clean.GetCleanLvl1(), clean.GetCleanLvl2());
    483801}
    484802
     
    504822//   with 0 up to 49.
    505823//
    506 Int_t MCamDisplay::GetColor(Float_t val)
     824Int_t MCamDisplay::GetColor(Float_t val, Float_t min, Float_t max)
    507825{
    508826    //
     
    511829    const Int_t maxcolidx = kItemsLegend-1;
    512830
    513     if (val >= fMaxPhe)
     831    if (val >= max)
    514832        return fColors[maxcolidx];
    515833
    516     if (val <= fMinPhe)
     834    if (val <= min)
    517835        return fColors[0];
    518836
     
    520838    // calculate the color index
    521839    //
    522     const Float_t ratio  = (val-fMinPhe) / (fMaxPhe-fMinPhe);
     840    const Float_t ratio  = (val-min) / (max-min);
    523841    const Int_t   colidx = (Int_t)(ratio*maxcolidx + .5);
    524842
     
    531849//    Display
    532850//
    533 void MCamDisplay::UpdateLegend()
     851void MCamDisplay::UpdateLegend(Float_t minphe, Float_t maxphe)
    534852{
    535853    char text[10];
     
    537855    for (Int_t i=0; i<kItemsLegend; i+=3)
    538856    {
    539         const Float_t val = fMinPhe + (Float_t)i/kItemsLegend * (fMaxPhe-fMinPhe) ;
     857        const Float_t val = minphe + (Float_t)i/kItemsLegend * (maxphe-minphe) ;
    540858
    541859        sprintf(text, "%5.1f", val);
  • trunk/MagicSoft/Mars/mgui/MCamDisplay.h

    r1426 r1540  
    1111class TBox;
    1212class TText;
     13class TArrow;
    1314class TVirtualPad;
    1415
     
    1718class MCerPhotEvt;
    1819class MCerPhotPix;
     20class MImgCleanStd;
     21class MPedestalPix;
     22class MPedestalCam;
    1923
    2024class MCamDisplay : public TObject
     
    2832    Float_t        fRange;       // the range in millimeters of the present geometry
    2933
    30     Float_t        fMinPhe;      // The minimal number of Phe
    31     Float_t        fMaxPhe;      // The maximum number of Phe
     34    Int_t          fColors[50];
    3235
    33     Int_t          fColors[50];
     36    TArrow        *fArrowX;      // Coordinate System
     37    TArrow        *fArrowY;      // Coordinate System
     38
     39    TText         *fLegRadius;   // Coordinate System
     40    TText         *fLegDegree;   // Coordinate System
    3441
    3542    TClonesArray  *fPixels;      // array of all hexagons
     
    4754    MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
    4855
    49     void  SetPixColor(const MCerPhotPix &pix, const Int_t i);
    50     Int_t GetColor(Float_t wert);
     56    void  SetPixColor(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max);
     57    void  SetPixColorRatio(const MCerPhotPix &pix, Float_t min, Float_t max);
     58    void  SetPixColorLevel(const MCerPhotPix &pix, Float_t lvl1, Float_t lvl2);
     59    void  SetPixColorError(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max);
     60    void  SetPixColorPedestal(const MPedestalPix &pix, Int_t i, Float_t min, Float_t max);
     61    Int_t GetColor(Float_t val, Float_t min, Float_t max);
    5162
    52     void UpdateLegend();
     63    void UpdateLegend(Float_t min, Float_t max);
    5364    void Paint(Option_t *option="");
    5465
     
    5970    void SetAutoScale(Bool_t input=kTRUE) { fAutoScale = input; }
    6071    void DrawPhotNum(const MCerPhotEvt *event);
     72    void DrawRatio(const MCerPhotEvt *event);
     73    void DrawLevels(const MCerPhotEvt *event, Float_t lvl1, Float_t lvl2);
     74    void DrawErrorPhot(const MCerPhotEvt *event);
     75    void DrawLevels(const MCerPhotEvt *event, const MImgCleanStd &clean);
     76    void DrawPedestals(const MPedestalCam *event);
    6177
    6278    void DrawPixelNumbers();
  • trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc

    r1489 r1540  
    155155void MHHillasSrc::SetMm2Deg(Float_t mmdeg)
    156156{
    157     if (mmdeg<0)
    158     {
    159         *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;
     157    if (mmdeg<=0)
     158    {
     159        *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl;
    160160        return;
    161161    }
    162162
    163     if (fMm2Deg>=0)
     163    if (fMm2Deg>0)
    164164        *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
    165165
  • trunk/MagicSoft/Mars/mhist/MHStarMap.cc

    r1524 r1540  
    119119    {
    120120        float r = geom ? geom->GetMaxRadius() : 600;
    121         r *= 2./3;
     121        r *= 5./6;
    122122        if (!fUseMmScale)
    123123            r *= fMm2Deg;
  • trunk/MagicSoft/Mars/mmain/MMars.cc

    r1330 r1540  
    111111}
    112112
    113 void MMars::CreateTextButton(TGVerticalFrame *tab, const char *text,
    114                              const UInt_t id, TGLayoutHints *hints) const
     113#include <TGLabel.h>
     114
     115void MMars::CreateTextButton(TGVerticalFrame *tab,
     116                             const char *text, const char *descr,
     117                             const UInt_t id) const
    115118{
    116119    //
    117120    // Create the button
    118121    //
    119     TGTextButton *button = new TGTextButton(tab, text, id);
     122    TGHorizontalFrame *frame  = new TGHorizontalFrame(tab, 1, 1);
     123    TGTextButton      *button = new TGTextButton(frame, text, id);
     124    TGLabel           *label  = new TGLabel(frame, descr);
     125    TGLayoutHints     *hints1 = new TGLayoutHints(kLHintsLeft|kLHintsCenterY|kLHintsExpandX, 5, 5, 2, 2);
    120126
    121127    //
    122128    // Add button for 'auto-delete'
    123129    //
     130    fList->Add(hints1);
    124131    fList->Add(button);
     132    fList->Add(label);
     133    fList->Add(frame);
    125134
    126135    //
     
    132141    // Add button with corresponding layout to containing frame
    133142    //
    134     tab->AddFrame(button, hints);
     143    tab->AddFrame(frame,    hints1);
     144    frame->AddFrame(button, hints1);
     145    frame->AddFrame(label,  hints1);
    135146}
    136147
     
    143154    fList->Add(laytabs);
    144155
    145     TGTab *tabs = new TGTab(low, 400, 400);
     156    TGTab *tabs = new TGTab(low, 1, 1);
    146157    fList->Add(tabs);
    147158    low->AddFrame(tabs, laytabs);
     
    152163    TGCompositeFrame *tf = tabs->AddTab("Control");
    153164
    154     TGVerticalFrame *tab1 = new TGVerticalFrame(tf, 300, 100);
    155     TGVerticalFrame *tab2 = new TGVerticalFrame(tf, 300, 100);
    156 
    157     fList->Add(tab1);
    158     fList->Add(tab2);
    159 
    160     TGLayoutHints *laytabx = new TGLayoutHints(kLHintsTop|kLHintsExpandX);
    161     fList->Add(laytabx);
    162 
    163     tf->AddFrame(tab1, laytabx);
    164     tf->AddFrame(tab2, laytabx);
    165 
    166     TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsCenterX, 10, 10, 10, 10);
    167     fList->Add(laybut);
    168 
    169     CreateTextButton(tab2, "Event Display",  kButEvtDisplay,    laybut);
    170     CreateTextButton(tab2, "Data Check",     kButDataCheck,  laybut);
    171     CreateTextButton(tab2, "Analysis",       kButAnalysis,    laybut);
    172     CreateTextButton(tab2, "Monte Carlo",    kButMonteCarlo, laybut);
    173     CreateTextButton(tab2, "Camera Display", kButCameraDisplay, laybut);
     165    TGLayoutHints   *laytab = new TGLayoutHints(kLHintsCenterY|kLHintsExpandX);
     166    TGVerticalFrame *tab    = new TGVerticalFrame(tf, 1, 1);
     167    fList->Add(laytab);
     168    fList->Add(tab);
     169
     170    CreateTextButton(tab, "Event Display",  "Historgrams: Pix per Event",
     171                     kButEvtDisplay);
     172    CreateTextButton(tab, "Data Check",     "Histograms: Pix per Run",
     173                     kButDataCheck);
     174    CreateTextButton(tab, "Analysis",       "Calculate image parameters",
     175                     kButAnalysis);
     176    CreateTextButton(tab, "Monte Carlo",    "Calculate MC stuff",
     177                     kButMonteCarlo);
     178    CreateTextButton(tab, "Camera Display", "Display Cerenekov Photons",
     179                     kButCameraDisplay);
     180
     181    tf->AddFrame(tab, laytab);
    174182}
    175183
    176184MMars::MMars()
    177 : TGMainFrame(gClient->GetRoot(), 330, 400, kVerticalFrame|kFixedSize)
     185: TGMainFrame(gClient->GetRoot(), 400, 400, kVerticalFrame)
    178186{
    179187    //
     
    191199    // create and layout the frame/contents
    192200    //
    193     TGHorizontalFrame *top = new TGHorizontalFrame(this, 300, 100);
    194     TGHorizontalFrame *low = new TGHorizontalFrame(this, 300, 100);
     201    TGHorizontalFrame *top = new TGHorizontalFrame(this, 1, 1);
     202    TGHorizontalFrame *low = new TGHorizontalFrame(this, 1, 1);
    195203
    196204    TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this);
     
    203211    CreateBottomFrame(low);
    204212
    205     TGLayoutHints *layout = new TGLayoutHints(kLHintsTop|kLHintsExpandX);
    206     fList->Add(layout);
    207 
    208     AddFrame(top,     layout);
    209     AddFrame(linesep, layout);
    210     AddFrame(low,     layout);
    211 
    212     //    CreateTopFrame(fTop2);
    213     //    CreateBottomFrame(fTop3);
     213    TGLayoutHints *layout1 = new TGLayoutHints(kLHintsTop|kLHintsExpandX);
     214    TGLayoutHints *layout2 = new TGLayoutHints(kLHintsTop|kLHintsExpandX|kLHintsExpandY);
     215    fList->Add(layout1);
     216    fList->Add(layout2);
     217
     218    AddFrame(top,     layout1);
     219    AddFrame(linesep, layout1);
     220    AddFrame(low,     layout2);
    214221
    215222    //
    216223    //   Map the window, set up the layout, etc.
    217     //   kFixedSize seems to be ignored
    218     //
    219     SetWMSizeHints(GetWidth(), GetHeight(), GetWidth(), GetHeight(), 0, 0);  // set the smallest and biggest size of the Main frame
     224    //
    220225    Move(rand()%100, rand()%100);
    221226
     227    Layout();
     228
    222229    MapSubwindows();
    223 
    224     Layout();
    225230
    226231    SetWindowName("MARS Main Window");
  • trunk/MagicSoft/Mars/mmain/MMars.h

    r1108 r1540  
    2121
    2222    void CreateTextButton(TGVerticalFrame *tab, const char *text,
    23                           const UInt_t id, TGLayoutHints *hints) const;
     23                          const char *descr, const UInt_t id) const;
    2424
    2525    void CreateMenuBar();
  • trunk/MagicSoft/Mars/mmain/MProgressBar.cc

    r1527 r1540  
    5353    fList->SetOwner();
    5454
     55    //SetMWMHints(0, 0, 0);
     56
    5557    SetWMSizeHints(150, 15, 640, 480, 10, 10); // set the smallest and biggest size of the Main frame
    5658    Move(rand()%100+50, rand()%100+50);
Note: See TracChangeset for help on using the changeset viewer.