15 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h" 16 #include "Alignment/CocoaVisMgr/interface/ALIColour.h" 21 using namespace CLHEP;
30 std::cout <<
"LR: DETAILED DEVIATION IN OPTICAL SQUARE " <<
name() << std::endl;
36 const ALIdouble refra_ind = findExtraEntryValueMustExist(
"refra_ind");
40 for (ii = 0; ii < 4; ii++) {
43 std::cout <<
"## OPTOOPTICALSQUARE: refract in face " << ii << std::endl;
44 lightray.
refract(
ALIPlane(faceP[ii], faceV[ii]), refra_ind0, refra_ind);
47 lightray.
refract(
ALIPlane(faceP[ii], faceV[ii]), refra_ind, refra_ind0);
66 std::cout <<
"LR: DETAILED TRAVERSES OPTICAL SQUARE " <<
name() << std::endl;
69 const ALIdouble refra_ind = findExtraEntryValueMustExist(
"refra_ind");
83 std::cout <<
"LR: FAST DEVIATION IN OPTICAL SQUARE " <<
name() << std::endl;
85 calculateFaces(
false);
98 lightray.
dumpData(
"intersected at face 3");
126 calculateFaces(
false);
138 lightray.
dumpData(
"Shifted and Deviated");
150 CLHEP::Hep3Vector opto_centre = centreGlob();
152 std::cout <<
"opto_centre " << opto_centre << std::endl;
153 const ALIdouble hlen1 = findExtraEntryValueMustExist(
"length1") / 2.;
154 const ALIdouble hlen2 = findExtraEntryValueMustExist(
"length2") / 2.;
158 faceP[0] = CLHEP::Hep3Vector(0, 0, -hlen1);
159 faceV[0] = CLHEP::Hep3Vector(0, 0, -1);
160 faceP[1] = CLHEP::Hep3Vector(0, hlen1 - hlen2 *
sin(ang), hlen1 + hlen2 *
cos(ang));
161 faceV[1] = CLHEP::Hep3Vector(0,
cos(ang),
sin(ang));
163 faceP[2] = CLHEP::Hep3Vector(0, -hlen1 - hlen2 *
cos(ang), -hlen1 + hlen2 *
sin(ang));
164 faceV[2] = CLHEP::Hep3Vector(0, -
sin(ang), -
cos(ang));
165 faceP[3] = CLHEP::Hep3Vector(0, hlen1, 0);
166 faceV[3] = CLHEP::Hep3Vector(0, 1, 0);
169 faceP[4] = CLHEP::Hep3Vector(0, 0, hlen1 + 2 * hlen2 *
cos(ang));
170 faceV[4] = CLHEP::Hep3Vector(0, 0, 1);
173 CLHEP::HepRotation rmt = rmGlob();
176 std::cout <<
" optical_square centre" << opto_centre << std::endl;
178 for (ii = 0; ii < numberOfFaces; ii++) {
179 faceP[
ii] = rmt * faceP[
ii];
180 faceP[
ii] += opto_centre;
181 faceV[
ii] = rmt * faceV[
ii];
183 std::cout <<
"point at face " << ii <<
": " << faceP[
ii] << std::endl;
184 std::cout <<
"normal at face " << ii <<
": " << faceV[
ii] << std::endl;
191 const ALIbool wxy = findExtraEntryValueIfExists(
"wedge", wedge);
193 wedgeX = findExtraEntryValue(
"wedgeX");
194 wedgeY = findExtraEntryValue(
"wedgeY");
202 std::cout <<
"OptOOpticalSquare calculateFaces: wedgeX " << wedgeX <<
" wedgeY " << wedgeY << std::endl;
203 CLHEP::Hep3Vector Axis1(1., 0., 0.);
209 faceV[1].rotate(0.5 * wedgeX, Axis1);
212 faceV[2].rotate(-0.5 * wedgeX, Axis1);
220 CLHEP::Hep3Vector Axis2 = Axis1;
221 Axis2 = Axis2.cross(faceV[1]);
222 faceV[1].rotate(0.5 * wedgeY, Axis2);
226 Axis2 = Axis2.cross(faceV[2]);
227 faceV[2].rotate(-0.5 * wedgeY, Axis2);
239 ALIColour*
col =
new ALIColour(0., 0., 1., 0.);
241 ALIbool wexists = findExtraEntryValueIfExists(
"length1", length1);
245 wexists = findExtraEntryValueIfExists(
"length2", length2);
249 std::vector<ALIdouble> spar;
250 spar.push_back(length1);
251 spar.push_back(length2);
252 IgCocoaFileMgr::getInstance().addSolid(*
this,
"OPTSQR", spar, col);
263 "Box", go * 5. * cm /
m, go * 5. * cm /
m, go * 5. * cm /
m);
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
Sin< T >::type sin(const T &t)
void refract(const ALIPlane &plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
static GlobalOptionMgr * getInstance()
void detailedDeviatesLightRay(LightRay &lightray) override
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
Cos< T >::type cos(const T &t)
void fastTraversesLightRay(LightRay &lightray) override
void fastDeviatesLightRay(LightRay &lightray) override
void constructSolidShape() override
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
void intersect(const ALIPlane &plane)
void calculateFaces(ALIbool isDetailed)
virtual void fillIguana()
void detailedTraversesLightRay(LightRay &lightray) override
void dumpData(const ALIstring &str) const
void reflect(const ALIPlane &plane)