Commit eac8e28c authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Pass a const reference instead of a shared_ptr.

parent 170e4f0f
......@@ -275,7 +275,7 @@ void PreprocessDetectorsToMD::processDetectorsPositions(
detIDMap[liveDetectorsCount] = i;
L2[liveDetectorsCount] = spDet->getDistance(*sample);
double polar = inputWS->detectorTwoTheta(spDet);
double polar = inputWS->detectorTwoTheta(*spDet);
double azim = spDet->getPhi();
TwoTheta[liveDetectorsCount] = polar;
Azimuthal[liveDetectorsCount] = azim;
......
......@@ -185,7 +185,7 @@ void CachedExperimentInfo::initCaches(
boost::lexical_cast<std::string>(det->getID()));
}
const double rad2deg = 180. / M_PI;
constexpr double rad2deg = 180. / M_PI;
const double thetaInDegs = twoTheta() * rad2deg;
const double phiInDegs = phi() * rad2deg;
......
......@@ -17,14 +17,6 @@ using namespace Mantid::API;
using namespace Mantid::DataObjects;
using namespace Mantid::MDAlgorithms;
class SaveMD2Tester : public SaveMD2 {
public:
void saveExperimentInfos(::NeXus::File *const file,
IMDEventWorkspace_const_sptr ws) {
this->saveExperimentInfos(file, ws);
}
};
/** Note: See the LoadMDTest class
* for a more thorough test that does
* a round-trip.
......
......@@ -16,14 +16,6 @@ using namespace Mantid::API;
using namespace Mantid::DataObjects;
using namespace Mantid::MDAlgorithms;
class SaveMDTester : public SaveMD {
public:
void saveExperimentInfos(::NeXus::File *const file,
IMDEventWorkspace_const_sptr ws) {
this->saveExperimentInfos(file, ws);
}
};
/** Note: See the LoadMDTest class
* for a more thorough test that does
* a round-trip.
......
......@@ -182,8 +182,6 @@ Mantid::API::Run &getSampleDetailsDeprecated(MatrixWorkspace &self) {
void export_MatrixWorkspace() {
/// Typedef to remove const qualifier on input detector shared_ptr. See
/// Policies/RemoveConst.h for more details
typedef double (MatrixWorkspace::*getDetectorSignature)(
Mantid::Geometry::IDetector_sptr det) const;
class_<MatrixWorkspace, boost::python::bases<ExperimentInfo, IMDWorkspace>,
boost::noncopyable>("MatrixWorkspace", no_init)
......@@ -198,12 +196,10 @@ void export_MatrixWorkspace() {
(arg("self"), arg("xvalue"), arg("workspaceIndex")),
"Returns the index of the bin containing the given xvalue. The "
"workspace_index is optional [default=0]"))
.def("detectorTwoTheta",
(getDetectorSignature)&MatrixWorkspace::detectorTwoTheta,
.def("detectorTwoTheta", &MatrixWorkspace::detectorTwoTheta,
(arg("self"), arg("det")),
"Returns the two theta value for a given detector")
.def("detectorSignedTwoTheta",
(getDetectorSignature)&MatrixWorkspace::detectorSignedTwoTheta,
.def("detectorSignedTwoTheta", &MatrixWorkspace::detectorSignedTwoTheta,
(arg("self"), arg("det")),
"Returns the signed two theta value for given detector")
.def("getSpectrum", (ISpectrum * (MatrixWorkspace::*)(const size_t)) &
......
......@@ -1311,7 +1311,7 @@ void processDetectorsPositions(const API::MatrixWorkspace_const_sptr &inputWS,
detIDMap[liveDetectorsCount] = i;
L2[liveDetectorsCount] = spDet->getDistance(*sample);
double polar = inputWS->detectorTwoTheta(spDet);
double polar = inputWS->detectorTwoTheta(*spDet);
double azim = spDet->getPhi();
TwoTheta[liveDetectorsCount] = polar;
Azimuthal[liveDetectorsCount] = azim;
......
......@@ -140,7 +140,7 @@ void SANSSolidAngleCorrection::exec() {
// Compute solid angle correction factor
const bool is_tube = getProperty("DetectorTubes");
const double tanTheta = tan(inputWS->detectorTwoTheta(det));
const double tanTheta = tan(inputWS->detectorTwoTheta(*det));
const double theta_term = sqrt(tanTheta * tanTheta + 1.0);
double corr;
if (is_tube) {
......@@ -204,7 +204,7 @@ void SANSSolidAngleCorrection::execEvent() {
// Compute solid angle correction factor
const bool is_tube = getProperty("DetectorTubes");
const double tanTheta = tan(outputEventWS->detectorTwoTheta(det));
const double tanTheta = tan(outputEventWS->detectorTwoTheta(*det));
const double theta_term = sqrt(tanTheta * tanTheta + 1.0);
double corr;
if (is_tube) {
......
......@@ -1235,8 +1235,8 @@ Table *MantidUI::createDetectorTable(
// Need to get R, theta through these methods to be correct for grouped
// detectors
R = det->getDistance(*sample);
theta = showSignedTwoTheta ? ws->detectorSignedTwoTheta(det)
: ws->detectorTwoTheta(det);
theta = showSignedTwoTheta ? ws->detectorSignedTwoTheta(*det)
: ws->detectorTwoTheta(*det);
theta *= 180.0 / M_PI; // To degrees
QString isMonitor = det->isMonitor() ? "yes" : "no";
......@@ -1252,7 +1252,7 @@ Table *MantidUI::createDetectorTable(
try {
// Get unsigned theta and efixed value
double efixed = ws->getEFixed(det);
double usignTheta = ws->detectorTwoTheta(det) / 2.0;
double usignTheta = ws->detectorTwoTheta(*det) * 0.5;
double q = Mantid::Kernel::UnitConversion::run(usignTheta, efixed);
colValues << QVariant(q);
......
......@@ -108,7 +108,7 @@ void ReflMainViewPresenter::pushCommands() {
// The expected number of commands
const size_t nCommands = 26;
auto commands = std::move(m_tablePresenter->publishCommands());
auto commands = m_tablePresenter->publishCommands();
if (commands.size() != nCommands) {
throw std::runtime_error("Invalid list of commands");
}
......
......@@ -282,12 +282,12 @@ std::vector<std::string> MatrixWSDataSource::getInfoList(double x, double y) {
l2 = l2 - l1;
} else {
l2 = det->getDistance(*m_sample);
two_theta = m_matWs->detectorTwoTheta(det);
two_theta = m_matWs->detectorTwoTheta(*det);
azi = det->getPhi();
}
SVUtils::PushNameValue("L2", 8, 4, l2, list);
SVUtils::PushNameValue("TwoTheta", 8, 2, two_theta * 180. / M_PI, list);
SVUtils::PushNameValue("Azimuthal", 8, 2, azi * 180. / M_PI, list);
SVUtils::PushNameValue("TwoTheta", 8, 2, two_theta * deg2rad, list);
SVUtils::PushNameValue("Azimuthal", 8, 2, azi * deg2rad, list);
/* For now, only support diffractometers and monitors. */
/* We need a portable way to determine emode and */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment