Commit 13b1dff9 authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Rename LoadILLSANS loadHelper

So it is used only once, and is consistent with other ILL loaders
parent 48a21c52
......@@ -81,7 +81,7 @@ private:
void adjustTOF();
void moveSource();
LoadHelper m_loader; ///< Load helper for metadata
LoadHelper m_loadHelper; ///< Load helper for metadata
std::string m_instrumentName; ///< Name of the instrument
std::vector<std::string>
m_supportedInstruments; ///< List of supported instruments
......@@ -91,7 +91,6 @@ private:
bool m_isTOF; ///< TOF or monochromatic flag
double m_sourcePos; ///< Source Z (for D33 TOF)
bool m_isD16Omega; ///< Data come from a D16 omega scan flag
LoadHelper m_loadHelper;
void setFinalProperties(const std::string &filename);
void setPixelSize();
......
......@@ -119,7 +119,7 @@ void LoadILLSANS::exec() {
NXRoot root(filename);
NXEntry firstEntry = root.openFirstEntry();
const std::string instrumentPath =
m_loader.findInstrumentNexusPath(firstEntry);
m_loadHelper.findInstrumentNexusPath(firstEntry);
setInstrumentName(firstEntry, instrumentPath);
Progress progress(this, 0.0, 1.0, 4);
progress.report("Initializing the workspace for " + m_instrumentName);
......@@ -150,13 +150,13 @@ void LoadILLSANS::exec() {
initWorkSpace(firstEntry, instrumentPath);
progress.report("Loading the instrument " + m_instrumentName);
runLoadInstrument();
double distance = m_loader.getDoubleFromNexusPath(
double distance = m_loadHelper.getDoubleFromNexusPath(
firstEntry, instrumentPath + "/detector/det_calc");
progress.report("Moving detectors");
moveDetectorDistance(distance, "detector");
if (m_instrumentName == "D22") {
double offset = m_loader.getDoubleFromNexusPath(
double offset = m_loadHelper.getDoubleFromNexusPath(
firstEntry, instrumentPath + "/detector/dtr_actual");
moveDetectorHorizontal(-offset / 1000, "detector"); // mm to meter
/*TODO: DO NOT ROTATE UNTIL CONFIRMED BY INSTRUMENT SCIENTIST
......@@ -182,8 +182,8 @@ void LoadILLSANS::setInstrumentName(const NeXus::NXEntry &firstEntry,
g_log.error(message);
throw std::runtime_error(message);
}
m_instrumentName =
m_loader.getStringFromNexusPath(firstEntry, instrumentNamePath + "/name");
m_instrumentName = m_loadHelper.getStringFromNexusPath(
firstEntry, instrumentNamePath + "/name");
const auto inst = std::find(m_supportedInstruments.begin(),
m_supportedInstruments.end(), m_instrumentName);
if (inst == m_supportedInstruments.end()) {
......@@ -203,24 +203,24 @@ LoadILLSANS::getDetectorPositionD33(const NeXus::NXEntry &firstEntry,
const std::string &instrumentNamePath) {
std::string detectorPath(instrumentNamePath + "/detector");
DetectorPosition pos;
pos.distanceSampleRear =
m_loader.getDoubleFromNexusPath(firstEntry, detectorPath + "/det2_calc");
pos.distanceSampleBottomTop =
m_loader.getDoubleFromNexusPath(firstEntry, detectorPath + "/det1_calc");
pos.distanceSampleRear = m_loadHelper.getDoubleFromNexusPath(
firstEntry, detectorPath + "/det2_calc");
pos.distanceSampleBottomTop = m_loadHelper.getDoubleFromNexusPath(
firstEntry, detectorPath + "/det1_calc");
pos.distanceSampleRightLeft =
pos.distanceSampleBottomTop +
m_loader.getDoubleFromNexusPath(firstEntry,
detectorPath + "/det1_panel_separation");
pos.shiftLeft = m_loader.getDoubleFromNexusPath(
m_loadHelper.getDoubleFromNexusPath(
firstEntry, detectorPath + "/det1_panel_separation");
pos.shiftLeft = m_loadHelper.getDoubleFromNexusPath(
firstEntry, detectorPath + "/OxL_actual") *
1e-3;
pos.shiftRight = m_loader.getDoubleFromNexusPath(
pos.shiftRight = m_loadHelper.getDoubleFromNexusPath(
firstEntry, detectorPath + "/OxR_actual") *
1e-3;
pos.shiftUp = m_loader.getDoubleFromNexusPath(firstEntry,
detectorPath + "/OyT_actual") *
pos.shiftUp = m_loadHelper.getDoubleFromNexusPath(
firstEntry, detectorPath + "/OyT_actual") *
1e-3;
pos.shiftDown = m_loader.getDoubleFromNexusPath(
pos.shiftDown = m_loadHelper.getDoubleFromNexusPath(
firstEntry, detectorPath + "/OyB_actual") *
1e-3;
pos >> g_log.debug();
......@@ -367,16 +367,16 @@ void LoadILLSANS::initWorkSpaceD33(NeXus::NXEntry &firstEntry,
// LTOF mode
std::string binPathPrefix(instrumentPath +
"/tof/tof_wavelength_detector");
binningRear = m_loader.getTimeBinningFromNexusPath(firstEntry,
binPathPrefix + "1");
binningRight = m_loader.getTimeBinningFromNexusPath(
binningRear = m_loadHelper.getTimeBinningFromNexusPath(
firstEntry, binPathPrefix + "1");
binningRight = m_loadHelper.getTimeBinningFromNexusPath(
firstEntry, binPathPrefix + "2");
binningLeft = m_loader.getTimeBinningFromNexusPath(firstEntry,
binPathPrefix + "3");
binningDown = m_loader.getTimeBinningFromNexusPath(firstEntry,
binPathPrefix + "4");
binningUp = m_loader.getTimeBinningFromNexusPath(firstEntry,
binPathPrefix + "5");
binningLeft = m_loadHelper.getTimeBinningFromNexusPath(
firstEntry, binPathPrefix + "3");
binningDown = m_loadHelper.getTimeBinningFromNexusPath(
firstEntry, binPathPrefix + "4");
binningUp = m_loadHelper.getTimeBinningFromNexusPath(
firstEntry, binPathPrefix + "5");
} catch (std::runtime_error &e) {
throw std::runtime_error(
"Unable to load the wavelength axes for TOF data " +
......@@ -738,7 +738,7 @@ void LoadILLSANS::loadMetaData(const NeXus::NXEntry &entry,
// merge runs
wavelengthRes = std::round(wavelengthRes * 100) / 100.;
runDetails.addProperty<double>("wavelength", wavelength);
double ei = m_loader.calculateEnergy(wavelength);
double ei = m_loadHelper.calculateEnergy(wavelength);
runDetails.addProperty<double>("Ei", ei, true);
// wavelength
m_defaultBinning[0] = wavelength - wavelengthRes * wavelength * 0.01 / 2;
......@@ -766,7 +766,7 @@ void LoadILLSANS::setFinalProperties(const std::string &filename) {
NXstatus nxStat = NXopen(filename.c_str(), NXACC_READ, &nxHandle);
if (nxStat != NX_ERROR) {
m_loader.addNexusFieldsToWsRun(nxHandle, runDetails);
m_loadHelper.addNexusFieldsToWsRun(nxHandle, runDetails);
NXclose(&nxHandle);
}
}
......
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