Changeset 9369 for trunk/MagicSoft/Mars/mgeom/MGeomPix.h
- Timestamp:
- 03/01/09 21:54:27 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgeom/MGeomPix.h
r9259 r9369 2 2 #define MARS_MGeomPix 3 3 4 #ifndef MARS_M ParContainer5 #include "M ParContainer.h"4 #ifndef MARS_MGeom 5 #include "MGeom.h" 6 6 #endif 7 7 8 class MGeomCam; 9 class TVector2; 10 class TOrdCollection; 11 12 13 class MGeomPix : public MParContainer 8 class MGeomPix : public MGeom 14 9 { 15 10 public: … … 17 12 static const Float_t gsTan30; // tan(30/kRad2Deg); 18 13 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); 27 16 28 17 private: 29 enum {30 kIsInOutermostRing = 0,31 kIsInOuterRing = 1,32 };33 34 Float_t fX; // [mm] the x coordinate of the center35 Float_t fY; // [mm] the y coordinate of the center36 18 Float_t fD; // [mm] the d coordinate of the pixel (dist between two parallel sides) 37 Float_t fA; // [mm^2] Area of the pixel38 39 Byte_t fNumNeighbors; // number of valid neighbors40 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 to43 UInt_t fAidx; // Area index of the pixel44 45 Byte_t fUserBits;46 19 47 20 public: … … 51 24 { 52 25 MGeomPix &pix = (MGeomPix&)obj; 53 pix.fX = fX; 54 pix.fY = fY; 26 55 27 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];63 28 29 MGeom::Copy(obj); 64 30 TObject::Copy(obj); 65 31 } 66 32 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 67 43 void Print(Option_t *opt=NULL) const; 68 44 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 108 46 }; 109 47
Note:
See TracChangeset
for help on using the changeset viewer.