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 |
|
---|
38 | void CalcMaxRadius();
|
---|
39 | void CalcNumSectors();
|
---|
40 | void CalcNumAreas();
|
---|
41 | void InitOuterRing();
|
---|
42 |
|
---|
43 |
|
---|
44 | public:
|
---|
45 | MGeomCam();
|
---|
46 | MGeomCam(UInt_t npix, Float_t dist, const char *name=NULL, const char *title=NULL);
|
---|
47 |
|
---|
48 | virtual TObject *Clone(const char *newname=NULL) const;
|
---|
49 |
|
---|
50 | void CalcPixRatio();
|
---|
51 | // FIXME, workaround: this function is made public just to allow
|
---|
52 | // the use of some camera files from the 0.7 beta version in which the
|
---|
53 | // array containing pixel ratios is not initialized.
|
---|
54 | void InitGeometry()
|
---|
55 | {
|
---|
56 | CalcNumSectors();
|
---|
57 | CalcNumAreas();
|
---|
58 | CalcMaxRadius();
|
---|
59 | CalcPixRatio();
|
---|
60 | InitOuterRing();
|
---|
61 | }
|
---|
62 |
|
---|
63 | Float_t GetCameraDist() const { return fCamDist; }
|
---|
64 | Float_t GetConvMm2Deg() const { return fConvMm2Deg; }
|
---|
65 |
|
---|
66 | UInt_t GetNumPixels() const { return fNumPixels; }
|
---|
67 |
|
---|
68 | Float_t GetMaxRadius(const Int_t i=-1) const;
|
---|
69 | Float_t GetMinRadius(const Int_t i=-1) const;
|
---|
70 |
|
---|
71 | UInt_t GetNumSectors() const { return fNumSectors; }
|
---|
72 | UInt_t GetNumAreas() const { return fNumAreas; }
|
---|
73 | Float_t GetPixRatio(UInt_t i) const;
|
---|
74 | Float_t GetPixRatioSqrt(UInt_t i) const;
|
---|
75 |
|
---|
76 | MGeomPix &operator[](Int_t i);
|
---|
77 | MGeomPix &operator[](Int_t i) const;
|
---|
78 |
|
---|
79 | Int_t GetPixelIdx(const TVector2 &v) const;
|
---|
80 | Int_t GetPixelIdxDeg(const TVector2 &v) const;
|
---|
81 | Int_t GetPixelIdxXY(Float_t x, Float_t y) const;
|
---|
82 | Int_t GetPixelIdxXYdeg(Float_t x, Float_t y) const
|
---|
83 | {
|
---|
84 | return GetPixelIdxXY(x/fConvMm2Deg, y/fConvMm2Deg);
|
---|
85 | }
|
---|
86 |
|
---|
87 | void GetNeighbors(TArrayI &arr, UInt_t idx, Float_t r) const;
|
---|
88 | void GetNeighbors(TList &arr, UInt_t idx, Float_t r) const;
|
---|
89 | void GetNeighbors(TArrayI &arr, const MGeomPix &pix, Float_t r) const;
|
---|
90 | void GetNeighbors(TList &arr, const MGeomPix &pix, Float_t r) const;
|
---|
91 |
|
---|
92 | virtual void Print(Option_t *opt=NULL) const;
|
---|
93 |
|
---|
94 | ClassDef(MGeomCam, 4) // Geometry base class for the camera
|
---|
95 | };
|
---|
96 |
|
---|
97 | #endif
|
---|