source: branches/Mars_McMismatchStudy/mgeom/MGeomPix.h@ 18007

Last change on this file since 18007 was 10089, checked in by tbretz, 14 years ago
Added a new abstract function GetL() to MGeom.
File size: 2.0 KB
Line 
1#ifndef MARS_MGeomPix
2#define MARS_MGeomPix
3
4#ifndef MARS_MGeom
5#include "MGeom.h"
6#endif
7
8class MGeomPix : public MGeom
9{
10public:
11 static const Float_t gsTan60; // tan(60/kRad2Deg);
12 static const Float_t gsTan30; // tan(30/kRad2Deg);
13
14 static const Float_t gsCos60; // cos(60/kRad2Deg);
15 static const Float_t gsSin60; // sin(30/kRad2Deg);
16
17private:
18 Float_t fD; // [mm] the d coordinate of the pixel (dist between two parallel sides)
19
20 Double_t fCosPhi;
21 Double_t fSinPhi;
22
23 // Store fD*fCosPhi ???
24 // Store fD*fSinPhi ???
25 // Store array and check if initialized before needed?
26
27public:
28 // Helper to calculate hexagonal geometry
29 enum { kDirCenter, kDirNE, kDirN, kDirNW, kDirSW, kDirS, kDirSE };
30
31 static Double_t CalcXY(Int_t dir, Int_t ring, Int_t i, Double_t &x, Double_t &y);
32
33 // MGeomPix
34 MGeomPix(Float_t x=0, Float_t y=0, Float_t d=1, UInt_t s=0, UInt_t aidx=0);
35
36 // TObject
37 void Copy(TObject &obj) const
38 {
39 MGeomPix &pix = (MGeomPix&)obj;
40
41 pix.fD = fD;
42
43 MGeom::Copy(obj);
44 TObject::Copy(obj);
45 }
46
47 void Print(Option_t *opt=NULL) const;
48
49 // Setter
50 void SetD(Float_t d=1) { fD=d; fA=d*d*gsSin60; }
51 void SetPhi(Double_t phi=0);
52
53 Float_t GetD() const { return fD; } // Distance between two parallel sides
54 Float_t GetL() const { return fD*gsTan30; } // Length of one of the parallel sides
55 Float_t GetT() const { return fD/gsTan60; } // Half distance between two opposite edges (traverse)
56
57 Float_t GetDx() const { return fD; } // Distance of two rows in x-direction (without rotation)
58 Float_t GetDy() const { return fD*gsSin60; } // Distance of two rows in y-direction (without rotation)
59
60 // Helper
61 Bool_t IsInside(Float_t px, Float_t py) const;
62 void PaintPrimitive(const TAttLine &line, const TAttFill &fill, Double_t scalexy=1, Double_t scaled=1) const;
63
64 ClassDef(MGeomPix, 5) // Geometry class describing the geometry of one pixel
65};
66
67#endif
Note: See TracBrowser for help on using the repository browser.