Changeset 8399 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/12/07 14:08:56 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mgeom
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.cc

    r8385 r8399  
    2020!   Author(s): Markus Gaug      03/2004 <mailto:markus@ifae.es>
    2121!
    22 !   Copyright: MAGIC Software Development, 2000-2005
     22!   Copyright: MAGIC Software Development, 2000-2007
    2323!
    2424\* ======================================================================== */
     
    4848// ----------
    4949//  - added fNumAreas
     50//  - added fNumSectors
     51//
     52// Version 4:
     53// ----------
     54//  - added fMaxRadius
     55//  - added fMinRadius
     56//
     57// Version 5:
     58// ----------
     59//  - added fNumPixInSector
     60//  - added fNumPixWithAidx
     61//  - removed fNumSectors
     62//  - removed fNumAreas
    5063//
    5164/////////////////////////////////////////////////////////////////////////////
     
    7285MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title)
    7386    : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)),
    74       fPixels(npix), fMaxRadius(1), fMinRadius(1), fPixRatio(npix), fPixRatioSqrt(npix)
     87    fPixels(npix), fMaxRadius(1), fMinRadius(1), fPixRatio(npix), fPixRatioSqrt(npix)
    7588{
    7689    fName  = name  ? name  : "MGeomCam";
     
    145158void MGeomCam::CalcNumSectors()
    146159{
    147     fNumSectors = 0;
    148 
    149160    for (UInt_t i=0; i<fNumPixels; i++)
    150161    {
    151162        const Int_t s = (*this)[i].GetSector();
    152163
    153         if (s>fNumSectors)
    154             fNumSectors = s;
    155     }
    156 
    157     fNumSectors++;
     164        if (s>=fNumPixInSector.GetSize())
     165            fNumPixInSector.Set(s+1);
     166
     167        fNumPixInSector[s]++;
     168    }
    158169}
    159170
     
    165176void MGeomCam::CalcNumAreas()
    166177{
    167     fNumAreas = 0;
    168 
    169178    for (UInt_t i=0; i<fNumPixels; i++)
    170179    {
    171180        const Int_t s = (*this)[i].GetAidx();
    172181
    173         if (s>fNumAreas)
    174             fNumAreas = s;
    175     }
    176 
    177     fNumAreas++;
     182        if (s>=fNumPixWithAidx.GetSize())
     183            fNumPixWithAidx.Set(s+1);
     184
     185        fNumPixWithAidx[s]++;
     186    }
    178187}
    179188
     
    184193void MGeomCam::CalcMaxRadius()
    185194{
    186     fMaxRadius.Set(fNumAreas+1);
    187     fMinRadius.Set(fNumAreas+1);
    188 
    189     for (Int_t i=0; i<fNumAreas+1; i++)
     195    fMaxRadius.Set(GetNumAreas()+1);
     196    fMinRadius.Set(GetNumAreas()+1);
     197
     198    for (UInt_t i=0; i<GetNumAreas()+1; i++)
    190199    {
    191200        fMaxRadius[i] = 0.;
     
    299308Float_t MGeomCam::GetMaxRadius(const Int_t i) const
    300309{
    301     return i<-1 || i>fNumAreas ? -1 : fMaxRadius[i+1];
     310    return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMaxRadius[i+1];
    302311}
    303312
     
    308317Float_t MGeomCam::GetMinRadius(const Int_t i) const
    309318{
    310     return i<-1 || i>fNumAreas ? -1 : fMinRadius[i+1];
     319    return i<-1 || i>=(Int_t)GetNumAreas() ? -1 : fMinRadius[i+1];
    311320}
    312321
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.h

    r7360 r8399  
    1111#include <TArrayF.h>
    1212#endif
     13#ifndef ROOT_TArrayS
     14#include <TArrayS.h>
     15#endif
    1316
    1417class TVector2;
     
    1922{
    2023private:
    21     UInt_t    fNumPixels;    // Number of pixels in this camera
     24    UInt_t    fNumPixels;       // Number of pixels in this camera
    2225
    23     Float_t   fCamDist;      // [m] Average distance of the camera from the mirror
    24     Float_t   fConvMm2Deg;   // conversion factor to convert mm in the camera plain into degrees
     26    Float_t   fCamDist;         // [m] Average distance of the camera from the mirror
     27    Float_t   fConvMm2Deg;      // conversion factor to convert mm in the camera plain into degrees
    2528
    26     TObjArray fPixels;       // Array of singel pixels storing the geometry
     29    TObjArray fPixels;          // Array of singel pixels storing the geometry
    2730
    28     TArrayF   fMaxRadius;    // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)
    29     TArrayF   fMinRadius;    // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)   
    30     TArrayF   fPixRatio;     // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)
    31     TArrayF   fPixRatioSqrt; // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)
     31    TArrayF   fMaxRadius;       // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)
     32    TArrayF   fMinRadius;       // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)
     33    TArrayF   fPixRatio;        // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)
     34    TArrayF   fPixRatioSqrt;    // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)
    3235
    33     Int_t     fNumSectors;   // Number of sectors
    34     Int_t     fNumAreas;     // Number of different pixel sizes
     36    TArrayS   fNumPixInSector;  // Number of pixels in sector
     37    TArrayS   fNumPixWithAidx;  // Number of pixels with one pixel sizes
     38
     39//    Int_t     fNumSectors;      // Number of sectors
     40//    Int_t     fNumAreas;        // Number of different pixel sizes
    3541
    3642protected:
     
    7177    Float_t GetAngle(UShort_t i, UShort_t j=0) const;
    7278
    73     UInt_t  GetNumSectors()                const  { return fNumSectors; }
    74     UInt_t  GetNumAreas()                  const  { return fNumAreas; }
    75     Float_t GetPixRatio(UInt_t i)          const;
    76     Float_t GetPixRatioSqrt(UInt_t i)      const;
     79    Float_t GetPixRatio(UInt_t i) const;
     80    Float_t GetPixRatioSqrt(UInt_t i) const;
     81
     82    UInt_t  GetNumSectors() const { return fNumPixInSector.GetSize(); }
     83    UInt_t  GetNumAreas() const { return fNumPixWithAidx.GetSize(); }
     84
     85    UShort_t GetNumPixInSector(UInt_t i) const { return (UShort_t)fNumPixInSector[i]; }
     86    UShort_t GetNumPixWithAidx(UInt_t i) const { return (UShort_t)fNumPixWithAidx[i]; }
    7787
    7888    MGeomPix &operator[](Int_t i);
     
    94104    virtual void Print(Option_t *opt=NULL)   const;
    95105
    96     ClassDef(MGeomCam, 4)  // Geometry base class for the camera
     106    ClassDef(MGeomCam, 5)  // Geometry base class for the camera
    97107};
    98108
Note: See TracChangeset for help on using the changeset viewer.