15 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h" 16 #include "Alignment/CocoaVisMgr/interface/ALIColour.h" 21 using namespace CLHEP;
31 std::cout <<
"LR: DETAILED REFLECTION IN MIRROR " <<
name() << std::endl;
36 ALIPlane plate = getPlate(
true,
false);
38 CLHEP::Hep3Vector inters = lightray.
point();
42 CLHEP::Hep3Vector ZAxis = getZAxis();
43 CLHEP::HepRotation rmt = rmGlob();
47 CLHEP::Hep3Vector plate_centre = centreGlob() - 0.5 *
width * ZAxis;
55 ALIdouble flatness = findExtraEntryValue(
"flatness");
63 length = findExtraEntryValueMustExist(
"length");
64 curvature_radius = (flatness * flatness + length * length) / (2 * flatness);
65 angFlatness = asin(
distance / curvature_radius);
72 std::cout <<
" intersection with plate " << inters << std::endl;
73 std::cout <<
" plate_centre " << plate_centre << std::endl;
75 std::cout <<
" flatness " << flatness <<
", length " << length;
76 std::cout <<
", curvature radius " << curvature_radius <<
" angle of flatness " << angFlatness << std::endl;
80 CLHEP::Hep3Vector ipcV = inters - plate_centre;
82 ipcV *= 1. / ipcV.mag();
83 CLHEP::HepRotation rtm = rmGlob();
85 CLHEP::Hep3Vector rotationAxis = ipcV.cross(ZAxis);
87 CLHEP::Hep3Vector inters_normal = CLHEP::Hep3Vector(0., 0., 1.);
88 inters_normal.rotate(angFlatness, rotationAxis);
89 inters_normal = rmt * inters_normal;
93 std::cout <<
"rotation Axis " << rotationAxis << std::endl;
94 std::cout <<
" plate normal at intersection point " << inters_normal << std::endl;
98 CLHEP::Hep3Vector lrold = lightray.
direction();
102 lightray.
dumpData(
"Reflected in mirror");
111 std::cout <<
"LR: FAST REFLECTION IN MIRROR " <<
name() << std::endl;
114 ALIPlane plate = getPlate(
true,
false);
119 lightray.
dumpData(
"Reflected in plate");
134 std::cout <<
"LR: DETAILED TRAVERSE IN MIRROR " <<
name() << std::endl;
137 ALIPlane plate = getPlate(
true,
true);
142 lightray.
dumpData(
"Traversed with 0 width");
148 ALIdouble refra_ind2 = findExtraEntryValue(
"refra_ind");
149 lightray.
refract(plate, refra_ind1, refra_ind2);
151 lightray.
dumpData(
"Refracted in first plate");
155 plate = getPlate(
false,
true);
157 lightray.
refract(plate, refra_ind2, refra_ind1);
159 lightray.
dumpData(
"Refracted in first plate");
169 ALIPlane plate = getPlate(
false,
false);
172 lightray.
dumpData(
"Intersected with plate");
177 lightray.
dumpData(
"Shifted and Deviated");
185 ALIbool wexists = findExtraEntryValueIfExists(
"width",
width);
189 wexists = findExtraEntryValueIfExists(
"length", length);
193 ALIColour*
col =
new ALIColour(0., 0., 1., 0.);
194 std::vector<ALIdouble> spar;
195 spar.push_back(length);
196 spar.push_back(length);
197 spar.push_back(
width);
198 IgCocoaFileMgr::getInstance().addSolid(*
this,
"BOX", spar,
col);
209 "Box", go * 5. * cm /
m, go * 5. * cm /
m, go * 1. * cm /
m);
void detailedTraversesLightRay(LightRay &lightray) override
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
void detailedDeviatesLightRay(LightRay &lightray) override
void refract(const ALIPlane &plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
void fastTraversesLightRay(LightRay &lightray) override
static GlobalOptionMgr * getInstance()
void setDirection(const CLHEP::Hep3Vector &direc)
void constructSolidShape() override
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
const CLHEP::Hep3Vector & direction() const
void dumpData(const ALIstring &str) const
const CLHEP::Hep3Vector & point() const
void fastDeviatesLightRay(LightRay &lightray) override
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
void defaultBehaviour(LightRay &lightray, Measurement &meas) override
void intersect(const ALIPlane &plane)
virtual void fillIguana()
void reflect(const ALIPlane &plane)