File indexing completed on 2024-05-10 02:20:14
0001
0002
0003
0004
0005
0006
0007
0008 #include "Alignment/CocoaModel/interface/OptODistancemeter3dim.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 <CLHEP/Units/SystemOfUnits.h>
0017 #include "Alignment/CocoaDDLObjects/interface/CocoaSolidShapeTubs.h"
0018 #include "Alignment/CocoaUtilities/interface/GlobalOptionMgr.h"
0019
0020
0021
0022
0023 void OptODistancemeter3dim::defaultBehaviour(LightRay& lightray, Measurement& meas) { makeMeasurement(lightray, meas); }
0024
0025
0026
0027
0028 void OptODistancemeter3dim::makeMeasurement(LightRay& lightray, Measurement& meas) {
0029 const OpticalObject* opto_prev = meas.getPreviousOptO(this);
0030 CLHEP::Hep3Vector dm_centre = centreGlob();
0031 dm_centre -= opto_prev->centreGlob();
0032 if (ALIUtils::debug >= 4) {
0033 std::cout << "OptO " << name() << std::endl;
0034 ALIUtils::dump3v(centreGlob(), " centre Glob ");
0035 std::cout << "OptO " << opto_prev->name() << std::endl;
0036 ALIUtils::dump3v(opto_prev->centreGlob(), " previous OptO centre Glob ");
0037 ALIUtils::dump3v(dm_centre, " distance std::vector");
0038 }
0039
0040 meas.setValueSimulated(0, dm_centre.mag());
0041 if (ALIUtils::debug >= 1) {
0042 std::cout << "SIMU value: D: " << meas.valueSimulated(0) * 1000. << " (mm) " << (this)->name() << std::endl;
0043 std::cout << "REAL value: D: " << meas.value()[0] * 1000. << " (mm) " << (this)->name() << std::endl;
0044 }
0045 }
0046
0047 #ifdef COCOA_VIS
0048
0049 void OptODistancemeter3dim::fillVRML() {
0050
0051 ALIVRMLMgr& vrmlmgr = ALIVRMLMgr::getInstance();
0052 vrmlmgr.AddBox(*this, 1., .2, .2);
0053 vrmlmgr.SendReferenceFrame(*this, 1.);
0054 vrmlmgr.SendName(*this, 0.01);
0055 }
0056
0057
0058 void OptODistancemeter3dim::fillIguana() {
0059 ALIColour* col = new ALIColour(1., 0., 1., 0.);
0060 std::vector<ALIdouble> spar;
0061 spar.push_back(1.);
0062 spar.push_back(3.);
0063 CLHEP::HepRotation rm;
0064 rm.rotateX(90. * deg);
0065 IgCocoaFileMgr::getInstance().addSolid(*this, "CYLINDER", spar, col, CLHEP::Hep3Vector(), rm);
0066 }
0067 #endif
0068
0069
0070 void OptODistancemeter3dim::constructSolidShape() {
0071 ALIdouble go;
0072 GlobalOptionMgr* gomgr = GlobalOptionMgr::getInstance();
0073 gomgr->getGlobalOptionValue("VisScale", go);
0074
0075 theSolidShape = new CocoaSolidShapeTubs("Tubs",
0076 go * 0. * CLHEP::cm / CLHEP::m,
0077 go * 2. * CLHEP::cm / CLHEP::m,
0078 go * 5. * CLHEP::cm / CLHEP::m);
0079 }