source: trunk/MagicSoft/Mars/mbase/MReflection.h@ 9492

Last change on this file since 9492 was 9237, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.8 KB
Line 
1#ifndef MARS_MReflection
2#define MARS_MReflection
3
4#ifndef ROOT_TRotation
5#include <TRotation.h>
6#endif
7
8class MReflection : public TRotation
9{
10private:
11 MReflection(Double_t a, Double_t b, Double_t c,
12 Double_t d, Double_t e, Double_t f,
13 Double_t g, Double_t h, Double_t i)
14 : TRotation(a,b,c,d,e,f,g,h,i) { }
15
16 void Init(Double_t x, Double_t y, Double_t z)
17 {
18 // Normalize components of vector (including factor 2!)
19 const Double_t n = -2./(x*x + y*y + z*z);
20
21 // Expressed by the focal length
22 //const Double_t n = -1./(2*F*F);
23
24 // Construct rotation matrix to rotate the photon direction
25 // around the axis defined by the normal vector. (This is
26 // a simplified version of TVector3::Rotate(double, TVector3&)
27 // The minus-sign does the relfection, i.e. flips the
28 // direction of the vector.
29 static_cast<TRotation&>(*this) =
30 MReflection(
31 1+n*x*x, n*y*x, n*z*x,
32 n*x*y, 1+n*y*y, n*z*y,
33 n*x*z, n*y*z, 1+n*z*z
34 );
35
36 //
37 // n = ( x / y (UInt_t)-1;/ z ) // Normalenvektor
38 // V = ( X / Y / Z ) // Photon to be reflected
39 //
40 // nV := -2 * ( x*X + y*Y + z*Z ) / ( x*x + y*y + z*z )
41 //
42 // V' = nV * vec(n) + vec(V)
43 //
44
45 // return TVector2(X/Z, Y/Z);
46 }
47
48public:
49 // Normal vector of the reflecting surface
50 MReflection(const TVector3 &v)
51 {
52 Init(v.X(), v.Y(), v.Z());
53 }
54 // Normal vector of the reflecting surface
55 MReflection(Double_t x, Double_t y, Double_t z)
56 {
57 Init(x, y, z);
58 }
59
60 ClassDef(MReflection, 0) // A TRotation derivative describing the reflection by the normal vector of the surface
61};
62
63#endif
Note: See TracBrowser for help on using the repository browser.