Commit 37d43e39 authored by Pranav Bahuguna's avatar Pranav Bahuguna
Browse files

Re #17808 More miscellaneous fixes and improvements

parent a58ebd18
......@@ -78,8 +78,7 @@ private:
loadDataIntoTheWorkSpace(NeXus::NXEntry &entry,
const std::vector<std::vector<int>> &,
int vanaCalculatedDetectorElasticPeakPosition = -1);
void loadSpectra(size_t &spec, size_t firstSpec, size_t numberOfMonitors,
size_t numberOfTubes,
void loadSpectra(size_t &spec, size_t numberOfMonitors, size_t numberOfTubes,
std::vector<Mantid::detid_t> &detectorIDs, NeXus::NXInt data,
Mantid::API::Progress progress);
......
......@@ -552,12 +552,11 @@ void LoadILLTOF::loadDataIntoTheWorkSpace(
}
std::vector<detid_t> detectorIDs = instrument->getDetectorIDs(true);
size_t firstSpec = spec;
size_t numberOfMonitors = monitors.size();
Progress progress(this, 0, 1, m_numberOfTubes * m_numberOfPixelsPerTube);
loadSpectra(spec, firstSpec, numberOfMonitors, m_numberOfTubes, detectorIDs,
loadSpectra(spec, numberOfMonitors, m_numberOfTubes, detectorIDs,
data, progress);
g_log.debug() << "Loading data into the workspace: DONE!\n";
......@@ -578,7 +577,7 @@ void LoadILLTOF::loadDataIntoTheWorkSpace(
Progress progressRosace(this, 0, 1,
numberOfTubes * m_numberOfPixelsPerTube);
loadSpectra(spec, firstSpec, numberOfMonitors, numberOfTubes, detectorIDs,
loadSpectra(spec, numberOfMonitors, numberOfTubes, detectorIDs,
dataRosace, progressRosace);
}
}
......@@ -588,23 +587,25 @@ void LoadILLTOF::loadDataIntoTheWorkSpace(
* of detector types in the workspace.
*
* @param spec The current spectrum id
* @param firstSpec The id of the first spectrum that is not a monitor
* @param numberOfMonitors The number of monitors in the workspace
* @param numberOfTubes The number of detector tubes in the workspace
* @param detectorIDs A list of all of the detector IDs
* @param data The NeXus data to load into the workspace
* @param progress The progress monitor (different
*/
void LoadILLTOF::loadSpectra(size_t &spec, size_t firstSpec,
size_t numberOfMonitors, size_t numberOfTubes,
void LoadILLTOF::loadSpectra(size_t &spec, size_t numberOfMonitors,
size_t numberOfTubes,
std::vector<detid_t> &detectorIDs, NXInt data,
Progress progress) {
for (size_t i = 0; i < numberOfTubes; ++i) {
for (size_t j = 0; j < m_numberOfPixelsPerTube; ++j) {
int *data_p = &data(static_cast<int>(i), static_cast<int>(j), 0);
m_localWorkspace->setHistogram(
spec++, m_localWorkspace->binEdges(0),
Counts(HistogramY(data_p, data_p + m_numberOfChannels)));
spec, m_localWorkspace->binEdges(0),
Counts(data_p, data_p + m_numberOfChannels));
m_localWorkspace->getSpectrum(spec)
.setDetectorID(detectorIDs[spec - numberOfMonitors]);
spec++;
progress.report();
}
}
......
......@@ -791,9 +791,8 @@ void LoadISISNexus2::loadPeriodData(
timeBins.load();
local_workspace->setHistogram(
hist_index,
BinEdges(HistogramX(timeBins(), timeBins() + timeBins.dim0())),
Counts(HistogramY(mondata(),
mondata() + m_monBlockInfo.getNumberOfChannels())));
BinEdges(timeBins(), timeBins() + timeBins.dim0()),
Counts(mondata(), mondata() + m_monBlockInfo.getNumberOfChannels()));
if (update_spectra2det_mapping) {
// local_workspace->getAxis(1)->setValue(hist_index,
......
......@@ -178,7 +178,7 @@ void LoadLLB::loadDataIntoTheWorkSpace(NeXus::NXEntry &entry) {
float *data_p = &data(static_cast<int>(i), static_cast<int>(j));
m_localWorkspace->setHistogram(
spec++, m_localWorkspace->binEdges(0),
Counts(HistogramY(data_p, data_p + m_numberOfChannels)));
Counts(data_p, data_p + m_numberOfChannels));
progress.report();
}
}
......
Markdown is supported
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