Changeset 4678 for trunk


Ignore:
Timestamp:
08/18/04 10:12:10 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4677 r4678  
    2121
    2222
    23   2004/08/18 : Wolfgang Wittek
    24 
    25     * mastro/MTransCelLocCam.[h,cc]
    26       - new class; allows to calculate for any point (X, Y) in the
    27         camera the local (celestial) coordinates if the local
    28         (celestial) coordinates are known for some fixed point (X0, Y0)
    29         in the camera
    30       - for given local (celestial) coordinates of the camera center,
    31         the meber function PlotGrid draws the lines of constant theta
    32         and phi (and of constant dec and hourangle) onto the camera
    33         plane
    34    
    35     * mastro/Makefile, mastro/AstroLinkDef.h
    36       - MTransCelLocCam added
    37 
    38     * macros/testMTrans.C
    39       - macro to test the class MTransCelLocCam
     23 2004/08/18: Thomas Bretz
     24
     25   * mbadpixels/MBadPixelsCam.[h,cc]:
     26     - implemented function to calculate max cluster sizes
     27
     28
     29
     30 2004/08/18 : Wolfgang Wittek
     31
     32   * mastro/MTransCelLocCam.[h,cc]
     33     - new class; allows to calculate for any point (X, Y) in the
     34       camera the local (celestial) coordinates if the local
     35       (celestial) coordinates are known for some fixed point (X0, Y0)
     36       in the camera
     37     - for given local (celestial) coordinates of the camera center,
     38       the meber function PlotGrid draws the lines of constant theta
     39       and phi (and of constant dec and hourangle) onto the camera
     40       plane
     41
     42   * mastro/Makefile, mastro/AstroLinkDef.h
     43     - MTransCelLocCam added
     44
     45   * macros/testMTrans.C
     46     - macro to test the class MTransCelLocCam
    4047
    4148
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc

    r4658 r4678  
    4242#include "MBadPixelsPix.h"
    4343
     44#include "MGeomCam.h"
     45#include "MGeomPix.h"
     46
    4447ClassImp(MBadPixelsCam);
    4548
     
    163166{
    164167    fArray->ForEach(TObject, Clear)();
     168}
     169
     170// --------------------------------------------------------------------------
     171//
     172// Calculate the number of pixels with the given type-flags.
     173//
     174// The second argument aidx is the area index (see MGeomCam, MGeomPix)
     175// The default (or any value less than 0) means: all
     176//
     177// Returns -1 if the geometry doesn't match.
     178//
     179Short_t MBadPixelsCam::GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx) const
     180{
     181    const UInt_t n = GetSize();
     182
     183    if (aidx>=0 && geom->GetNumPixels()!=n)
     184    {
     185        *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom->ClassName() << ") size mismatch!" << endl;
     186        return -1;
     187    }
     188
     189    Short_t rc = 0;
     190    for (UInt_t i=0; i<n; i++)
     191    {
     192        if (aidx>=0 && (*geom)[i].GetAidx()!=aidx)
     193            continue;
     194
     195        if ((*this)[i].IsUnsuitable(type))
     196            rc++;
     197    }
     198    return rc;
     199}
     200
     201// --------------------------------------------------------------------------
     202//
     203// Calculate the number of pixels which are - under no circumstances -
     204// interpolatable, called isolated. This means that a pixel (its own status
     205// doesn't matter) has less than two reliable neighbor pixels.
     206//
     207// The second argument aidx is the area index (see MGeomCam, MGeomPix)
     208// The default (or any value less than 0) means: all
     209//
     210// Returns -1 if the geometry doesn't match.
     211//
     212Short_t MBadPixelsCam::GetNumIsolated(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx) const
     213{
     214    const Int_t n = geom.GetNumPixels();
     215
     216    if (n!=GetSize())
     217    {
     218        *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom.ClassName() << ") size mismatch!" << endl;
     219        return -1;
     220    }
     221
     222    Short_t rc = 0;
     223    for (int i=0; i<n; i++)
     224    {
     225        const MGeomPix &pix = geom[i];
     226        if (aidx>=0 && pix.GetAidx()!=aidx)
     227            continue;
     228
     229        const Int_t n2 = pix.GetNumNeighbors();
     230
     231        Int_t cnt=0;
     232        for (int j=0; j<n2; j++)
     233        {
     234            const Int_t id2 = pix.GetNeighbor(j);
     235            if (!(*this)[id2].IsUnsuitable(type))
     236                cnt++;
     237        }
     238
     239        if (cnt<2)
     240            rc++;
     241    }
     242    return rc;
     243}
     244
     245// --------------------------------------------------------------------------
     246//
     247// This is a helper function which calculates the size of a single cluster
     248// by iterative calling.
     249//
     250// If a pixel matches the criterias the counter is increased by 1 and
     251// the function is called for all its neighbors. If
     252//
     253// The second argument aidx is the area index (see MGeomCam, MGeomPix)
     254// The default (or any value less than 0) means: all
     255//
     256// Returns -1 if the geometry doesn't match.
     257//
     258Short_t MBadPixelsCam::GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, TObjArray &list, Int_t idx, Int_t aidx) const
     259{
     260    const MGeomPix *pix = (MGeomPix*)list[idx];
     261    if (!pix)
     262        return 0;
     263
     264    if (!(*this)[idx].IsUnsuitable(type))
     265        return 0;
     266
     267    if (aidx>=0 && pix->GetAidx()!=aidx)
     268        return 1;
     269
     270    list.RemoveAt(idx);
     271
     272    Short_t cnt = 1;
     273    const Int_t n = pix->GetNumNeighbors();
     274    for (int i=0; i<n; i++)
     275        cnt += GetNumMaxCluster(type, list, pix->GetNeighbor(i), aidx);
     276
     277    return cnt;
     278}
     279
     280// --------------------------------------------------------------------------
     281//
     282// Returns the size of the biggest cluster with the given USuitableType
     283// type and the given area index.
     284//
     285// The second argument aidx is the area index (see MGeomCam, MGeomPix)
     286// The default (or any value less than 0) means: all
     287//
     288// Returns -1 if the geometry doesn't match.
     289//
     290Short_t MBadPixelsCam::GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx) const
     291{
     292    const Int_t n = geom.GetNumPixels();
     293
     294    if (n!=GetSize())
     295    {
     296        *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom.ClassName() << ") size mismatch!" << endl;
     297        return -1;
     298    }
     299
     300    TObjArray list(n);
     301    for (int i=0; i<n; i++)
     302        list.AddAt(&geom[i], i);
     303
     304    Short_t max = 0;
     305    for (int i=0; i<n; i++)
     306        max = TMath::Max(GetNumMaxCluster(type, list, i, aidx), max);
     307
     308    return max;
    165309}
    166310
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.h

    r3734 r4678  
    22#define MARS_MBadPixelsCam
    33
    4 #ifndef MARS_MParContainer
    5 #include "MParContainer.h"
     4#ifndef MARS_MBadPixelsPix
     5#include "MBadPixelsPix.h"
    66#endif
    77#ifndef MARS_MCamEvent
     
    1010
    1111class TClonesArray;
    12 class MBadPixelsPix;
    1312
    1413class MBadPixelsCam : public MParContainer, public MCamEvent
     
    1615private:
    1716    TClonesArray *fArray; //->
     17
     18    Short_t GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, TObjArray &list, Int_t idx, Int_t aidx) const;
    1819
    1920public:
     
    3435    void Merge(const MBadPixelsCam &cam);
    3536
     37    Short_t GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx=-1) const;
     38    Short_t GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type) const { return GetNumUnsuitable(type, 0); }
     39    Short_t GetNumIsolated(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx=-1) const;
     40    Short_t GetNumIsolated(const MGeomCam &geom, Int_t aidx=-1) const { return GetNumIsolated(MBadPixelsPix::kUnsuitableRun, geom, aidx); }
     41    Short_t GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx=-1) const;
     42    Short_t GetNumMaxCluster(const MGeomCam &geom, Int_t aidx=-1) { return GetNumMaxCluster(MBadPixelsPix::kUnsuitableRun, geom, aidx); }
     43
    3644    void   AsciiRead(ifstream &fin, UInt_t run);
    3745    void   AsciiRead(ifstream &fin) { AsciiRead(fin, 0); }
Note: See TracChangeset for help on using the changeset viewer.