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