|
||||
File indexing completed on 2024-04-06 11:56:04
0001 // COCOA class implementation file 0002 //Id: OptOTiltmeter.cc 0003 //CAT: Model 0004 // 0005 // History: v1.0 0006 // Pedro Arce 0007 0008 #include "Alignment/CocoaModel/interface/OptOTiltmeter.h" 0009 #include "Alignment/CocoaModel/interface/Measurement.h" 0010 #include <iostream> 0011 #include <iomanip> 0012 #ifdef COCOA_VIS 0013 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h" 0014 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.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 //@@ Default behaviour: make measurement 0023 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 0024 void OptOTiltmeter::defaultBehaviour(LightRay& lightray, Measurement& meas) { makeMeasurement(lightray, meas); } 0025 0026 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 0027 //@@ Make measurement as angle with the horizontal plane = angle between local Z axis and its projection on the global XZ plane 0028 //-Make measurement as rotations around X axis: difference between current Z axis and Z axis (0,0,1) 0029 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 0030 void OptOTiltmeter::makeMeasurement(LightRay& lightray, Measurement& meas) { 0031 //---------- Get local Z axix 0032 CLHEP::HepRotation rmt = rmGlob(); 0033 CLHEP::Hep3Vector ZAxisl(0., 0., 1.); 0034 ZAxisl *= rmt; 0035 0036 //--------- Get projection in a global XZ plane 0037 /*-plane parallel to global Y (gravity) and to tiltmeter Z 0038 CLHEP::Hep3Vector plane_point(0.,0.,0.); 0039 CLHEP::Hep3Vector plane_normal = ZAxisl.cross( CLHEP::Hep3Vector(0.,1.,0.) ); 0040 CLHEP::Hep3Vector ZAxis_proj = (ALIPlane( plane_point, plane_normal)).project( ZAxisl ); 0041 */ 0042 CLHEP::Hep3Vector XAxisg(1., 0., 0.); 0043 CLHEP::Hep3Vector ZAxisg(0., 0., 1.); 0044 CLHEP::Hep3Vector ZAxis_proj = (ZAxisl * XAxisg) * XAxisg + (ZAxisl * ZAxisg) * ZAxisg; 0045 ZAxis_proj *= (1. / ZAxis_proj.mag()); 0046 0047 //--------- Get measurement 0048 ALIdouble measvalue = acos(ZAxisl * ZAxis_proj / ZAxisl.mag() / ZAxis_proj.mag()); 0049 //----- get sign of angle as sign of y component of ZAxis 0050 if (ZAxisl.y() != 0) 0051 measvalue *= (ZAxisl.y() / fabs(ZAxisl.y())); 0052 meas.setValueSimulated(0, measvalue); 0053 0054 if (ALIUtils::debug >= 3) { 0055 ALIUtils::dump3v(ZAxisl, " OptOTiltmeter: Local Z axis "); 0056 ALIUtils::dumprm(rmt, " tiltmeter rotation matrix"); 0057 ALIUtils::dump3v(ZAxis_proj, " Projection of Local Z axis on global XZ plane "); 0058 std::cout << "SIMU value: TA: " << std::setprecision(8) << 1000 * meas.valueSimulated(0) << " (mrad) " 0059 << (this)->name() << std::endl; 0060 std::cout << "REAL value: TA: " << std::setprecision(8) << 1000 * meas.value()[0] << " (mrad) " << (this)->name() 0061 << std::endl; 0062 } 0063 0064 /*- //---------- Get simulated value: 0065 CLHEP::HepRotation rmtori = rmGlobOriginal(); 0066 CLHEP::Hep3Vector ZAxism(0.,0.,1.); 0067 CLHEP::Hep3Vector ZAxism_ori = ZAxism; 0068 ZAxism_ori *= rmtori; 0069 0070 //---------- Measure rotation with respect to original position, around the X axis defined by the original position, in the original YZ plane 0071 CLHEP::Hep3Vector ZAxism_rot = ZAxism; 0072 CLHEP::HepRotation rmt = rmGlob(); 0073 ZAxism_rot *= rmt; 0074 //----- Project on original YZ plane 0075 CLHEP::Hep3Vector YAxism_ori(0.,1.,0.); 0076 YAxism_ori *= rmtori; 0077 //--- create original YZ plane 0078 CLHEP::Hep3Vector YZplanePoint = centreGlob(); 0079 CLHEP::Hep3Vector YZplaneNormal = YAxism_ori.cross( ZAxism_ori ); 0080 ALIPlane yzorig( YZplanePoint, YZplaneNormal ); 0081 CLHEP::Hep3Vector ZAxism_proj = yzorig.project( ZAxism_rot); 0082 //- ALIUtils::dump3v( YAxism_ori, "YAxism_ori"); 0083 //- ALIUtils::dump3v( ZAxism_ori, "ZAxism_ori"); 0084 //- ALIUtils::dump3v( ZAxism_rot, "ZAxism_rot"); 0085 //- ALIUtils::dump3v( ZAxism_proj, "ZAxism_proj"); 0086 ALIdouble measValue = acos( ZAxism.dot(ZAxism_proj)/ZAxism_proj.mag() ); 0087 if( ZAxism_proj.x() < 0) measValue *= -1.; 0088 meas.setValueSimulated(0 , measValue ); 0089 0090 if (ALIUtils::debug >= 3) { 0091 std::cout << " OptOTiltmeter: Original Z axis " << ZAxism_ori << std::endl; 0092 ALIUtils::dumprm(rmt," tiltmeter original rotation matrix"); 0093 std::cout << " OptOTiltmeter: current Z axis " << ZAxism_rot << std::endl; 0094 ALIUtils::dumprm(rmt," tiltmeter current rotation matrix"); 0095 std::cout << "SIMU value; TA: " << std::setprecision(8) << meas.valueSimulated(0) 0096 << " (rad) " << (this)->name() << std::endl; 0097 std::cout << "REAL value: TA: " << std::setprecision(8) << meas.value()[0] 0098 << " (rad) " << (this)->name() << std::endl; 0099 0100 } 0101 */ 0102 } 0103 0104 #ifdef COCOA_VIS 0105 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 0106 void OptOTiltmeter::fillVRML() { 0107 //- std::cout << " filling optosensor " << std::endl; 0108 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance(); 0109 ALIColour* col = new ALIColour(1., 1., 0., 0.); 0110 vrmlmgr.AddBox(*this, .2, .2, 1., col); 0111 vrmlmgr.SendReferenceFrame(*this, 0.6); 0112 vrmlmgr.SendName(*this, 0.01); 0113 } 0114 0115 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 0116 void OptOTiltmeter::fillIguana() { 0117 ALIColour* col = new ALIColour(1., 0., 0.9, 0.); 0118 std::vector<ALIdouble> spar; 0119 spar.push_back(1.); 0120 spar.push_back(1.); 0121 spar.push_back(4.); 0122 IgCocoaFileMgr::getInstance().addSolid(*this, "BOX", spar, col); 0123 } 0124 #endif 0125 0126 //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 0127 void OptOTiltmeter::constructSolidShape() { 0128 ALIdouble go; 0129 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance(); 0130 gomgr->getGlobalOptionValue("VisScale", go); 0131 0132 theSolidShape = new CocoaSolidShapeBox( 0133 "Box", go * 2. * cm / m, go * 2. * cm / m, go * 5. * cm / m); //COCOA internal units are meters 0134 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |