source: trunk/Mars/mgeom/MGeom.h@ 19344

Last change on this file since 19344 was 10089, checked in by tbretz, 14 years ago
Added a new abstract function GetL() to MGeom.
File size: 3.0 KB
Line 
1#ifndef MARS_MGeom
2#define MARS_MGeom
3
4#ifndef ROOT_TObject
5#include <TObject.h>
6#endif
7
8class MGeomCam;
9
10class TAttLine;
11class TAttFill;
12class TVector2;
13
14class MGeom : public TObject
15{
16public:
17 enum {
18 kRightTop,
19 kRight,
20 kRightBottom,
21 kLeftBottom,
22 kLeft,
23 kLeftTop,
24 kTop,
25 kBottom
26 };
27
28private:
29 enum {
30 kIsInOutermostRing = 0,
31 kIsInOuterRing = 1,
32 };
33
34protected:
35 Float_t fX; // [mm] the x coordinate of the center
36 Float_t fY; // [mm] the y coordinate of the center
37 Float_t fA; // [mm^2] Area of the pixel
38
39 UInt_t fSector; // Number of sector the pixels corresponds to
40 UInt_t fAidx; // Area index of the pixel
41
42protected:
43 Byte_t fNumNeighbors; // number of valid neighbors
44 Short_t fNeighbors[6]; // the IDs of the pixel next to it (we are assuming an hexagonal geometry)
45
46 Byte_t fUserBits;
47
48public:
49 MGeom(Float_t x=0, Float_t y=0, UInt_t s=0, UInt_t aidx=0);
50
51 void Copy(TObject &obj) const
52 {
53 MGeom &pix = (MGeom&)obj;
54 pix.fX = fX;
55 pix.fY = fY;
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
64 TObject::Copy(obj);
65 }
66
67 void Print(Option_t *opt=NULL) const;
68
69 void Set(Float_t x, Float_t y, UInt_t s=0, UInt_t aidx=0) { fX=x; fY=y; fSector=s; fAidx=aidx; }
70 void SetP(Float_t x, Float_t y) { fX=x; fY=y; }
71 void SetP(const TVector2 &v);
72
73 void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1,
74 Short_t i3=-1, Short_t i4=-1, Short_t i5=-1);
75
76 void CheckOuterRing(const MGeomCam &cam);
77
78 Float_t GetX() const { return fX; }
79 Float_t GetY() const { return fY; }
80
81 virtual Float_t GetL() const = 0; // Length of a side to a neighbor
82 virtual Float_t GetT() const = 0; // Maximum elongation
83
84 UInt_t GetSector() const { return fSector; }
85
86 TVector2 GetP() const;
87
88 Float_t GetDist() const;
89 Float_t GetDist(const MGeom &pix) const;
90 Float_t GetDist2(const MGeom &pix) const;
91 Float_t GetAngle(const MGeom &pix) const;
92
93 Float_t GetA() const { return fA; /*fD*fD*gsTan60/2;*/ }
94 Int_t GetAidx() const { return fAidx; }
95
96 Byte_t GetNumNeighbors() const { return fNumNeighbors; }
97 Short_t GetNeighbor(Byte_t i) const { return fNeighbors[i]; }
98
99 Bool_t IsInOutermostRing() const { return TESTBIT(fUserBits, kIsInOutermostRing); }
100 Bool_t IsInOuterRing() const { return TESTBIT(fUserBits, kIsInOuterRing); }
101
102 virtual Bool_t IsInside(Float_t px, Float_t py) const = 0;
103 Int_t GetDirection(const MGeom &pix) const;
104
105 Int_t DistancetoPrimitive(Int_t px, Int_t py);
106
107 virtual void PaintPrimitive(const TAttLine &line, const TAttFill &fill, Double_t scalexy=1, Double_t scaled=1) const = 0;
108
109 ClassDef(MGeom, 1) // Geometry class describing the basics of a pixel
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.