Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:04

0001 //   COCOA class implementation file

0002 //Id:  OptOPlateSplitter.cc

0003 //CAT: Model

0004 //

0005 //   History: v1.0

0006 //   Pedro Arce

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 //@@ Detailed simulation of Reflection in Plate Splitter

0023 //@@ The software gets the plane of reflection as the forward splitter plane

0024 //@@ Then the beam is reflected in this plane.

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   //---------- Get forward plate

0033   ALIPlane plate = getPlate(true, true);
0034   //---------- Reflect

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 //@@ Detailed simulation of the light ray traversing

0044 //@@  The beam enters the splitter, is refracted, traverses the splitter and finally is again refracted when it exits:

0045 //@@ Get the intersection with the forward splitter plane

0046 //@@ Refract the beam and propagate until it intersects the backward splitter plane.

0047 //@@ Finally the beam is refracted again.

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   //---------- Get forward plate

0055   ALIPlane plate = getPlate(true, true);
0056   //---------- If width is 0, just keep the same point

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   //---------- Refract while entering splitter

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   //---------- Get backward plate

0073   plate = getPlate(false, true);
0074   //---------- Refract while exiting splitter

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 //@@ Fast simulation of deviation of the light ray:

0083 //@@ Reflect in a Plate Splitter

0084 //@@ The beam is reflected in the first plate of the plate splitter, which is obtained without applying the rotation by 'wedge'.

0085 //@@ After the beam is reflected, it is rotated around the splitter X axis by 'deviX' and around the Y axis by 'deviY'.

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   //---------- Get forward plate

0093   ALIPlane plate = getPlate(true, false);
0094   //---------- Reflect in plate (including intersection with it)

0095   lightray.reflect(plate);
0096   if (ALIUtils::debug >= 2) {
0097     lightray.dumpData("Reflected in plate");
0098   }
0099   //---------- Deviate Lightray

0100   lightray.shiftAndDeviateWhileTraversing(this, 'R');
0101   if (ALIUtils::debug >= 2) {
0102     lightray.dumpData("Deviated ");
0103   }
0104 }
0105 
0106 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0107 //@@ Fast simulation of the light ray traversing

0108 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

0109 //@@ Traverse Plane Parallel Plate

0110 //@@ Traslated to the backward plate of the plate splitter

0111 //@@ Shifted in the splitter X direction by 'shiftX', and in the Y direction by 'shiftY'

0112 //@@ and  rotated around the splitter X axis by 'deviX' and around the Y axis by 'deviY'.

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   //---------- Get backward plate

0120   ALIPlane plate = getPlate(false, false);
0121   lightray.intersect(plate);
0122   if (ALIUtils::debug >= 2) {
0123     lightray.dumpData("Intersected with plate");
0124   }
0125   //---------- Shift and Deviate

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);  //COCOA internal units are meters

0157 }