source: trunk/MagicSoft/Mars/mgeom/MGeomCam.h@ 5677

Last change on this file since 5677 was 5429, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 2.8 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
14class TVector2;
15class MGeomPix;
16
17class MGeomCam : public MParContainer
18{
19private:
20 UInt_t fNumPixels; // Number of pixels in this camera
21
22 Float_t fCamDist; // [m] Average distance of the camera from the mirror
23 Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees
24
25 TObjArray fPixels; // Array of singel pixels storing the geometry
26
27 TArrayF fMaxRadius; // maximum radius of the part of the camera with the same pixel size (eg. for GUI layout)
28 TArrayF fMinRadius; // minimum radius of the part of the camera with the same pixel size (eg. for GUI layout)
29 TArrayF fPixRatio; // Array storing the ratio between size of pixel 0 and pixel idx (for speed reasons)
30 TArrayF fPixRatioSqrt; // Array storing the square root ratio between size of pixel 0 and pixel idx (for speed reasons)
31
32 Int_t fNumSectors; // Number of sectors
33 Int_t fNumAreas; // Number of different pixel sizes
34
35protected:
36
37 void CalcMaxRadius();
38 void CalcNumSectors();
39 void CalcNumAreas();
40 void InitOuterRing();
41
42
43public:
44 MGeomCam();
45 MGeomCam(UInt_t npix, Float_t dist, const char *name=NULL, const char *title=NULL);
46
47 virtual TObject *Clone(const char *newname=NULL) const;
48
49 void CalcPixRatio();
50 // FIXME, workaround: this function is made public just to allow
51 // the use of some camera files from the 0.7 beta version in which the
52 // array containing pixel ratios is not initialized.
53 void InitGeometry()
54 {
55 CalcNumSectors();
56 CalcNumAreas();
57 CalcMaxRadius();
58 CalcPixRatio();
59 InitOuterRing();
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 UInt_t GetNumSectors() const { return fNumSectors; }
71 UInt_t GetNumAreas() const { return fNumAreas; }
72 Float_t GetPixRatio(UInt_t i) const;
73 Float_t GetPixRatioSqrt(UInt_t i) const;
74
75 MGeomPix &operator[](Int_t i);
76 MGeomPix &operator[](Int_t i) const;
77
78 Int_t GetPixelIdx(const TVector2 &v) const;
79 Int_t GetPixelIdxDeg(const TVector2 &v) const;
80 Int_t GetPixelIdxXY(Float_t x, Float_t y) const;
81 Int_t GetPixelIdxXYdeg(Float_t x, Float_t y) const
82 {
83 return GetPixelIdxXY(x/fConvMm2Deg, y/fConvMm2Deg);
84 }
85
86 virtual void Print(Option_t *opt=NULL) const;
87
88 ClassDef(MGeomCam, 4) // Geometry base class for the camera
89};
90
91#endif
Note: See TracBrowser for help on using the repository browser.