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