| 1 | #ifndef MARS_MGeomPix
|
|---|
| 2 | #define MARS_MGeomPix
|
|---|
| 3 |
|
|---|
| 4 | #ifndef MARS_MParContainer
|
|---|
| 5 | #include "MParContainer.h"
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | class MGeomCam;
|
|---|
| 9 | class TVector2;
|
|---|
| 10 |
|
|---|
| 11 | class MGeomPix : public MParContainer
|
|---|
| 12 | {
|
|---|
| 13 | public:
|
|---|
| 14 | static const Float_t gsTan60; // tan(60/kRad2Deg);
|
|---|
| 15 | static const Float_t gsTan30; // tan(30/kRad2Deg);
|
|---|
| 16 |
|
|---|
| 17 | enum {
|
|---|
| 18 | kRightTop,
|
|---|
| 19 | kRight,
|
|---|
| 20 | kRightBottom,
|
|---|
| 21 | kLeftBottom,
|
|---|
| 22 | kLeft,
|
|---|
| 23 | kLeftTop
|
|---|
| 24 | };
|
|---|
| 25 |
|
|---|
| 26 | private:
|
|---|
| 27 | enum {
|
|---|
| 28 | kIsInOutermostRing = 0,
|
|---|
| 29 | kIsInOuterRing = 1,
|
|---|
| 30 | };
|
|---|
| 31 |
|
|---|
| 32 | Float_t fX; // [mm] the x coordinate of the center
|
|---|
| 33 | Float_t fY; // [mm] the y coordinate of the center
|
|---|
| 34 | Float_t fD; // [mm] the d coordinate of the pixel (dist between two parallel sides)
|
|---|
| 35 | Float_t fA; // [mm^2] Area of the pixel
|
|---|
| 36 |
|
|---|
| 37 | Byte_t fNumNeighbors; // number of valid neighbors
|
|---|
| 38 | Short_t fNeighbors[6]; // the IDs of the pixel next to it (we are assuming an hexagonal geometry)
|
|---|
| 39 |
|
|---|
| 40 | UInt_t fSector; // Number of sector the pixels corresponds to
|
|---|
| 41 | UInt_t fAidx; // Area index of the pixel
|
|---|
| 42 |
|
|---|
| 43 | Byte_t fUserBits;
|
|---|
| 44 |
|
|---|
| 45 | public:
|
|---|
| 46 | MGeomPix(Float_t x=0, Float_t y=0, Float_t d=1, UInt_t s=0, UInt_t aidx=0);
|
|---|
| 47 |
|
|---|
| 48 | void Copy(TObject &obj) const
|
|---|
| 49 | {
|
|---|
| 50 | MGeomPix &pix = (MGeomPix&)obj;
|
|---|
| 51 | pix.fX = fX;
|
|---|
| 52 | pix.fY = fY;
|
|---|
| 53 | pix.fD = fD;
|
|---|
| 54 | pix.fA = fA;
|
|---|
| 55 | pix.fNumNeighbors = fNumNeighbors;
|
|---|
| 56 | pix.fSector = fSector;
|
|---|
| 57 | pix.fAidx = fAidx;
|
|---|
| 58 | pix.fUserBits = fUserBits;
|
|---|
| 59 | for (int i=0; i<6; i++)
|
|---|
| 60 | pix.fNeighbors[i] = fNeighbors[i];
|
|---|
| 61 |
|
|---|
| 62 | TObject::Copy(obj);
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | void Print(Option_t *opt=NULL) const;
|
|---|
| 66 |
|
|---|
| 67 | 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; }
|
|---|
| 68 |
|
|---|
| 69 | void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1,
|
|---|
| 70 | Short_t i3=-1, Short_t i4=-1, Short_t i5=-1);
|
|---|
| 71 |
|
|---|
| 72 | void CheckOuterRing(const MGeomCam &cam);
|
|---|
| 73 |
|
|---|
| 74 | Float_t GetX() const { return fX; }
|
|---|
| 75 | Float_t GetY() const { return fY; }
|
|---|
| 76 | Float_t GetD() const { return fD; }
|
|---|
| 77 | Float_t GetL() const { return fD*gsTan30; } // Length of one of the parallel sides
|
|---|
| 78 | UInt_t GetSector() const { return fSector; }
|
|---|
| 79 |
|
|---|
| 80 | TVector2 GetP() const;
|
|---|
| 81 |
|
|---|
| 82 | Float_t GetDist() const;
|
|---|
| 83 | Float_t GetDist(const MGeomPix &pix) const;
|
|---|
| 84 | Float_t GetAngle(const MGeomPix &pix) const;
|
|---|
| 85 |
|
|---|
| 86 | Float_t GetA() const { return fA; /*fD*fD*gsTan60/2;*/ }
|
|---|
| 87 | Int_t GetAidx() const { return fAidx; }
|
|---|
| 88 |
|
|---|
| 89 | Byte_t GetNumNeighbors() const { return fNumNeighbors; }
|
|---|
| 90 | Short_t GetNeighbor(Byte_t i) const { return fNeighbors[i]; }
|
|---|
| 91 |
|
|---|
| 92 | Bool_t IsInOutermostRing() const { return TESTBIT(fUserBits, kIsInOutermostRing); }
|
|---|
| 93 | Bool_t IsInOuterRing() const { return TESTBIT(fUserBits, kIsInOuterRing); }
|
|---|
| 94 |
|
|---|
| 95 | Bool_t IsInside(Float_t px, Float_t py) const;
|
|---|
| 96 | Int_t GetDirection(const MGeomPix &pix) const;
|
|---|
| 97 |
|
|---|
| 98 | ClassDef(MGeomPix, 4) // Geometry class describing the geometry of one pixel
|
|---|
| 99 | };
|
|---|
| 100 |
|
|---|
| 101 | #endif
|
|---|