Commit 6156c52c authored by Stephen's avatar Stephen
Browse files

Make LoadMuonNexus algorithms use specnum_t for spectrum based integers

parent a7ff8f7f
......@@ -85,12 +85,10 @@ protected:
std::string m_instrument_name;
/// The sample name read from Nexus
std::string m_samplename;
/// The number of the input entry
int64_t m_entrynumber;
/// The number of spectra in the raw file
int64_t m_numberOfSpectra;
specnum_t m_numberOfSpectra;
/// The number of periods in the raw file
int64_t m_numberOfPeriods;
/// Has the spectrum_list property been set?
......@@ -100,11 +98,11 @@ protected:
/// The value of the spectrum_list property
std::vector<specnum_t> m_spec_list;
/// The value of the spectrum_min property
int64_t m_spec_min;
specnum_t m_spec_min;
/// The value of the spectrum_max property
int64_t m_spec_max;
specnum_t m_spec_max;
/// The group which each detector belongs to in order
std::vector<specnum_t> m_groupings;
std::vector<detid_t> m_groupings;
private:
/// Overwrites Algorithm method.
......
......@@ -60,13 +60,11 @@ void LoadMuonNexus::init() {
"algorithm. For multiperiod files, one workspace will be\n"
"generated for each period");
auto mustBePositive = std::make_shared<BoundedValidator<int64_t>>();
mustBePositive->setLower(1);
declareProperty("SpectrumMin", static_cast<int64_t>(EMPTY_INT()),
mustBePositive,
"Index number of the first spectrum to read\n"
"(default 1)");
declareProperty("SpectrumMax", static_cast<int64_t>(EMPTY_INT()),
auto mustBePositive = std::make_shared<BoundedValidator<specnum_t>>();
mustBePositive->setLower(0);
declareProperty("SpectrumMin", static_cast<specnum_t>(0), mustBePositive,
"Index number of the first spectrum to read\n");
declareProperty("SpectrumMax", static_cast<specnum_t>(EMPTY_INT()),
mustBePositive,
"Index of last spectrum to read\n"
"(default the last spectrum)");
......
......@@ -151,7 +151,7 @@ void LoadMuonNexus1::exec() {
checkOptionalProperties();
// Calculate the size of a workspace, given its number of periods & spectra to
// read
int64_t total_specs;
size_t total_specs;
if (m_interval || m_list) {
// Remove from list possible duplicate specs
for (auto it = m_spec_list.begin(); it != m_spec_list.end();) {
......@@ -239,10 +239,10 @@ void LoadMuonNexus1::exec() {
addGoodFrames(localWorkspace, period, nxload.t_nper);
size_t counter = 0;
for (int64_t i = m_spec_min; i < m_spec_max; ++i) {
for (auto i = m_spec_min; i < m_spec_max; ++i) {
// Shift the histogram to read if we're not in the first period
auto histToRead = static_cast<specnum_t>(i - 1 + period * nxload.t_nsp1);
auto specNo = static_cast<specnum_t>(i);
auto specNo = i;
loadData(counter, histToRead, specNo, nxload, lengthIn - 1,
localWorkspace); // added -1 for NeXus
counter++;
......@@ -358,8 +358,8 @@ void LoadMuonNexus1::loadDeadTimes(NXRoot &root) {
// Load only selected spectra
specToLoad.insert(
specToLoad.end(),
boost::counting_iterator<int>(static_cast<int>(m_spec_min)),
boost::counting_iterator<int>(static_cast<int>(m_spec_max)));
boost::counting_iterator<specnum_t>(m_spec_min),
boost::counting_iterator<specnum_t>(m_spec_max));
specToLoad.insert(specToLoad.end(), m_spec_list.begin(),
m_spec_list.end());
} else {
......@@ -466,8 +466,8 @@ Workspace_sptr LoadMuonNexus1::loadDetectorGrouping(
// Load only selected spectra
specToLoad.insert(
specToLoad.end(),
boost::counting_iterator<int>(static_cast<int>(m_spec_min)),
boost::counting_iterator<int>(static_cast<int>(m_spec_max)));
boost::counting_iterator<specnum_t>(m_spec_min),
boost::counting_iterator<specnum_t>(m_spec_max));
specToLoad.insert(specToLoad.end(), m_spec_list.begin(),
m_spec_list.end());
} else {
......
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