From 2fa2270c230f84e1f4d93f492a29d5f2223c6ced Mon Sep 17 00:00:00 2001 From: Federico Montesino Pouzols Date: Thu, 28 May 2015 21:42:00 +0100 Subject: [PATCH] newer coverity issues in framework, up to 1127165, re #11829 --- .../MantidAlgorithms/SphericalAbsorption.h | 6 +-- .../Algorithms/src/SaveGSASInstrumentFile.cpp | 6 ++- .../Algorithms/src/SmoothNeighbours.cpp | 5 +- .../Algorithms/src/SphericalAbsorption.cpp | 5 +- .../Framework/Algorithms/src/StripPeaks.cpp | 53 ++++++++++--------- .../Algorithms/src/UnwrapMonitor.cpp | 4 +- .../Framework/Algorithms/src/UnwrapSNS.cpp | 4 +- .../inc/MantidCrystal/AnvredCorrection.h | 4 +- .../Crystal/src/AnvredCorrection.cpp | 28 +++++----- .../src/NeutronBk2BkExpConvPVoigt.cpp | 6 ++- .../inc/MantidDataHandling/FindDetectorsPar.h | 4 +- .../src/Instrument/RectangularDetector.cpp | 7 ++- .../MantidISISLiveData/TCPEventStreamDefs.h | 7 +-- .../MantidLiveData/ISIS/TCPEventStreamDefs.h | 4 +- .../LiveData/src/FileEventDataListener.cpp | 3 +- .../inc/MantidMDAlgorithms/FindPeaksMD.h | 6 +-- .../MDAlgorithms/src/FindPeaksMD.cpp | 30 +++++------ 17 files changed, 101 insertions(+), 81 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/SphericalAbsorption.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/SphericalAbsorption.h index b86dc460e812..4d0b13b9e429 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/SphericalAbsorption.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/SphericalAbsorption.h @@ -116,11 +116,7 @@ class DLLExport SphericalAbsorption : public API::Algorithm { int64_t x_step; ///< 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 - - typedef double (*expfunction)( - double); ///< Typedef pointer to exponential function - expfunction EXPONENTIAL; ///< Pointer to exponential function + /// if provided }; } // namespace Algorithms diff --git a/Code/Mantid/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp b/Code/Mantid/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp index df3763b7760e..8eca28a2c0bd 100644 --- a/Code/Mantid/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SaveGSASInstrumentFile.cpp @@ -276,7 +276,11 @@ ChopperConfiguration::parseStringUnsignedInt(const string &instring) const { //---------------------------------------------------------------------------------------------- /** Constructor */ -SaveGSASInstrumentFile::SaveGSASInstrumentFile() {} +SaveGSASInstrumentFile::SaveGSASInstrumentFile() + : API::Algorithm(), m_instrument(), m_L1(0.), m_L2(0.), m_2theta(0.), + m_frequency(0), m_id_line(), m_sample(), m_vecBankID2File(), + m_gsasFileName(), m_configuration(), m_profileMap(), m_gdsp(), m_gdt(), + m_galpha(), m_gbeta(), m_bank_mndsp(), m_bank_mxtof() {} //---------------------------------------------------------------------------------------------- /** Destructor diff --git a/Code/Mantid/Framework/Algorithms/src/SmoothNeighbours.cpp b/Code/Mantid/Framework/Algorithms/src/SmoothNeighbours.cpp index ff3facf845ed..ad39fb1d85c8 100644 --- a/Code/Mantid/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -36,7 +36,10 @@ const std::string SmoothNeighbours::RECTANGULAR_GROUP = "Rectangular Detectors"; const std::string SmoothNeighbours::INPUT_WORKSPACE = "InputWorkspace"; SmoothNeighbours::SmoothNeighbours() - : API::Algorithm(), WeightedSum(new NullWeighting) {} + : API::Algorithm(), AdjX(0), AdjY(0), Edge(0), Radius(0.), nNeighbours(0), + WeightedSum(new NullWeighting), PreserveEvents(false), + expandSumAllPixels(false), outWI(0), inWS(), m_neighbours(), + m_prog(NULL) {} /** Initialisation method. * diff --git a/Code/Mantid/Framework/Algorithms/src/SphericalAbsorption.cpp b/Code/Mantid/Framework/Algorithms/src/SphericalAbsorption.cpp index 0e0920189e29..9449eb51b422 100644 --- a/Code/Mantid/Framework/Algorithms/src/SphericalAbsorption.cpp +++ b/Code/Mantid/Framework/Algorithms/src/SphericalAbsorption.cpp @@ -25,7 +25,10 @@ using namespace API; using namespace DataObjects; SphericalAbsorption::SphericalAbsorption() - : API::Algorithm(), m_inputWS(), m_refAtten(0.0), m_scattering(0) {} + : API::Algorithm(), m_inputWS(), m_sampleObject(NULL), m_beamDirection(), + m_L1s(), m_elementVolumes(), m_elementPositions(), m_numVolumeElements(0), + m_sampleVolume(0.), m_refAtten(0.0), m_scattering(0.), n_lambda(0), + x_step(0), m_emode(0), m_lambdaFixed(0.) {} void SphericalAbsorption::init() { // The input workspace must have an instrument and units of wavelength diff --git a/Code/Mantid/Framework/Algorithms/src/StripPeaks.cpp b/Code/Mantid/Framework/Algorithms/src/StripPeaks.cpp index a12cb5283725..884d0aac8216 100644 --- a/Code/Mantid/Framework/Algorithms/src/StripPeaks.cpp +++ b/Code/Mantid/Framework/Algorithms/src/StripPeaks.cpp @@ -14,7 +14,7 @@ DECLARE_ALGORITHM(StripPeaks) using namespace Kernel; using namespace API; -StripPeaks::StripPeaks() : API::Algorithm() {} +StripPeaks::StripPeaks() : API::Algorithm(), m_maxChiSq(0.) {} void StripPeaks::init() { declareProperty( @@ -110,7 +110,7 @@ API::ITableWorkspace_sptr StripPeaks::findPeaks(API::MatrixWorkspace_sptr WS) { std::vector peakpositions = getProperty("PeakPositions"); double peakpostol = getProperty("PeakPositionTolerance"); if (peakpostol < 0.) - peakpostol = EMPTY_DBL(); + peakpostol = EMPTY_DBL(); // Set up and execute algorithm bool showlog = true; @@ -216,16 +216,16 @@ StripPeaks::removePeaks(API::MatrixWorkspace_const_sptr input, << " denoted by chi^2 = " << chisq << " <= 0. \n"; } { - auto left = lower_bound(X.begin(), X.end(), centre); - double delta_d = (*left) - (*(left-1)); - if ((width/delta_d) < 1.) { - g_log.warning() << "StripPeaks(): Peak Index = " << i - << " @ X = " << centre - << " Error: Peak fit with too narrow of peak " - << "delta_d = " << delta_d - << " sigma/delta_d = " << (width/delta_d) << "\n"; - continue; - } + auto left = lower_bound(X.begin(), X.end(), centre); + double delta_d = (*left) - (*(left - 1)); + if ((width / delta_d) < 1.) { + g_log.warning() << "StripPeaks(): Peak Index = " << i + << " @ X = " << centre + << " Error: Peak fit with too narrow of peak " + << "delta_d = " << delta_d + << " sigma/delta_d = " << (width / delta_d) << "\n"; + continue; + } } g_log.information() << "Subtracting peak " << i << " from spectrum " @@ -233,19 +233,22 @@ StripPeaks::removePeaks(API::MatrixWorkspace_const_sptr input, << " at x = " << centre << " h = " << height << " s = " << width << " chi2 = " << chisq << "\n"; - { // log the background function - double a0 = 0.; - double a1 = 0.; - double a2 = 0.; - const std::vector columnNames = peakslist->getColumnNames(); - if (std::find(columnNames.begin(), columnNames.end(), "A0") != columnNames.end()) - a0 = peakslist->getRef("A0", i); - if (std::find(columnNames.begin(), columnNames.end(), "A1") != columnNames.end()) - a1 = peakslist->getRef("A1", i); - if (std::find(columnNames.begin(), columnNames.end(), "A2") != columnNames.end()) - a2 = peakslist->getRef("A2", i); - g_log.information() << " background = " << a0 << " + " - << a1 << " x + " << a2 << " x^2\n"; + { // log the background function + double a0 = 0.; + double a1 = 0.; + double a2 = 0.; + const std::vector columnNames = peakslist->getColumnNames(); + if (std::find(columnNames.begin(), columnNames.end(), "A0") != + columnNames.end()) + a0 = peakslist->getRef("A0", i); + if (std::find(columnNames.begin(), columnNames.end(), "A1") != + columnNames.end()) + a1 = peakslist->getRef("A1", i); + if (std::find(columnNames.begin(), columnNames.end(), "A2") != + columnNames.end()) + a2 = peakslist->getRef("A2", i); + g_log.information() << " background = " << a0 << " + " << a1 + << " x + " << a2 << " x^2\n"; } // Loop over the spectrum elements diff --git a/Code/Mantid/Framework/Algorithms/src/UnwrapMonitor.cpp b/Code/Mantid/Framework/Algorithms/src/UnwrapMonitor.cpp index dc03112b1295..df3d8df8104a 100644 --- a/Code/Mantid/Framework/Algorithms/src/UnwrapMonitor.cpp +++ b/Code/Mantid/Framework/Algorithms/src/UnwrapMonitor.cpp @@ -16,7 +16,9 @@ using namespace Kernel; using namespace API; /// Default constructor -UnwrapMonitor::UnwrapMonitor() : m_progress(NULL) {} +UnwrapMonitor::UnwrapMonitor() + : m_conversionConstant(0.), m_inputWS(), m_LRef(0.), m_Tmin(0.), m_Tmax(0.), + m_XSize(0), m_progress(NULL) {} /// Destructor UnwrapMonitor::~UnwrapMonitor() { diff --git a/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp b/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp index 28705ab92762..7701d293b5ce 100644 --- a/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp +++ b/Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp @@ -23,7 +23,9 @@ using Kernel::Exception::NotFoundError; using std::size_t; /// Default constructor -UnwrapSNS::UnwrapSNS() : m_progress(NULL) {} +UnwrapSNS::UnwrapSNS() + : m_inputWS(), m_inputEvWS(), m_LRef(0.), m_L1(0.), m_Tmin(0.), m_Tmax(0.), + m_frameWidth(0.), m_numberOfSpectra(0), m_XSize(0), m_progress(NULL) {} /// Destructor UnwrapSNS::~UnwrapSNS() { diff --git a/Code/Mantid/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h b/Code/Mantid/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h index 980e50035a3a..4295b5631f89 100644 --- a/Code/Mantid/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h +++ b/Code/Mantid/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h @@ -136,8 +136,8 @@ class DLLExport AnvredCorrection : public API::Algorithm { double m_radius; ///< sample radius in cm double m_power_th; ///< Power of lamda in BuildLamdaWeights std::vector m_lamda_weight; ///< lmabda weights - bool m_OnlySphericalAbsorption; - bool m_ReturnTransmissionOnly; + bool m_onlySphericalAbsorption; + bool m_returnTransmissionOnly; bool m_useScaleFactors; }; diff --git a/Code/Mantid/Framework/Crystal/src/AnvredCorrection.cpp b/Code/Mantid/Framework/Crystal/src/AnvredCorrection.cpp index aecbf5e898ac..1eeda9694bd6 100644 --- a/Code/Mantid/Framework/Crystal/src/AnvredCorrection.cpp +++ b/Code/Mantid/Framework/Crystal/src/AnvredCorrection.cpp @@ -72,8 +72,8 @@ std::map detScale = map_list_of(17, 1.092114823)(18, 0.869105443)( AnvredCorrection::AnvredCorrection() : API::Algorithm(), m_smu(0.), m_amu(0.), m_radius(0.), m_power_th(0.), - m_lamda_weight(), m_OnlySphericalAbsorption(false), - m_ReturnTransmissionOnly(false), m_useScaleFactors(false) {} + m_lamda_weight(), m_onlySphericalAbsorption(false), + m_returnTransmissionOnly(false), m_useScaleFactors(false) {} void AnvredCorrection::init() { @@ -105,10 +105,10 @@ void AnvredCorrection::init() { "input has events (default).\n" "If false, then the workspace gets converted to a " "Workspace2D histogram."); - declareProperty("m_OnlySphericalAbsorption", false, + declareProperty("OnlySphericalAbsorption", false, "All corrections done if false (default).\n" "If true, only the spherical absorption correction."); - declareProperty("m_ReturnTransmissionOnly", false, + declareProperty("ReturnTransmissionOnly", false, "Corrections applied to data if false (default).\n" "If true, only return the transmission coefficient."); declareProperty("PowerLambda", 4.0, "Power of lamda "); @@ -122,19 +122,19 @@ void AnvredCorrection::init() { void AnvredCorrection::exec() { // Retrieve the input workspace m_inputWS = getProperty("InputWorkspace"); - m_OnlySphericalAbsorption = getProperty("m_OnlySphericalAbsorption"); - m_ReturnTransmissionOnly = getProperty("m_ReturnTransmissionOnly"); + m_onlySphericalAbsorption = getProperty("OnlySphericalAbsorption"); + m_returnTransmissionOnly = getProperty("ReturnTransmissionOnly"); m_useScaleFactors = getProperty("DetectorBankScaleFactors"); - if (!m_OnlySphericalAbsorption) { + if (!m_onlySphericalAbsorption) { const API::Run &run = m_inputWS->run(); if (run.hasProperty("LorentzCorrection")) { Kernel::Property *prop = run.getProperty("LorentzCorrection"); bool lorentzDone = boost::lexical_cast(prop->value()); if (lorentzDone) { - m_OnlySphericalAbsorption = true; + m_onlySphericalAbsorption = true; g_log.warning() << "Lorentz Correction was already done for this " - "workspace. m_OnlySphericalAbsorption was changed to " + "workspace. OnlySphericalAbsorption was changed to " "true." << std::endl; } } @@ -151,7 +151,7 @@ void AnvredCorrection::exec() { if (eventW) eventW->sortAll(TOF_SORT, NULL); if ((getProperty("PreserveEvents")) && (eventW != NULL) && - !m_ReturnTransmissionOnly) { + !m_returnTransmissionOnly) { // Input workspace is an event workspace. Use the other exec method this->execEvent(); this->cleanup(); @@ -233,7 +233,7 @@ void AnvredCorrection::exec() { double lambda = timeflight[0]; timeflight.clear(); - if (m_ReturnTransmissionOnly) { + if (m_returnTransmissionOnly) { Y[j] = 1.0 / this->getEventWeight(lambda, scattering); } else { double value = this->getEventWeight(lambda, scattering); @@ -255,7 +255,7 @@ void AnvredCorrection::exec() { // set the absorption correction values in the run parameters API::Run &run = correctionFactors->mutableRun(); run.addProperty("Radius", m_radius, true); - if (!m_OnlySphericalAbsorption && !m_ReturnTransmissionOnly) + if (!m_onlySphericalAbsorption && !m_returnTransmissionOnly) run.addProperty("LorentzCorrection", 1, true); setProperty("OutputWorkspace", correctionFactors); } @@ -372,7 +372,7 @@ void AnvredCorrection::execEvent() { // set the absorption correction values in the run parameters API::Run &run = correctionFactors->mutableRun(); run.addProperty("Radius", m_radius, true); - if (!m_OnlySphericalAbsorption && !m_ReturnTransmissionOnly) + if (!m_onlySphericalAbsorption && !m_returnTransmissionOnly) run.addProperty("LorentzCorrection", 1, true); setProperty("OutputWorkspace", boost::dynamic_pointer_cast(correctionFactors)); @@ -429,7 +429,7 @@ double AnvredCorrection::getEventWeight(double lamda, double two_theta) { if (m_radius > 0) transinv = absor_sphere(two_theta, lamda); // Only Spherical absorption correction - if (m_OnlySphericalAbsorption || m_ReturnTransmissionOnly) + if (m_onlySphericalAbsorption || m_returnTransmissionOnly) return transinv; // Resolution of the lambda table diff --git a/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp b/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp index 63457f7f7097..9f4d315690da 100644 --- a/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/NeutronBk2BkExpConvPVoigt.cpp @@ -27,7 +27,11 @@ DECLARE_FUNCTION(NeutronBk2BkExpConvPVoigt) //---------------------------------------------------------------------------------------------- /** Constructor */ -NeutronBk2BkExpConvPVoigt::NeutronBk2BkExpConvPVoigt() { mHKLSet = false; } +NeutronBk2BkExpConvPVoigt::NeutronBk2BkExpConvPVoigt() + : API::IPowderDiffPeakFunction(), m_Alpha(), m_Beta(), m_Sigma2(), + m_Gamma(), m_eta(), m_N() { + mHKLSet = false; +} //---------------------------------------------------------------------------------------------- /** Destructor diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/FindDetectorsPar.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/FindDetectorsPar.h index 91445a25eb74..ba4a6768804d 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/FindDetectorsPar.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/FindDetectorsPar.h @@ -240,7 +240,9 @@ class DetParameters { /// the detector's ID int64_t detID; // default detector ID -- -1 means undefined - DetParameters() : detID(-1) {} + DetParameters() + : azimutAngle(0.), polarAngle(0.), secondaryFlightPath(0.), azimWidth(0.), + polarWidth(0.), detID(-1) {} }; /** helper class-collection to keep together the parameters, which characterize diff --git a/Code/Mantid/Framework/Geometry/src/Instrument/RectangularDetector.cpp b/Code/Mantid/Framework/Geometry/src/Instrument/RectangularDetector.cpp index 79c460489ed5..bfdcb9c34658 100644 --- a/Code/Mantid/Framework/Geometry/src/Instrument/RectangularDetector.cpp +++ b/Code/Mantid/Framework/Geometry/src/Instrument/RectangularDetector.cpp @@ -21,7 +21,8 @@ using Kernel::Matrix; /** Empty constructor */ RectangularDetector::RectangularDetector() - : CompAssembly(), IObjComponent(NULL), m_minDetId(0), m_maxDetId(0) { + : CompAssembly(), IObjComponent(NULL), m_rectBase(NULL), m_minDetId(0), + m_maxDetId(0) { init(); setGeometryHandler(new BitmapGeometryHandler(this)); @@ -57,9 +58,7 @@ RectangularDetector::RectangularDetector(const std::string &n, setGeometryHandler(new BitmapGeometryHandler(this)); } -void RectangularDetector::init() -{ - m_rectBase = NULL; +void RectangularDetector::init() { m_xpixels = m_ypixels = 0; m_xsize = m_ysize = 0; m_xstart = m_ystart = 0; diff --git a/Code/Mantid/Framework/ISISLiveData/inc/MantidISISLiveData/TCPEventStreamDefs.h b/Code/Mantid/Framework/ISISLiveData/inc/MantidISISLiveData/TCPEventStreamDefs.h index e87c02ac4adb..3b5937223be6 100644 --- a/Code/Mantid/Framework/ISISLiveData/inc/MantidISISLiveData/TCPEventStreamDefs.h +++ b/Code/Mantid/Framework/ISISLiveData/inc/MantidISISLiveData/TCPEventStreamDefs.h @@ -94,8 +94,8 @@ struct TCPStreamEventHeaderSetup { char inst_name[32]; ///< instrument name TCPStreamEventHeaderSetup() - : length(sizeof(TCPStreamEventHeaderSetup)), start_time(0), run_number(0), - run_state(0) { + : ChangedFields(), length(sizeof(TCPStreamEventHeaderSetup)), + start_time(0), run_number(0), run_state(0) { inst_name[0] = '\0'; } bool isValid() const { return length >= sizeof(TCPStreamEventHeaderSetup); } @@ -126,7 +126,8 @@ struct TCPStreamEventHeaderNeutron { uint32_t nevents; ///< number of TCPStreamEvent() structures in this packet TCPStreamEventHeaderNeutron() - : length(sizeof(TCPStreamEventHeaderNeutron)), nevents(0) {} + : length(sizeof(TCPStreamEventHeaderNeutron)), frame_number(0), period(0), + protons(0.), frame_time_zero(0.), nevents(0) {} bool isValid() const { return length >= sizeof(TCPStreamEventHeaderNeutron); } }; diff --git a/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ISIS/TCPEventStreamDefs.h b/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ISIS/TCPEventStreamDefs.h index d02a4bf90ba7..25e222b74eea 100644 --- a/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ISIS/TCPEventStreamDefs.h +++ b/Code/Mantid/Framework/LiveData/inc/MantidLiveData/ISIS/TCPEventStreamDefs.h @@ -94,8 +94,8 @@ struct TCPStreamEventHeaderSetup { char inst_name[32]; ///< instrument name TCPStreamEventHeaderSetup() - : length(sizeof(TCPStreamEventHeaderSetup)), start_time(0), run_number(0), - run_state(0) { + : ChangedFields(), length(sizeof(TCPStreamEventHeaderSetup)), + start_time(0), run_number(0), run_state(0) { inst_name[0] = '\0'; } bool isValid() const { return length >= sizeof(TCPStreamEventHeaderSetup); } diff --git a/Code/Mantid/Framework/LiveData/src/FileEventDataListener.cpp b/Code/Mantid/Framework/LiveData/src/FileEventDataListener.cpp index 6959de986d2b..1ed3a89f3c01 100644 --- a/Code/Mantid/Framework/LiveData/src/FileEventDataListener.cpp +++ b/Code/Mantid/Framework/LiveData/src/FileEventDataListener.cpp @@ -19,7 +19,8 @@ Kernel::Logger g_log("FileEventDataListener"); /// Constructor FileEventDataListener::FileEventDataListener() - : ILiveListener(), m_tempWSname("__filelistenerchunk"), m_nextChunk(1), + : ILiveListener(), m_filename(), m_runNumber(-1), + m_tempWSname("__filelistenerchunk"), m_nextChunk(1), m_filePropName("Filename"), m_loaderName(""), m_canLoadMonitors(true), m_chunkload(NULL) { std::string tfilename = diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h index c834de294711..5e776882c26e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/FindPeaksMD.h @@ -73,7 +73,7 @@ class DLLExport FindPeaksMD : public API::Algorithm { double DensityThresholdFactor; /// Max # of peaks - int64_t MaxPeaks; + int64_t m_maxPeaks; /// Flag to include the detectors within the peak bool m_addDetectors; @@ -91,11 +91,11 @@ class DLLExport FindPeaksMD : public API::Algorithm { /// Instrument Mantid::Geometry::Instrument_const_sptr inst; /// Run number of the peaks - int runNumber; + int m_runNumber; /// Dimension type eDimensionType dimType; /// Goniometer matrix - Mantid::Kernel::Matrix goniometer; + Mantid::Kernel::Matrix m_goniometer; }; } // namespace Mantid diff --git a/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp index 8d70251479e8..44966553e284 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -106,9 +106,9 @@ DECLARE_ALGORITHM(FindPeaksMD) /** Constructor */ FindPeaksMD::FindPeaksMD() -: peakWS(), peakRadiusSquared(), DensityThresholdFactor(0.0), MaxPeaks(0), +: peakWS(), peakRadiusSquared(), DensityThresholdFactor(0.0), m_maxPeaks(0), m_addDetectors(true), m_densityScaleFactor(1e-6), prog(NULL), inst(), - runNumber(-1), dimType(), goniometer() {} + m_runNumber(-1), dimType(), m_goniometer() {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -162,7 +162,7 @@ void FindPeaksMD::readExperimentInfo(const ExperimentInfo_sptr &ei, // Instrument associated with workspace inst = ei->getInstrument(); // Find the run number - runNumber = ei->getRunNumber(); + m_runNumber = ei->getRunNumber(); // Check that the workspace dimensions are in Q-sample-frame or Q-lab-frame. std::string dim0 = ws->getDimension(0)->getName(); @@ -179,10 +179,10 @@ void FindPeaksMD::readExperimentInfo(const ExperimentInfo_sptr &ei, "Unexpected dimensions: need either Q_lab_x or Q_sample_x."); // Find the goniometer rotation matrix - goniometer = + m_goniometer = Mantid::Kernel::Matrix(3, 3, true); // Default IDENTITY matrix try { - goniometer = ei->mutableRun().getGoniometerMatrix(); + m_goniometer = ei->mutableRun().getGoniometerMatrix(); } catch (std::exception &e) { g_log.warning() << "Error finding goniometer matrix. It will not be set in " "the peaks found." << std::endl; @@ -216,10 +216,10 @@ FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) { // Build using the Q-lab-frame constructor p = boost::shared_ptr(new Peak(inst, Q)); // Save gonio matrix for later - p->setGoniometerMatrix(goniometer); + p->setGoniometerMatrix(m_goniometer); } else if (dimType == QSAMPLE) { // Build using the Q-sample-frame constructor - p = boost::shared_ptr(new Peak(inst, Q, goniometer)); + p = boost::shared_ptr(new Peak(inst, Q, m_goniometer)); } try { // Look for a detector @@ -229,7 +229,7 @@ FindPeaksMD::createPeak(const Mantid::Kernel::V3D &Q, const double binCount) { p->setBinCount(binCount); // Save the run number found before. - p->setRunNumber(runNumber); + p->setRunNumber(m_runNumber); return p; } @@ -315,7 +315,7 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace::sptr ws) { // List of chosen possible peak boxes. std::vector peakBoxes; - prog = new Progress(this, 0.30, 0.95, MaxPeaks); + prog = new Progress(this, 0.30, 0.95, m_maxPeaks); // used for selecting method for calculating BinCount bool isMDEvent(ws->id().find("MDEventWorkspace") != std::string::npos); @@ -364,9 +364,9 @@ void FindPeaksMD::findPeaks(typename MDEventWorkspace::sptr ws) { // The box was not rejected for another reason. if (!badBox) { - if (numBoxesFound++ >= MaxPeaks) { + if (numBoxesFound++ >= m_maxPeaks) { g_log.notice() << "Number of peaks found exceeded the limit of " - << MaxPeaks << ". Stopping peak finding." << std::endl; + << m_maxPeaks << ". Stopping peak finding." << std::endl; break; } @@ -489,7 +489,7 @@ void FindPeaksMD::findPeaksHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) // List of chosen possible peak boxes. std::vector peakBoxes; - prog = new Progress(this, 0.30, 0.95, MaxPeaks); + prog = new Progress(this, 0.30, 0.95, m_maxPeaks); int64_t numBoxesFound = 0; // Now we go (backwards) through the map @@ -524,9 +524,9 @@ void FindPeaksMD::findPeaksHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) // The box was not rejected for another reason. if (!badBox) { - if (numBoxesFound++ >= MaxPeaks) { + if (numBoxesFound++ >= m_maxPeaks) { g_log.notice() << "Number of peaks found exceeded the limit of " - << MaxPeaks << ". Stopping peak finding." << std::endl; + << m_maxPeaks << ". Stopping peak finding." << std::endl; break; } @@ -586,7 +586,7 @@ void FindPeaksMD::exec() { static_cast(PeakDistanceThreshold * PeakDistanceThreshold); DensityThresholdFactor = getProperty("DensityThresholdFactor"); - MaxPeaks = getProperty("MaxPeaks"); + m_maxPeaks = getProperty("MaxPeaks"); // Execute the proper algo based on the type of workspace if (inMDHW) {