diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/AbsorptionCorrection.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/AbsorptionCorrection.h index 5ef69327a2d23e0c86c4e2f6745a7e1914c5488c..f5155910f6b3e33e0be585f2114e02f9a1d68f93 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/AbsorptionCorrection.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/AbsorptionCorrection.h @@ -134,7 +134,7 @@ private: double m_scattering; ///< The scattering cross-section in 1/m int64_t n_lambda; ///< The number of points in wavelength, the rest is /// interpolated linearly - int64_t x_step; ///< The step in bin number between adjacent points + int64_t m_xStep; ///< The step in bin number between adjacent points int64_t m_emode; ///< The energy mode: 0 - elastic, 1 - direct, 2 - indirect double m_lambdaFixed; ///< The wavelength corresponding to the fixed energy, /// if provided diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis2.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis2.h index dffd8a3b45140698d74adcfd6105b26a23a0811d..3fca63f124891b06c67caf55be15bc4d63de6d5e 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis2.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis2.h @@ -30,7 +30,7 @@ namespace Algorithms { class DLLExport ConvertSpectrumAxis2 : public API::Algorithm { public: /// (Empty) Constructor - ConvertSpectrumAxis2() : API::Algorithm() {} + ConvertSpectrumAxis2(); /// Virtual destructor virtual ~ConvertSpectrumAxis2() {} /// Algorithm's name diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h index 6d8b961779ef2860bfb25d4ec2e50baf7f7be595..72d732838d708e1bea0873e5da9e7bc3d17b1c37 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h @@ -33,8 +33,8 @@ const double CHOPPER_LOCATION[4] = {5700., 7800., 9497., 9507.}; class DLLExport EQSANSTofStructure : public API::Algorithm { public: - /// (Empty) Constructor - EQSANSTofStructure() : API::Algorithm() {} + /// Default constructor + EQSANSTofStructure(); /// Virtual destructor virtual ~EQSANSTofStructure() {} /// Algorithm's name diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExponentialCorrection.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExponentialCorrection.h index 9bf1ce4df57123cde089b1ee43553430e4f691a5..e42e08f93ef99d79ebac308dca866ebe7d2faa19 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExponentialCorrection.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExponentialCorrection.h @@ -54,7 +54,7 @@ File change history is stored at: <https://github.com/mantidproject/mantid> class DLLExport ExponentialCorrection : public UnaryOperation { public: /// Default constructor - ExponentialCorrection() : UnaryOperation(){}; + ExponentialCorrection(); /// Destructor virtual ~ExponentialCorrection(){}; /// Algorithm's name for identification diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h index 1afbb270f7e587d3c1eb21d79067f37fc42f628e..b27d1b62ad062868de647c75b90c4d88a619ecb3 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h @@ -89,9 +89,6 @@ private: void addToTableWorkspace(DataObjects::TableWorkspace_sptr outws, std::vector<detid_t> maskeddetids, double xmin, double xmax, std::vector<detid_t> prevmaskedids); - - /// Input workspace type - bool m_inputIsMask; }; } // namespace Algorithms diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth.h index 605e5bf78d5974872c2ececcfb33c67df18447ca..f04f7762714f0dcbb08ae20579dcbb5c0331d169 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth.h @@ -72,8 +72,6 @@ private: API::MatrixWorkspace_sptr m_unfilteredWS; /// Temporary workspace for keeping the filtered spectrum API::MatrixWorkspace_sptr m_filteredWS; - /// Variable for storing the lowest x value - double m_x0; }; } // namespace Algorithm diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth2.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth2.h index af11d8e0eee115dcee75d68273f40b077c23c568..8e3d189d468d03f0a79ae48781873d3030ef028a 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth2.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/FFTSmooth2.h @@ -74,11 +74,6 @@ private: API::MatrixWorkspace_sptr m_unfilteredWS; /// Temporary workspace for keeping the filtered spectrum API::MatrixWorkspace_sptr m_filteredWS; - /// Variable for storing the lowest x value - double m_x0; - - /// Will we Allow Any X Bins? - bool IgnoreXBins; }; } // namespace Algorithm diff --git a/Code/Mantid/Framework/Algorithms/src/ChangeBinOffset.cpp b/Code/Mantid/Framework/Algorithms/src/ChangeBinOffset.cpp index 036ac97413f5fcaa8c86c49534c1e213b5bf5153..be5db1d67f671863fff5df5ad90028a82d9f48e5 100644 --- a/Code/Mantid/Framework/Algorithms/src/ChangeBinOffset.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ChangeBinOffset.cpp @@ -18,7 +18,8 @@ DECLARE_ALGORITHM(ChangeBinOffset) /** * Default constructor */ -ChangeBinOffset::ChangeBinOffset() : API::Algorithm(), m_progress(NULL) {} +ChangeBinOffset::ChangeBinOffset() + : API::Algorithm(), m_progress(NULL), offset(0.), wi_min(0), wi_max(0) {} /** * Destructor diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp index e697859d12e99a4cb46a113889d744c055ac7846..58fe670a884249e4395a2a2843925c8b84fdc9e0 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp @@ -21,6 +21,10 @@ using namespace Kernel; using namespace API; using namespace Geometry; +ConvertSpectrumAxis2::ConvertSpectrumAxis2() + : API::Algorithm(), m_inputWS(), m_indexMap(), m_nBins(0), m_nxBins(0), + m_nHist(0) {} + void ConvertSpectrumAxis2::init() { // Validator for Input Workspace auto wsVal = boost::make_shared<CompositeValidator>(); diff --git a/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp b/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp index da3e873b40757ca73b45fc3075cf84742eb6b0f2..d8ee449dd2f8176e73284539b25b8e6c61235e75 100644 --- a/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp @@ -31,7 +31,8 @@ using boost::bind; /// Default constructor ConvertUnits::ConvertUnits() - : Algorithm(), m_numberOfSpectra(0), m_inputEvents(false) {} + : Algorithm(), m_numberOfSpectra(0), m_distribution(false), + m_inputEvents(false), m_inputUnit(), m_outputUnit() {} /// Destructor ConvertUnits::~ConvertUnits() {} diff --git a/Code/Mantid/Framework/Algorithms/src/CorrectFlightPaths.cpp b/Code/Mantid/Framework/Algorithms/src/CorrectFlightPaths.cpp index 31f3f27605c754378bb6f03c9ab09e0c765ca236..75608fd98addc548316097cac8d9e5b3730015e7 100644 --- a/Code/Mantid/Framework/Algorithms/src/CorrectFlightPaths.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CorrectFlightPaths.cpp @@ -24,7 +24,9 @@ using namespace Geometry; DECLARE_ALGORITHM(CorrectFlightPaths) // Constructor -CorrectFlightPaths::CorrectFlightPaths() : API::Algorithm() {} +CorrectFlightPaths::CorrectFlightPaths() + : API::Algorithm(), m_inputWS(), m_outputWS(), m_instrument(), m_sample(), + m_l2(0.), m_wavelength(0.) {} /** Initialisation method. Declares properties to be used in algorithm. * diff --git a/Code/Mantid/Framework/Algorithms/src/CreateLogTimeCorrection.cpp b/Code/Mantid/Framework/Algorithms/src/CreateLogTimeCorrection.cpp index ab68c85fcc5b5ddaaf032967056e48df63141520..7bab28c41c75aeadf727acba8ff964ee218bc009 100644 --- a/Code/Mantid/Framework/Algorithms/src/CreateLogTimeCorrection.cpp +++ b/Code/Mantid/Framework/Algorithms/src/CreateLogTimeCorrection.cpp @@ -23,7 +23,9 @@ DECLARE_ALGORITHM(CreateLogTimeCorrection) //---------------------------------------------------------------------------------------------- /** Constructor */ -CreateLogTimeCorrection::CreateLogTimeCorrection() {} +CreateLogTimeCorrection::CreateLogTimeCorrection() + : API::Algorithm(), m_dataWS(), m_instrument(), m_l2map(), + m_correctionMap(), m_L1(0.) {} //---------------------------------------------------------------------------------------------- /** Destructor diff --git a/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp b/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp index 559a747688bc1e561cf4550995d40415d180174a..8350ba3e3180264519d696f5adf90436c39096df 100644 --- a/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp +++ b/Code/Mantid/Framework/Algorithms/src/DetectorEfficiencyCorUser.cpp @@ -18,7 +18,8 @@ DECLARE_ALGORITHM(DetectorEfficiencyCorUser) //---------------------------------------------------------------------------------------------- /** Constructor */ -DetectorEfficiencyCorUser::DetectorEfficiencyCorUser() {} +DetectorEfficiencyCorUser::DetectorEfficiencyCorUser() + : API::Algorithm(), m_inputWS(), m_outputWS(), m_Ei(0.) {} //---------------------------------------------------------------------------------------------- /** Destructor diff --git a/Code/Mantid/Framework/Algorithms/src/EQSANSTofStructure.cpp b/Code/Mantid/Framework/Algorithms/src/EQSANSTofStructure.cpp index ede4630245ae5a8fe4e2cf1f1a5e4d9c0820979a..4f43e39735765a753f35d62ea851951eb60f7691 100644 --- a/Code/Mantid/Framework/Algorithms/src/EQSANSTofStructure.cpp +++ b/Code/Mantid/Framework/Algorithms/src/EQSANSTofStructure.cpp @@ -25,6 +25,10 @@ using namespace Kernel; using namespace API; using namespace Geometry; +EQSANSTofStructure::EQSANSTofStructure() + : API::Algorithm(), frame_tof0(0.), flight_path_correction(false), + low_tof_cut(0.), high_tof_cut(0.) {} + void EQSANSTofStructure::init() { declareProperty(new WorkspaceProperty<EventWorkspace>( "InputWorkspace", "", Direction::Input, diff --git a/Code/Mantid/Framework/Algorithms/src/ExponentialCorrection.cpp b/Code/Mantid/Framework/Algorithms/src/ExponentialCorrection.cpp index 88ffb6f220450750bdb8d9e46f608774671c5a5f..c882f7534d4ddf32f36b927aa97f1794135474ad 100644 --- a/Code/Mantid/Framework/Algorithms/src/ExponentialCorrection.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ExponentialCorrection.cpp @@ -12,6 +12,9 @@ namespace Algorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(ExponentialCorrection) +ExponentialCorrection::ExponentialCorrection() + : UnaryOperation(), m_c0(0.), m_c1(0.), m_divide(false) {} + void ExponentialCorrection::defineProperties() { declareProperty( "C0", 1.0, diff --git a/Code/Mantid/Framework/Algorithms/src/ExtractMaskToTable.cpp b/Code/Mantid/Framework/Algorithms/src/ExtractMaskToTable.cpp index 239b215494170d46a7bc0e52944e81a199c3005c..343b4d2c77132f454cdf5439c551e2a674265d29 100644 --- a/Code/Mantid/Framework/Algorithms/src/ExtractMaskToTable.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ExtractMaskToTable.cpp @@ -62,6 +62,8 @@ void ExtractMaskToTable::exec() { throw runtime_error("InputWorkspace cannot be cast to a MatrixWorkspace."); MaskWorkspace_const_sptr maskws = boost::dynamic_pointer_cast<const MaskWorkspace>(m_dataWS); + + bool m_inputIsMask = false; if (maskws) { g_log.notice() << "InputWorkspace " << m_dataWS->name() << " is a MaskWorkspace.\n"; diff --git a/Code/Mantid/Framework/Algorithms/src/FFTSmooth.cpp b/Code/Mantid/Framework/Algorithms/src/FFTSmooth.cpp index 5f95cc21b463e2b3cc317f33b29918096435d71e..9069be1a52b98c0c5a031aaaa63f29c3ab59f907 100644 --- a/Code/Mantid/Framework/Algorithms/src/FFTSmooth.cpp +++ b/Code/Mantid/Framework/Algorithms/src/FFTSmooth.cpp @@ -47,7 +47,7 @@ void FFTSmooth::exec() { int spec = getProperty("WorkspaceIndex"); // Save the starting x value so it can be restored after all transforms. - m_x0 = m_inWS->readX(spec)[0]; + double x0 = m_inWS->readX(spec)[0]; // Symmetrize the input spectrum int dn = static_cast<int>(m_inWS->readY(0).size()); @@ -62,11 +62,11 @@ void FFTSmooth::exec() { symmWS->dataX(0)[dn + i] = m_inWS->readX(spec)[i]; symmWS->dataY(0)[dn + i] = m_inWS->readY(spec)[i]; - symmWS->dataX(0)[dn - i] = m_x0 - dx * i; + symmWS->dataX(0)[dn - i] = x0 - dx * i; symmWS->dataY(0)[dn - i] = m_inWS->readY(spec)[i]; } symmWS->dataY(0).front() = m_inWS->readY(spec).back(); - symmWS->dataX(0).front() = m_x0 - dx * dn; + symmWS->dataX(0).front() = x0 - dx * dn; if (m_inWS->isHistogramData()) symmWS->dataX(0).back() = m_inWS->readX(spec).back(); @@ -136,19 +136,19 @@ void FFTSmooth::exec() { // after truncation) // but it doesn't work accurately enough, so commented out //// Correct the x values: - // m_x0 -= tmpWS->dataX(0)[dn]; + // x0 -= tmpWS->dataX(0)[dn]; // if (tmpWS->isHistogramData()) //{// Align centres of the in and out histograms. I am not sure here // double dX = m_inWS->readX(0)[1] - m_inWS->readX(0)[0]; // double dx = tmpWS->readX(0)[1] - tmpWS->readX(0)[0]; - // m_x0 += dX/2 - dx; + // x0 += dX/2 - dx; //} // outWS->dataX(0).assign(tmpWS->readX(0).begin()+dn,tmpWS->readX(0).end()); // outWS->dataY(0).assign(tmpWS->readY(0).begin()+dn,tmpWS->readY(0).end()); // // std::transform( outWS->dataX(0).begin(), outWS->dataX(0).end(), // outWS->dataX(0).begin(), - // std::bind2nd(std::plus<double>(), m_x0) ); + // std::bind2nd(std::plus<double>(), x0) ); outWS->dataX(0).assign(m_inWS->readX(0).begin(), m_inWS->readX(0).end()); outWS->dataY(0).assign(tmpWS->readY(0).begin() + dn, tmpWS->readY(0).end()); diff --git a/Code/Mantid/Framework/Algorithms/src/FFTSmooth2.cpp b/Code/Mantid/Framework/Algorithms/src/FFTSmooth2.cpp index 4126a2ae797cddb39c98b84ab403384e94527dbb..745441a1a978f70d2bb620b9aef5093fd7987b93 100644 --- a/Code/Mantid/Framework/Algorithms/src/FFTSmooth2.cpp +++ b/Code/Mantid/Framework/Algorithms/src/FFTSmooth2.cpp @@ -60,7 +60,8 @@ void FFTSmooth2::init() { */ void FFTSmooth2::exec() { m_inWS = getProperty("InputWorkspace"); - IgnoreXBins = getProperty("IgnoreXBins"); + /// Will we Allow Any X Bins? + bool ignoreXBins = getProperty("IgnoreXBins"); // First spectrum in input int s0 = getProperty("WorkspaceIndex"); @@ -82,7 +83,7 @@ void FFTSmooth2::exec() { for (int spec = s0; spec < send; spec++) { // Save the starting x value so it can be restored after all transforms. - m_x0 = m_inWS->readX(spec)[0]; + double x0 = m_inWS->readX(spec)[0]; double dx = (m_inWS->readX(spec).back() - m_inWS->readX(spec).front()) / (static_cast<double>(m_inWS->readX(spec).size()) - 1.0); @@ -90,11 +91,11 @@ void FFTSmooth2::exec() { symmWS->dataX(0)[dn + i] = m_inWS->readX(spec)[i]; symmWS->dataY(0)[dn + i] = m_inWS->readY(spec)[i]; - symmWS->dataX(0)[dn - i] = m_x0 - dx * i; + symmWS->dataX(0)[dn - i] = x0 - dx * i; symmWS->dataY(0)[dn - i] = m_inWS->readY(spec)[i]; } symmWS->dataY(0).front() = m_inWS->readY(spec).back(); - symmWS->dataX(0).front() = m_x0 - dx * dn; + symmWS->dataX(0).front() = x0 - dx * dn; if (m_inWS->isHistogramData()) symmWS->dataX(0).back() = m_inWS->readX(spec).back(); @@ -104,7 +105,7 @@ void FFTSmooth2::exec() { IAlgorithm_sptr fft = createChildAlgorithm("RealFFT", 0, 0.5); fft->setProperty("InputWorkspace", symmWS); fft->setProperty("WorkspaceIndex", 0); - fft->setProperty("IgnoreXBins", IgnoreXBins); + fft->setProperty("IgnoreXBins", ignoreXBins); try { fft->execute(); } catch (...) { @@ -170,7 +171,7 @@ void FFTSmooth2::exec() { // fft->setProperty("Real",0); // fft->setProperty("Imaginary",1); fft->setProperty("Transform", "Backward"); - fft->setProperty("IgnoreXBins", IgnoreXBins); + fft->setProperty("IgnoreXBins", ignoreXBins); try { fft->execute(); } catch (...) { @@ -188,19 +189,19 @@ void FFTSmooth2::exec() { // after truncation) // but it doesn't work accurately enough, so commented out //// Correct the x values: - // m_x0 -= tmpWS->dataX(0)[dn]; + // x0 -= tmpWS->dataX(0)[dn]; // if (tmpWS->isHistogramData()) //{// Align centres of the in and out histograms. I am not sure here // double dX = m_inWS->readX(0)[1] - m_inWS->readX(0)[0]; // double dx = tmpWS->readX(0)[1] - tmpWS->readX(0)[0]; - // m_x0 += dX/2 - dx; + // x0 += dX/2 - dx; //} // outWS->dataX(0).assign(tmpWS->readX(0).begin()+dn,tmpWS->readX(0).end()); // outWS->dataY(0).assign(tmpWS->readY(0).begin()+dn,tmpWS->readY(0).end()); // // std::transform( outWS->dataX(0).begin(), outWS->dataX(0).end(), // outWS->dataX(0).begin(), - // std::bind2nd(std::plus<double>(), m_x0) ); + // std::bind2nd(std::plus<double>(), x0) ); if (getProperty("AllSpectra")) { outWS->dataX(spec) diff --git a/Code/Mantid/Framework/Algorithms/src/FilterEvents.cpp b/Code/Mantid/Framework/Algorithms/src/FilterEvents.cpp index e4e513aa79e4553be0b7308cc383a751a1cc205c..9231d98e06e926b8c8a8af2767b3ebb0ae3d3ec7 100644 --- a/Code/Mantid/Framework/Algorithms/src/FilterEvents.cpp +++ b/Code/Mantid/Framework/Algorithms/src/FilterEvents.cpp @@ -32,7 +32,15 @@ DECLARE_ALGORITHM(FilterEvents) //---------------------------------------------------------------------------------------------- /** Constructor */ -FilterEvents::FilterEvents() {} +FilterEvents::FilterEvents() + : m_eventWS(), m_splittersWorkspace(), m_matrixSplitterWS(), + m_detCorrectWorkspace(), m_useTableSplitters(false), m_workGroupIndexes(), + m_splitters(), m_outputWS(), m_wsNames(), m_detTofOffsets(), + m_detTofShifts(), m_FilterByPulseTime(false), m_informationWS(), + m_hasInfoWS(), m_progress(0.), m_outputWSNameBase(), m_toGroupWS(false), + m_vecSplitterTime(), m_vecSplitterGroup(), m_splitSampleLogs(false), + m_useDBSpectrum(false), m_dbWSIndex(-1), m_tofCorrType(), + m_specSkipType(), m_vecSkip() {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -54,10 +62,11 @@ void FilterEvents::init() { declareProperty("OutputWorkspaceBaseName", "OutputWorkspace", "The base name to use for the output workspace"); - declareProperty( - new WorkspaceProperty<TableWorkspace>( - "InformationWorkspace", "", Direction::Input, PropertyMode::Optional), - "Optional output for the information of each splitter workspace index."); + declareProperty(new WorkspaceProperty<TableWorkspace>("InformationWorkspace", + "", Direction::Input, + PropertyMode::Optional), + "Optional output for the information of each splitter " + "workspace index."); declareProperty( new WorkspaceProperty<MatrixWorkspace>("OutputTOFCorrectionWorkspace", @@ -114,10 +123,10 @@ void FilterEvents::init() { boost::make_shared<StringListValidator>(spec_no_det), "Approach to deal with spectrum without detectors. "); - declareProperty( - "SplitSampleLogs", true, - "If selected, all sample logs will be splitted by the " - "event splitters. It is not recommended for fast event log splitters. "); + declareProperty("SplitSampleLogs", true, + "If selected, all sample logs will be splitted by the " + "event splitters. It is not recommended for fast event " + "log splitters. "); declareProperty("NumberOutputWS", 0, "Number of output output workspace splitted. ", @@ -144,26 +153,26 @@ void FilterEvents::exec() { examineEventWS(); // Parse splitters - mProgress = 0.0; - progress(mProgress, "Processing SplittersWorkspace."); + m_progress = 0.0; + progress(m_progress, "Processing SplittersWorkspace."); if (m_useTableSplitters) processSplittersWorkspace(); else processMatrixSplitterWorkspace(); // Create output workspaces - mProgress = 0.1; - progress(mProgress, "Create Output Workspaces."); + m_progress = 0.1; + progress(m_progress, "Create Output Workspaces."); createOutputWorkspaces(); // Optionall import corrections - mProgress = 0.20; - progress(mProgress, "Importing TOF corrections. "); + m_progress = 0.20; + progress(m_progress, "Importing TOF corrections. "); setupDetectorTOFCalibration(); // Filter Events - mProgress = 0.30; - progress(mProgress, "Filter Events."); + m_progress = 0.30; + progress(m_progress, "Filter Events."); double progressamount; if (m_toGroupWS) progressamount = 0.6; @@ -176,8 +185,8 @@ void FilterEvents::exec() { // Optional to group detector if (m_toGroupWS) { - mProgress = 0.9; - progress(mProgress, "Group workspaces"); + m_progress = 0.9; + progress(m_progress, "Group workspaces"); std::string groupname = m_outputWSNameBase; API::IAlgorithm_sptr groupws = @@ -200,8 +209,8 @@ void FilterEvents::exec() { } setProperty("OutputWorkspaceNames", outputwsnames); - mProgress = 1.0; - progress(mProgress, "Completed"); + m_progress = 1.0; + progress(m_progress, "Completed"); return; } @@ -243,7 +252,7 @@ void FilterEvents::processProperties() { m_hasInfoWS = true; m_outputWSNameBase = this->getPropertyValue("OutputWorkspaceBaseName"); - mFilterByPulseTime = this->getProperty("FilterByPulseTime"); + m_FilterByPulseTime = this->getProperty("FilterByPulseTime"); m_toGroupWS = this->getProperty("GroupWorkspaces"); @@ -377,8 +386,8 @@ void FilterEvents::processSplittersWorkspace() { if (inorder && i > 0 && m_splitters[i] < m_splitters[i - 1]) inorder = false; } - mProgress = 0.05; - progress(mProgress); + m_progress = 0.05; + progress(m_progress); // 3. Order if not ordered and add workspace for events excluded if (!inorder) { @@ -482,7 +491,8 @@ void FilterEvents::createOutputWorkspaces() { add2output = false; } - // Generate one of the output workspaces & Copy geometry over. But we don't + // Generate one of the output workspaces & Copy geometry over. But we + // don't // copy the data. DataObjects::EventWorkspace_sptr optws = boost::dynamic_pointer_cast<DataObjects::EventWorkspace>( @@ -537,8 +547,8 @@ void FilterEvents::createOutputWorkspaces() { << "\n"; // Update progress report - mProgress = 0.1 + 0.1 * wsgindex / numnewws; - progress(mProgress, "Creating output workspace"); + m_progress = 0.1 + 0.1 * wsgindex / numnewws; + progress(m_progress, "Creating output workspace"); wsgindex += 1.; } // If add workspace to output @@ -935,7 +945,7 @@ void FilterEvents::filterEventsBySplitters(double progressamount) { // Perform the filtering (using the splitting function and just one // output) - if (mFilterByPulseTime) { + if (m_FilterByPulseTime) { input_el.splitByPulseTime(m_splitters, outputs); } else if (m_tofCorrType != NoneCorrect) { input_el.splitByFullTime(m_splitters, outputs, true, @@ -1042,7 +1052,7 @@ void FilterEvents::filterEventsByVectorSplitters(double progressamount) { // Perform the filtering (using the splitting function and just one // output) std::string logmessage(""); - if (mFilterByPulseTime) { + if (m_FilterByPulseTime) { throw runtime_error( "It is not a good practice to split fast event by pulse time. "); } else if (m_tofCorrType != NoneCorrect) { @@ -1073,7 +1083,8 @@ void FilterEvents::filterEventsByVectorSplitters(double progressamount) { } //---------------------------------------------------------------------------------------------- -/** Generate splitters for specified workspace index as a subset of m_splitters +/** Generate splitters for specified workspace index as a subset of + * m_splitters */ void FilterEvents::generateSplitters(int wsindex, Kernel::TimeSplitterType &splitters) { diff --git a/Code/Mantid/Framework/Algorithms/src/FindPeaks.cpp b/Code/Mantid/Framework/Algorithms/src/FindPeaks.cpp index 17f88faab701a2333fbdffb9fc9757c23de320a3..ecd32bc31318602910c6f3fdee7752191c2bfc4a 100644 --- a/Code/Mantid/Framework/Algorithms/src/FindPeaks.cpp +++ b/Code/Mantid/Framework/Algorithms/src/FindPeaks.cpp @@ -49,7 +49,8 @@ FindPeaks::FindPeaks() m_stepGuessedPeakWidth(0), m_usePeakPositionTolerance(false), m_peakPositionTolerance(0.0), m_fitFunctions(), m_peakLeftIndexes(), m_peakRightIndexes(), m_minimizer("Levenberg-MarquardtMD"), - m_costFunction(), m_minHeight(0.0), m_useObsCentre(false) {} + m_costFunction(), m_minHeight(0.0), m_leastMaxObsY(0.), + m_useObsCentre(false) {} //---------------------------------------------------------------------------------------------- /** Initialize and declare properties. diff --git a/Code/Mantid/Framework/Algorithms/src/FlatPlateAbsorption.cpp b/Code/Mantid/Framework/Algorithms/src/FlatPlateAbsorption.cpp index f17750260e999ee56b8fba5577e9c6a5c54e21cd..eeb68b217b6b7cf925d97861bbf4236bac21bda6 100644 --- a/Code/Mantid/Framework/Algorithms/src/FlatPlateAbsorption.cpp +++ b/Code/Mantid/Framework/Algorithms/src/FlatPlateAbsorption.cpp @@ -16,7 +16,8 @@ using namespace API; FlatPlateAbsorption::FlatPlateAbsorption() : AbsorptionCorrection(), m_slabHeight(0.0), m_slabWidth(0.0), - m_slabThickness(0.0) {} + m_slabThickness(0.0), m_numXSlices(0), m_numYSlices(0), m_numZSlices(0), + m_XSliceThickness(0), m_YSliceThickness(0), m_ZSliceThickness(0) {} void FlatPlateAbsorption::defineProperties() { auto mustBePositive = boost::make_shared<BoundedValidator<double>>(); diff --git a/Code/Mantid/Framework/Algorithms/src/Integration.cpp b/Code/Mantid/Framework/Algorithms/src/Integration.cpp index 03a00b76cde2f0d3faeb0792364a3f1a6567e534..302661368b18d6047887914f40a7587d2a8ad4a5 100644 --- a/Code/Mantid/Framework/Algorithms/src/Integration.cpp +++ b/Code/Mantid/Framework/Algorithms/src/Integration.cpp @@ -71,11 +71,17 @@ public: */ void Integration::exec() { // Try and retrieve the optional properties - m_MinRange = getProperty("RangeLower"); - m_MaxRange = getProperty("RangeUpper"); - m_MinSpec = getProperty("StartWorkspaceIndex"); - m_MaxSpec = getProperty("EndWorkspaceIndex"); - m_IncPartBins = getProperty("IncludePartialBins"); + + /// The value in X to start the integration from + double minRange = getProperty("RangeLower"); + /// The value in X to finish the integration at + double maxRange = getProperty("RangeUpper"); + /// The spectrum to start the integration from + int minSpec = getProperty("StartWorkspaceIndex"); + /// The spectrum to finish the integration at + int maxSpec = getProperty("EndWorkspaceIndex"); + /// Flag for including partial bins + bool incPartBins = getProperty("IncludePartialBins"); // Get the input workspace MatrixWorkspace_const_sptr localworkspace = this->getInputWorkspace(); @@ -84,38 +90,38 @@ void Integration::exec() { static_cast<int>(localworkspace->getNumberHistograms()); // Check 'StartSpectrum' is in range 0-numberOfSpectra - if (m_MinSpec > numberOfSpectra) { + if (minSpec > numberOfSpectra) { g_log.warning("StartSpectrum out of range! Set to 0."); - m_MinSpec = 0; + minSpec = 0; } - if (isEmpty(m_MaxSpec)) - m_MaxSpec = numberOfSpectra - 1; - if (m_MaxSpec > numberOfSpectra - 1 || m_MaxSpec < m_MinSpec) { + if (isEmpty(maxSpec)) + maxSpec = numberOfSpectra - 1; + if (maxSpec > numberOfSpectra - 1 || maxSpec < minSpec) { g_log.warning("EndSpectrum out of range! Set to max detector number"); - m_MaxSpec = numberOfSpectra; + maxSpec = numberOfSpectra; } - if (m_MinRange > m_MaxRange) { + if (minRange > maxRange) { g_log.warning("Range_upper is less than Range_lower. Will integrate up to " "frame maximum."); - m_MaxRange = 0.0; + maxRange = 0.0; } // Create the 2D workspace (with 1 bin) for the output MatrixWorkspace_sptr outputWorkspace = - this->getOutputWorkspace(localworkspace); + this->getOutputWorkspace(localworkspace, minSpec, maxSpec); bool is_distrib = outputWorkspace->isDistribution(); - Progress progress(this, 0, 1, m_MaxSpec - m_MinSpec + 1); + Progress progress(this, 0, 1, maxSpec - minSpec + 1); const bool axisIsText = localworkspace->getAxis(1)->isText(); const bool axisIsNumeric = localworkspace->getAxis(1)->isNumeric(); // Loop over spectra PARALLEL_FOR2(localworkspace, outputWorkspace) - for (int i = m_MinSpec; i <= m_MaxSpec; ++i) { + for (int i = minSpec; i <= maxSpec; ++i) { PARALLEL_START_INTERUPT_REGION // Workspace index on the output - const int outWI = i - m_MinSpec; + const int outWI = i - minSpec; // Copy Axis values from previous workspace if (axisIsText) { @@ -147,23 +153,23 @@ void Integration::exec() { // values // regardless of whether they're 'in range' for this spectrum // Have to do this here, ahead of the 'continue' a bit down from here. - if (m_IncPartBins) { - outSpec->dataX()[0] = m_MinRange; - outSpec->dataX()[1] = m_MaxRange; + if (incPartBins) { + outSpec->dataX()[0] = minRange; + outSpec->dataX()[1] = maxRange; } // Find the range [min,max] MantidVec::const_iterator lowit, highit; - if (m_MinRange == EMPTY_DBL()) { + if (minRange == EMPTY_DBL()) { lowit = X.begin(); } else { - lowit = std::lower_bound(X.begin(), X.end(), m_MinRange, tolerant_less()); + lowit = std::lower_bound(X.begin(), X.end(), minRange, tolerant_less()); } - if (m_MaxRange == EMPTY_DBL()) { + if (maxRange == EMPTY_DBL()) { highit = X.end(); } else { - highit = std::upper_bound(lowit, X.end(), m_MaxRange, tolerant_less()); + highit = std::upper_bound(lowit, X.end(), maxRange, tolerant_less()); } // If range specified doesn't overlap with this spectrum then bail out @@ -204,11 +210,11 @@ void Integration::exec() { } // If partial bins are included, set integration range to exact range // given and add on contributions from partial bins either side of range. - if (m_IncPartBins) { + if (incPartBins) { if (distmin > 0) { const double lower_bin = *lowit; const double prev_bin = *(lowit - 1); - double fraction = (lower_bin - m_MinRange); + double fraction = (lower_bin - minRange); if (!is_distrib) { fraction /= (lower_bin - prev_bin); } @@ -220,7 +226,7 @@ void Integration::exec() { if (highit < X.end() - 1) { const double upper_bin = *highit; const double next_bin = *(highit + 1); - double fraction = (m_MaxRange - upper_bin); + double fraction = (maxRange - upper_bin); if (!is_distrib) { fraction /= (next_bin - upper_bin); } @@ -272,8 +278,7 @@ MatrixWorkspace_const_sptr Integration::getInputWorkspace() { } // To integrate point data it will be converted to histograms - if ( !temp->isHistogramData() ) - { + if (!temp->isHistogramData()) { auto alg = this->createChildAlgorithm("ConvertToHistogram"); alg->setProperty<MatrixWorkspace_sptr>("InputWorkspace", temp); std::string outName = "_" + temp->getName() + "_histogram"; @@ -290,18 +295,24 @@ MatrixWorkspace_const_sptr Integration::getInputWorkspace() { * This function creates the output workspace. In the case of a RebinnedOutput * workspace, the resulting workspace only needs to be a Workspace2D to handle * the integration. Other workspaces are handled normally. + * + * @param inWS input workspace to integrate + * @param minSpec minimum spectrum to integrate + * @param maxSpec maximum spectrum to integrate + * * @return the output workspace */ MatrixWorkspace_sptr -Integration::getOutputWorkspace(MatrixWorkspace_const_sptr inWS) { +Integration::getOutputWorkspace(MatrixWorkspace_const_sptr inWS, + const int minSpec, const int maxSpec) { if (inWS->id() == "RebinnedOutput") { MatrixWorkspace_sptr outWS = API::WorkspaceFactory::Instance().create( - "Workspace2D", m_MaxSpec - m_MinSpec + 1, 2, 1); + "Workspace2D", maxSpec - minSpec + 1, 2, 1); API::WorkspaceFactory::Instance().initializeFromParent(inWS, outWS, true); return outWS; } else { - return API::WorkspaceFactory::Instance().create( - inWS, m_MaxSpec - m_MinSpec + 1, 2, 1); + return API::WorkspaceFactory::Instance().create(inWS, maxSpec - minSpec + 1, + 2, 1); } } diff --git a/Code/Mantid/Framework/Algorithms/src/MaxMin.cpp b/Code/Mantid/Framework/Algorithms/src/MaxMin.cpp index 7acd61c8936e05f4795c3c1199bd427b8fcee7ba..d6273ea22f5311bde5b5919a938a4692341b43e5 100644 --- a/Code/Mantid/Framework/Algorithms/src/MaxMin.cpp +++ b/Code/Mantid/Framework/Algorithms/src/MaxMin.cpp @@ -48,11 +48,17 @@ void MaxMin::init() { */ void MaxMin::exec() { // Try and retrieve the optional properties - m_MinRange = getProperty("RangeLower"); - m_MaxRange = getProperty("RangeUpper"); - m_MinSpec = getProperty("StartWorkspaceIndex"); - m_MaxSpec = getProperty("EndWorkspaceIndex"); - showMin = getProperty("ShowMin"); + + /// The value in X to start the search from + double MinRange = getProperty("RangeLower"); + /// The value in X to finish the search at + double MaxRange = getProperty("RangeUpper"); + /// The spectrum to start the integration from + int MinSpec = getProperty("StartWorkspaceIndex"); + /// The spectrum to finish the integration at + int MaxSpec = getProperty("EndWorkspaceIndex"); + /// The flag to show minimum + bool showMin = getProperty("ShowMin"); // Get the input workspace MatrixWorkspace_const_sptr localworkspace = getProperty("InputWorkspace"); @@ -61,33 +67,33 @@ void MaxMin::exec() { static_cast<int>(localworkspace->getNumberHistograms()); // Check 'StartSpectrum' is in range 0-numberOfSpectra - if (m_MinSpec > numberOfSpectra) { + if (MinSpec > numberOfSpectra) { g_log.warning("StartSpectrum out of range! Set to 0."); - m_MinSpec = 0; + MinSpec = 0; } - if (isEmpty(m_MaxSpec)) - m_MaxSpec = numberOfSpectra - 1; - if (m_MaxSpec > numberOfSpectra - 1 || m_MaxSpec < m_MinSpec) { + if (isEmpty(MaxSpec)) + MaxSpec = numberOfSpectra - 1; + if (MaxSpec > numberOfSpectra - 1 || MaxSpec < MinSpec) { g_log.warning("EndSpectrum out of range! Set to max detector number"); - m_MaxSpec = numberOfSpectra; + MaxSpec = numberOfSpectra; } - if (m_MinRange > m_MaxRange) { + if (MinRange > MaxRange) { g_log.warning("Range_upper is less than Range_lower. Will integrate up to " "frame maximum."); - m_MaxRange = 0.0; + MaxRange = 0.0; } // Create the 1D workspace for the output MatrixWorkspace_sptr outputWorkspace = API::WorkspaceFactory::Instance().create(localworkspace, - m_MaxSpec - m_MinSpec + 1, 2, 1); + MaxSpec - MinSpec + 1, 2, 1); - Progress progress(this, 0, 1, (m_MaxSpec - m_MinSpec + 1)); + Progress progress(this, 0, 1, (MaxSpec - MinSpec + 1)); PARALLEL_FOR2(localworkspace, outputWorkspace) // Loop over spectra - for (int i = m_MinSpec; i <= m_MaxSpec; ++i) { + for (int i = MinSpec; i <= MaxSpec; ++i) { PARALLEL_START_INTERUPT_REGION - int newindex = i - m_MinSpec; + int newindex = i - MinSpec; // Copy over spectrum and detector number info outputWorkspace->getSpectrum(newindex) ->copyInfoFrom(*localworkspace->getSpectrum(i)); @@ -98,16 +104,16 @@ void MaxMin::exec() { // Find the range [min,max] MantidVec::const_iterator lowit, highit; - if (m_MinRange == EMPTY_DBL()) + if (MinRange == EMPTY_DBL()) lowit = X.begin(); else - lowit = std::lower_bound(X.begin(), X.end(), m_MinRange); + lowit = std::lower_bound(X.begin(), X.end(), MinRange); - if (m_MaxRange == EMPTY_DBL()) + if (MaxRange == EMPTY_DBL()) highit = X.end(); else highit = std::find_if(lowit, X.end(), - std::bind2nd(std::greater<double>(), m_MaxRange)); + std::bind2nd(std::greater<double>(), MaxRange)); // If range specified doesn't overlap with this spectrum then bail out if (lowit == X.end() || highit == X.begin() || lowit == highit) diff --git a/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp b/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp index c7a22c2a163256a76b46dd8a990492c1abc5a1f1..eb954f560164c0b1d3a11df7f39a334e5c688b22 100644 --- a/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp @@ -21,6 +21,12 @@ using namespace Mantid::API; using namespace Mantid::Geometry; using namespace Mantid::DataObjects; +ModeratorTzero::ModeratorTzero() + : Mantid::API::Algorithm(), + m_convfactor(0.5e+12 * Mantid::PhysicalConstants::NeutronMass / + Mantid::PhysicalConstants::meV), + m_niter(1), m_tolTOF(0.), m_t1min(200.0) {} + /// set attribute m_formula void ModeratorTzero::setFormula(const std::string &formula) { m_formula = formula; diff --git a/Code/Mantid/Framework/Algorithms/src/ModeratorTzeroLinear.cpp b/Code/Mantid/Framework/Algorithms/src/ModeratorTzeroLinear.cpp index 6d7a0bded9d60f68a02aa465543ccf8ed67b977f..e05fb167d709390118651e08c1601cad936ae1ef 100644 --- a/Code/Mantid/Framework/Algorithms/src/ModeratorTzeroLinear.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ModeratorTzeroLinear.cpp @@ -23,6 +23,9 @@ using namespace Mantid::DataObjects; // A reference to the logger is provided by the base class, it is called g_log. // It is used to print out information, warning and error messages +ModeratorTzeroLinear::ModeratorTzeroLinear() + : API::Algorithm(), m_gradient(0.), m_intercept(0.), m_instrument() {} + const std::string ModeratorTzeroLinear::name() const { return "ModeratorTzeroLinear"; } diff --git a/Code/Mantid/Framework/Algorithms/src/MultiplyRange.cpp b/Code/Mantid/Framework/Algorithms/src/MultiplyRange.cpp index 842a1f28c4e42961ab6cf237cfa48d3468099203..679389a9332d7c75e6b77f609121feff6a08b519 100644 --- a/Code/Mantid/Framework/Algorithms/src/MultiplyRange.cpp +++ b/Code/Mantid/Framework/Algorithms/src/MultiplyRange.cpp @@ -40,20 +40,20 @@ void MultiplyRange::init() { void MultiplyRange::exec() { // Get the input workspace and other properties MatrixWorkspace_const_sptr inputWS = getProperty("InputWorkspace"); - m_startBin = getProperty("StartBin"); - m_endBin = getProperty("EndBin"); - m_factor = getProperty("Factor"); + int startBin = getProperty("StartBin"); + int endBin = getProperty("EndBin"); + double factor = getProperty("Factor"); // A few checks on the input properties const int specSize = static_cast<int>(inputWS->blocksize()); - if (isEmpty(m_endBin)) - m_endBin = specSize - 1; + if (isEmpty(endBin)) + endBin = specSize - 1; - if (m_endBin >= specSize) { + if (endBin >= specSize) { g_log.error("EndBin out of range!"); throw std::out_of_range("EndBin out of range!"); } - if (m_endBin < m_startBin) { + if (endBin < startBin) { g_log.error("StartBin must be less than or equal to EndBin"); throw std::out_of_range("StartBin must be less than or equal to EndBin"); } @@ -81,12 +81,12 @@ void MultiplyRange::exec() { MantidVec &newE = outputWS->dataE(i); // Now multiply the requested range - std::transform(newY.begin() + m_startBin, newY.begin() + m_endBin + 1, - newY.begin() + m_startBin, - std::bind2nd(std::multiplies<double>(), m_factor)); - std::transform(newE.begin() + m_startBin, newE.begin() + m_endBin + 1, - newE.begin() + m_startBin, - std::bind2nd(std::multiplies<double>(), m_factor)); + std::transform(newY.begin() + startBin, newY.begin() + endBin + 1, + newY.begin() + startBin, + std::bind2nd(std::multiplies<double>(), factor)); + std::transform(newE.begin() + startBin, newE.begin() + endBin + 1, + newE.begin() + startBin, + std::bind2nd(std::multiplies<double>(), factor)); progress.report(); PARALLEL_END_INTERUPT_REGION diff --git a/Code/Mantid/Framework/Algorithms/src/OneMinusExponentialCor.cpp b/Code/Mantid/Framework/Algorithms/src/OneMinusExponentialCor.cpp index 85e1dd6f6faf6194ce06f042b1893c560fcb6506..36ab76f347bdea9b29ea047909e2fb72f14a3605 100644 --- a/Code/Mantid/Framework/Algorithms/src/OneMinusExponentialCor.cpp +++ b/Code/Mantid/Framework/Algorithms/src/OneMinusExponentialCor.cpp @@ -13,6 +13,9 @@ namespace Algorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(OneMinusExponentialCor) +OneMinusExponentialCor::OneMinusExponentialCor() + : UnaryOperation(), m_c(0.), m_c1(0.), m_divide(false) {} + void OneMinusExponentialCor::defineProperties() { auto mustBePositive = boost::make_shared<BoundedValidator<double>>(); mustBePositive->setLower(0.0); diff --git a/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp b/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp index 63211e6460e1891541244eb1fd65292140ea4fa4..f3091a0fbd19307adfafbce3ca169c6aafc40439 100644 --- a/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp +++ b/Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp @@ -38,18 +38,18 @@ namespace // anonymous * @return :: True if successful */ template <typename T> -bool convertLogToDouble(const Mantid::Kernel::Property *property, - double &value, const std::string& function) { +bool convertLogToDouble(const Mantid::Kernel::Property *property, double &value, + const std::string &function) { const Mantid::Kernel::TimeSeriesProperty<T> *log = dynamic_cast<const Mantid::Kernel::TimeSeriesProperty<T> *>(property); if (log) { - if (function=="Mean") { + if (function == "Mean") { value = static_cast<double>(log->timeAverageValue()); - } else if (function=="First") { + } else if (function == "First") { value = static_cast<double>(log->firstValue()); - } else if (function=="Min") { + } else if (function == "Min") { value = static_cast<double>(log->minValue()); - } else if (function=="Max") { + } else if (function == "Max") { value = static_cast<double>(log->maxValue()); } else { // Default value = static_cast<double>(log->lastValue()); @@ -105,6 +105,9 @@ int PlotAsymmetryByLogValue::g_filenameZeros = 0; double PlotAsymmetryByLogValue::g_minTime = EMPTY_DBL(); double PlotAsymmetryByLogValue::g_maxTime = EMPTY_DBL(); +PlotAsymmetryByLogValue::PlotAsymmetryByLogValue() + : Algorithm(), m_int(false), m_autogroup(false) {} + /** Initialisation method. Declares properties to be used in algorithm. * */ @@ -130,9 +133,9 @@ void PlotAsymmetryByLogValue::init() { optionsLog.push_back("Max"); optionsLog.push_back("First"); optionsLog.push_back("Last"); - declareProperty("Function", "Last", - boost::make_shared<StringListValidator>(optionsLog), - "The function to apply: 'Mean', 'Min', 'Max', 'First' or 'Last'."); + declareProperty( + "Function", "Last", boost::make_shared<StringListValidator>(optionsLog), + "The function to apply: 'Mean', 'Min', 'Max', 'First' or 'Last'."); declareProperty("Red", 1, "The period number for the 'red' data."); declareProperty("Green", EMPTY_INT(), @@ -185,7 +188,7 @@ void PlotAsymmetryByLogValue::exec() { // Check input properties to decide whether or not we can reuse previous // results, if any size_t is, ie; - checkProperties(is,ie); + checkProperties(is, ie); Progress progress(this, 0, 1, ie - is + 1); @@ -193,23 +196,22 @@ void PlotAsymmetryByLogValue::exec() { for (size_t i = is; i <= ie; i++) { // Check if run i was already loaded - if ( !g_redX.count(i) ) { + if (!g_redX.count(i)) { // Load run, apply dead time corrections and detector grouping Workspace_sptr loadedWs = doLoad(i); - if ( loadedWs ) { + if (loadedWs) { // Analyse loadedWs - doAnalysis (loadedWs, i); + doAnalysis(loadedWs, i); } } progress.report(); } - // Create the 2D workspace for the output - int nplots = (g_green!= EMPTY_INT()) ? 4 : 1; + int nplots = (g_green != EMPTY_INT()) ? 4 : 1; size_t npoints = ie - is + 1; MatrixWorkspace_sptr outWS = WorkspaceFactory::Instance().create( "Workspace2D", @@ -218,17 +220,16 @@ void PlotAsymmetryByLogValue::exec() { npoints // it's not a histogram ); // Populate output workspace with data - populateOutputWorkspace(outWS,nplots); + populateOutputWorkspace(outWS, nplots); // Assign the result to the output workspace property setProperty("OutputWorkspace", outWS); - } /** Checks input properties and compares them to previous values * @param is :: [output] Number of the first run * @param ie :: [output] Number of the last run */ -void PlotAsymmetryByLogValue::checkProperties (size_t &is, size_t &ie) { +void PlotAsymmetryByLogValue::checkProperties(size_t &is, size_t &ie) { // If any of the following properties has a different value from the // previous call, we need to re-do all the computations, which means @@ -259,61 +260,53 @@ void PlotAsymmetryByLogValue::checkProperties (size_t &is, size_t &ie) { // Parse run names and get the number of runs std::string filenameBase, filenameExt; int filenameZeros; - parseRunNames( firstFN, lastFN, filenameBase, filenameExt, filenameZeros); + parseRunNames(firstFN, lastFN, filenameBase, filenameExt, filenameZeros); is = atoi(firstFN.c_str()); // starting run number ie = atoi(lastFN.c_str()); // last run number - if ( ie < is ) { - throw std::runtime_error("First run number is greater than last run number"); + if (ie < is) { + throw std::runtime_error( + "First run number is greater than last run number"); } - // Skip checks if there are no previous results - if ( !g_redX.empty() ) { + if (!g_redX.empty()) { - size_t isOld = g_redX.begin()->first; // Old first run number + size_t isOld = g_redX.begin()->first; // Old first run number size_t ieOld = g_redX.rbegin()->first; // Old last run number // Check if any property has changed - if ( g_logName != logName || - g_logFunc != logFunc || - g_stype != stype || - g_forward_list != forward_list || - g_backward_list != backward_list || - g_green != green || - g_red != red || - g_dtcType != dtcType || - g_dtcFile != dtcFile || - g_filenameBase != filenameBase || - g_filenameExt != filenameExt || - g_filenameZeros != filenameZeros || - g_minTime != minTime || - g_maxTime != maxTime) { - - // If so, clear previous results - clearResultsFromTo(isOld,ieOld); + if (g_logName != logName || g_logFunc != logFunc || g_stype != stype || + g_forward_list != forward_list || g_backward_list != backward_list || + g_green != green || g_red != red || g_dtcType != dtcType || + g_dtcFile != dtcFile || g_filenameBase != filenameBase || + g_filenameExt != filenameExt || g_filenameZeros != filenameZeros || + g_minTime != minTime || g_maxTime != maxTime) { + + // If so, clear previous results + clearResultsFromTo(isOld, ieOld); } else { // If all of the above are the same, we may re-use previous // results, provided that new run numbers are 'appropriate' - if ( is > ieOld || ie < isOld ) { + if (is > ieOld || ie < isOld) { // Completely new set of runs - clearResultsFromTo(isOld,ieOld); + clearResultsFromTo(isOld, ieOld); } else { - if ( is > isOld ) { + if (is > isOld) { // Remove runs from isOld to is-1 - clearResultsFromTo(isOld,is-1); + clearResultsFromTo(isOld, is - 1); } - if ( ie < ieOld ) { + if (ie < ieOld) { // Remove runs from ie+1 to ieOld - clearResultsFromTo(ie+1,ieOld); + clearResultsFromTo(ie + 1, ieOld); } } // else - } // else + } // else } // !g_redX.empty() @@ -334,7 +327,6 @@ void PlotAsymmetryByLogValue::checkProperties (size_t &is, size_t &ie) { g_filenameZeros = filenameZeros; g_minTime = minTime; g_maxTime = maxTime; - } /** Clears any possible result from previous call @@ -343,7 +335,7 @@ void PlotAsymmetryByLogValue::checkProperties (size_t &is, size_t &ie) { */ void PlotAsymmetryByLogValue::clearResultsFromTo(size_t is, size_t ie) { - for (size_t i=is; i<=ie; i++) { + for (size_t i = is; i <= ie; i++) { g_redX.erase(i); g_redY.erase(i); g_redE.erase(i); @@ -357,13 +349,13 @@ void PlotAsymmetryByLogValue::clearResultsFromTo(size_t is, size_t ie) { g_diffY.erase(i); g_diffE.erase(i); } - } -/** Loads one run and applies dead-time corrections and detector grouping if required +/** Loads one run and applies dead-time corrections and detector grouping if +* required * @param runNumber :: [input] Run number specifying run to load */ -Workspace_sptr PlotAsymmetryByLogValue::doLoad (int64_t runNumber ) { +Workspace_sptr PlotAsymmetryByLogValue::doLoad(int64_t runNumber) { // Get complete run name std::ostringstream fn, fnn; @@ -371,7 +363,7 @@ Workspace_sptr PlotAsymmetryByLogValue::doLoad (int64_t runNumber ) { fn << g_filenameBase << fnn.str() << g_filenameExt; // Check if file exists - if ( !Poco::File(fn.str()).exists() ) { + if (!Poco::File(fn.str()).exists()) { g_log.warning() << "File " << fn.str() << " not found" << std::endl; return Workspace_sptr(); } @@ -388,33 +380,35 @@ Workspace_sptr PlotAsymmetryByLogValue::doLoad (int64_t runNumber ) { // If user specifies a file, load corrections now Workspace_sptr customDeadTimes; - loadCorrectionsFromFile (customDeadTimes, g_dtcFile); - applyDeadtimeCorr (loadedWs, customDeadTimes); + loadCorrectionsFromFile(customDeadTimes, g_dtcFile); + applyDeadtimeCorr(loadedWs, customDeadTimes); } else { // Load corrections from run Workspace_sptr deadTimes = load->getProperty("DeadTimeTable"); - applyDeadtimeCorr (loadedWs, deadTimes); + applyDeadtimeCorr(loadedWs, deadTimes); } } // If m_autogroup, group detectors if (m_autogroup) { - Workspace_sptr loadedDetGrouping = load->getProperty("DetectorGroupingTable"); + Workspace_sptr loadedDetGrouping = + load->getProperty("DetectorGroupingTable"); if (!loadedDetGrouping) throw std::runtime_error("No grouping info in the file.\n\nPlease " - "specify grouping manually"); - groupDetectors(loadedWs,loadedDetGrouping); + "specify grouping manually"); + groupDetectors(loadedWs, loadedDetGrouping); } return loadedWs; } /** Load dead-time corrections from specified file -* @param customDeadTimes :: [input/output] Output workspace to store corrections +* @param customDeadTimes :: [input/output] Output workspace to store +* corrections * @param deadTimeFile :: [input] File to read corrections from */ -void PlotAsymmetryByLogValue::loadCorrectionsFromFile (Workspace_sptr &customDeadTimes, std::string deadTimeFile ) -{ +void PlotAsymmetryByLogValue::loadCorrectionsFromFile( + Workspace_sptr &customDeadTimes, std::string deadTimeFile) { IAlgorithm_sptr loadDeadTimes = createChildAlgorithm("LoadNexusProcessed"); loadDeadTimes->setPropertyValue("Filename", deadTimeFile); loadDeadTimes->setProperty("OutputWorkspace", customDeadTimes); @@ -425,17 +419,17 @@ void PlotAsymmetryByLogValue::loadCorrectionsFromFile (Workspace_sptr &customDea * @param outWS :: [input/output] Output workspace to populate * @param nplots :: [input] Number of histograms */ -void PlotAsymmetryByLogValue::populateOutputWorkspace (MatrixWorkspace_sptr &outWS, int nplots) -{ +void +PlotAsymmetryByLogValue::populateOutputWorkspace(MatrixWorkspace_sptr &outWS, + int nplots) { TextAxis *tAxis = new TextAxis(nplots); if (nplots == 1) { std::vector<double> vecRedX, vecRedY, vecRedE; - for (auto it=g_redX.begin(); it!=g_redX.end(); ++it) - { - vecRedX.push_back( g_redX[ it->first ] ); - vecRedY.push_back( g_redY[ it->first ] ); - vecRedE.push_back( g_redE[ it->first ] ); + for (auto it = g_redX.begin(); it != g_redX.end(); ++it) { + vecRedX.push_back(g_redX[it->first]); + vecRedY.push_back(g_redY[it->first]); + vecRedE.push_back(g_redE[it->first]); } tAxis->setLabel(0, "Asymmetry"); @@ -448,20 +442,19 @@ void PlotAsymmetryByLogValue::populateOutputWorkspace (MatrixWorkspace_sptr &out std::vector<double> vecGreenX, vecGreenY, vecGreenE; std::vector<double> vecSumX, vecSumY, vecSumE; std::vector<double> vecDiffX, vecDiffY, vecDiffE; - for (auto it=g_redX.begin(); it!=g_redX.end(); ++it) - { - vecRedX.push_back( g_redX[ it->first ] ); - vecRedY.push_back( g_redY[ it->first ] ); - vecRedE.push_back( g_redE[ it->first ] ); - vecGreenX.push_back( g_greenX[ it->first ] ); - vecGreenY.push_back( g_greenY[ it->first ] ); - vecGreenE.push_back( g_greenE[ it->first ] ); - vecSumX.push_back( g_sumX[ it->first ] ); - vecSumY.push_back( g_sumY[ it->first ] ); - vecSumE.push_back( g_sumE[ it->first ] ); - vecDiffX.push_back( g_diffX[ it->first ] ); - vecDiffY.push_back( g_diffY[ it->first ] ); - vecDiffE.push_back( g_diffE[ it->first ] ); + for (auto it = g_redX.begin(); it != g_redX.end(); ++it) { + vecRedX.push_back(g_redX[it->first]); + vecRedY.push_back(g_redY[it->first]); + vecRedE.push_back(g_redE[it->first]); + vecGreenX.push_back(g_greenX[it->first]); + vecGreenY.push_back(g_greenY[it->first]); + vecGreenE.push_back(g_greenE[it->first]); + vecSumX.push_back(g_sumX[it->first]); + vecSumY.push_back(g_sumY[it->first]); + vecSumE.push_back(g_sumE[it->first]); + vecDiffX.push_back(g_diffX[it->first]); + vecDiffY.push_back(g_diffY[it->first]); + vecDiffE.push_back(g_diffE[it->first]); } tAxis->setLabel(0, "Red-Green"); @@ -492,8 +485,10 @@ void PlotAsymmetryByLogValue::populateOutputWorkspace (MatrixWorkspace_sptr &out * @param fnExt :: [output] Runs extension * @param fnZeros :: [output] Number of zeros in run's name */ -void PlotAsymmetryByLogValue::parseRunNames (std::string& firstFN, std::string& lastFN, std::string& fnBase, std::string& fnExt, int& fnZeros) -{ +void PlotAsymmetryByLogValue::parseRunNames(std::string &firstFN, + std::string &lastFN, + std::string &fnBase, + std::string &fnExt, int &fnZeros) { // Parse first run's name std::string firstExt = firstFN.substr(firstFN.find_last_of(".")); @@ -508,7 +503,7 @@ void PlotAsymmetryByLogValue::parseRunNames (std::string& firstFN, std::string& } firstBase.erase(i + 1); firstFN.erase(0, firstBase.size()); - + // Parse last run's name std::string lastExt = lastFN.substr(lastFN.find_last_of(".")); lastFN.erase(lastFN.size() - 4); @@ -524,7 +519,7 @@ void PlotAsymmetryByLogValue::parseRunNames (std::string& firstFN, std::string& lastFN.erase(0, lastBase.size()); // Compare first and last - if ( firstBase != lastBase ) { + if (firstBase != lastBase) { // Runs are not in the same directory // First run number with last base name @@ -536,42 +531,46 @@ void PlotAsymmetryByLogValue::parseRunNames (std::string& firstFN, std::string& tempLast << firstBase << lastFN << lastExt << std::endl; std::string pathLast = FileFinder::Instance().getFullPath(tempLast.str()); - // Try to correct this on the fly by + // Try to correct this on the fly by // checking if the last run can be found in the first directory... - if ( Poco::File(pathLast).exists() ) { + if (Poco::File(pathLast).exists()) { fnBase = firstBase; fnExt = firstExt; - g_log.warning() << "First and last run are not in the same directory. File " - << pathLast << " will be used instead." << std::endl; + g_log.warning() + << "First and last run are not in the same directory. File " + << pathLast << " will be used instead." << std::endl; } else if (Poco::File(pathFirst).exists()) { // ...or viceversa fnBase = lastBase; fnExt = lastExt; - g_log.warning() << "First and last run are not in the same directory. File " - << pathFirst << " will be used instead." << std::endl; + g_log.warning() + << "First and last run are not in the same directory. File " + << pathFirst << " will be used instead." << std::endl; } else { - throw std::runtime_error("First and last runs are not in the same directory."); + throw std::runtime_error( + "First and last runs are not in the same directory."); } - + } else { fnBase = firstBase; fnExt = firstExt; } fnZeros = static_cast<int>(firstFN.size()); - } -/** Apply dead-time corrections. The calculation is done by ApplyDeadTimeCorr algorithm +/** Apply dead-time corrections. The calculation is done by ApplyDeadTimeCorr +* algorithm * @param loadedWs :: [input/output] Workspace to apply corrections to * @param deadTimes :: [input] Corrections to apply */ -void PlotAsymmetryByLogValue::applyDeadtimeCorr (Workspace_sptr &loadedWs, Workspace_sptr deadTimes) -{ +void PlotAsymmetryByLogValue::applyDeadtimeCorr(Workspace_sptr &loadedWs, + Workspace_sptr deadTimes) { ScopedWorkspace ws(loadedWs); ScopedWorkspace dt(deadTimes); - IAlgorithm_sptr applyCorr = AlgorithmManager::Instance().create("ApplyDeadTimeCorr"); + IAlgorithm_sptr applyCorr = + AlgorithmManager::Instance().create("ApplyDeadTimeCorr"); applyCorr->setLogging(false); applyCorr->setRethrows(true); applyCorr->setPropertyValue("InputWorkspace", ws.name()); @@ -588,15 +587,16 @@ void PlotAsymmetryByLogValue::applyDeadtimeCorr (Workspace_sptr &loadedWs, Works * @param loadedWs :: [input/output] Workspace to apply grouping to * @param loadedDetGrouping :: [input] Workspace storing detectors grouping */ -void PlotAsymmetryByLogValue::groupDetectors (Workspace_sptr &loadedWs, Workspace_sptr loadedDetGrouping) -{ +void PlotAsymmetryByLogValue::groupDetectors(Workspace_sptr &loadedWs, + Workspace_sptr loadedDetGrouping) { // Could be groups of workspaces, so need to work with ADS ScopedWorkspace inWS(loadedWs); ScopedWorkspace grouping(loadedDetGrouping); ScopedWorkspace outWS; - IAlgorithm_sptr applyGrouping = AlgorithmManager::Instance().create("MuonGroupDetectors"); + IAlgorithm_sptr applyGrouping = + AlgorithmManager::Instance().create("MuonGroupDetectors"); applyGrouping->setLogging(false); applyGrouping->setRethrows(true); @@ -612,88 +612,88 @@ void PlotAsymmetryByLogValue::groupDetectors (Workspace_sptr &loadedWs, Workspac * @param loadedWs :: [input] Workspace to apply analysis to * @param index :: [input] Vector index where results will be stored */ -void PlotAsymmetryByLogValue::doAnalysis (Workspace_sptr loadedWs, int64_t index ) { +void PlotAsymmetryByLogValue::doAnalysis(Workspace_sptr loadedWs, + int64_t index) { - // Check if workspace is a workspace group - WorkspaceGroup_sptr loadedGroup = - boost::dynamic_pointer_cast<WorkspaceGroup>(loadedWs); + // Check if workspace is a workspace group + WorkspaceGroup_sptr loadedGroup = + boost::dynamic_pointer_cast<WorkspaceGroup>(loadedWs); - // If it is not, we only have 'red' data - if (!loadedGroup) { - Workspace2D_sptr loadedWs2D = - boost::dynamic_pointer_cast<Workspace2D>(loadedWs); + // If it is not, we only have 'red' data + if (!loadedGroup) { + Workspace2D_sptr loadedWs2D = + boost::dynamic_pointer_cast<Workspace2D>(loadedWs); - double Y, E; - calcIntAsymmetry(loadedWs2D, Y, E); - g_redX[index]=getLogValue(*loadedWs2D); - g_redY[index]=Y; - g_redE[index]=E; + double Y, E; + calcIntAsymmetry(loadedWs2D, Y, E); + g_redX[index] = getLogValue(*loadedWs2D); + g_redY[index] = Y; + g_redE[index] = E; - } else { + } else { - DataObjects::Workspace2D_sptr ws_red; - DataObjects::Workspace2D_sptr ws_green; - // Run through the periods of the loaded file and save the - // selected ones - for (int mi = 0; mi < loadedGroup->getNumberOfEntries(); mi++) { - - Workspace2D_sptr memberWs = - boost::dynamic_pointer_cast<Workspace2D>(loadedGroup->getItem(mi)); - int period = mi + 1; - if ( period == g_red ){ - ws_red = memberWs; - } - if ( g_green!= EMPTY_INT() ){ - if ( period == g_green ){ - ws_green = memberWs; - } + DataObjects::Workspace2D_sptr ws_red; + DataObjects::Workspace2D_sptr ws_green; + // Run through the periods of the loaded file and save the + // selected ones + for (int mi = 0; mi < loadedGroup->getNumberOfEntries(); mi++) { + + Workspace2D_sptr memberWs = + boost::dynamic_pointer_cast<Workspace2D>(loadedGroup->getItem(mi)); + int period = mi + 1; + if (period == g_red) { + ws_red = memberWs; + } + if (g_green != EMPTY_INT()) { + if (period == g_green) { + ws_green = memberWs; } } + } - // Check ws_red - if (!ws_red){ - throw std::invalid_argument("Red period is out of range"); - } - // Check ws_green - if ( (g_green!=EMPTY_INT()) && (!ws_green) ){ - throw std::invalid_argument("Green period is out of range"); - } + // Check ws_red + if (!ws_red) { + throw std::invalid_argument("Red period is out of range"); + } + // Check ws_green + if ((g_green != EMPTY_INT()) && (!ws_green)) { + throw std::invalid_argument("Green period is out of range"); + } - if ( g_green==EMPTY_INT() ){ - double Y, E; - calcIntAsymmetry(ws_red, Y, E); - g_redX[index] = getLogValue(*ws_red); - g_redY[index] = Y; - g_redE[index] = E; - - } else{ - - double YR, ER; - double YG, EG; - double logValue = getLogValue(*ws_red); - calcIntAsymmetry(ws_red, YR, ER); - calcIntAsymmetry(ws_green, YG, EG); - // Red data - g_redX[index] = logValue; - g_redY[index] = YR; - g_redE[index] = ER; - // Green data - g_greenX[index] = logValue; - g_greenY[index] = YG; - g_greenE[index] = EG; - // Sum - g_sumX[index] = logValue; - g_sumY[index] = YR+YG; - g_sumE[index] = sqrt(ER * ER + EG * EG); - // move to last for safety since some grouping takes place in the - // calcIntAsymmetry call below - calcIntAsymmetry(ws_red, ws_green, YR, ER); - g_diffX[index] = logValue; - g_diffY[index] = YR; - g_diffE[index] = ER; - } - } // else loadedGroup + if (g_green == EMPTY_INT()) { + double Y, E; + calcIntAsymmetry(ws_red, Y, E); + g_redX[index] = getLogValue(*ws_red); + g_redY[index] = Y; + g_redE[index] = E; + + } else { + double YR, ER; + double YG, EG; + double logValue = getLogValue(*ws_red); + calcIntAsymmetry(ws_red, YR, ER); + calcIntAsymmetry(ws_green, YG, EG); + // Red data + g_redX[index] = logValue; + g_redY[index] = YR; + g_redE[index] = ER; + // Green data + g_greenX[index] = logValue; + g_greenY[index] = YG; + g_greenE[index] = EG; + // Sum + g_sumX[index] = logValue; + g_sumY[index] = YR + YG; + g_sumE[index] = sqrt(ER * ER + EG * EG); + // move to last for safety since some grouping takes place in the + // calcIntAsymmetry call below + calcIntAsymmetry(ws_red, ws_green, YR, ER); + g_diffX[index] = logValue; + g_diffY[index] = YR; + g_diffE[index] = ER; + } + } // else loadedGroup } /** Calculate the integral asymmetry for a workspace. @@ -885,12 +885,11 @@ PlotAsymmetryByLogValue::groupDetectors(API::MatrixWorkspace_sptr &ws, */ double PlotAsymmetryByLogValue::getLogValue(MatrixWorkspace &ws) { - const Run& run = ws.run(); + const Run &run = ws.run(); // Get the start & end time for the run Mantid::Kernel::DateAndTime start, end; - if ( run.hasProperty("run_start") && run.hasProperty("run_end") ) - { + if (run.hasProperty("run_start") && run.hasProperty("run_end")) { start = run.getProperty("run_start")->value(); end = run.getProperty("run_end")->value(); } @@ -936,7 +935,5 @@ double PlotAsymmetryByLogValue::getLogValue(MatrixWorkspace &ws) { " cannot be converted to a double type."); } - - } // namespace Algorithm } // namespace Mantid diff --git a/Code/Mantid/Framework/Algorithms/src/PolynomialCorrection.cpp b/Code/Mantid/Framework/Algorithms/src/PolynomialCorrection.cpp index 8c7cf8b940b1e259922aae21d2275ea3721ca531..156afeeea1d9282c48cdcadea1bc27ea3217c51a 100644 --- a/Code/Mantid/Framework/Algorithms/src/PolynomialCorrection.cpp +++ b/Code/Mantid/Framework/Algorithms/src/PolynomialCorrection.cpp @@ -15,6 +15,10 @@ namespace Algorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(PolynomialCorrection) +PolynomialCorrection::PolynomialCorrection() + : UnaryOperation(), m_coeffs(), m_polySize(), m_isOperationMultiply(false) { +} + void PolynomialCorrection::defineProperties() { // We need an array property for the coefficients of the polynomial: C0 + C1*x // + C2*x*x + .... diff --git a/Code/Mantid/Framework/Algorithms/src/PowerLawCorrection.cpp b/Code/Mantid/Framework/Algorithms/src/PowerLawCorrection.cpp index 8d283199bf74455702835748131e4acd0ccf7d37..4ebea2bd6ca49432464012f19c2bfe34662583d6 100644 --- a/Code/Mantid/Framework/Algorithms/src/PowerLawCorrection.cpp +++ b/Code/Mantid/Framework/Algorithms/src/PowerLawCorrection.cpp @@ -12,6 +12,9 @@ namespace Algorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(PowerLawCorrection) +PowerLawCorrection::PowerLawCorrection() + : UnaryOperation(), m_c0(0.), m_c1(0.) {} + void PowerLawCorrection::defineProperties() { // We need an array property for the coefficients of the PowerLaw: C0*X^C1 declareProperty("C0", 1.0, diff --git a/Code/Mantid/Framework/Algorithms/src/Q1D2.cpp b/Code/Mantid/Framework/Algorithms/src/Q1D2.cpp index d891659b47bb02271453f30ef282f4251eab7f9e..497fbbec9e1d3624f4dbcc4817c568e171520d23 100644 --- a/Code/Mantid/Framework/Algorithms/src/Q1D2.cpp +++ b/Code/Mantid/Framework/Algorithms/src/Q1D2.cpp @@ -23,6 +23,8 @@ using namespace Kernel; using namespace API; using namespace Geometry; +Q1D2::Q1D2() : API::Algorithm(), m_dataWS(), m_doSolidAngle(false) {} + void Q1D2::init() { auto dataVal = boost::make_shared<CompositeValidator>(); dataVal->add<WorkspaceUnitValidator>("Wavelength"); diff --git a/Code/Mantid/Framework/Algorithms/src/RealFFT.cpp b/Code/Mantid/Framework/Algorithms/src/RealFFT.cpp index 912d5c6ae20d60fbd2cc8af5f94a1bdfc0ed979f..aff45f2b6f619b3dfa8c1799c50017cd15825c59 100644 --- a/Code/Mantid/Framework/Algorithms/src/RealFFT.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RealFFT.cpp @@ -70,7 +70,7 @@ void RealFFT::init() { void RealFFT::exec() { API::MatrixWorkspace_sptr inWS = getProperty("InputWorkspace"); std::string transform = getProperty("Transform"); - IgnoreXBins = getProperty("IgnoreXBins"); + bool IgnoreXBins = getProperty("IgnoreXBins"); int spec = (transform == "Forward") ? getProperty("WorkspaceIndex") : 0; diff --git a/Code/Mantid/Framework/Algorithms/src/Rebin2D.cpp b/Code/Mantid/Framework/Algorithms/src/Rebin2D.cpp index 191169a6cf283b987604099a5dc5223c4b61c2b8..65a74bebe6abe6ebcdfb31615bd248ed9897ca8c 100644 --- a/Code/Mantid/Framework/Algorithms/src/Rebin2D.cpp +++ b/Code/Mantid/Framework/Algorithms/src/Rebin2D.cpp @@ -96,16 +96,17 @@ void Rebin2D::exec() { MantidVecPtr newXBins; MantidVec newYBins; - this->useFractionalArea = getProperty("UseFractionalArea"); - MatrixWorkspace_sptr outputWS = - createOutputWorkspace(inputWS, newXBins.access(), newYBins); - if (this->useFractionalArea && + // Flag for using a RebinnedOutput workspace + bool useFractionalArea = getProperty("UseFractionalArea"); + MatrixWorkspace_sptr outputWS = createOutputWorkspace( + inputWS, newXBins.access(), newYBins, useFractionalArea); + if (useFractionalArea && !boost::dynamic_pointer_cast<RebinnedOutput>(outputWS)) { g_log.warning("Fractional area tracking requires the input workspace to " "contain calculated bin fractions from a parallelpiped rebin " "like SofQW" "Continuing without fractional area tracking"); - this->useFractionalArea = false; + useFractionalArea = false; } // Progress reports & cancellation @@ -129,7 +130,7 @@ void Rebin2D::exec() { const double x_j = oldXEdges[j]; const double x_jp1 = oldXEdges[j + 1]; Quadrilateral inputQ = Quadrilateral(x_j, x_jp1, vlo, vhi); - if (!this->useFractionalArea) { + if (!useFractionalArea) { rebinToOutput(inputQ, inputWS, i, j, outputWS, newYBins); } else { rebinToFractionalOutput( @@ -141,7 +142,7 @@ void Rebin2D::exec() { PARALLEL_END_INTERUPT_REGION } PARALLEL_CHECK_INTERUPT_REGION - if (this->useFractionalArea) { + if (useFractionalArea) { boost::dynamic_pointer_cast<RebinnedOutput>(outputWS)->finalize(); } normaliseOutput(outputWS, inputWS); @@ -370,11 +371,13 @@ void Rebin2D::normaliseOutput(MatrixWorkspace_sptr outputWS, * boundaries * @param newYBins [out] :: An output vector to be filled with the new Y bin * boundaries + * @param useFractionalArea :: use a RebinnedOutput workspace * @return A pointer to the output workspace */ MatrixWorkspace_sptr Rebin2D::createOutputWorkspace(MatrixWorkspace_const_sptr parent, - MantidVec &newXBins, MantidVec &newYBins) const { + MantidVec &newXBins, MantidVec &newYBins, + const bool useFractionalArea) const { using Kernel::VectorHelper::createAxisFromRebinParams; // First create the two sets of bin boundaries const int newXSize = @@ -383,7 +386,7 @@ Rebin2D::createOutputWorkspace(MatrixWorkspace_const_sptr parent, createAxisFromRebinParams(getProperty("Axis2Binning"), newYBins); // and now the workspace MatrixWorkspace_sptr outputWS; - if (!this->useFractionalArea) { + if (!useFractionalArea) { outputWS = WorkspaceFactory::Instance().create(parent, newYSize - 1, newXSize, newXSize - 1); } else { diff --git a/Code/Mantid/Framework/Algorithms/src/ReplaceSpecialValues.cpp b/Code/Mantid/Framework/Algorithms/src/ReplaceSpecialValues.cpp index 262012eb0cedd84ebd82e19425f881f1624242f0..ebce095ad184309d204a0658f60bcf29f9155f26 100644 --- a/Code/Mantid/Framework/Algorithms/src/ReplaceSpecialValues.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ReplaceSpecialValues.cpp @@ -16,6 +16,12 @@ namespace Algorithms { // Register the class into the algorithm factory DECLARE_ALGORITHM(ReplaceSpecialValues) +ReplaceSpecialValues::ReplaceSpecialValues() + : UnaryOperation(), m_NaNValue(0.), m_NaNError(0.), m_InfiniteValue(0.), + m_InfiniteError(0.), m_bigThreshold(0.), m_bigValue(0.), m_bigError(0.), + m_performNaNCheck(false), m_performInfiniteCheck(false), + m_performBigCheck(false) {} + void ReplaceSpecialValues::defineProperties() { declareProperty("NaNValue", Mantid::EMPTY_DBL(), "The value used to replace occurrances of NaN " diff --git a/Code/Mantid/Framework/Algorithms/src/SpatialGrouping.cpp b/Code/Mantid/Framework/Algorithms/src/SpatialGrouping.cpp index a3c2892dbc41d7737de283bf2ac23b54f31f8812..6a87bf3829f417bbd6f4b2d9e254b7debc376cf6 100644 --- a/Code/Mantid/Framework/Algorithms/src/SpatialGrouping.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SpatialGrouping.cpp @@ -68,7 +68,6 @@ void SpatialGrouping::init() { void SpatialGrouping::exec() { inputWorkspace = getProperty("InputWorkspace"); double searchDist = getProperty("SearchDistance"); - m_pix = searchDist; int gridSize = getProperty("GridSize"); size_t nNeighbours = (gridSize * gridSize) - 1; @@ -114,7 +113,7 @@ void SpatialGrouping::exec() { Mantid::Geometry::BoundingBox bbox(empty, empty, empty, empty, empty, empty); - createBox(det, bbox); + createBox(det, bbox, searchDist); bool extend = true; while ((nNeighbours > nearest.size()) && extend) { @@ -306,12 +305,17 @@ SpatialGrouping::sortByDistance(std::map<detid_t, Mantid::Kernel::V3D> &nearest, * Creates a bounding box representing the area in which to search for * neighbours, and a scaling vector representing the dimensions * of the detector +* * @param det :: input detector +* * @param bndbox :: reference to BoundingBox object (changed by this function) +* +* @param searchDist :: search distance in pixels, number of pixels to search +* through for finding group */ void SpatialGrouping::createBox(boost::shared_ptr<const Geometry::IDetector> det, - Geometry::BoundingBox &bndbox) { + Geometry::BoundingBox &bndbox, double searchDist) { // We may have DetectorGroups here // Unfortunately, IDetector doesn't contain the @@ -328,7 +332,7 @@ SpatialGrouping::createBox(boost::shared_ptr<const Geometry::IDetector> det, double ymin = bbox.yMin(); double zmin = bbox.zMin(); - double factor = 2.0 * m_pix; + double factor = 2.0 * searchDist; growBox(xmin, xmax, factor); growBox(ymin, ymax, factor); diff --git a/Code/Mantid/Framework/Algorithms/src/SumNeighbours.cpp b/Code/Mantid/Framework/Algorithms/src/SumNeighbours.cpp index 285577f035f11293fe5e58d874818678a39a06a2..dcdb670b48c38eb86bf590ba2691095f4af6d23e 100644 --- a/Code/Mantid/Framework/Algorithms/src/SumNeighbours.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SumNeighbours.cpp @@ -56,8 +56,8 @@ void SumNeighbours::init() { */ void SumNeighbours::exec() { // Try and retrieve the optional properties - SumX = getProperty("SumX"); - SumY = getProperty("SumY"); + int SumX = getProperty("SumX"); + int SumY = getProperty("SumY"); // Get the input workspace Mantid::API::MatrixWorkspace_sptr inWS = getProperty("InputWorkspace"); diff --git a/Code/Mantid/Framework/Algorithms/src/SumSpectra.cpp b/Code/Mantid/Framework/Algorithms/src/SumSpectra.cpp index 50821649345fb70dcd83ba14869fa9ea2e655481..4f6fd41ec46d165ff2cbe7338ee47806115eb52c 100644 --- a/Code/Mantid/Framework/Algorithms/src/SumSpectra.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SumSpectra.cpp @@ -17,6 +17,11 @@ using namespace Kernel; using namespace API; using namespace DataObjects; +SumSpectra::SumSpectra() + : API::Algorithm(), m_outSpecId(0), m_MinSpec(0), m_MaxSpec(0), + m_keepMonitors(false), m_numberOfSpectra(0), m_yLength(0), m_indices(), + m_CalculateWeightedSum(false) {} + /** Initialisation method. * */ @@ -71,16 +76,16 @@ void SumSpectra::exec() { m_MaxSpec = getProperty("EndWorkspaceIndex"); const std::vector<int> indices_list = getProperty("ListOfWorkspaceIndices"); - keepMonitors = getProperty("IncludeMonitors"); + m_keepMonitors = getProperty("IncludeMonitors"); // Get the input workspace MatrixWorkspace_const_sptr localworkspace = getProperty("InputWorkspace"); - numberOfSpectra = static_cast<int>(localworkspace->getNumberHistograms()); - this->yLength = static_cast<int>(localworkspace->blocksize()); + m_numberOfSpectra = static_cast<int>(localworkspace->getNumberHistograms()); + this->m_yLength = static_cast<int>(localworkspace->blocksize()); - // Check 'StartSpectrum' is in range 0-numberOfSpectra - if (m_MinSpec > numberOfSpectra) { + // Check 'StartSpectrum' is in range 0-m_numberOfSpectra + if (m_MinSpec > m_numberOfSpectra) { g_log.warning("StartWorkspaceIndex out of range! Set to 0."); m_MinSpec = 0; } @@ -88,23 +93,23 @@ void SumSpectra::exec() { if (indices_list.empty()) { // If no list was given and no max, just do all. if (isEmpty(m_MaxSpec)) - m_MaxSpec = numberOfSpectra - 1; + m_MaxSpec = m_numberOfSpectra - 1; } // Something for m_MaxSpec was given but it is out of range? if (!isEmpty(m_MaxSpec) && - (m_MaxSpec > numberOfSpectra - 1 || m_MaxSpec < m_MinSpec)) { + (m_MaxSpec > m_numberOfSpectra - 1 || m_MaxSpec < m_MinSpec)) { g_log.warning("EndWorkspaceIndex out of range! Set to max Workspace Index"); - m_MaxSpec = numberOfSpectra; + m_MaxSpec = m_numberOfSpectra; } // Make the set of indices to sum up from the list - this->indices.insert(indices_list.begin(), indices_list.end()); + this->m_indices.insert(indices_list.begin(), indices_list.end()); // And add the range too, if any if (!isEmpty(m_MaxSpec)) { for (int i = m_MinSpec; i <= m_MaxSpec; i++) - this->indices.insert(i); + this->m_indices.insert(i); } // determine the output spectrum id @@ -119,21 +124,22 @@ void SumSpectra::exec() { boost::dynamic_pointer_cast<const EventWorkspace>(localworkspace); if (eventW) { m_CalculateWeightedSum = false; - this->execEvent(eventW, this->indices); + this->execEvent(eventW, this->m_indices); } else { //-------Workspace 2D mode ----- // Create the 2D workspace for the output MatrixWorkspace_sptr outputWorkspace = API::WorkspaceFactory::Instance().create( - localworkspace, 1, localworkspace->readX(0).size(), this->yLength); + localworkspace, 1, localworkspace->readX(0).size(), + this->m_yLength); size_t numSpectra(0); // total number of processed spectra size_t numMasked(0); // total number of the masked and skipped spectra size_t numZeros(0); // number of spectra which have 0 value in the first // column (used in special cases of evaluating how good // Puasonian statistics is) - Progress progress(this, 0, 1, this->indices.size()); + Progress progress(this, 0, 1, this->m_indices.size()); // This is the (only) output spectrum ISpectrum *outSpec = outputWorkspace->getSpectrum(0); @@ -184,13 +190,13 @@ specid_t SumSpectra::getOutputSpecId(MatrixWorkspace_const_sptr localworkspace) { // initial value specid_t specId = - localworkspace->getSpectrum(*(this->indices.begin()))->getSpectrumNo(); + localworkspace->getSpectrum(*(this->m_indices.begin()))->getSpectrumNo(); // the total number of spectra int totalSpec = static_cast<int>(localworkspace->getNumberHistograms()); specid_t temp; - for (auto it = this->indices.begin(); it != this->indices.end(); ++it) { + for (auto it = this->m_indices.begin(); it != this->m_indices.end(); ++it) { if (*(it) < totalSpec) { temp = localworkspace->getSpectrum(*(it))->getSpectrumNo(); if (temp < specId) @@ -233,10 +239,10 @@ void SumSpectra::doWorkspace2D(MatrixWorkspace_const_sptr localworkspace, // Loop over spectra std::set<int>::iterator it; // for (int i = m_MinSpec; i <= m_MaxSpec; ++i) - for (it = this->indices.begin(); it != this->indices.end(); ++it) { + for (it = this->m_indices.begin(); it != this->m_indices.end(); ++it) { int i = *it; // Don't go outside the range. - if ((i >= this->numberOfSpectra) || (i < 0)) { + if ((i >= this->m_numberOfSpectra) || (i < 0)) { g_log.error() << "Invalid index " << i << " was specified. Sum was aborted.\n"; break; @@ -246,7 +252,7 @@ void SumSpectra::doWorkspace2D(MatrixWorkspace_const_sptr localworkspace, // Get the detector object for this spectrum Geometry::IDetector_const_sptr det = localworkspace->getDetector(i); // Skip monitors, if the property is set to do so - if (!keepMonitors && det->isMonitor()) + if (!m_keepMonitors && det->isMonitor()) continue; // Skip masked detectors if (det->isMasked()) { @@ -262,7 +268,7 @@ void SumSpectra::doWorkspace2D(MatrixWorkspace_const_sptr localworkspace, const MantidVec &YValues = localworkspace->readY(i); const MantidVec &YErrors = localworkspace->readE(i); if (m_CalculateWeightedSum) { - for (int k = 0; k < this->yLength; ++k) { + for (int k = 0; k < this->m_yLength; ++k) { if (YErrors[k] != 0) { double errsq = YErrors[k] * YErrors[k]; YError[k] += errsq; @@ -273,7 +279,7 @@ void SumSpectra::doWorkspace2D(MatrixWorkspace_const_sptr localworkspace, } } } else { - for (int k = 0; k < this->yLength; ++k) { + for (int k = 0; k < this->m_yLength; ++k) { YSum[k] += YValues[k]; YError[k] += YErrors[k] * YErrors[k]; } @@ -348,10 +354,10 @@ void SumSpectra::doRebinnedOutput(MatrixWorkspace_sptr outputWorkspace, // Loop over spectra std::set<int>::iterator it; // for (int i = m_MinSpec; i <= m_MaxSpec; ++i) - for (it = indices.begin(); it != indices.end(); ++it) { + for (it = m_indices.begin(); it != m_indices.end(); ++it) { int i = *it; // Don't go outside the range. - if ((i >= numberOfSpectra) || (i < 0)) { + if ((i >= m_numberOfSpectra) || (i < 0)) { g_log.error() << "Invalid index " << i << " was specified. Sum was aborted.\n"; break; @@ -361,7 +367,7 @@ void SumSpectra::doRebinnedOutput(MatrixWorkspace_sptr outputWorkspace, // Get the detector object for this spectrum Geometry::IDetector_const_sptr det = localworkspace->getDetector(i); // Skip monitors, if the property is set to do so - if (!keepMonitors && det->isMonitor()) + if (!m_keepMonitors && det->isMonitor()) continue; // Skip masked detectors if (det->isMasked()) { @@ -379,7 +385,7 @@ void SumSpectra::doRebinnedOutput(MatrixWorkspace_sptr outputWorkspace, const MantidVec &FracArea = inWS->readF(i); if (m_CalculateWeightedSum) { - for (int k = 0; k < this->yLength; ++k) { + for (int k = 0; k < this->m_yLength; ++k) { if (YErrors[k] != 0) { double errsq = YErrors[k] * YErrors[k] * FracArea[k] * FracArea[k]; YError[k] += errsq; @@ -392,7 +398,7 @@ void SumSpectra::doRebinnedOutput(MatrixWorkspace_sptr outputWorkspace, } } } else { - for (int k = 0; k < this->yLength; ++k) { + for (int k = 0; k < this->m_yLength; ++k) { YSum[k] += YValues[k] * FracArea[k]; YError[k] += YErrors[k] * YErrors[k] * FracArea[k] * FracArea[k]; FracSum[k] += FracArea[k]; @@ -449,7 +455,7 @@ void SumSpectra::execEvent(EventWorkspace_const_sptr localworkspace, for (it = indices.begin(); it != indices.end(); ++it) { int i = *it; // Don't go outside the range. - if ((i >= numberOfSpectra) || (i < 0)) { + if ((i >= m_numberOfSpectra) || (i < 0)) { g_log.error() << "Invalid index " << i << " was specified. Sum was aborted.\n"; break; @@ -459,7 +465,7 @@ void SumSpectra::execEvent(EventWorkspace_const_sptr localworkspace, // Get the detector object for this spectrum Geometry::IDetector_const_sptr det = localworkspace->getDetector(i); // Skip monitors, if the property is set to do so - if (!keepMonitors && det->isMonitor()) + if (!m_keepMonitors && det->isMonitor()) continue; // Skip masked detectors if (det->isMasked()) { diff --git a/Code/Mantid/Framework/Algorithms/src/TOFSANSResolution.cpp b/Code/Mantid/Framework/Algorithms/src/TOFSANSResolution.cpp index ce0357adf63ec566d6ea2f0c19d63b1ae815475c..342c6719e5e37dcd02738da33a7841cd53d8dfdd 100644 --- a/Code/Mantid/Framework/Algorithms/src/TOFSANSResolution.cpp +++ b/Code/Mantid/Framework/Algorithms/src/TOFSANSResolution.cpp @@ -24,6 +24,9 @@ using namespace API; using namespace Geometry; using namespace DataObjects; +TOFSANSResolution::TOFSANSResolution() + : API::Algorithm(), m_wl_resolution(0.) {} + void TOFSANSResolution::init() { declareProperty( new WorkspaceProperty<>( @@ -60,7 +63,7 @@ void TOFSANSResolution::init() { */ double TOFSANSResolution::getTOFResolution(double wl) { UNUSED_ARG(wl); - return wl_resolution; + return m_wl_resolution; } void TOFSANSResolution::exec() { @@ -79,7 +82,7 @@ void TOFSANSResolution::exec() { pixel_size_y /= 1000.0; R1 /= 1000.0; R2 /= 1000.0; - wl_resolution = getProperty("DeltaT"); + m_wl_resolution = getProperty("DeltaT"); // Calculate the output binning const std::vector<double> binParams = getProperty("OutputBinning");