Ignore:
Timestamp:
03/01/09 21:54:27 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mgeom/MGeomPix.h

    r9259 r9369  
    22#define MARS_MGeomPix
    33
    4 #ifndef MARS_MParContainer
    5 #include "MParContainer.h"
     4#ifndef MARS_MGeom
     5#include "MGeom.h"
    66#endif
    77
    8 class MGeomCam;
    9 class TVector2;
    10 class TOrdCollection;
    11 
    12 
    13 class MGeomPix : public MParContainer
     8class MGeomPix : public MGeom
    149{
    1510public:
     
    1712    static const Float_t gsTan30; // tan(30/kRad2Deg);
    1813
    19     enum {
    20         kRightTop,
    21         kRight,
    22         kRightBottom,
    23         kLeftBottom,
    24         kLeft,
    25         kLeftTop
    26     };
     14    static const Float_t gsCos60; // cos(60/kRad2Deg);
     15    static const Float_t gsSin60; // sin(30/kRad2Deg);
    2716
    2817private:
    29     enum {
    30         kIsInOutermostRing = 0,
    31         kIsInOuterRing     = 1,
    32     };
    33 
    34     Float_t fX;            // [mm]   the x coordinate of the center
    35     Float_t fY;            // [mm]   the y coordinate of the center
    3618    Float_t fD;            // [mm]   the d coordinate of the pixel (dist between two parallel sides)
    37     Float_t fA;            // [mm^2] Area of the pixel
    38 
    39     Byte_t  fNumNeighbors; // number of valid neighbors
    40     Short_t fNeighbors[6]; // the IDs of the pixel next to it (we are assuming an hexagonal geometry)
    41 
    42     UInt_t fSector;        // Number of sector the pixels corresponds to
    43     UInt_t fAidx;          // Area index of the pixel
    44 
    45     Byte_t fUserBits;
    4619
    4720public:
     
    5124    {
    5225        MGeomPix &pix = (MGeomPix&)obj;
    53         pix.fX = fX;
    54         pix.fY = fY;
     26
    5527        pix.fD = fD;
    56         pix.fA = fA;
    57         pix.fNumNeighbors = fNumNeighbors;
    58         pix.fSector = fSector;
    59         pix.fAidx = fAidx;
    60         pix.fUserBits = fUserBits;
    61         for (int i=0; i<6; i++)
    62             pix.fNeighbors[i] = fNeighbors[i];
    6328
     29        MGeom::Copy(obj);
    6430        TObject::Copy(obj);
    6531    }
    6632
     33    void SetD(Float_t d=1) { fD=d; fA=d*d*gsTan60/2; }
     34
     35    Float_t GetD() const  { return fD; }         // Distance between two parallel sides
     36    Float_t GetL() const  { return fD*gsTan30; } // Length of one of the parallel sides
     37    Float_t GetT() const  { return fD/gsTan60; } // Distance between two opposite edges (traverse)
     38
     39    Bool_t  IsInside(Float_t px, Float_t py) const;
     40    Float_t DistanceToPrimitive(Float_t px, Float_t py) const;
     41    void    PaintPrimitive(const TAttLine &line, const TAttFill &fill, Double_t scalexy=1, Double_t scaled=1) const;
     42
    6743    void Print(Option_t *opt=NULL) const;
    6844
    69     void Set(Float_t x, Float_t y, Float_t d=1, UInt_t s=0, UInt_t aidx=0) { fX=x; fY=y; fD=d; fA=d*d*gsTan60/2; fSector=s; fAidx=aidx; }
    70 
    71     void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1,
    72                       Short_t i3=-1, Short_t i4=-1, Short_t i5=-1);
    73 
    74     void CheckOuterRing(const MGeomCam &cam);
    75 
    76     Float_t GetX() const  { return fX; }
    77     Float_t GetY() const  { return fY; }
    78     Float_t GetD() const  { return fD; }         // Distance between two parellel sides
    79     Float_t GetL() const  { return fD*gsTan30; } // Length of one of the parallel sides
    80     Float_t GetT() const  { return fD/gsTan60; } // Distance between two opposite edges (traverse)
    81     UInt_t  GetSector() const { return fSector; }
    82 
    83     TVector2 GetP() const;
    84 
    85     Float_t GetDist() const;
    86     Float_t GetDist(const MGeomPix &pix) const;
    87     Float_t GetAngle(const MGeomPix &pix) const;
    88 
    89     Float_t GetA() const    { return fA; /*fD*fD*gsTan60/2;*/ }
    90     Int_t   GetAidx() const { return fAidx; }
    91 
    92     Byte_t  GetNumNeighbors() const { return fNumNeighbors; }
    93     Short_t GetNeighbor(Byte_t i) const { return fNeighbors[i]; }
    94 
    95     Bool_t IsInOutermostRing() const { return TESTBIT(fUserBits, kIsInOutermostRing); }
    96     Bool_t IsInOuterRing() const     { return TESTBIT(fUserBits, kIsInOuterRing); }
    97 
    98     Bool_t IsInside(Float_t px, Float_t py) const;
    99     Int_t  GetDirection(const MGeomPix &pix) const;
    100 
    101     virtual Float_t DistanceToPrimitive(Float_t px, Float_t py) const;
    102     //void GetIntersectionBorder(TOrdCollection &col, const MGeomPix &hex) const;
    103     //Double_t CalcOverlapArea(const MGeomPix &cam) const;
    104 
    105     //TObject *GetGraphics() { return new MHexagon(*this); }
    106 
    107     ClassDef(MGeomPix, 4) // Geometry class describing the geometry of one pixel
     45    ClassDef(MGeomPix, 5) // Geometry class describing the geometry of one pixel
    10846};
    10947
Note: See TracChangeset for help on using the changeset viewer.