File indexing completed on 2024-04-06 11:56:04
0001
0002
0003
0004
0005
0006
0007
0008 #include "Alignment/CocoaModel/interface/OptOPlateSplitter.h"
0009 #include "Alignment/CocoaModel/interface/LightRay.h"
0010 #include "Alignment/CocoaModel/interface/ALIPlane.h"
0011 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
0012 #ifdef COCOA_VIS
0013 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.h"
0014 #include "Alignment/CocoaVisMgr/interface/ALIColour.h"
0015 #endif
0016 #include "Alignment/CocoaDDLObjects/interface/CocoaSolidShapeBox.h"
0017 #include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"
0018
0019 using namespace CLHEP;
0020
0021
0022
0023
0024
0025
0026 void OptOPlateSplitter::detailedDeviatesLightRay(LightRay& lightray) {
0027 if (ALIUtils::debug >= 2)
0028 std::cout << "LR: DETAILED REFLECTION IN PLATE SPLITTER " << name() << std::endl;
0029 if (ALIUtils::debug >= 3)
0030 ALIUtils::dump3v(centreGlob(), " centre Global RF ");
0031
0032
0033 ALIPlane plate = getPlate(true, true);
0034
0035 lightray.reflect(plate);
0036 if (ALIUtils::debug >= 2) {
0037 std::cout << "Reflected in plate" << std::endl;
0038 lightray.dumpData(" ");
0039 }
0040 }
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 void OptOPlateSplitter::detailedTraversesLightRay(LightRay& lightray) {
0051 if (ALIUtils::debug >= 2)
0052 std::cout << "LR: DETAILED TRAVERSE IN PLATE SPLITTER " << name() << std::endl;
0053
0054
0055 ALIPlane plate = getPlate(true, true);
0056
0057 ALIdouble width = findExtraEntryValue("width");
0058 if (width == 0) {
0059 if (ALIUtils::debug >= 3)
0060 lightray.dumpData("Traversed with 0 width");
0061 return;
0062 }
0063
0064
0065 ALIdouble refra_ind1 = 1.;
0066 ALIdouble refra_ind2 = findExtraEntryValue("refra_ind");
0067 lightray.refract(plate, refra_ind1, refra_ind2);
0068 if (ALIUtils::debug >= 2) {
0069 lightray.dumpData("Refracted in first plate");
0070 }
0071
0072
0073 plate = getPlate(false, true);
0074
0075 lightray.refract(plate, refra_ind2, refra_ind1);
0076 if (ALIUtils::debug >= 2) {
0077 lightray.dumpData("Refracted in first plate");
0078 }
0079 }
0080
0081
0082
0083
0084
0085
0086
0087
0088 void OptOPlateSplitter::fastDeviatesLightRay(LightRay& lightray) {
0089 if (ALIUtils::debug >= 2)
0090 std::cout << "LR: REFLECTION IN PLATE SPLITTER " << name() << std::endl;
0091
0092
0093 ALIPlane plate = getPlate(true, false);
0094
0095 lightray.reflect(plate);
0096 if (ALIUtils::debug >= 2) {
0097 lightray.dumpData("Reflected in plate");
0098 }
0099
0100 lightray.shiftAndDeviateWhileTraversing(this, 'R');
0101 if (ALIUtils::debug >= 2) {
0102 lightray.dumpData("Deviated ");
0103 }
0104 }
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115 void OptOPlateSplitter::fastTraversesLightRay(LightRay& lightray) {
0116 if (ALIUtils::debug >= 2)
0117 std::cout << "LR: TRAVERSE PLATE SPLITTER " << name() << std::endl;
0118
0119
0120 ALIPlane plate = getPlate(false, false);
0121 lightray.intersect(plate);
0122 if (ALIUtils::debug >= 2) {
0123 lightray.dumpData("Intersected with plate");
0124 }
0125
0126 lightray.shiftAndDeviateWhileTraversing(this, 'T');
0127 if (ALIUtils::debug >= 2) {
0128 lightray.dumpData("Shifted and Deviated");
0129 }
0130 }
0131
0132 #ifdef COCOA_VIS
0133
0134 void OptOPlateSplitter::fillIguana() {
0135 ALIColour* col = new ALIColour(0., 0., 0., 0.);
0136 ALIdouble width;
0137 ALIbool wexists = findExtraEntryValueIfExists("width", width);
0138 if (!wexists)
0139 width = 1.;
0140
0141 std::vector<ALIdouble> spar;
0142 spar.push_back(4.);
0143 spar.push_back(4.);
0144 spar.push_back(width);
0145 IgCocoaFileMgr::getInstance().addSolid(*this, "BOX", spar, col);
0146 }
0147 #endif
0148
0149
0150 void OptOPlateSplitter::constructSolidShape() {
0151 ALIdouble go;
0152 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
0153 gomgr->getGlobalOptionValue("VisScale", go);
0154
0155 theSolidShape = new CocoaSolidShapeBox(
0156 "Box", go * 5. * cm / m, go * 5. * cm / m, go * 1. * cm / m);
0157 }