Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "Alignment/CocoaModel/interface/OptOCubeSplitter.h"
00009 #include "Alignment/CocoaModel/interface/LightRay.h"
00010 #include "Alignment/CocoaModel/interface/ALIPlane.h"
00011 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
00012 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00013 #ifdef COCOA_VIS
00014 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
00015 #include "Alignment/CocoaVisMgr/interface/ALIColour.h"
00016 #endif
00017 #include "Alignment/CocoaDDLObjects/interface/CocoaSolidShapeBox.h"
00018 #include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"
00019
00020
00021
00022
00023
00024
00025
00026
00027 void OptOCubeSplitter::fastDeviatesLightRay( LightRay& lightray )
00028 {
00029 if (ALIUtils::debug >= 2) std::cout << "LR: FAST REFLECTION IN CUBE SPLITTER " << name() << std::endl;
00030
00031
00032 ALIPlane plate = getMiddlePlate();
00033
00034 lightray.reflect( plate );
00035 if (ALIUtils::debug >= 2) {
00036 lightray.dumpData("Reflected in plate");
00037 }
00038
00039
00040
00041
00042 lightray.shiftAndDeviateWhileTraversing( this, 'R' );
00043 if (ALIUtils::debug >= 2) {
00044 lightray.dumpData("Deviated ");
00045 }
00046
00047 }
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 void OptOCubeSplitter::fastTraversesLightRay( LightRay& lightray )
00060 {
00061 if (ALIUtils::debug >= 2) std::cout << "LR: FAST TRAVERSE CUBE SPLITTER " << name() << std::endl;
00062
00063
00064 ALIPlane plate = getPlate(0, 0);
00065 lightray.intersect( plate );
00066 if (ALIUtils::debug >= 2) {
00067 lightray.dumpData("Intersected with plate");
00068 }
00069
00070 lightray.shiftAndDeviateWhileTraversing( this, 'T');
00071
00072
00073
00074
00075
00076
00077 if (ALIUtils::debug >= 2) {
00078 lightray.dumpData("Shifted and Deviated");
00079 }
00080
00081 }
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 void OptOCubeSplitter::detailedDeviatesLightRay( LightRay& lightray )
00095 {
00096 if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED REFLECTION IN CUBE SPLITTER " << name() << std::endl;
00097
00098 if(ALIUtils::debug >= 2) ALIUtils::dump3v( centreGlob(), "centreGlob");
00099
00100 if (ALIUtils::debug >= 3) std::cout << "%%%%% refracting at entering first plate " << std::endl;
00101 if (ALIUtils::debug >= 3) std::cout << "%%% getting first plate " << std::endl;
00102 ALIPlane plate = getPlate(1, 1);
00103
00104
00105 ALIdouble refra_ind1 = 1.;
00106 ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
00107 lightray.refract( plate, refra_ind1, refra_ind2 );
00108
00109
00110 if (ALIUtils::debug >= 3) std::cout << "%%%%% reflecting in middle plate " << std::endl;
00111 if (ALIUtils::debug >= 3) std::cout << "%%% getting middle plate " << std::endl;
00112 plate = getMiddlePlate();
00113
00114
00115 lightray.reflect( plate );
00116 if (ALIUtils::debug >= 2) {
00117 lightray.dumpData("Reflected in plate");
00118 }
00119
00120
00121 if (ALIUtils::debug >= 3) std::cout << "%%%%% getting second plate " << std::endl;
00122 plate = getUpperPlate();
00123 if (ALIUtils::debug >= 3) std::cout << "%%%%% refracting at exiting second plate " << std::endl;
00124 lightray.refract( plate, refra_ind2, refra_ind1 );
00125
00126 if (ALIUtils::debug >= 2) {
00127 lightray.dumpData("After CubeSplitter");
00128 }
00129
00130 }
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 void OptOCubeSplitter::detailedTraversesLightRay( LightRay& lightray )
00142 {
00143 if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED TRAVERSE CUBE SPLITTER " << name() << std::endl;
00144
00145
00146 ALIPlane plate = getPlate(1, 1);
00147
00148
00149 ALIdouble refra_ind1 = 1.;
00150 ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
00151 lightray.refract( plate, refra_ind1, refra_ind2 );
00152 if (ALIUtils::debug >= 2) {
00153 lightray.dumpData("Refracted in first plate");
00154 }
00155
00156
00157 plate = getPlate(0, 1);
00158
00159 lightray.refract( plate, refra_ind2, refra_ind1 );
00160 if (ALIUtils::debug >= 2) {
00161 lightray.dumpData("Refracted in first plate");
00162 }
00163
00164 }
00165
00166
00167
00168
00169
00170
00171
00172 ALIPlane OptOCubeSplitter::getMiddlePlate()
00173 {
00174 if (ALIUtils::debug >= 4) std::cout << "%%% LR: GET MIDDLE PLATE " << name() << std::endl;
00175
00176
00177 ALIdouble anglePlanes;
00178 ALIbool angpl = findExtraEntryValueIfExists("anglePlanes", anglePlanes);
00179 if( !angpl ) {
00180 anglePlanes = acos(0.)/2.;
00181 if (ALIUtils::debug >= 4) std::cout << "anglePlanes default = " << anglePlanes/deg << std::endl;
00182 }
00183 CLHEP::Hep3Vector Axis(0., 0., 1.);
00184 CLHEP::Hep3Vector XAxis(1., 0., 0.);
00185 Axis.rotate( anglePlanes, XAxis);
00186 CLHEP::HepRotation rmt = rmGlob();
00187 CLHEP::Hep3Vector plate_normal = rmt*Axis;
00188 if (ALIUtils::debug >= 3) {
00189 ALIUtils::dumprm( rmt, "rmt before wedge angles" );
00190 ALIUtils::dump3v( plate_normal, "plate_normal before wedge");
00191 }
00192
00193 CLHEP::Hep3Vector plate_point = centreGlob();
00194
00195
00196 return ALIPlane(plate_point, plate_normal);
00197
00198 }
00199
00200
00201
00202
00203
00204
00205 ALIPlane OptOCubeSplitter::getUpperPlate()
00206 {
00207 if (ALIUtils::debug >= 4) std::cout << "LR: GET UPPER PLATE " << name() << std::endl;
00208
00209 ALIdouble width = findExtraEntryValue("width");
00210
00211 CLHEP::Hep3Vector Axis(0., 1., 0.);
00212 CLHEP::HepRotation rmt = rmGlob();
00213 CLHEP::Hep3Vector plate_normal = rmt*Axis;
00214 if (ALIUtils::debug >= 3) {
00215 ALIUtils::dumprm( rmt, "rmt before wedge angles" );
00216 ALIUtils::dump3v( plate_normal, "plate_normal before wedge");
00217 }
00218
00219 CLHEP::Hep3Vector plate_point = centreGlob();
00220 plate_point += width/2. * plate_normal;
00221
00222
00223 return ALIPlane(plate_point, plate_normal);
00224
00225 }
00226
00227
00228 #ifdef COCOA_VIS
00229
00230 void OptOCubeSplitter::fillIguana()
00231 {
00232 ALIColour* col = new ALIColour( 0., 0., 0., 0. );
00233 ALIdouble width;
00234 ALIbool wexists = findExtraEntryValueIfExists("width",width);
00235 if( !wexists ) width = 4.;
00236
00237 std::vector<ALIdouble> spar;
00238 spar.push_back(width);
00239 spar.push_back(width);
00240 spar.push_back(width);
00241 IgCocoaFileMgr::getInstance().addSolid( *this, "BOX", spar, col);
00242 }
00243 #endif
00244
00245
00246
00247 void OptOCubeSplitter::constructSolidShape()
00248 {
00249 ALIdouble go;
00250 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
00251 gomgr->getGlobalOptionValue("VisScale", go );
00252
00253 theSolidShape = new CocoaSolidShapeBox( "Box", go*5.*cm/m, go*5.*cm/m, go*5.*cm/m );
00254 }