1 | #ifndef MARS_MMirror
|
---|
2 | #define MARS_MMirror
|
---|
3 |
|
---|
4 | #ifndef ROOT_TRotation
|
---|
5 | #include <TRotation.h>
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | class MQuaternion;
|
---|
9 |
|
---|
10 | class 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 |
|
---|
17 | private:
|
---|
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 |
|
---|
29 | public:
|
---|
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 SetPosition(const TVector3 &v) { fPos = v; }
|
---|
39 | void SetNorm(const TVector3 &n) {
|
---|
40 | fNorm = n;
|
---|
41 |
|
---|
42 | fTilt = TRotation();
|
---|
43 | // Can be simplified?? rotate the mirror along
|
---|
44 | // perpendicular to its normal projected to x/y and z
|
---|
45 | // by its "zenith angle"
|
---|
46 | fTilt.Rotate(-n.Theta(), TVector3(-n.Y(), n.X(), 0));
|
---|
47 | }
|
---|
48 |
|
---|
49 | Double_t X() const { return fPos.X(); }
|
---|
50 | Double_t Y() const { return fPos.Y(); }
|
---|
51 |
|
---|
52 | TVector2 GetPosXY() const { return fPos.XYvector(); }
|
---|
53 | const TVector3 &GetPos() const { return fPos; }
|
---|
54 | const TVector3 &GetNorm() const { return fNorm; }
|
---|
55 |
|
---|
56 | Double_t GetDist() const { return fPos.Perp(); }
|
---|
57 |
|
---|
58 | virtual Double_t GetMaxR() const=0;// { return TMath::Max(fMaxRX, fMaxRY); }
|
---|
59 |
|
---|
60 | TVector3 SimPSF(const TVector3 &n, Double_t F, Double_t psf) const;
|
---|
61 |
|
---|
62 | Bool_t ExecuteMirror(MQuaternion &p, MQuaternion &u) const;
|
---|
63 |
|
---|
64 | // ----- Basic function for parabolic mirror -----
|
---|
65 | void SetFocalLength(Double_t f) { fFocalLength = f; }
|
---|
66 | Double_t GetFocalLength() const { return fFocalLength; }
|
---|
67 |
|
---|
68 | Bool_t ExecuteReflection(MQuaternion &p, MQuaternion &u) const;
|
---|
69 |
|
---|
70 | // ----- Mirror specialized functions -----
|
---|
71 |
|
---|
72 | // This should fit with Paint()
|
---|
73 | virtual Bool_t HasHit(const MQuaternion &p) const=0;
|
---|
74 | // This should fit with HasHit()
|
---|
75 | //void Paint(Option_t *)=0;
|
---|
76 | virtual Bool_t CanHit(const MQuaternion &p) const=0;
|
---|
77 |
|
---|
78 | virtual Int_t ReadM(const TObjArray &tok)=0;
|
---|
79 |
|
---|
80 | /*
|
---|
81 | Bool_t IsSortable() const { return kTRUE; }
|
---|
82 | Int_t Compare(const TObject *obj) const
|
---|
83 | {
|
---|
84 | MMirror &m = (MMirror&)*obj;
|
---|
85 | return m.fPos.Mag2()<fPos.Mag2();
|
---|
86 | }
|
---|
87 | */
|
---|
88 | ClassDef(MMirror, 0) // Base class to describe a mirror
|
---|
89 | };
|
---|
90 |
|
---|
91 | #endif
|
---|