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

Last change on this file since 9518 was 9371, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.7 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 virtual Double_t GetA() const=0;// { return TMath::Max(fMaxRX, fMaxRY); }
65
66 TVector3 SimPSF(const TVector3 &n, Double_t F, Double_t psf) const;
67
68 Bool_t ExecuteMirror(MQuaternion &p, MQuaternion &u) const;
69
70 // ----- Basic function for parabolic mirror -----
71 Bool_t ExecuteReflection(MQuaternion &p, MQuaternion &u) const;
72
73 // ----- Mirror specialized functions -----
74
75 virtual Bool_t HasHit(const MQuaternion &p) const=0;
76 virtual Bool_t CanHit(const MQuaternion &p) const=0;
77
78 virtual Int_t ReadM(const TObjArray &tok)=0;
79
80 // TObject
81 void Print(Option_t *o) const;
82
83 /*
84 Bool_t IsSortable() const { return kTRUE; }
85 Int_t Compare(const TObject *obj) const
86 {
87 MMirror &m = (MMirror&)*obj;
88 return m.fPos.Mag2()<fPos.Mag2();
89 }
90 */
91 ClassDef(MMirror, 1) // Base class to describe a mirror
92};
93
94#endif
Note: See TracBrowser for help on using the repository browser.