1 | #ifndef MARS_MGeomCam
|
---|
2 | #define MARS_MGeomCam
|
---|
3 |
|
---|
4 | #ifndef MARS_MParContainer
|
---|
5 | #include "MParContainer.h"
|
---|
6 | #endif
|
---|
7 | #ifndef ROOT_TObjArray
|
---|
8 | #include <TObjArray.h>
|
---|
9 | #endif
|
---|
10 | #ifndef ROOT_TArrayF
|
---|
11 | #include <TArrayF.h>
|
---|
12 | #endif
|
---|
13 |
|
---|
14 | class TVector2;
|
---|
15 | class TArrayI;
|
---|
16 | class MGeomPix;
|
---|
17 |
|
---|
18 | class MGeomCam : public MParContainer
|
---|
19 | {
|
---|
20 | private:
|
---|
21 | UInt_t fNumPixels; // Number of pixels in this camera
|
---|
22 |
|
---|
23 | Float_t fCamDist; // [m] Average distance of the camera from the mirror
|
---|
24 | Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees
|
---|
25 |
|
---|
26 | TObjArray fPixels; // Array of singel pixels storing the geometry
|
---|
27 |
|
---|
28 | TArrayF fMaxRadius; // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)
|
---|
29 | TArrayF fMinRadius; // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)
|
---|
30 | TArrayF fPixRatio; // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)
|
---|
31 | TArrayF fPixRatioSqrt; // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)
|
---|
32 |
|
---|
33 | Int_t fNumSectors; // Number of sectors
|
---|
34 | Int_t fNumAreas; // Number of different pixel sizes
|
---|
35 |
|
---|
36 | protected:
|
---|
37 | void CalcMaxRadius();
|
---|
38 | void CalcNumSectors();
|
---|
39 | void CalcNumAreas();
|
---|
40 | void InitOuterRing();
|
---|
41 | void SortNeighbors();
|
---|
42 |
|
---|
43 | public:
|
---|
44 | MGeomCam(UInt_t npix=0, Float_t dist=1, const char *name=NULL, const char *title=NULL);
|
---|
45 |
|
---|
46 | virtual TObject *Clone(const char *newname=NULL) const;
|
---|
47 |
|
---|
48 | void CalcPixRatio();
|
---|
49 | // FIXME, workaround: this function is made public just to allow
|
---|
50 | // the use of some camera files from the 0.7 beta version in which the
|
---|
51 | // array containing pixel ratios is not initialized.
|
---|
52 | void InitGeometry()
|
---|
53 | {
|
---|
54 | CalcNumSectors();
|
---|
55 | CalcNumAreas();
|
---|
56 | CalcMaxRadius();
|
---|
57 | CalcPixRatio();
|
---|
58 | InitOuterRing();
|
---|
59 | SortNeighbors();
|
---|
60 | }
|
---|
61 |
|
---|
62 | Float_t GetCameraDist() const { return fCamDist; }
|
---|
63 | Float_t GetConvMm2Deg() const { return fConvMm2Deg; }
|
---|
64 |
|
---|
65 | UInt_t GetNumPixels() const { return fNumPixels; }
|
---|
66 |
|
---|
67 | Float_t GetMaxRadius(const Int_t i=-1) const;
|
---|
68 | Float_t GetMinRadius(const Int_t i=-1) const;
|
---|
69 |
|
---|
70 | Float_t GetDist(UShort_t i, UShort_t j=0) const;
|
---|
71 | Float_t GetAngle(UShort_t i, UShort_t j=0) const;
|
---|
72 |
|
---|
73 | UInt_t GetNumSectors() const { return fNumSectors; }
|
---|
74 | UInt_t GetNumAreas() const { return fNumAreas; }
|
---|
75 | Float_t GetPixRatio(UInt_t i) const;
|
---|
76 | Float_t GetPixRatioSqrt(UInt_t i) const;
|
---|
77 |
|
---|
78 | MGeomPix &operator[](Int_t i);
|
---|
79 | MGeomPix &operator[](Int_t i) const;
|
---|
80 |
|
---|
81 | Int_t GetPixelIdx(const TVector2 &v) const;
|
---|
82 | Int_t GetPixelIdxDeg(const TVector2 &v) const;
|
---|
83 | Int_t GetPixelIdxXY(Float_t x, Float_t y) const;
|
---|
84 | Int_t GetPixelIdxXYdeg(Float_t x, Float_t y) const
|
---|
85 | {
|
---|
86 | return GetPixelIdxXY(x/fConvMm2Deg, y/fConvMm2Deg);
|
---|
87 | }
|
---|
88 |
|
---|
89 | void GetNeighbors(TArrayI &arr, UInt_t idx, Float_t r) const;
|
---|
90 | void GetNeighbors(TList &arr, UInt_t idx, Float_t r) const;
|
---|
91 | void GetNeighbors(TArrayI &arr, const MGeomPix &pix, Float_t r) const;
|
---|
92 | void GetNeighbors(TList &arr, const MGeomPix &pix, Float_t r) const;
|
---|
93 |
|
---|
94 | virtual void Print(Option_t *opt=NULL) const;
|
---|
95 |
|
---|
96 | ClassDef(MGeomCam, 4) // Geometry base class for the camera
|
---|
97 | };
|
---|
98 |
|
---|
99 | #endif
|
---|