44 std::cout <<
"***** OptOCOPS::makeMeasurement(lightray, meas) " << std::endl;
53 CLHEP::HepRotation rmt =
rmGlob();
54 dowel1 = rmt * dowel1;
63 CLHEP::Hep3Vector line_dowel21 = (dowel1 - dowel2);
64 CLHEP::Hep3Vector ZAxis(0., 0, 1.);
66 CLHEP::Hep3Vector line_dowel21_perp = ZAxis.cross(line_dowel21);
76 CCDlength = 2048 * 14 * 1.E-6;
82 std::cout << std::endl <<
"***** UP CCD *****" << std::endl <<
"******************" << std::endl << std::endl;
87 posY = CCDlength + 0.004;
89 CLHEP::Hep3Vector posxy(posX, posY, 0);
91 std::cout <<
" %%%% CCD distances to Dowel2: " << std::endl;
93 std::cout <<
" up ccd in local RF " << posxy << std::endl;
96 std::cout <<
" up ccd in global RF " << posxy << std::endl;
99 ALILine upCCD(dowel2 + posxy, line_dowel21);
103 std::cout << std::endl <<
"***** DOWN CCD *****" << std::endl <<
"********************" << std::endl << std::endl;
108 posxy = CLHEP::Hep3Vector(posX, posY, 0);
110 std::cout <<
" down ccd in local RF " << posxy << std::endl;
113 std::cout <<
" down ccd in global RF " << posxy << std::endl;
117 ALILine downCCD(dowel2 + posxy, line_dowel21);
123 std::cout << std::endl <<
"***** LEFT CCD *****" << std::endl <<
"********************" << std::endl << std::endl;
127 posX = -CCDlength - 0.002;
129 posxy = CLHEP::Hep3Vector(posX, posY, 0);
131 std::cout <<
" left ccd in local RF " << posxy << std::endl;
134 std::cout <<
" left ccd in global RF " << posxy << std::endl;
138 ALILine leftCCD(dowel2 + posxy, -line_dowel21_perp);
143 std::cout << std::endl <<
"***** RIGHT CCD *****" << std::endl <<
"*********************" << std::endl << std::endl;
149 posxy = CLHEP::Hep3Vector(posX, posY, 0);
151 std::cout <<
" right ccd in local RF " << posxy << std::endl;
154 std::cout <<
" right ccd in global RF " << posxy << std::endl << std::endl;
158 ALILine rightCCD(dowel2 + posxy, -line_dowel21_perp);
162 std::cout <<
" %%% Positions of CCDs in global RF: " << std::endl << std::endl;
163 std::cout <<
" upCCD: " << upCCD << std::endl;
164 std::cout <<
" downCCD: " << downCCD << std::endl;
165 std::cout <<
" leftCCD: " << leftCCD << std::endl;
166 std::cout <<
" rightCCD: " << rightCCD << std::endl << std::endl;
171 std::cout <<
" %%% Intersecting x-hair laser with COPS: " << std::endl;
174 CLHEP::Hep3Vector inters = lightray.
point();
181 std::cout <<
"1. Get the OptO x-hair laser from the measurement list of OptOs" << std::endl;
186 std::cout <<
"2. Get the Y of the laser and project it on the COPS" << std::endl;
187 CLHEP::Hep3Vector YAxis_xhair(0., 1., 0.);
188 const CLHEP::HepRotation& rmtx = xhairOptO->
rmGlob();
189 YAxis_xhair = rmtx * YAxis_xhair;
190 ALILine Yline_xhair(inters, copsPlane.project(YAxis_xhair));
192 std::cout <<
" %%%% Projecting x-hair laser on COPS: " << std::endl;
194 std::cout <<
" Y line of laser projected on COPS " << Yline_xhair << std::endl;
198 std::cout <<
" 3. Get the X of the laser (correct it if cross is not 90o) and project it on the COPS" << std::endl;
204 CLHEP::Hep3Vector XAxis_xhair = YAxis_xhair;
207 ZAxis = CLHEP::Hep3Vector(0., 0., 1.);
208 ZAxis = rmtx * ZAxis;
209 XAxis_xhair.rotate(anglebx, ZAxis);
210 ALILine Xline_xhair(inters, copsPlane.project(XAxis_xhair));
212 std::cout <<
"angleBetweenAxis = " << anglebx << std::endl;
214 std::cout <<
" X line of laser projected on COPS " << Xline_xhair << std::endl;
219 std::cout <<
" Getting measurements as intersection with four CCDs: " << std::endl;
222 std::cout <<
"intersecting with upCCD " << std::endl;
228 std::cout <<
"$@S@ measv[0][0] upccd " << std::endl;
231 std::cout <<
"$@$@ measv[0][1] upccd " << std::endl;
236 std::cout <<
"intersecting with downCCD " << std::endl;
243 std::cout <<
"intersecting with leftCCD " << std::endl;
247 std::cout <<
"intersecting with rightCCD " << std::endl;
282 ALIstring measNames[4] = {
"up",
"down",
"left",
"right"};
286 <<
"--> Now comparing measurement in ccds by x and y laser lines (will always choose the smaller one) "
290 for (ii = 0; ii < 4; ii++) {
292 std::cout <<
"\tmeas CCD " << measNames[
ii] <<
" ii=(" << ii
309 std::cout <<
" --> Swapping for " << measv[
ii][1] <<
"(inf)" << std::endl;
326 std::cout <<
"***** OptOCOPS::makeMeasurement - identify pathological cases U and D intersected by same line"
329 for (ii = 0; ii < 4; ii++) {
333 if (xlaserDir[0] ^ xlaserDir[1]) {
334 std::cerr <<
"!!EXITING up and down CCDs intersected by different x-laser line " << xlaserDir[0] <<
" "
335 << xlaserDir[1] << std::endl;
338 if (xlaserDir[2] ^ xlaserDir[3]) {
339 std::cerr <<
"!!EXITING right and left CCDs intersected by different x-laser line " << xlaserDir[0] <<
" "
340 << xlaserDir[1] << std::endl;
345 std::cout <<
"***** OptOCOPS::makeMeasurement - now output sim values" << std::endl;
349 std::cout <<
"REAL value: " << chrg <<
"U: " << 1000 * meas.
value()[0] << chrg <<
" D: " << 1000 * meas.
value()[1]
350 <<
" L: " << 1000 * meas.
value()[2] <<
" R: " << 1000 * meas.
value()[3] <<
" (mm) " << (
this)->
name()
367 << detU << chrg <<
" D: " << detD << chrg <<
" L: " << detL << chrg <<
" R: " << detR <<
" (mm) "
368 << (
this)->
name() << std::endl;
constexpr bool isNotFinite(T x)
const ALIbool findExtraEntryValueIfExists(const ALIstring &eename, ALIdouble &value) const
const CLHEP::HepRotation & rmGlob() const
virtual void setXlaserLine(ALIuint ii, int val)
const CLHEP::Hep3Vector & point() const
Abs< T >::type abs(const T &t)
void setValueSimulated(ALIint coor, ALIdouble value)
virtual int xlaserLine(ALIuint ii)
const ALIdouble findExtraEntryValue(const ALIstring &eename) const
const std::vector< OpticalObject * > & OptOList() const
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
void intersect(const ALIPlane &plane)
const CLHEP::Hep3Vector & centreGlob() const
const ALIdouble * value() const
const ALIdouble valueSimulated(ALIuint ii) const
ALIdouble getMeasFromInters(ALILine &line_xhair, ALILine &ccd, CLHEP::Hep3Vector &cops_line)
const ALIstring & name() const