source: branches/Mars_use_drstimefiles/mgeom/MGeomCam.h@ 18302

Last change on this file since 18302 was 15256, checked in by tbretz, 12 years ago
Removed some unsused parameters from the header to avoid compiler warnings.
File size: 4.4 KB
Line 
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#ifndef MARS_MQuaternion
17#include "MQuaternion.h"
18#endif
19
20class TVector2;
21class TArrayI;
22class MGeom;
23
24class MGeomCam : public MParContainer
25{
26private:
27 UInt_t fNumPixels; // Number of pixels in this camera
28
29 Float_t fCamDist; // [m] Average distance of the camera from the mirror
30 Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees
31
32 TObjArray fPixels; // Array of singel pixels storing the geometry
33
34 TArrayF fMaxRadius; // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)
35 TArrayF fMinRadius; // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)
36 TArrayF fPixRatio; // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)
37 TArrayF fPixRatioSqrt; // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)
38
39 TArrayS fNumPixInSector; // Number of pixels in sector
40 TArrayS fNumPixWithAidx; // Number of pixels with one pixel sizes
41
42// Int_t fNumSectors; // Number of sectors
43// Int_t fNumAreas; // Number of different pixel sizes
44
45 void CalcMaxRadius();
46 void CalcNumSectors();
47 void CalcNumAreas();
48 void InitOuterRing();
49
50 virtual void CreateNN();
51
52protected:
53 void SortNeighbors();
54
55public:
56 MGeomCam(UInt_t npix=0, Float_t dist=1, const char *name=NULL, const char *title=NULL);
57 MGeomCam(const MGeomCam &cam) : MParContainer(cam) { cam.Copy(*this); }
58
59 TObject *Clone(const char *name="") const;
60 void Copy(TObject &o) const;
61
62 // FIXME, workaround: this function is made public just to allow
63 // the use of some camera files from the 0.7 beta version in which the
64 // array containing pixel ratios is not initialized.
65 void CalcPixRatio();
66
67 // FIXME, workaround broken streaming
68 void StreamerWorkaround();
69
70 void InitGeometry()
71 {
72 CreateNN();
73 CalcNumSectors();
74 CalcNumAreas();
75 CalcMaxRadius();
76 CalcPixRatio();
77 InitOuterRing();
78 }
79
80 Float_t GetCameraDist() const { return fCamDist; }
81 Float_t GetConvMm2Deg() const { return fConvMm2Deg; }
82
83 UInt_t GetNumPixels() const { return fNumPixels; }
84
85 Float_t GetMaxRadius() const;
86 Float_t GetMinRadius() const;
87 Float_t GetMaxRadius(const Int_t i) const;
88 Float_t GetMinRadius(const Int_t i) const;
89
90 Float_t GetDist(UShort_t i, UShort_t j=0) const;
91 Float_t GetAngle(UShort_t i, UShort_t j=0) const;
92
93 Float_t GetA() const;
94
95 Float_t GetPixRatio(UInt_t i) const;
96 Float_t GetPixRatioSqrt(UInt_t i) const;
97
98 UInt_t GetNumSectors() const { return fNumPixInSector.GetSize(); }
99 UInt_t GetNumAreas() const { return fNumPixWithAidx.GetSize(); }
100
101 UShort_t GetNumPixInSector(UInt_t i) const { return (UShort_t)fNumPixInSector[i]; }
102 UShort_t GetNumPixWithAidx(UInt_t i) const { return (UShort_t)fNumPixWithAidx[i]; }
103
104 MGeom &operator[](Int_t i);
105 MGeom &operator[](Int_t i) const;
106
107 Int_t GetPixelIdx(const TVector2 &v) const;
108 Int_t GetPixelIdxDeg(const TVector2 &v) const;
109 Int_t GetPixelIdxXY(Float_t x, Float_t y) const;
110 Int_t GetPixelIdxXYdeg(Float_t x, Float_t y) const
111 {
112 return GetPixelIdxXY(x/fConvMm2Deg, y/fConvMm2Deg);
113 }
114
115 void GetNeighbors(TArrayI &arr, UInt_t idx, Float_t r) const;
116 void GetNeighbors(TList &arr, UInt_t idx, Float_t r) const;
117 void GetNeighbors(TArrayI &arr, const MGeom &pix, Float_t r) const;
118 void GetNeighbors(TList &arr, const MGeom &pix, Float_t r) const;
119
120 Int_t GetDirection(UInt_t p1, UInt_t p2) const;
121 Int_t GetNeighbor(UInt_t idx, Int_t dir) const;
122
123 virtual Bool_t HitFrame(MQuaternion, const MQuaternion &) const { return kFALSE; }
124 Bool_t HitFrame(MQuaternion p, const MQuaternion &u, Double_t margin) const;
125 virtual Bool_t HitDetector(const MQuaternion &p, Double_t offset=0) const;
126
127 void Print(Option_t *opt=NULL) const;
128
129 void SetAt(UInt_t i, const MGeom &pix);
130
131 ClassDef(MGeomCam, 5) // Geometry base class for the camera
132};
133
134#endif
Note: See TracBrowser for help on using the repository browser.