From 00e8658d6b3ef6d93a872d55e2a6772e3737e4d8 Mon Sep 17 00:00:00 2001 From: Russell Taylor <taylorrj@ornl.gov> Date: Tue, 30 Aug 2011 16:14:18 +0000 Subject: [PATCH] Remove unnecessary IDetector method. Re #1944. --- .../Algorithms/src/AbsorptionCorrection.cpp | 2 +- .../Framework/Algorithms/src/ConvertUnits.cpp | 2 +- .../Mantid/Framework/Algorithms/src/SofQW.cpp | 2 +- .../DataHandling/src/LoadDetectorInfo.cpp | 5 ++--- .../DataHandling/test/LoadDetectorInfoTest.h | 9 ++++----- Code/Mantid/Framework/Geometry/CMakeLists.txt | 1 - .../Geometry/inc/MantidGeometry/IDetector.h | 19 ++++++++----------- .../inc/MantidGeometry/Instrument/Detector.h | 2 -- .../Framework/Geometry/src/IDetector.cpp | 10 ---------- 9 files changed, 17 insertions(+), 35 deletions(-) delete mode 100644 Code/Mantid/Framework/Geometry/src/IDetector.cpp diff --git a/Code/Mantid/Framework/Algorithms/src/AbsorptionCorrection.cpp b/Code/Mantid/Framework/Algorithms/src/AbsorptionCorrection.cpp index 16f14ddca8e..a1c0fc0d075 100644 --- a/Code/Mantid/Framework/Algorithms/src/AbsorptionCorrection.cpp +++ b/Code/Mantid/Framework/Algorithms/src/AbsorptionCorrection.cpp @@ -155,7 +155,7 @@ void AbsorptionCorrection::exec() if (m_emode==2) { try { - Parameter_sptr par = pmap.get(det->getComponent(),"Efixed"); + Parameter_sptr par = pmap.get(det.get(),"Efixed"); if (par) { Unit_const_sptr energy = UnitFactory::Instance().create("Energy"); diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp index eed19164734..69c211cdd63 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp @@ -434,7 +434,7 @@ void ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUnit, API::MatrixWo { try { - Parameter_sptr par = pmap.getRecursive(det->getComponent(),"Efixed"); + Parameter_sptr par = pmap.getRecursive(det.get(),"Efixed"); if (par) { efixed = par->value<double>(); diff --git a/Code/Mantid/Framework/Algorithms/src/SofQW.cpp b/Code/Mantid/Framework/Algorithms/src/SofQW.cpp index 4bb4c47e8a7..56db4eb07c0 100644 --- a/Code/Mantid/Framework/Algorithms/src/SofQW.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SofQW.cpp @@ -117,7 +117,7 @@ void SofQW::exec() if (emode==2) { try { - Parameter_sptr par = pmap.get(spectrumDet->getComponent(),"Efixed"); + Parameter_sptr par = pmap.get(spectrumDet.get(),"Efixed"); if (par) { efixed = par->value<double>(); diff --git a/Code/Mantid/Framework/DataHandling/src/LoadDetectorInfo.cpp b/Code/Mantid/Framework/DataHandling/src/LoadDetectorInfo.cpp index 96b88c62b24..8930b4b354e 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadDetectorInfo.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadDetectorInfo.cpp @@ -417,11 +417,10 @@ void LoadDetectorInfo::setDetectorParams(const detectorInfo ¶ms, detectorInf } Geometry::ParameterMap &pmap = m_workspace->instrumentParameters(); - const IComponent* comp = det->getComponent(); // Set the detectors pressure. - pmap.addDouble(comp, "3He(atm)", params.pressure); + pmap.addDouble(det.get(), "3He(atm)", params.pressure); // Set the wall thickness - pmap.addDouble(comp, "wallT(m)", params.wallThick); + pmap.addDouble(det.get(), "wallT(m)", params.wallThick); // If we have a l2, theta and phi. Update the postion if required if( m_moveDets && diff --git a/Code/Mantid/Framework/DataHandling/test/LoadDetectorInfoTest.h b/Code/Mantid/Framework/DataHandling/test/LoadDetectorInfoTest.h index 2ef969d8b08..972aa20c8a9 100644 --- a/Code/Mantid/Framework/DataHandling/test/LoadDetectorInfoTest.h +++ b/Code/Mantid/Framework/DataHandling/test/LoadDetectorInfoTest.h @@ -81,7 +81,7 @@ public: boost::shared_ptr<const IComponent> comp = boost::dynamic_pointer_cast<const IComponent>(detector); - const IComponent* baseComp = detector->getComponent(); + const IComponent* baseComp = detector->getComponentID(); Parameter_sptr par = pmap.get(baseComp,"3He(atm)"); // this is only for PSD detectors, code 3 @@ -221,14 +221,13 @@ public: for ( int i = 0; i < NUMRANDOM; ++i) { int detID = DETECTS[i]; - boost::shared_ptr<const IDetector> detector =WS->getInstrument()->getDetector(detID); + IDetector_const_sptr detector =WS->getInstrument()->getDetector(detID); - const IComponent* baseComp = detector->getComponent(); - Parameter_sptr par = pmap.get(baseComp,"3He(atm)"); + Parameter_sptr par = pmap.get(detector.get(),"3He(atm)"); TS_ASSERT(par); TS_ASSERT_EQUALS(par->asString(), castaround("10.0")); - par = pmap.get(baseComp,"wallT(m)"); + par = pmap.get(detector.get(),"wallT(m)"); TS_ASSERT(par); TS_ASSERT_EQUALS(par->asString(), castaround("0.0008").substr(0,6)); diff --git a/Code/Mantid/Framework/Geometry/CMakeLists.txt b/Code/Mantid/Framework/Geometry/CMakeLists.txt index 40323c9d85e..369c2b50668 100644 --- a/Code/Mantid/Framework/Geometry/CMakeLists.txt +++ b/Code/Mantid/Framework/Geometry/CMakeLists.txt @@ -3,7 +3,6 @@ set ( SRC_FILES src/Crystal/OrientedLattice.cpp src/Crystal/ReflectionCondition.cpp src/Crystal/UnitCell.cpp - src/IDetector.cpp src/Instrument.cpp src/IObjComponent.cpp src/Instrument/CompAssembly.cpp diff --git a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/IDetector.h b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/IDetector.h index 82fbffb2555..c37c4883364 100644 --- a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/IDetector.h +++ b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/IDetector.h @@ -25,7 +25,14 @@ namespace Kernel namespace Geometry { - + /** Describes the topology of a detectors group used to calculate angular position and angular + * measures for detectors. The topology defines the meaning of angular measurements for a detector + */ + enum det_topology{ + rect, //< rectangular geometry + cyl, //< cylindrical geometry + undef //< the geometry is yet undefined, if you need to know the geometry, a method to identify it must be deployed + }; /** Interface class for detector objects. @@ -52,14 +59,6 @@ namespace Geometry File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ -/** enum describes the toplogy of a detectors group used to calculate angular position and angular - * measures for detecors. The topology defines the meaning of angular measurements for a detector -*/ -enum det_topology{ - rect, //< rectangular geometry - cyl, //< cylindrical geometry - undef //< the geometry is yet undefined, if you need to know the geometry, a method to identify it must be deployed -}; class MANTID_GEOMETRY_DLL IDetector : public virtual IObjComponent { public: @@ -90,8 +89,6 @@ public: /// Indicates whether this is a monitor detector virtual bool isMonitor() const = 0; - /// Must return a pointer to itself if derived from IComponent - virtual const IComponent* getComponent() const; /// returns the geometry of detectors, meaningful for groups, rectangular for single; returns the centre of a detector virtual det_topology getTopology(Kernel::V3D ¢er)const = 0; diff --git a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/Instrument/Detector.h b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/Instrument/Detector.h index 248bb8ec23c..4c1a965ba17 100644 --- a/Code/Mantid/Framework/Geometry/inc/MantidGeometry/Instrument/Detector.h +++ b/Code/Mantid/Framework/Geometry/inc/MantidGeometry/Instrument/Detector.h @@ -64,8 +64,6 @@ public: double getPhi() const; bool isMasked() const; bool isMonitor() const; - /// Returns a reference to itself - const IComponent* getComponent() const {return static_cast<const IComponent*>(this);} // end IDetector methods void markAsMonitor(const bool flag = true); /** returns the detector's topology, namely, the meaning of the detector's angular measurements. diff --git a/Code/Mantid/Framework/Geometry/src/IDetector.cpp b/Code/Mantid/Framework/Geometry/src/IDetector.cpp deleted file mode 100644 index 1d17c1b13f3..00000000000 --- a/Code/Mantid/Framework/Geometry/src/IDetector.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "MantidGeometry/IDetector.h" - -using namespace Mantid::Geometry; - -/// Must return a pointer to itself if derived from IComponent -const IComponent* IDetector::getComponent() const -{ - throw std::runtime_error("This detector class does not inherit from IComponent."); -} - -- GitLab