1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
// COCOA class implementation file
//Id: OptOMOdifiedRhomboidPrism.cc
//CAT: Model
//
// History: v0.9 Dec 1999
// Pedro Arce
#include "Alignment/CocoaModel/interface/OptOModifiedRhomboidPrism.h"
#include "Alignment/CocoaModel/interface/LightRay.h"
#include "Alignment/CocoaModel/interface/ALIPlane.h"
#include "Alignment/CocoaModel/interface/Measurement.h"
#include <iostream>
#include <iomanip>
#ifdef COCOA_VIS
#include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
#include "Alignment/CocoaVisMgr/interface/ALIColour.h"
#endif
#include "Alignment/CocoaDDLObjects/interface/CocoaSolidShapeBox.h"
#include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"
using namespace CLHEP;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@ Detailed simulation of Reflection in Plate Splitter
//@@ The software gets the plane of reflection as the forward splitter plane
//@@ Then the beam is reflected in this plane.
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOModifiedRhomboidPrism::detailedDeviatesLightRay(LightRay& lightray) {
if (ALIUtils::debug >= 2)
std::cout << "$$$$$ LR: DETAILED DEVIATION IN MODIFIED RHOMBOID PRISM " << name() << std::endl;
CLHEP::Hep3Vector XAxis(1., 0., 0.);
CLHEP::HepRotation rmt = rmGlob();
XAxis = rmt * XAxis;
CLHEP::Hep3Vector YAxis(0., 1., 0.);
YAxis = rmt * YAxis;
CLHEP::Hep3Vector ZAxis(0., 0., 1.);
ZAxis = rmt * ZAxis;
ALIUtils::dump3v(XAxis, " x axis ");
ALIUtils::dump3v(YAxis, " y axis ");
ALIUtils::dump3v(ZAxis, " z axis ");
if (ALIUtils::debug >= 5) {
ALIUtils::dump3v(centreGlob(), " centre ");
}
if (ALIUtils::debug >= 2)
std::cout << "$$$ LR: REFRACTION IN FORWARD PLATE " << std::endl;
//---------- Get forward plate
ALIPlane plate = getPlate(true, true);
//---------- Refract in plate while entering
ALIdouble refra_ind1 = 1.;
ALIdouble refra_ind2 = findExtraEntryValueMustExist("refra_ind");
lightray.refract(plate, refra_ind1, refra_ind2);
if (ALIUtils::debug >= 2) {
lightray.dumpData("LightRay after Refraction at entering: ");
}
if (ALIUtils::debug >= 2)
std::cout << std::endl << "$$$ LR: REFLECTION IN FIRST PLATE " << std::endl;
//---------- Get up plate rotated
plate = getRotatedPlate(true);
//---------- Reflect in plate
lightray.reflect(plate);
if (ALIUtils::debug >= 2)
std::cout << std::endl << "$$$ LR: REFLECTION IN SECOND PLATE " << std::endl;
//---------- Get up plate rotated
plate = getRotatedPlate(false);
//---------- Reflect in plate
lightray.reflect(plate);
if (ALIUtils::debug >= 2)
std::cout << std::endl << "$$$ LR: REFRACTION IN BACKWARD PLATE " << std::endl;
//---------- Get backward plate
plate = getPlate(false, true);
//---------- Refract in plate while exiting
lightray.refract(plate, refra_ind2, refra_ind1);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@ Detailed simulation of the light ray traversing
//@@ The beam enters the prism, is refracted, traverses the prism and finally is again refracted when it exits:
//@@ Get the intersection with the forward prism plane
//@@ Refract the beam and propagate until it intersects the backward plane.
//@@ Finally the beam is refracted again.
//@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOModifiedRhomboidPrism::detailedTraversesLightRay(LightRay& lightray) {
if (ALIUtils::debug >= 2)
std::cout << "LR: DETAILED TRAVERSE MODIFIED RHOMBOID PRISM " << name() << std::endl;
//---------- Get forward plate
ALIPlane plate = getPlate(true, true);
//---------- Refract while entering splitter
ALIdouble refra_ind1 = 1.;
ALIdouble refra_ind2 = findExtraEntryValueMustExist("refra_ind");
lightray.refract(plate, refra_ind1, refra_ind2);
if (ALIUtils::debug >= 2) {
lightray.dumpData("Refracted in first plate");
}
//---------- Get back ward plate (of triangular piiece)
plate = getPlate(true, false);
//---------- Refract while exiting prism
lightray.refract(plate, refra_ind2, refra_ind1);
if (ALIUtils::debug >= 2) {
lightray.dumpData("Refracted in first plate");
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@ Fast simulation of deviation of the light ray:
//@@ Reflect in a Plate Splitter
//@@ The beam is reflected in the first plate of the plate splitter, which is obtained without applying the rotation by 'wedge'.
//@@ After the beam is reflected, it is rotated around the splitter X axis by 'deviX' and around the Y axis by 'deviY'.
//@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOModifiedRhomboidPrism::fastDeviatesLightRay(LightRay& lightray) {
if (ALIUtils::debug >= 2)
std::cout << "LR: FAST REFLECTION IN MODIFIED RHOMBOID PRISM " << name() << std::endl;
//---------- Get backward plate
ALIPlane plate = getPlate(false, false);
//---------- Intersect with plate
lightray.intersect(plate);
if (ALIUtils::debug >= 2) {
lightray.dumpData("Intersected in plate");
}
//---------- Deviate Lightray
lightray.shiftAndDeviateWhileTraversing(this, 'R');
/* ALIdouble deviRX = findExtraEntryValue("deviRX");
ALIdouble deviRY = findExtraEntryValue("deviRY");
ALIdouble shiftRX = findExtraEntryValue("shiftRX");
ALIdouble shiftRY = findExtraEntryValue("shiftRY");
lightray.shiftAndDeviateWhileTraversing( this, shiftRX, shiftRY, deviRX, deviRY);
*/
if (ALIUtils::debug >= 2) {
// std::cout << " shiftRX " << shiftRX << " shiftRY " << shiftRY << std::endl;
// std::cout << " deviRX " << deviRX << " deviRY " << deviRY << std::endl;
lightray.dumpData("Deviated ");
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@ Fast simulation of the light ray traversing
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@ Traverse Plane Parallel Plate
//@@ Traslated to the backward plate of the plate splitter
//@@ Shifted in the splitter X direction by 'shiftX', and in the Y direction by 'shiftY'
//@@ and rotated around the splitter X axis by 'deviX' and around the Y axis by 'deviY'.
//@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOModifiedRhomboidPrism::fastTraversesLightRay(LightRay& lightray) {
if (ALIUtils::debug >= 2)
std::cout << "LR: FAST TRAVERSE MODIFIED RHOMBOID PRISM " << name() << std::endl;
//---------- Get backward plate
ALIPlane plate = getPlate(false, false);
lightray.intersect(plate);
if (ALIUtils::debug >= 2) {
lightray.dumpData("Intersected with plate");
}
//---------- Shift and Deviate
lightray.shiftAndDeviateWhileTraversing(this, 'T');
/* ALIdouble shiftTX = findExtraEntryValue("shiftTX");
ALIdouble shiftTY = findExtraEntryValue("shiftTY");
ALIdouble deviTX = findExtraEntryValue("deviTX");
ALIdouble deviTY = findExtraEntryValue("deviTY");
lightray.shiftAndDeviateWhileTraversing( this, shiftTX, shiftTY, deviTX, deviTY);*/
if (ALIUtils::debug >= 2) {
lightray.dumpData("Shifted and Deviated");
}
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@ Get one of the rotated plates of an OptO
//@@
//@@ The point is defined taking the centre of the prism,
//@@ and traslating it by +/-1/2 'shift' in the direction of the splitter Z.
//@@ The normal of this plane is obtained as the splitter Z,
//@@ and then it is rotated around X by 'angle' and with the global rotation matrix.
//@@ It is also rotated around the splitter X and Y axis by +/-1/2 of the 'wedgeR'.
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ALIPlane OptOModifiedRhomboidPrism::getRotatedPlate(const ALIbool forwardPlate) {
if (ALIUtils::debug >= 4)
std::cout << "% LR: GET ROTATED PLATE " << name() << std::endl;
//---------- Get OptO variables
const ALIdouble shift = (findExtraEntryValue("shiftRY"));
ALIdouble wedgeR = findExtraEntryValue("wedgeR");
//---------- Get centre of plate
//----- plate centre = OptO centre +/- 1/2 shift
CLHEP::Hep3Vector plate_point = centreGlob();
//--- Add to it half of the shift following the direction of the prism Y. -1/2 if it is forward plate, +1/2 if it is backward plate
ALIdouble normal_sign = -forwardPlate * 2 + 1;
CLHEP::Hep3Vector YAxis(0., 1., 0.);
CLHEP::HepRotation rmt = rmGlob();
YAxis = rmt * YAxis;
plate_point += normal_sign * shift / 2. * YAxis;
//---------- Get normal of plate
//----- Plate normal before wedgeR (Z axis of OptO rotated 'angle' around X)
CLHEP::Hep3Vector ZAxis(0., 0., 1.);
ALIdouble anglePlanes;
ALIbool we = findExtraEntryValueIfExists("anglePlanes", anglePlanes);
if (!we) {
anglePlanes = 45. * ALIUtils::deg;
}
ZAxis.rotateX(anglePlanes);
//----- Rotate with global rotation matrix
CLHEP::Hep3Vector plate_normal = rmt * ZAxis;
if (ALIUtils::debug >= 3) {
ALIUtils::dump3v(plate_point, "plate_point");
ALIUtils::dump3v(plate_normal, "plate_normal before wedge");
ALIUtils::dumprm(rmt, "rmt before wedge angles");
}
//----- Rotate plate normal by 1/2 wedgeR angles
//--- Around X axis
CLHEP::Hep3Vector XAxis(0., 0., 1.);
XAxis = rmt * XAxis;
plate_normal.rotate(normal_sign * wedgeR / 2., XAxis);
if (ALIUtils::debug >= 3)
ALIUtils::dump3v(plate_normal, "plate_normal after wedgeR around X ");
//--- Around the axis obtained rotating the prism Y axis by 'anglePlanes' around the prism X axis
YAxis = CLHEP::Hep3Vector(0., 1., 0.);
YAxis.rotateX(anglePlanes);
YAxis = rmt * YAxis;
plate_normal.rotate(normal_sign * wedgeR / 2., YAxis);
if (ALIUtils::debug >= 3)
ALIUtils::dump3v(plate_normal, "plate_normal after wedgeR around Y ");
//---------- Return plate plane
return ALIPlane(plate_point, plate_normal);
}
#ifdef COCOA_VIS
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOModifiedRhomboidPrism::fillIguana() {
ALIColour* col = new ALIColour(0., 0., 1., 0.);
ALIdouble width;
ALIbool wexists = findExtraEntryValueIfExists("width", width);
if (!wexists)
width = 1.;
ALIdouble shift;
wexists = findExtraEntryValueIfExists("shift", shift);
if (!wexists)
shift = 4.;
std::vector<ALIdouble> spar;
spar.push_back(shift);
spar.push_back(shift);
spar.push_back(width);
spar.push_back(0.);
spar.push_back(45.);
spar.push_back(0.);
IgCocoaFileMgr::getInstance().addSolid(*this, "PARAL", spar, col);
//add a triangle
std::vector<ALIdouble> spar2;
spar2.push_back(width);
spar2.push_back(width);
spar2.push_back(0.);
spar2.push_back(width);
spar2.push_back(width);
IgCocoaFileMgr::getInstance().addSolid(*this, "TRD", spar2, col);
}
#endif
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void OptOModifiedRhomboidPrism::constructSolidShape() {
ALIdouble go;
GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
gomgr->getGlobalOptionValue("VisScale", go);
theSolidShape = new CocoaSolidShapeBox(
"Box", go * 5. * cm / m, go * 5. * cm / m, go * 5. * cm / m); //COCOA internal units are meters
}
|