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 | Int_t fShape; // Spherical=0, Parabolic=1
|
---|
28 |
|
---|
29 | // MMirror *fNeighbors[964];
|
---|
30 |
|
---|
31 | public:
|
---|
32 | MMirror() : fSigmaPSF(-1), fShape(0)
|
---|
33 | {
|
---|
34 | }
|
---|
35 |
|
---|
36 | // ----- Mirror basic functions -----
|
---|
37 | TVector2 operator-(const MQuaternion &q) const;// { return TVector2(X()-q.X(), Y()-q.Y()); }
|
---|
38 | TVector2 operator-(const MMirror &m) const;// { return TVector2(X()-m.X(), Y()-m.Y()); }
|
---|
39 |
|
---|
40 | void SetSigmaPSF(Double_t psf) { fSigmaPSF = psf; }
|
---|
41 | void SetFocalLength(Double_t f) { fFocalLength = f; }
|
---|
42 | void SetPosition(const TVector3 &v) { fPos = v; }
|
---|
43 | void SetNorm(const TVector3 &n) {
|
---|
44 | fNorm = n;
|
---|
45 |
|
---|
46 | fTilt = TRotation();
|
---|
47 | // Can be simplified?? rotate the mirror along
|
---|
48 | // perpendicular to its normal projected to x/y and z
|
---|
49 | // by its "zenith angle"
|
---|
50 | fTilt.Rotate(-n.Theta(), TVector3(-n.Y(), n.X(), 0));
|
---|
51 | }
|
---|
52 | void SetShape(Char_t c);
|
---|
53 |
|
---|
54 | void SetZ(Double_t z) { fPos.SetZ(z); }
|
---|
55 |
|
---|
56 | Double_t X() const { return fPos.X(); }
|
---|
57 | Double_t Y() const { return fPos.Y(); }
|
---|
58 |
|
---|
59 | TVector2 GetPosXY() const { return fPos.XYvector(); }
|
---|
60 | const TVector3 &GetPos() const { return fPos; }
|
---|
61 | const TVector3 &GetNorm() const { return fNorm; }
|
---|
62 |
|
---|
63 | Double_t GetFocalLength() const { return fFocalLength; }
|
---|
64 | Double_t GetSigmaPSF() const { return fSigmaPSF; }
|
---|
65 |
|
---|
66 | Double_t GetDist() const { return fPos.Perp(); }
|
---|
67 |
|
---|
68 | virtual Double_t GetMaxR() const=0;// { return TMath::Max(fMaxRX, fMaxRY); }
|
---|
69 | virtual Double_t GetA() const=0;// { return TMath::Max(fMaxRX, fMaxRY); }
|
---|
70 |
|
---|
71 | TVector3 SimPSF(const TVector3 &n, Double_t F, Double_t psf) const;
|
---|
72 | TVector3 SimPSF(const TVector3 &n) const
|
---|
73 | {
|
---|
74 | return SimPSF(n, fFocalLength, fSigmaPSF/10); // Convert from mm to cm
|
---|
75 | }
|
---|
76 |
|
---|
77 | Bool_t ExecuteMirror(MQuaternion &p, MQuaternion &u) const;
|
---|
78 |
|
---|
79 | // ----- Basic function for parabolic mirror -----
|
---|
80 | Bool_t ExecuteReflection(MQuaternion &p, MQuaternion &u) const;
|
---|
81 |
|
---|
82 | // ----- Mirror specialized functions -----
|
---|
83 |
|
---|
84 | virtual Bool_t HasHit(const MQuaternion &p) const=0;
|
---|
85 | virtual Bool_t CanHit(const MQuaternion &p) const=0;
|
---|
86 |
|
---|
87 | virtual Int_t ReadM(const TObjArray &tok)=0;
|
---|
88 |
|
---|
89 | // TObject
|
---|
90 | void Print(Option_t *o) const;
|
---|
91 |
|
---|
92 | /*
|
---|
93 | Bool_t IsSortable() const { return kTRUE; }
|
---|
94 | Int_t Compare(const TObject *obj) const
|
---|
95 | {
|
---|
96 | MMirror &m = (MMirror&)*obj;
|
---|
97 | return m.fPos.Mag2()<fPos.Mag2();
|
---|
98 | }
|
---|
99 | */
|
---|
100 | ClassDef(MMirror, 2) // Base class to describe a mirror
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif
|
---|