00001
00002
00003
00004
00005
00006
00007
00008 #include "Alignment/CocoaModel/interface/OptOPlateSplitter.h"
00009 #include "Alignment/CocoaModel/interface/LightRay.h"
00010 #include "Alignment/CocoaModel/interface/ALIPlane.h"
00011 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
00012 #ifdef COCOA_VIS
00013 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
00014 #include "Alignment/CocoaVisMgr/interface/ALIColour.h"
00015 #endif
00016 #include "Alignment/CocoaDDLObjects/interface/CocoaSolidShapeBox.h"
00017 #include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"
00018
00019
00020
00021
00022
00023
00024 void OptOPlateSplitter::detailedDeviatesLightRay( LightRay& lightray )
00025 {
00026 if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED REFLECTION IN PLATE SPLITTER " << name() << std::endl;
00027 if (ALIUtils::debug >= 3) ALIUtils::dump3v( centreGlob(), " centre Global RF ");
00028
00029
00030 ALIPlane plate = getPlate(1, 1);
00031
00032 lightray.reflect( plate );
00033 if (ALIUtils::debug >= 2) {
00034 std::cout << "Reflected in plate" << std::endl;
00035 lightray.dumpData(" ");
00036 }
00037
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 void OptOPlateSplitter::detailedTraversesLightRay( LightRay& lightray )
00050 {
00051 if (ALIUtils::debug >= 2) std::cout << "LR: DETAILED TRAVERSE IN PLATE SPLITTER " << name() << std::endl;
00052
00053
00054 ALIPlane plate = getPlate(1, 1);
00055
00056 ALIdouble width = findExtraEntryValue("width");
00057 if( width == 0 ) {
00058 if(ALIUtils::debug >= 3) lightray.dumpData("Traversed with 0 width");
00059 return;
00060 }
00061
00062
00063 ALIdouble refra_ind1 = 1.;
00064 ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
00065 lightray.refract( plate, refra_ind1, refra_ind2 );
00066 if (ALIUtils::debug >= 2) {
00067 lightray.dumpData("Refracted in first plate");
00068 }
00069
00070
00071 plate = getPlate(0, 1);
00072
00073 lightray.refract( plate, refra_ind2, refra_ind1 );
00074 if (ALIUtils::debug >= 2) {
00075 lightray.dumpData("Refracted in first plate");
00076 }
00077
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 void OptOPlateSplitter::fastDeviatesLightRay( LightRay& lightray )
00089 {
00090 if (ALIUtils::debug >= 2) std::cout << "LR: REFLECTION IN PLATE SPLITTER " << name() << std::endl;
00091
00092
00093 ALIPlane plate = getPlate(1, 0);
00094
00095 lightray.reflect( plate );
00096 if (ALIUtils::debug >= 2) {
00097 lightray.dumpData("Reflected in plate");
00098 }
00099
00100 ALIdouble deviRX = findExtraEntryValue("deviRX");
00101 ALIdouble deviRY = findExtraEntryValue("deviRY");
00102 ALIdouble deviR;
00103 ALIbool bb = findExtraEntryValueIfExists("deviR", deviR);
00104 if( bb ) {
00105 deviRX = deviR;
00106 deviRY = deviR;
00107 }
00108
00109
00110 lightray.shiftAndDeviateWhileTraversing( this, 'R' );
00111 if (ALIUtils::debug >= 2) {
00112 lightray.dumpData("Deviated ");
00113 }
00114
00115 }
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 void OptOPlateSplitter::fastTraversesLightRay( LightRay& lightray )
00128 {
00129 if (ALIUtils::debug >= 2) std::cout << "LR: TRAVERSE PLATE SPLITTER " << name() << std::endl;
00130
00131
00132 ALIPlane plate = getPlate(0, 0);
00133 lightray.intersect( plate );
00134 if (ALIUtils::debug >= 2) {
00135 lightray.dumpData("Intersected with plate");
00136 }
00137
00138 ALIdouble shiftX = findExtraEntryValue("shiftTX");
00139 ALIdouble shiftY = findExtraEntryValue("shiftTY");
00140 ALIdouble shift;
00141 ALIbool bb = findExtraEntryValueIfExists("shiftT", shift);
00142 if( bb ) {
00143 shiftX = shift;
00144 shiftY = shift;
00145 }
00146
00147 ALIdouble deviTX = findExtraEntryValue("deviTX");
00148 ALIdouble deviTY = findExtraEntryValue("deviTY");
00149 ALIdouble deviT;
00150 bb = findExtraEntryValueIfExists("deviT", deviT);
00151 if( bb ) {
00152 deviTX = deviT;
00153 deviTY = deviT;
00154 }
00155
00156
00157 lightray.shiftAndDeviateWhileTraversing( this, 'T' );
00158 if (ALIUtils::debug >= 2) {
00159 lightray.dumpData("Shifted and Deviated");
00160 }
00161
00162 }
00163
00164
00165 #ifdef COCOA_VIS
00166
00167 void OptOPlateSplitter::fillIguana()
00168 {
00169 ALIColour* col = new ALIColour( 0., 0., 0., 0. );
00170 ALIdouble width;
00171 ALIbool wexists = findExtraEntryValueIfExists("width",width);
00172 if( !wexists ) width = 1.;
00173
00174 std::vector<ALIdouble> spar;
00175 spar.push_back(4.);
00176 spar.push_back(4.);
00177 spar.push_back(width);
00178 IgCocoaFileMgr::getInstance().addSolid( *this, "BOX", spar, col);
00179 }
00180 #endif
00181
00182
00183
00184 void OptOPlateSplitter::constructSolidShape()
00185 {
00186 ALIdouble go;
00187 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
00188 gomgr->getGlobalOptionValue("VisScale", go );
00189
00190 theSolidShape = new CocoaSolidShapeBox( "Box", go*5.*cm/m, go*5.*cm/m, go*1.*cm/m );
00191 }