Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "Alignment/CocoaModel/interface/OptOTiltmeter.h"
00009 #include "Alignment/CocoaModel/interface/Measurement.h"
00010 #include <iostream>
00011 #include <iomanip>
00012 #ifdef COCOA_VIS
00013 #include "Alignment/CocoaVisMgr/interface/ALIVRMLMgr.h"
00014 #include "Alignment/IgCocoaFileWriter/interface/IgCocoaFileMgr.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 void OptOTiltmeter::defaultBehaviour( LightRay& lightray, Measurement& meas )
00025 {
00026 makeMeasurement( lightray, meas);
00027
00028 }
00029
00030
00031
00032
00033
00034
00035 void OptOTiltmeter::makeMeasurement( LightRay& lightray, Measurement& meas )
00036 {
00037
00038
00039 CLHEP::HepRotation rmt = rmGlob();
00040 CLHEP::Hep3Vector ZAxisl(0.,0.,1.);
00041 ZAxisl *= rmt;
00042
00043
00044
00045
00046
00047
00048
00049 CLHEP::Hep3Vector XAxisg(1.,0.,0.);
00050 CLHEP::Hep3Vector ZAxisg(0.,0.,1.);
00051 CLHEP::Hep3Vector ZAxis_proj = (ZAxisl*XAxisg) * XAxisg + (ZAxisl*ZAxisg) * ZAxisg;
00052 ZAxis_proj *= (1. / ZAxis_proj.mag() );
00053
00054
00055 ALIdouble measvalue = acos(ZAxisl*ZAxis_proj / ZAxisl.mag() / ZAxis_proj.mag());
00056
00057 if( ZAxisl.y() != 0 ) measvalue *= (ZAxisl.y() / fabs(ZAxisl.y()) );
00058 meas.setValueSimulated(0 , measvalue );
00059
00060 if (ALIUtils::debug >= 3) {
00061 ALIUtils::dump3v(ZAxisl," OptOTiltmeter: Local Z axis ");
00062 ALIUtils::dumprm(rmt," tiltmeter rotation matrix");
00063 ALIUtils::dump3v(ZAxis_proj," Projection of Local Z axis on global XZ plane ");
00064 std::cout << "SIMU value: TA: " << std::setprecision(8) << 1000*meas.valueSimulated(0)
00065 << " (mrad) " << (this)->name() << std::endl;
00066 std::cout << "REAL value: TA: " << std::setprecision(8) << 1000*meas.value()[0]
00067 << " (mrad) " << (this)->name() << std::endl;
00068
00069 }
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 }
00112
00113 #ifdef COCOA_VIS
00114
00115 void OptOTiltmeter::fillVRML()
00116 {
00117
00118 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance();
00119 ALIColour* col = new ALIColour( 1., 1., 0., 0. );
00120 vrmlmgr.AddBox( *this, .2, .2, 1., col);
00121 vrmlmgr.SendReferenceFrame( *this, 0.6);
00122 vrmlmgr.SendName( *this, 0.01 );
00123 }
00124
00125
00126
00127 void OptOTiltmeter::fillIguana()
00128 {
00129 ALIColour* col = new ALIColour( 1., 0., 0.9, 0. );
00130 std::vector<ALIdouble> spar;
00131 spar.push_back(1.);
00132 spar.push_back(1.);
00133 spar.push_back(4.);
00134 IgCocoaFileMgr::getInstance().addSolid( *this, "BOX", spar, col);
00135 }
00136 #endif
00137
00138
00139 void OptOTiltmeter::constructSolidShape()
00140 {
00141 ALIdouble go;
00142 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
00143 gomgr->getGlobalOptionValue("VisScale", go );
00144
00145 theSolidShape = new CocoaSolidShapeBox( "Box", go*2.*cm/m, go*2.*cm/m, go*5.*cm/m );
00146 }
00147