15 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
16 #include "Alignment/CocoaVisMgr/interface/ALIColour.h"
21 using namespace CLHEP;
26 detailedDeviatesLightRay( lightray );
41 CLHEP::Hep3Vector inters = lightray.
point( );
45 CLHEP::Hep3Vector ZAxis = getZAxis();
46 CLHEP::HepRotation rmt = rmGlob();
50 CLHEP::Hep3Vector plate_centre = centreGlob() - 0.5 * width * ZAxis;
58 ALIdouble flatness = findExtraEntryValue(
"flatness");
66 length = findExtraEntryValueMustExist(
"length");
67 curvature_radius = (flatness*flatness + length*length) / (2*flatness);
68 angFlatness = asin( distance / curvature_radius);
75 std::cout <<
" intersection with plate " << inters << std::endl;
76 std::cout <<
" plate_centre " << plate_centre << std::endl;
77 std::cout <<
" distance plate_centre - intersection " << distance << std::endl;
78 std::cout <<
" flatness " << flatness <<
", length " << length;
79 std::cout <<
", curvature radius " << curvature_radius <<
" angle of flatness " << angFlatness << std::endl;
83 CLHEP::Hep3Vector ipcV = inters - plate_centre;
84 if( ipcV.mag() != 0) ipcV *= 1./ipcV.mag();
85 CLHEP::HepRotation rtm = rmGlob();
87 CLHEP::Hep3Vector rotationAxis = ipcV.cross(ZAxis);
89 CLHEP::Hep3Vector inters_normal = CLHEP::Hep3Vector(0.,0.,1.);
90 inters_normal.rotate( angFlatness, rotationAxis );
91 inters_normal = rmt * inters_normal;
95 std::cout <<
"rotation Axis " << rotationAxis << std::endl;
96 std::cout <<
" plate normal at intersection point " << inters_normal << std::endl;
100 inters_normal.mag() / lightray.
direction().mag();
101 CLHEP::Hep3Vector lrold = lightray.
direction();
105 lightray.
dumpData(
"Reflected in mirror");
124 lightray.
dumpData(
"Reflected in plate");
153 ALIdouble refra_ind2 = findExtraEntryValue(
"refra_ind");
154 lightray.
refract( plate, refra_ind1, refra_ind2 );
156 lightray.
dumpData(
"Refracted in first plate");
160 plate = getPlate(0, 1);
162 lightray.
refract( plate, refra_ind2, refra_ind1 );
164 lightray.
dumpData(
"Refracted in first plate");
179 lightray.
dumpData(
"Intersected with plate");
184 lightray.
dumpData(
"Shifted and Deviated");
196 ALIbool wexists = findExtraEntryValueIfExists(
"width",width);
197 if( !wexists ) width = 1.;
199 wexists = findExtraEntryValueIfExists(
"length",length);
200 if( !wexists ) length = 4.;
202 ALIColour* col =
new ALIColour( 0., 0., 1., 0. );
203 std::vector<ALIdouble> spar;
204 spar.push_back(length);
205 spar.push_back(length);
206 spar.push_back(width);
207 IgCocoaFileMgr::getInstance().addSolid( *
this,
"BOX", spar, col);
void shiftAndDeviateWhileTraversing(const OpticalObject *opto, char behav)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void constructSolidShape()
static GlobalOptionMgr * getInstance()
virtual void fastTraversesLightRay(LightRay &lightray)
void setDirection(const CLHEP::Hep3Vector &direc)
int getGlobalOptionValue(const ALIstring &sstr, ALIdouble &val)
--— Search a string in theGlobalOptions and return 1 if found
virtual void detailedTraversesLightRay(LightRay &lightray)
const CLHEP::Hep3Vector & point() const
void defaultBehaviour(LightRay &lightray, Measurement &meas)
void refract(const ALIPlane plate, const ALIdouble refra_ind1, const ALIdouble refra_ind2)
virtual void fastDeviatesLightRay(LightRay &lightray)
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
void intersect(const ALIPlane &plane)
virtual void fillIguana()
virtual void detailedDeviatesLightRay(LightRay &lightray)
void dumpData(const ALIstring &str) const
void reflect(const ALIPlane &plane)
const CLHEP::Hep3Vector & direction() const