source: trunk/MagicSoft/Mars/msimreflector/MMirror.h@ 9356

Last change on this file since 9356 was 9332, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.6 KB
Line 
1#ifndef MARS_MMirror
2#define MARS_MMirror
3
4#ifndef ROOT_TRotation
5#include <TRotation.h>
6#endif
7
8class MQuaternion;
9
10class MMirror : public TObject
11{
12 friend void operator/=(MQuaternion &, const MMirror &);
13 friend void operator*=(MQuaternion &, const MMirror &);
14 friend void operator-=(MQuaternion &, const MMirror &);
15 friend void operator+=(MQuaternion &, const MMirror &);
16
17private:
18 TVector3 fPos;
19 TVector3 fNorm; // faster without
20
21 TRotation fTilt;
22
23 // ----- Spherical mirror data members -----
24 Double_t fFocalLength;
25 Double_t fSigmaPSF;
26
27 // MMirror *fNeighbors[964];
28
29public:
30 MMirror() : fSigmaPSF(-1)
31 {
32 }
33
34 // ----- Mirror basic functions -----
35 TVector2 operator-(const MQuaternion &q) const;// { return TVector2(X()-q.X(), Y()-q.Y()); }
36 TVector2 operator-(const MMirror &m) const;// { return TVector2(X()-m.X(), Y()-m.Y()); }
37
38 void SetSigmaPSF(Double_t psf) { fSigmaPSF = psf; }
39 void SetFocalLength(Double_t f) { fFocalLength = f; }
40 void SetPosition(const TVector3 &v) { fPos = v; }
41 void SetNorm(const TVector3 &n) {
42 fNorm = n;
43
44 fTilt = TRotation();
45 // Can be simplified?? rotate the mirror along
46 // perpendicular to its normal projected to x/y and z
47 // by its "zenith angle"
48 fTilt.Rotate(-n.Theta(), TVector3(-n.Y(), n.X(), 0));
49 }
50
51 Double_t X() const { return fPos.X(); }
52 Double_t Y() const { return fPos.Y(); }
53
54 TVector2 GetPosXY() const { return fPos.XYvector(); }
55 const TVector3 &GetPos() const { return fPos; }
56 const TVector3 &GetNorm() const { return fNorm; }
57
58 Double_t GetFocalLength() const { return fFocalLength; }
59 Double_t GetSigmaPSF() const { return fSigmaPSF; }
60
61 Double_t GetDist() const { return fPos.Perp(); }
62
63 virtual Double_t GetMaxR() const=0;// { return TMath::Max(fMaxRX, fMaxRY); }
64
65 TVector3 SimPSF(const TVector3 &n, Double_t F, Double_t psf) const;
66
67 Bool_t ExecuteMirror(MQuaternion &p, MQuaternion &u) const;
68
69 // ----- Basic function for parabolic mirror -----
70 Bool_t ExecuteReflection(MQuaternion &p, MQuaternion &u) const;
71
72 // ----- Mirror specialized functions -----
73
74 virtual Bool_t HasHit(const MQuaternion &p) const=0;
75 virtual Bool_t CanHit(const MQuaternion &p) const=0;
76
77 virtual Int_t ReadM(const TObjArray &tok)=0;
78
79 // TObject
80 void Print(Option_t *o) const;
81
82 /*
83 Bool_t IsSortable() const { return kTRUE; }
84 Int_t Compare(const TObject *obj) const
85 {
86 MMirror &m = (MMirror&)*obj;
87 return m.fPos.Mag2()<fPos.Mag2();
88 }
89 */
90 ClassDef(MMirror, 1) // Base class to describe a mirror
91};
92
93#endif
Note: See TracBrowser for help on using the repository browser.