Commit 02e6ae0d authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Change m_convertToTOF to a local variable

As the attribute is only used in exec, it can be replaced by a local
variable.
parent cbdda10b
...@@ -59,7 +59,8 @@ private: ...@@ -59,7 +59,8 @@ private:
void loadTimeDetails(NeXus::NXEntry &entry); void loadTimeDetails(NeXus::NXEntry &entry);
void loadDataIntoTheWorkSpace(NeXus::NXEntry &entry, void loadDataIntoTheWorkSpace(NeXus::NXEntry &entry,
const std::vector<std::vector<int>> &); const std::vector<std::vector<int>> &,
bool convertToTOF);
void loadSpectra(size_t &spec, const size_t numberOfTubes, void loadSpectra(size_t &spec, const size_t numberOfTubes,
const std::vector<Mantid::detid_t> &detectorIDs, const std::vector<Mantid::detid_t> &detectorIDs,
const NeXus::NXInt &data, Mantid::API::Progress &progress); const NeXus::NXInt &data, Mantid::API::Progress &progress);
...@@ -70,7 +71,6 @@ private: ...@@ -70,7 +71,6 @@ private:
static double calculateError(double in) { return sqrt(in); } static double calculateError(double in) { return sqrt(in); }
API::MatrixWorkspace_sptr m_localWorkspace; API::MatrixWorkspace_sptr m_localWorkspace;
bool m_convertToTOF;
std::string m_instrumentName = ""; ///< Name of the instrument std::string m_instrumentName = ""; ///< Name of the instrument
std::string m_instrumentPath = ""; ///< Name of the instrument path std::string m_instrumentPath = ""; ///< Name of the instrument path
......
...@@ -81,7 +81,7 @@ void LoadILLTOF2::init() { ...@@ -81,7 +81,7 @@ void LoadILLTOF2::init() {
void LoadILLTOF2::exec() { void LoadILLTOF2::exec() {
// Retrieve filename // Retrieve filename
const std::string filenameData = getPropertyValue("Filename"); const std::string filenameData = getPropertyValue("Filename");
m_convertToTOF = getProperty("convertToTOF"); bool convertToTOF = getProperty("convertToTOF");
// open the root node // open the root node
NeXus::NXRoot dataRoot(filenameData); NeXus::NXRoot dataRoot(filenameData);
...@@ -99,7 +99,7 @@ void LoadILLTOF2::exec() { ...@@ -99,7 +99,7 @@ void LoadILLTOF2::exec() {
runLoadInstrument(); // just to get IDF contents runLoadInstrument(); // just to get IDF contents
loadDataIntoTheWorkSpace(dataFirstEntry, monitors); loadDataIntoTheWorkSpace(dataFirstEntry, monitors, convertToTOF);
addEnergyToRun(); addEnergyToRun();
addPulseInterval(); addPulseInterval();
...@@ -355,9 +355,12 @@ void LoadILLTOF2::addPulseInterval() { ...@@ -355,9 +355,12 @@ void LoadILLTOF2::addPulseInterval() {
* *
* @param entry The Nexus entry * @param entry The Nexus entry
* @param monitors List of monitor data * @param monitors List of monitor data
* @param convertToTOF Should the bin edges be converted to time of flight or
* keep the channel indexes
*/ */
void LoadILLTOF2::loadDataIntoTheWorkSpace( void LoadILLTOF2::loadDataIntoTheWorkSpace(
NeXus::NXEntry &entry, const std::vector<std::vector<int>> &monitors) { NeXus::NXEntry &entry, const std::vector<std::vector<int>> &monitors,
bool convertToTOF) {
g_log.debug() << "Loading data into the workspace...\n"; g_log.debug() << "Loading data into the workspace...\n";
// read in the data // read in the data
...@@ -371,7 +374,7 @@ void LoadILLTOF2::loadDataIntoTheWorkSpace( ...@@ -371,7 +374,7 @@ void LoadILLTOF2::loadDataIntoTheWorkSpace(
// Put tof in an array // Put tof in an array
auto &X0 = m_localWorkspace->mutableX(0); auto &X0 = m_localWorkspace->mutableX(0);
if (monitor.containsDataSet("time_of_flight")) { if (monitor.containsDataSet("time_of_flight")) {
if (m_convertToTOF) { if (convertToTOF) {
for (size_t i = 0; i < m_numberOfChannels + 1; ++i) { for (size_t i = 0; i < m_numberOfChannels + 1; ++i) {
X0[i] = m_timeOfFlightDelay + m_channelWidth * static_cast<double>(i) - X0[i] = m_timeOfFlightDelay + m_channelWidth * static_cast<double>(i) -
m_channelWidth / 2; // to make sure the bin centre is correct m_channelWidth / 2; // to make sure the bin centre is correct
......
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