Commit eb19232b authored by Zhang, Chen's avatar Zhang, Chen
Browse files

formatting fix for files affect by older PR

parent c8b4c0b7
......@@ -108,14 +108,11 @@ public:
double getEFixed(const detid_t detID) const;
/// Easy access to the efixed value for this run & optional detector
double getEFixed(const std::shared_ptr<const Geometry::IDetector> &detector =
std::shared_ptr<const Geometry::IDetector>{
nullptr}) const;
double getEFixedGivenEMode(
const std::shared_ptr<const Geometry::IDetector> &detector,
const Kernel::DeltaEMode::Type emode) const;
double getEFixedForIndirect(
const std::shared_ptr<const Geometry::IDetector> &detector,
const std::vector<std::string> &parameterNames) const;
std::shared_ptr<const Geometry::IDetector>{nullptr}) const;
double getEFixedGivenEMode(const std::shared_ptr<const Geometry::IDetector> &detector,
const Kernel::DeltaEMode::Type emode) const;
double getEFixedForIndirect(const std::shared_ptr<const Geometry::IDetector> &detector,
const std::vector<std::string> &parameterNames) const;
/// Set the efixed value for a given detector ID
void setEFixed(const detid_t detID, const double value);
......
......@@ -70,9 +70,7 @@ public:
double azimuthal(const size_t index) const;
std::pair<double, double> geographicalAngles(const size_t index) const;
Kernel::V3D position(const size_t index) const;
Kernel::UnitParametersMap
diffractometerConstants(const size_t index,
std::vector<detid_t> &uncalibratedDets) const;
Kernel::UnitParametersMap diffractometerConstants(const size_t index, std::vector<detid_t> &uncalibratedDets) const;
Kernel::UnitParametersMap diffractometerConstants(const size_t index) const;
double difcUncalibrated(const size_t index) const;
bool hasDetectors(const size_t index) const;
......@@ -91,13 +89,10 @@ public:
Kernel::V3D samplePosition() const;
double l1() const;
void getDetectorValues(const Kernel::Unit &inputUnit,
const Kernel::Unit &outputUnit,
const Kernel::DeltaEMode::Type emode,
const bool signedTheta, int64_t wsIndex,
void getDetectorValues(const Kernel::Unit &inputUnit, const Kernel::Unit &outputUnit,
const Kernel::DeltaEMode::Type emode, const bool signedTheta, int64_t wsIndex,
Kernel::UnitParametersMap &pmap) const;
void createDetectorIdLogMessages(const std::vector<detid_t> &detids,
int64_t wsIndex) const;
void createDetectorIdLogMessages(const std::vector<detid_t> &detids, int64_t wsIndex) const;
SpectrumInfoIterator<SpectrumInfo> begin();
SpectrumInfoIterator<SpectrumInfo> end();
......
......@@ -635,22 +635,18 @@ double ExperimentInfo::getEFixed(const std::shared_ptr<const Geometry::IDetector
return getEFixedGivenEMode(detector, emode);
}
double ExperimentInfo::getEFixedForIndirect(
const std::shared_ptr<const Geometry::IDetector> &detector,
const std::vector<std::string> &parameterNames) const {
double ExperimentInfo::getEFixedForIndirect(const std::shared_ptr<const Geometry::IDetector> &detector,
const std::vector<std::string> &parameterNames) const {
double efixed = 0.;
for (auto &parameterName : parameterNames) {
Parameter_sptr par =
constInstrumentParameters().getRecursive(detector.get(), parameterName);
Parameter_sptr par = constInstrumentParameters().getRecursive(detector.get(), parameterName);
if (par) {
efixed = par->value<double>();
} else {
std::vector<double> efixedVec =
detector->getNumberParameter(parameterName);
std::vector<double> efixedVec = detector->getNumberParameter(parameterName);
if (efixedVec.empty()) {
int detid = detector->getID();
IDetector_const_sptr detectorSingle =
getInstrument()->getDetector(detid);
IDetector_const_sptr detectorSingle = getInstrument()->getDetector(detid);
efixedVec = detectorSingle->getNumberParameter(parameterName);
}
if (!efixedVec.empty()) {
......@@ -675,9 +671,8 @@ double ExperimentInfo::getEFixedForIndirect(
* @param emode :: enum value indicating whether elastic, direct or indirect
* @return The current efixed value
*/
double ExperimentInfo::getEFixedGivenEMode(
const std::shared_ptr<const Geometry::IDetector> &detector,
const Kernel::DeltaEMode::Type emode) const {
double ExperimentInfo::getEFixedGivenEMode(const std::shared_ptr<const Geometry::IDetector> &detector,
const Kernel::DeltaEMode::Type emode) const {
if (emode == Kernel::DeltaEMode::Direct) {
double efixed = 0.;
for (auto &parameterName : {"Ei", "EnergyRequested", "EnergyEstimate"}) {
......
......@@ -1061,15 +1061,11 @@ void IFunction::setMatrixWorkspace(std::shared_ptr<const API::MatrixWorkspace> w
// if unit specified convert centre value to unit required by
// formula or look-up-table
if (centreUnit) {
g_log.debug()
<< "For FitParameter " << parameterName(i)
<< " centre of peak before any unit conversion is "
<< centreValue << '\n';
centreValue =
convertValue(centreValue, centreUnit, workspace, wi);
g_log.debug() << "For FitParameter " << parameterName(i)
<< " centre of peak after any unit conversion is "
<< centreValue << '\n';
<< " centre of peak before any unit conversion is " << centreValue << '\n';
centreValue = convertValue(centreValue, centreUnit, workspace, wi);
g_log.debug() << "For FitParameter " << parameterName(i)
<< " centre of peak after any unit conversion is " << centreValue << '\n';
}
double paramValue = fitParam.getValue(centreValue);
......@@ -1081,15 +1077,12 @@ void IFunction::setMatrixWorkspace(std::shared_ptr<const API::MatrixWorkspace> w
// www.mantidproject.org/IDF
if (fitParam.getFormula().empty()) {
// so from look up table
Kernel::Unit_sptr resultUnit =
fitParam.getLookUpTable().getYUnit(); // from table
g_log.debug()
<< "The FitParameter " << parameterName(i) << " = "
<< paramValue << " before y-unit conversion\n";
Kernel::Unit_sptr resultUnit = fitParam.getLookUpTable().getYUnit(); // from table
g_log.debug() << "The FitParameter " << parameterName(i) << " = " << paramValue
<< " before y-unit conversion\n";
paramValue /= convertValue(1.0, resultUnit, workspace, wi);
g_log.debug()
<< "The FitParameter " << parameterName(i) << " = "
<< paramValue << " after y-unit conversion\n";
g_log.debug() << "The FitParameter " << parameterName(i) << " = " << paramValue
<< " after y-unit conversion\n";
} else {
// so from formula
......@@ -1111,14 +1104,11 @@ void IFunction::setMatrixWorkspace(std::shared_ptr<const API::MatrixWorkspace> w
try {
mu::Parser p;
p.SetExpr(resultUnitStr);
g_log.debug() << "The FitParameter " << parameterName(i)
<< " = " << paramValue
<< " before result-unit conversion (using "
<< resultUnitStr << ")\n";
g_log.debug() << "The FitParameter " << parameterName(i) << " = " << paramValue
<< " before result-unit conversion (using " << resultUnitStr << ")\n";
paramValue *= p.Eval();
g_log.debug()
<< "The FitParameter " << parameterName(i) << " = "
<< paramValue << " after result-unit conversion\n";
g_log.debug() << "The FitParameter " << parameterName(i) << " = " << paramValue
<< " after result-unit conversion\n";
} catch (mu::Parser::exception_type &e) {
g_log.error() << "Cannot convert formula unit to workspace unit"
<< " Formula unit which cannot be passed is " << resultUnitStr
......@@ -1214,9 +1204,8 @@ void IFunction::convertValue(std::vector<double> &values, Kernel::Unit_sptr &out
Instrument_const_sptr instrument = ws->getInstrument();
Geometry::IComponent_const_sptr sample = instrument->getSample();
if (sample == nullptr) {
g_log.error()
<< "No sample defined instrument. Cannot convert units for function\n"
<< "Ignore conversion.";
g_log.error() << "No sample defined instrument. Cannot convert units for function\n"
<< "Ignore conversion.";
return;
}
const auto &spectrumInfo = ws->spectrumInfo();
......@@ -1225,15 +1214,13 @@ void IFunction::convertValue(std::vector<double> &values, Kernel::Unit_sptr &out
auto emode = ws->getEMode();
Kernel::UnitParametersMap pmap{};
spectrumInfo.getDetectorValues(*wsUnit, *outUnit, emode, false, wsIndex,
pmap);
spectrumInfo.getDetectorValues(*wsUnit, *outUnit, emode, false, wsIndex, pmap);
std::vector<double> emptyVec;
try {
wsUnit->toTOF(values, emptyVec, l1, emode, pmap);
outUnit->fromTOF(values, emptyVec, l1, emode, pmap);
} catch (std::exception &) {
throw std::runtime_error("Unable to perform unit conversion to " +
outUnit->unitID());
throw std::runtime_error("Unable to perform unit conversion to " + outUnit->unitID());
}
}
}
......
......@@ -147,9 +147,7 @@ Kernel::V3D SpectrumInfo::position(const size_t index) const {
* some don't
* @return map containing the average constants
*/
UnitParametersMap
SpectrumInfo::diffractometerConstants(const size_t index,
std::vector<detid_t> &warningDets) const {
UnitParametersMap SpectrumInfo::diffractometerConstants(const size_t index, std::vector<detid_t> &warningDets) const {
if (m_detectorInfo.isScanning()) {
throw std::runtime_error("Retrieval of diffractometer constants not "
"implemented for scanning instrument");
......@@ -158,33 +156,27 @@ SpectrumInfo::diffractometerConstants(const size_t index,
std::vector<size_t> detectorIndicesOnly;
std::vector<detid_t> calibratedDets;
std::vector<detid_t> uncalibratedDets;
std::transform(spectrumDef.begin(), spectrumDef.end(),
std::back_inserter(detectorIndicesOnly),
std::transform(spectrumDef.begin(), spectrumDef.end(), std::back_inserter(detectorIndicesOnly),
[](auto const &pair) { return pair.first; });
double difa{0.}, difc{0.}, tzero{0.};
for (const auto &detIndex : detectorIndicesOnly) {
auto newDiffConstants = m_detectorInfo.diffractometerConstants(
detIndex, calibratedDets, uncalibratedDets);
auto newDiffConstants = m_detectorInfo.diffractometerConstants(detIndex, calibratedDets, uncalibratedDets);
difa += std::get<0>(newDiffConstants);
difc += std::get<1>(newDiffConstants);
tzero += std::get<2>(newDiffConstants);
}
if (calibratedDets.size() > 0 && uncalibratedDets.size() > 0) {
warningDets.insert(warningDets.end(), uncalibratedDets.begin(),
uncalibratedDets.end());
warningDets.insert(warningDets.end(), uncalibratedDets.begin(), uncalibratedDets.end());
};
// if no calibration is found then return difc only based on the average
// of the detector L2 and twoThetas.
if (calibratedDets.size() == 0) {
return {{UnitParams::difc, difcUncalibrated(index)}};
}
return {{UnitParams::difa,
difa / static_cast<double>(spectrumDefinition(index).size())},
{UnitParams::difc,
difc / static_cast<double>(spectrumDefinition(index).size())},
{UnitParams::tzero,
tzero / static_cast<double>(spectrumDefinition(index).size())}};
return {{UnitParams::difa, difa / static_cast<double>(spectrumDefinition(index).size())},
{UnitParams::difc, difc / static_cast<double>(spectrumDefinition(index).size())},
{UnitParams::tzero, tzero / static_cast<double>(spectrumDefinition(index).size())}};
}
/** Calculate average diffractometer constants (DIFA, DIFC, TZERO) of
......@@ -193,8 +185,7 @@ SpectrumInfo::diffractometerConstants(const size_t index,
* @param index Index of the spectrum that constants are required for
* @return map containing the average constants
*/
UnitParametersMap
SpectrumInfo::diffractometerConstants(const size_t index) const {
UnitParametersMap SpectrumInfo::diffractometerConstants(const size_t index) const {
std::vector<int> warningDets;
return diffractometerConstants(index, warningDets);
}
......@@ -209,8 +200,7 @@ double SpectrumInfo::difcUncalibrated(const size_t index) const {
// This will be different to the average of the per detector difcs. This is
// for backwards compatibility because Mantid always used to calculate
// spectrum level difc's this way
return 1. / Kernel::Units::tofToDSpacingFactor(l1(), l2(index),
twoTheta(index), 0.);
return 1. / Kernel::Units::tofToDSpacingFactor(l1(), l2(index), twoTheta(index), 0.);
}
/** Get the detector values relevant to unit conversion for a workspace index
......@@ -224,10 +214,8 @@ required by unit classes to perform their conversions eg efixed. It can
contain values on the way in if a look up isn't desired here eg if value
supplied in parameters to the calling algorithm
*/
void SpectrumInfo::getDetectorValues(const Kernel::Unit &inputUnit,
const Kernel::Unit &outputUnit,
const Kernel::DeltaEMode::Type emode,
const bool signedTheta, int64_t wsIndex,
void SpectrumInfo::getDetectorValues(const Kernel::Unit &inputUnit, const Kernel::Unit &outputUnit,
const Kernel::DeltaEMode::Type emode, const bool signedTheta, int64_t wsIndex,
UnitParametersMap &pmap) const {
if (!hasDetectors(wsIndex))
return;
......@@ -243,15 +231,11 @@ void SpectrumInfo::getDetectorValues(const Kernel::Unit &inputUnit,
} catch (const std::runtime_error &e) {
g_log.warning(e.what());
}
if (emode != Kernel::DeltaEMode::Elastic &&
pmap.find(UnitParams::efixed) == pmap.end()) {
std::shared_ptr<const Geometry::IDetector> det(&detector(wsIndex),
Mantid::NoDeleting());
if (emode != Kernel::DeltaEMode::Elastic && pmap.find(UnitParams::efixed) == pmap.end()) {
std::shared_ptr<const Geometry::IDetector> det(&detector(wsIndex), Mantid::NoDeleting());
try {
pmap[UnitParams::efixed] =
m_experimentInfo.getEFixedGivenEMode(det, emode);
g_log.debug() << "Detector: " << det->getID()
<< " EFixed: " << pmap[UnitParams::efixed] << "\n";
pmap[UnitParams::efixed] = m_experimentInfo.getEFixedGivenEMode(det, emode);
g_log.debug() << "Detector: " << det->getID() << " EFixed: " << pmap[UnitParams::efixed] << "\n";
} catch (std::runtime_error) {
// let the unit classes work out if this is a problem
}
......@@ -259,11 +243,9 @@ void SpectrumInfo::getDetectorValues(const Kernel::Unit &inputUnit,
std::vector<detid_t> warnDetIds;
try {
std::set<std::string> diffConstUnits = {"dSpacing", "MomentumTransfer",
"Empty"};
std::set<std::string> diffConstUnits = {"dSpacing", "MomentumTransfer", "Empty"};
if ((emode == Kernel::DeltaEMode::Elastic) &&
(diffConstUnits.count(inputUnit.unitID()) ||
diffConstUnits.count(outputUnit.unitID()))) {
(diffConstUnits.count(inputUnit.unitID()) || diffConstUnits.count(outputUnit.unitID()))) {
auto diffConstsMap = diffractometerConstants(wsIndex, warnDetIds);
pmap.insert(diffConstsMap.begin(), diffConstsMap.end());
if (warnDetIds.size() > 0) {
......@@ -286,8 +268,7 @@ void SpectrumInfo::getDetectorValues(const Kernel::Unit &inputUnit,
}
}
void SpectrumInfo::createDetectorIdLogMessages(
const std::vector<detid_t> &detids, int64_t wsIndex) const {
void SpectrumInfo::createDetectorIdLogMessages(const std::vector<detid_t> &detids, int64_t wsIndex) const {
std::string detIDstring;
auto iter = detids.begin();
auto itEnd = detids.end();
......@@ -298,11 +279,9 @@ void SpectrumInfo::createDetectorIdLogMessages(
if (!detIDstring.empty()) {
detIDstring.pop_back(); // Drop last comma
}
g_log.warning(
"Incomplete set of calibrated diffractometer constants found for "
"workspace index" +
std::to_string(wsIndex) + ". Using uncalibrated values for detectors " +
detIDstring);
g_log.warning("Incomplete set of calibrated diffractometer constants found for "
"workspace index" +
std::to_string(wsIndex) + ". Using uncalibrated values for detectors " + detIDstring);
}
/// Returns true if the spectrum is associated with detectors in the
......
......@@ -40,8 +40,7 @@ class ConversionFactors;
@author Russell Taylor, Tessella Support Services plc
@date 18/08/2008
*/
class MANTID_ALGORITHMS_DLL AlignDetectors : public API::Algorithm,
public API::DeprecatedAlgorithm {
class MANTID_ALGORITHMS_DLL AlignDetectors : public API::Algorithm, public API::DeprecatedAlgorithm {
public:
AlignDetectors();
......@@ -67,8 +66,7 @@ private:
void init() override;
void exec() override;
void align(const ConversionFactors &converter, API::Progress &progress,
API::MatrixWorkspace_sptr &outputWS);
void align(const ConversionFactors &converter, API::Progress &progress, API::MatrixWorkspace_sptr &outputWS);
void loadCalFile(const API::MatrixWorkspace_sptr &inputWS, const std::string &filename);
void getCalibrationWS(const API::MatrixWorkspace_sptr &inputWS);
......
......@@ -89,9 +89,8 @@ protected:
/// Convert the workspace units according to a simple output = a * (input^b)
/// relationship
API::MatrixWorkspace_sptr
convertQuickly(const API::MatrixWorkspace_const_sptr &inputWS,
const double &factor, const double &power);
API::MatrixWorkspace_sptr convertQuickly(const API::MatrixWorkspace_const_sptr &inputWS, const double &factor,
const double &power);
/// Convert the workspace units using TOF as an intermediate step in the
/// conversion
......
......@@ -62,13 +62,10 @@ std::string createTruncatedList(const std::set<int> &elements);
void populateTable(Mantid::API::ITableWorkspace_sptr &t, const Mantid::API::MatrixWorkspace_sptr &ws, const int nrows,
const std::vector<int> &indices, const Mantid::API::SpectrumInfo &spectrumInfo,
bool signedThetaParamRetrieved, bool showSignedTwoTheta,
const Mantid::Geometry::PointingAlong &beamAxisIndex,
const double sampleDist, const bool isScanning,
const bool include_data, const bool calcQ,
const bool includeDiffConstants, Kernel::Logger &logger);
std::vector<std::pair<std::string, std::string>>
createColumns(const bool isScanning, const bool includeData, const bool calcQ,
const bool hasDiffConstants);
const Mantid::Geometry::PointingAlong &beamAxisIndex, const double sampleDist, const bool isScanning,
const bool include_data, const bool calcQ, const bool includeDiffConstants, Kernel::Logger &logger);
std::vector<std::pair<std::string, std::string>> createColumns(const bool isScanning, const bool includeData,
const bool calcQ, const bool hasDiffConstants);
} // namespace Algorithms
} // namespace Mantid
......@@ -42,18 +42,12 @@ private:
void createCalTableFromExisting();
void createCalTableNew();
void createInformationWorkspaces();
std::tuple<double, double, double>
getDSpacingToTof(const std::set<detid_t> &detIds);
std::vector<double> dSpacingWindows(const std::vector<double> &centres,
const double widthMax);
std::vector<double> getTOFminmax(const double difc, const double difa,
const double tzero);
void setCalibrationValues(const detid_t detid, const double difc,
const double difa, const double tzero);
void fitDIFCtZeroDIFA_LM(const std::vector<double> &d,
const std::vector<double> &tof,
const std::vector<double> &height2, double &difc,
double &t0, double &difa);
std::tuple<double, double, double> getDSpacingToTof(const std::set<detid_t> &detIds);
std::vector<double> dSpacingWindows(const std::vector<double> &centres, const double widthMax);
std::vector<double> getTOFminmax(const double difc, const double difa, const double tzero);
void setCalibrationValues(const detid_t detid, const double difc, const double difa, const double tzero);
void fitDIFCtZeroDIFA_LM(const std::vector<double> &d, const std::vector<double> &tof,
const std::vector<double> &height2, double &difc, double &t0, double &difa);
API::MatrixWorkspace_sptr calculateResolutionTable();
/// NEW: convert peak positions in dSpacing to peak centers workspace
......
......@@ -46,15 +46,11 @@ public:
BackgroundHelper &operator=(const BackgroundHelper &) = delete;
BackgroundHelper(const BackgroundHelper &) = delete;
void initialize(const API::MatrixWorkspace_const_sptr &bkgWS,
const API::MatrixWorkspace_sptr &sourceWS,
Kernel::DeltaEMode::Type emode,
Kernel::Logger *pLog = nullptr, int nThreads = 1,
bool inPlace = true, bool nullifyNegative = false);
void removeBackground(int nHist, HistogramData::HistogramX &x_data,
HistogramData::HistogramY &y_data,
HistogramData::HistogramE &e_data,
int threadNum = 0) const;
void initialize(const API::MatrixWorkspace_const_sptr &bkgWS, const API::MatrixWorkspace_sptr &sourceWS,
Kernel::DeltaEMode::Type emode, Kernel::Logger *pLog = nullptr, int nThreads = 1, bool inPlace = true,
bool nullifyNegative = false);
void removeBackground(int nHist, HistogramData::HistogramX &x_data, HistogramData::HistogramY &y_data,
HistogramData::HistogramE &e_data, int threadNum = 0) const;
private:
// vector of pointers to the units conversion class for the working workspace;
......
......@@ -81,8 +81,7 @@ void AddPeak::exec() {
double l1 = detectorInfo.l1();
double l2 = detectorInfo.l2(detectorIndex);
std::vector<int> emptyWarningVec;
auto [difa, difc, tzero] = detectorInfo.diffractometerConstants(
detectorIndex, emptyWarningVec, emptyWarningVec);
auto [difa, difc, tzero] = detectorInfo.diffractometerConstants(detectorIndex, emptyWarningVec, emptyWarningVec);
Mantid::Kernel::Unit_sptr unit = runWS->getAxis(0)->unit();
if (unit->unitID() != "TOF") {
......
......@@ -47,8 +47,7 @@ public:
this->generateDetidToRow(table);
}
std::tuple<double, double, double>
getDiffConstants(const std::set<detid_t> &detIds) const {
std::tuple<double, double, double> getDiffConstants(const std::set<detid_t> &detIds) const {
const std::set<size_t> rows = this->getRow(detIds);
double difc = 0.;
double difa = 0.;
......@@ -86,14 +85,11 @@ private:
}
}
if (rows.empty()) {
std::string detIdsStr = std::accumulate(
std::begin(detIds), std::end(detIds), std::string{},
[](const std::string &a, const detid_t &b) {
return a.empty() ? std::to_string(b) : a + ',' + std::to_string(b);
});
throw Exception::NotFoundError(
"None of the detectors were found in the calibration table",
detIdsStr);
std::string detIdsStr = std::accumulate(std::begin(detIds), std::end(detIds), std::string{},
[](const std::string &a, const detid_t &b) {
return a.empty() ? std::to_string(b) : a + ',' + std::to_string(b);
});
throw Exception::NotFoundError("None of the detectors were found in the calibration table", detIdsStr);
}
return rows;
}
......@@ -267,8 +263,7 @@ void AlignDetectors::exec() {
align(converter, progress, outputWS);
}
void AlignDetectors::align(const ConversionFactors &converter,
Progress &progress, MatrixWorkspace_sptr &outputWS) {
void AlignDetectors::align(const ConversionFactors &converter, Progress &progress, MatrixWorkspace_sptr &outputWS) {
auto eventW = std::dynamic_pointer_cast<EventWorkspace>(outputWS);
PARALLEL_FOR_IF(Kernel::threadSafe(*outputWS))
for (int64_t i = 0; i < m_numberOfSpectra; ++i) {
......@@ -276,17 +271,15 @@ void AlignDetectors::align(const ConversionFactors &converter,
try {
// Get the input spectrum number at this workspace index
auto &spec = outputWS->getSpectrum(size_t(i));
auto [difc, difa, tzero] =
converter.getDiffConstants(spec.getDetectorIDs());
auto [difc, difa, tzero] = converter.getDiffConstants(spec.getDetectorIDs());
auto &x = outputWS->dataX(i);
Kernel::Units::dSpacing dSpacingUnit;
std::vector<double> yunused;
dSpacingUnit.fromTOF(
x, yunused, -1., 0,
UnitParametersMap{{Kernel::UnitParams::difa, difa},
{Kernel::UnitParams::difc, difc},
{Kernel::UnitParams::tzero, tzero}});
dSpacingUnit.fromTOF(x, yunused, -1., 0,
UnitParametersMap{{Kernel::UnitParams::difa, difa},
{Kernel::UnitParams::difc, difc},
{Kernel::UnitParams::tzero, tzero}});
if (eventW) {
Kernel::Units::TOF tofUnit;
......@@ -298,8 +291,7 @@ void AlignDetectors::align(const ConversionFactors &converter,
if (!eventW) {
// Zero the data in this case (detectors not found in cal table or
// conversion fails)
outputWS->setHistogram(i, BinEdges(outputWS->x(i).size()),
Counts(outputWS->y(i).size()));
outputWS->setHistogram(i, BinEdges(outputWS->x(i).size()), Counts(outputWS->y(i).size()));
}
}
progress.report();
......
......@@ -151,8 +151,7 @@ void CalculatePlaczekSelfScattering::exec() {
Kernel::Units::TOF tof;
Kernel::UnitParametersMap pmap{};
double l1 = specInfo.l1();
specInfo.getDetectorValues(wavelength, tof, Kernel::DeltaEMode::Elastic,
false, specIndex, pmap);
specInfo.getDetectorValues(wavelength, tof, Kernel::DeltaEMode::Elastic, false, specIndex, pmap);
double l2 = 0., twoTheta = 0.;
if (pmap.find(Kernel::UnitParams::l2) != pmap.end()) {
l2 = pmap[Kernel::UnitParams::l2];
......
......@@ -828,11 +828,9 @@ bool CompareWorkspaces::checkInstrument(const API::MatrixWorkspace_const_sptr &w
const bool checkAllData = getProperty("CheckAllData");
auto errorStr = ws1_parmap.diff(ws2_parmap, !checkAllData);
if (!errorStr.empty()) {
g_log.debug()
<< "Here information to help understand parameter map differences:\n";
g_log.debug() << "Here information to help understand parameter map differences:\n";
g_log.debug() << errorStr;
recordMismatch(
"Instrument ParameterMap mismatch (differences in ordering ignored)");
recordMismatch("Instrument ParameterMap mismatch (differences in ordering ignored)");
return false;
}
......
......@@ -98,8 +98,7 @@ void ConvertSpectrumAxis::exec() {
double efixedProp = getProperty("Efixed");
if (efixedProp != EMPTY_DBL()) {
pmap[UnitParams::efixed] = efixedProp;
g_log.debug() << "Detector: " << spectrumInfo.detector(i).getID()
<< " Efixed: " << efixedProp << "\n";
g_log.debug() << "Detector: " << spectrumInfo.detector(i).getID() << " Efixed: " << efixedProp << "\n";
}
spectrumInfo.getDetectorValues(*fromUnit, *toUnit, emode, false, i, pmap);
......@@ -118,8 +117,7 @@ void ConvertSpectrumAxis::exec() {
indexMap.emplace(value, i);
}
if (nfailures == nHist) {
throw std::runtime_error(
"Unable to convert spectrum axis values on all spectra");
throw std::runtime_error("Unable to convert spectrum axis values on all spectra");
}
} else {
// Set up binding to memeber funtion. Avoids condition as part of loop over
......
......@@ -417,8 +417,7 @@ MatrixWorkspace_sptr ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUni
pmap[UnitParams::efixed] = efixedProp;
}
size_t checkIndex = 0;
spectrumInfo.getDetectorValues(*fromUnit, *outputUnit, emode, signedTheta,
checkIndex, pmap);
spectrumInfo.getDetectorValues(*fromUnit, *outputUnit, emode, signedTheta, checkIndex, pmap);
// copy the X values for the check
auto checkXValues = inputWS->readX(checkIndex);
try {
......@@ -426,8 +425,7 @@ MatrixWorkspace_sptr ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUni
checkFromUnit->toTOF(checkXValues, emptyVec, l1, emode, pmap);
// Convert from time-of-flight to the desired unit
checkOutputUnit->fromTOF(checkXValues, emptyVec, l1, emode, pmap);
} catch (
std::runtime_error) { // if it's a detector specific problem then ignore
} catch (std::runtime_error) { // if it's a detector specific problem then ignore
}
// create the output workspace
......@@ -454,8 +452,7 @@ MatrixWorkspace_sptr ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUni
if (efixedProp != EMPTY_DBL()) {
pmap[UnitParams::efixed] = efixed;
}
outSpectrumInfo.getDetectorValues(*fromUnit, *outputUnit, emode,
signedTheta, i, pmap);
outSpectrumInfo.getDetectorValues(*fromUnit, *outputUnit, emode, signedTheta, i, pmap);