source: trunk/MagicSoft/Mars/mgeom/MGeom.h@ 9384

Last change on this file since 9384 was 9368, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.9 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
42private:
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
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
79 virtual Float_t GetT() const = 0; // Maximum elongation
80
81 UInt_t GetSector() const { return fSector; }
82
83 TVector2 GetP() const;
84
85 Float_t GetDist() const;
86 Float_t GetDist(const MGeom &pix) const;
87 Float_t GetAngle(const MGeom &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 virtual Bool_t IsInside(Float_t px, Float_t py) const = 0;
99 Int_t GetDirection(const MGeom &pix) const;
100
101 virtual Float_t DistanceToPrimitive(Float_t px, Float_t py) const = 0;
102 Int_t DistancetoPrimitive(Int_t px, Int_t py);
103
104 virtual void PaintPrimitive(const TAttLine &line, const TAttFill &fill, Double_t scalexy=1, Double_t scaled=1) const = 0;
105
106 ClassDef(MGeom, 1) // Geometry class describing the basics of a pixel
107};
108
109#endif
Note: See TracBrowser for help on using the repository browser.