diff --git a/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h b/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h index 7f611dbca6927f333369a2971012c43d4e32bfb5..7e0b8e11fce5300c8547c11f03cbcde637975b9a 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h +++ b/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h @@ -55,8 +55,6 @@ private: void readVersion1(const std::string &filename, API::ITableWorkspace_sptr &wksp); void readExpIni(const std::string &filename, API::ITableWorkspace_sptr &wksp); - bool hasExtras; - std::vector<std::string> canColumnNames; }; } // namespace DataHandling diff --git a/Framework/DataHandling/src/PDLoadCharacterizations.cpp b/Framework/DataHandling/src/PDLoadCharacterizations.cpp index 56ab2785176b01da5c2097965d502f9de5390303..0aa45f6285fdb4d70df342dda63c338cd98c486a 100644 --- a/Framework/DataHandling/src/PDLoadCharacterizations.cpp +++ b/Framework/DataHandling/src/PDLoadCharacterizations.cpp @@ -145,14 +145,8 @@ void PDLoadCharacterizations::init() { /** Execute the algorithm. */ void PDLoadCharacterizations::exec() { - this->hasExtras = false; auto filenames = this->getFilenames(); - - for (const auto filename : filenames) { // REMOVE - std::cout << filename << std::endl; // REMOVE - } // REMOVE - - this->canColumnNames = extra_columns(filenames); + const std::vector<std::string> canColumnNames = extra_columns(filenames); // setup the default table workspace for the characterization runs ITableWorkspace_sptr wksp = WorkspaceFactory::Instance().createTable(); @@ -170,7 +164,7 @@ void PDLoadCharacterizations::exec() { wksp->addColumn("double", "tof_max"); wksp->addColumn("double", "wavelength_min"); wksp->addColumn("double", "wavelength_max"); - for (const auto name : this->canColumnNames) { + for (const auto &name : canColumnNames) { wksp->addColumn("str", name); // all will be strings } @@ -317,6 +311,8 @@ void PDLoadCharacterizations::readCharInfo(std::ifstream &file, if (file.eof()) return; + const size_t num_of_columns = wksp->columnCount(); + // parse the file for (std::string line = Strings::getLine(file); !file.eof(); line = Strings::getLine(file)) { @@ -351,9 +347,12 @@ void PDLoadCharacterizations::readCharInfo(std::ifstream &file, row << boost::lexical_cast<double>(splitted[9]); // tof_max row << boost::lexical_cast<double>(splitted[10]); // wavelength_min row << boost::lexical_cast<double>(splitted[11]); // wavelength_max - // pad all extras with empty string - for (const auto name : this->canColumnNames) + + // pad all extras with empty string - the 14 required columns have + // already been added to the row + for (size_t i = 14; i < num_of_columns; ++i) { row << "0"; + } } }