From 7089a050b7741462aa44cbdea45167d66c7ec33e Mon Sep 17 00:00:00 2001 From: Raquel Alvarez Banos <raquel.alvarez.banos@gmail.com> Date: Fri, 31 Jul 2015 09:22:11 +0100 Subject: [PATCH] Re #13151 Remove X maps plus some minor changes --- .../PlotAsymmetryByLogValue.h | 36 +++++++++---------- .../src/PlotAsymmetryByLogValue.cpp | 30 +++++++--------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PlotAsymmetryByLogValue.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PlotAsymmetryByLogValue.h index 779db1df4c0..8a32bf6df79 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PlotAsymmetryByLogValue.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PlotAsymmetryByLogValue.h @@ -79,9 +79,9 @@ private: void init(); void exec(); // Load run, apply dead time corrections and detector grouping - API::Workspace_sptr doLoad(int64_t runNumber); + API::Workspace_sptr doLoad(size_t runNumber); // Analyse loaded run - void doAnalysis(API::Workspace_sptr loadedWs, int64_t index); + void doAnalysis(API::Workspace_sptr loadedWs, size_t index); // Parse run names void parseRunNames(std::string &firstFN, std::string &lastFN, std::string &fnBase, std::string &fnExt, int &fnZeros); @@ -132,23 +132,21 @@ private: int m_red; /// Store green period int m_green; - // Mantid vectors to store results - // Red mantid vectors - std::map<int64_t, double> m_redX; - std::map<int64_t, double> m_redY; - std::map<int64_t, double> m_redE; - // Green mantid vectors - std::map<int64_t, double> m_greenX; - std::map<int64_t, double> m_greenY; - std::map<int64_t, double> m_greenE; - // Mantid vectors to store Red + Green - std::map<int64_t, double> m_sumX; - std::map<int64_t, double> m_sumY; - std::map<int64_t, double> m_sumE; - // Mantid vectors to store Red - Green - std::map<int64_t, double> m_diffX; - std::map<int64_t, double> m_diffY; - std::map<int64_t, double> m_diffE; + // Mantid maps to store intermediate results + // Map to store log value + std::map<size_t, double> m_logValue; + // Red values + std::map<size_t, double> m_redY; + std::map<size_t, double> m_redE; + // Green values + std::map<size_t, double> m_greenY; + std::map<size_t, double> m_greenE; + // Sum values (Red + Green) + std::map<size_t, double> m_sumY; + std::map<size_t, double> m_sumE; + // Diff values (Red - Green) + std::map<size_t, double> m_diffY; + std::map<size_t, double> m_diffE; // LogValue name std::string m_logName; // LogValue function diff --git a/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp b/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp index d9268bb6cdc..f478b500662 100644 --- a/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp +++ b/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp @@ -161,7 +161,7 @@ void PlotAsymmetryByLogValue::exec() { for (size_t i = is; i <= ie; i++) { // Check if run i was already loaded - if (!m_redX.count(i)) { + if (!m_logValue.count(i)) { // Load run, apply dead time corrections and detector grouping Workspace_sptr loadedWs = doLoad(i); @@ -174,7 +174,7 @@ void PlotAsymmetryByLogValue::exec() { } // Create the 2D workspace for the output - int nplots = m_greenX.size() ? 4 : 1; + int nplots = m_greenY.size() ? 4 : 1; size_t npoints = ie - is + 1; MatrixWorkspace_sptr outWS = WorkspaceFactory::Instance().create( "Workspace2D", @@ -236,7 +236,7 @@ void PlotAsymmetryByLogValue::checkProperties(size_t &is, size_t &ie) { * @param runNumber :: [input] Run number specifying run to load * @return :: Loaded workspace */ -Workspace_sptr PlotAsymmetryByLogValue::doLoad(int64_t runNumber) { +Workspace_sptr PlotAsymmetryByLogValue::doLoad(size_t runNumber) { // Get complete run name std::ostringstream fn, fnn; @@ -316,8 +316,8 @@ void PlotAsymmetryByLogValue::populateOutputWorkspace( if (nplots == 1) { std::vector<double> vecRedX, vecRedY, vecRedE; - for (auto it = m_redX.begin(); it != m_redX.end(); ++it) { - vecRedX.push_back(m_redX[it->first]); + for (auto it = m_logValue.begin(); it != m_logValue.end(); ++it) { + vecRedX.push_back(m_logValue[it->first]); vecRedY.push_back(m_redY[it->first]); vecRedE.push_back(m_redE[it->first]); } @@ -332,17 +332,17 @@ void PlotAsymmetryByLogValue::populateOutputWorkspace( std::vector<double> vecGreenX, vecGreenY, vecGreenE; std::vector<double> vecSumX, vecSumY, vecSumE; std::vector<double> vecDiffX, vecDiffY, vecDiffE; - for (auto it = m_redX.begin(); it != m_redX.end(); ++it) { - vecRedX.push_back(m_redX[it->first]); + for (auto it = m_logValue.begin(); it != m_logValue.end(); ++it) { + vecRedX.push_back(m_logValue[it->first]); vecRedY.push_back(m_redY[it->first]); vecRedE.push_back(m_redE[it->first]); - vecGreenX.push_back(m_greenX[it->first]); + vecGreenX.push_back(m_logValue[it->first]); vecGreenY.push_back(m_greenY[it->first]); vecGreenE.push_back(m_greenE[it->first]); - vecSumX.push_back(m_sumX[it->first]); + vecSumX.push_back(m_logValue[it->first]); vecSumY.push_back(m_sumY[it->first]); vecSumE.push_back(m_sumE[it->first]); - vecDiffX.push_back(m_diffX[it->first]); + vecDiffX.push_back(m_logValue[it->first]); vecDiffY.push_back(m_diffY[it->first]); vecDiffE.push_back(m_diffE[it->first]); } @@ -520,7 +520,7 @@ void PlotAsymmetryByLogValue::groupDetectors(Workspace_sptr &loadedWs, * @param index :: [input] Vector index where results will be stored */ void PlotAsymmetryByLogValue::doAnalysis(Workspace_sptr loadedWs, - int64_t index) { + size_t index) { // Check if workspace is a workspace group WorkspaceGroup_sptr group = @@ -533,7 +533,7 @@ void PlotAsymmetryByLogValue::doAnalysis(Workspace_sptr loadedWs, double Y, E; calcIntAsymmetry(ws_red, Y, E); - m_redX[index] = getLogValue(*ws_red); + m_logValue[index] = getLogValue(*ws_red); m_redY[index] = Y; m_redE[index] = E; @@ -551,7 +551,7 @@ void PlotAsymmetryByLogValue::doAnalysis(Workspace_sptr loadedWs, double YR, ER; calcIntAsymmetry(ws_red, YR, ER); double logValue = getLogValue(*ws_red); - m_redX[index] = logValue; + m_logValue[index] = logValue; m_redY[index] = YR; m_redE[index] = ER; @@ -567,20 +567,16 @@ void PlotAsymmetryByLogValue::doAnalysis(Workspace_sptr loadedWs, double YG, EG; calcIntAsymmetry(ws_green, YG, EG); // Red data - m_redX[index] = logValue; m_redY[index] = YR; m_redE[index] = ER; // Green data - m_greenX[index] = logValue; m_greenY[index] = YG; m_greenE[index] = EG; // Sum - m_sumX[index] = logValue; m_sumY[index] = YR + YG; m_sumE[index] = sqrt(ER * ER + EG * EG); // Diff calcIntAsymmetry(ws_red, ws_green, YR, ER); - m_diffX[index] = logValue; m_diffY[index] = YR; m_diffE[index] = ER; } -- GitLab