Skip to content

Commit

Permalink
Re #11324 Add member variable to store number of zeros in run name
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Mar 11, 2015
1 parent 424f5d9 commit 2a876e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Expand Up @@ -83,7 +83,7 @@ class DLLExport PlotAsymmetryByLogValue : public API::Algorithm {
// Analyse loaded run
void doAnalysis (Workspace_sptr loadedWs);
// Parse run names
void parseRunNames (std::string& firstFN, std::string& lastFN, std::string& fnBase, std::string& fnExt);
void parseRunNames (std::string& firstFN, std::string& lastFN, std::string& fnBase, std::string& fnExt, int& fnZeros);
// Load dead-time corrections from specified file
void loadCorrectionsFromFile (API::Workspace_sptr &customDeadTimes, std::string deadTimeFile );
// Apply dead-time corrections
Expand All @@ -105,6 +105,8 @@ class DLLExport PlotAsymmetryByLogValue : public API::Algorithm {
std::string m_filenameBase;
/// Stores extension shared by all runs
std::string m_filenameExt;
/// Sotres number of zeros in run name
std::string m_filenameZeros;
/// Stores property "Int"
bool m_int;
/// Store forward spectra
Expand Down
Expand Up @@ -176,10 +176,9 @@ void PlotAsymmetryByLogValue::exec() {
m_logFunc = getPropertyValue("Function");

// Parse run names and get the number of runs
parseRunNames( firstFN, lastFN, m_filenameBase, m_filenameExt);
parseRunNames( firstFN, lastFN, m_filenameBase, m_filenameExt, m_filenameZeros);
size_t is = atoi(firstFN.c_str()); // starting run number
size_t ie = atoi(lastFN.c_str()); // last run number
int w = static_cast<int>(firstFN.size());

Progress progress(this, 0, 1, ie - is + 2);

Expand Down Expand Up @@ -304,7 +303,7 @@ void PlotAsymmetryByLogValue::populateOutputWorkspace (MatrixWorkspace_sptr &out
* @param fnBase :: [output] Runs base name
* @param fnExt :: [output] Runs extension
*/
void PlotAsymmetryByLogValue::parseRunNames (std::string& firstFN, std::string& lastFN, std::string& fnBase, std::string& fnExt)
void PlotAsymmetryByLogValue::parseRunNames (std::string& firstFN, std::string& lastFN, std::string& fnBase, std::string& fnExt, int& fnZeros)
{

// Parse first run's name
Expand Down Expand Up @@ -370,6 +369,8 @@ void PlotAsymmetryByLogValue::parseRunNames (std::string& firstFN, std::string&
fnBase = firstBase;
fnExt = firstExt;
}
fnZeros = static_cast<int>(firstFN.size());

}

/** Apply dead-time corrections. The calculation is done by ApplyDeadTimeCorr algorithm
Expand Down

0 comments on commit 2a876e2

Please sign in to comment.