1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Oscar Blanch 11/2002 <mailto:blanch@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2002
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MGeomMirror
|
---|
28 | //
|
---|
29 | // This is the base class of the Mirror geometry.
|
---|
30 | //
|
---|
31 | /////////////////////////////////////////////////////////////////////////////
|
---|
32 |
|
---|
33 | #include "MGeomMirror.h"
|
---|
34 |
|
---|
35 | #include "MLog.h"
|
---|
36 | #include "MLogManip.h"
|
---|
37 |
|
---|
38 | ClassImp(MGeomMirror);
|
---|
39 |
|
---|
40 | using namespace std;
|
---|
41 |
|
---|
42 | // --------------------------------------------------------------------------
|
---|
43 | //
|
---|
44 | // Initializes a Mirror geometry with 0 values, except for fMirrorID.
|
---|
45 | //
|
---|
46 | MGeomMirror::MGeomMirror(Int_t mir, const char *name, const char *title)
|
---|
47 | {
|
---|
48 | fName = name ? name : "MGeomMirror";
|
---|
49 | fTitle = title ? title : "Storage container for a mirror geometry";
|
---|
50 |
|
---|
51 | fMirrorId=mir; // the Mirror Id
|
---|
52 |
|
---|
53 | fFocalDist=0.; // focal distance of that mirror [cm]
|
---|
54 | fSX=0.; // curvilinear coordinate of mirror's center in X[cm]
|
---|
55 | fSY=0.; // curvilinear coordinate of mirror's center in X[cm]
|
---|
56 | fX=0.; // x coordinate of the center of the mirror [cm]
|
---|
57 | fY=0.; // y coordinate of the center of the mirror [cm]
|
---|
58 | fZ=0.; // z coordinate of the center of the mirror [cm]
|
---|
59 | fThetaN=0.; // polar theta angle of the direction
|
---|
60 | // where the mirror points to
|
---|
61 | fPhiN=0.; // polar phi angle of the direction
|
---|
62 | // where the mirror points to
|
---|
63 | fXN=0.; // xn coordinate of the normal vector
|
---|
64 | // in the center
|
---|
65 | fYN=0.; // yn coordinate of the normal vector
|
---|
66 | // in the center
|
---|
67 | fZN=0.; // zn coordinate of the normal vector
|
---|
68 | // in the center
|
---|
69 | // Note: fXN^2*fYN^2*fZN^2 = 1
|
---|
70 | fDeviationX=0.; // deviation in x [cm]
|
---|
71 | fDeviationY=0.; // deviation in y [cm]
|
---|
72 | // of the spot of a single mirror on the camera plane
|
---|
73 |
|
---|
74 | }
|
---|
75 |
|
---|
76 | // --------------------------------------------------------------------------
|
---|
77 | //
|
---|
78 | // DESCRIPTION MISSING: Please contact Oscar
|
---|
79 | //
|
---|
80 | void MGeomMirror::SetMirrorContent(Int_t mir, Float_t focal, Float_t curv_x,
|
---|
81 | Float_t curv_y, Float_t lin_x, Float_t lin_y,
|
---|
82 | Float_t lin_z, Float_t theta, Float_t phi,
|
---|
83 | Float_t x_n, Float_t y_n, Float_t z_n){
|
---|
84 | fMirrorId=mir; // the Mirror Id
|
---|
85 |
|
---|
86 | fFocalDist=focal; // focal distance of that mirror [cm]
|
---|
87 | fSX=curv_x; // curvilinear coordinate of mirror's center in X[cm]
|
---|
88 | fSY=curv_y; // curvilinear coordinate of mirror's center in X[cm]
|
---|
89 | fX=lin_x; // x coordinate of the center of the mirror [cm]
|
---|
90 | fY=lin_y; // y coordinate of the center of the mirror [cm]
|
---|
91 | fZ=lin_z; // z coordinate of the center of the mirror [cm]
|
---|
92 | fThetaN=theta; // polar theta angle of the direction
|
---|
93 | // where the mirror points to
|
---|
94 | fPhiN=phi; // polar phi angle of the direction
|
---|
95 | // where the mirror points to
|
---|
96 | fXN=x_n; // xn coordinate of the normal vector
|
---|
97 | // in the center
|
---|
98 | fYN=y_n; // yn coordinate of the normal vector
|
---|
99 | // in the center
|
---|
100 | fZN=z_n; // zn coordinate of the normal vector
|
---|
101 | // in the center
|
---|
102 | // Note: fXN^2*fYN^2*fZN^2 = 1
|
---|
103 | }
|
---|
104 |
|
---|
105 | void MGeomMirror::SetMirrorDeviations(Float_t dev_x, Float_t dev_y)
|
---|
106 | {
|
---|
107 | fDeviationX=dev_x; // deviation in x [cm]
|
---|
108 | fDeviationY=dev_y; // deviation in y [cm]
|
---|
109 | // of the spot of a single mirror on the camera plane
|
---|
110 | }
|
---|
111 |
|
---|
112 | // --------------------------------------------------------------------------
|
---|
113 | //
|
---|
114 | // Setting function to store the mirror reflectivity (ref) at different
|
---|
115 | // wavelength (wav).
|
---|
116 | //
|
---|
117 | void MGeomMirror::SetReflectivity(const TArrayF &wav, const TArrayF &ref)
|
---|
118 | {
|
---|
119 | if (fWavelength.GetSize()!=wav.GetSize() ||
|
---|
120 | fReflectivity.GetSize()!=ref.GetSize())
|
---|
121 | {
|
---|
122 | *fLog << err << dbginf << " fWavelength or fQE do not have ";
|
---|
123 | *fLog << "size of setting arrays" << endl;
|
---|
124 | return;
|
---|
125 | }
|
---|
126 |
|
---|
127 | fWavelength = wav;
|
---|
128 | fReflectivity = ref;
|
---|
129 | }
|
---|
130 |
|
---|
131 | TVector3 MGeomMirror::GetReflection(const TVector3 &star, Double_t dist)
|
---|
132 | {
|
---|
133 | if (fReflector==TRotation())
|
---|
134 | {
|
---|
135 | fReflector = TRotation(); // unit matrix
|
---|
136 | fReflector.Rotate(TMath::Pi(), GetMirrorNorm());
|
---|
137 | }
|
---|
138 |
|
---|
139 | // Reflect star on the mirror (done by a rotation
|
---|
140 | // around the normal vector of the mirror center
|
---|
141 | TVector3 light(star);
|
---|
142 | light *= fReflector;
|
---|
143 |
|
---|
144 | if (dist<0)
|
---|
145 | return light;
|
---|
146 |
|
---|
147 | // calculate distance to the camera
|
---|
148 | const TVector3 &pos = GetMirrorCenter();
|
---|
149 | const Double_t d = (dist - pos.Z()) / light.Z();
|
---|
150 |
|
---|
151 | return light*d + pos;
|
---|
152 | }
|
---|