diff --git a/Framework/API/inc/MantidAPI/Algorithm.h b/Framework/API/inc/MantidAPI/Algorithm.h index 044cb68477079e55ff46b814f0aeee8d1df304ce..b92a36024ec8a509b62f672e6b9ced601420e985 100644 --- a/Framework/API/inc/MantidAPI/Algorithm.h +++ b/Framework/API/inc/MantidAPI/Algorithm.h @@ -288,7 +288,7 @@ public: const std::string &name, const double startProgress = -1., const double endProgress = -1., const bool enableLogging = true, const int &version = -1); - void setupAsChildAlgorithm(boost::shared_ptr algorithm, + void setupAsChildAlgorithm(const boost::shared_ptr &algorithm, const double startProgress = -1., const double endProgress = -1., const bool enableLogging = true); diff --git a/Framework/API/inc/MantidAPI/AlgorithmFactory.h b/Framework/API/inc/MantidAPI/AlgorithmFactory.h index af81adc43d9d6397bee92a7dec26e34272363c52..0bbcea94b8ab9bad420414f6dbe55ece8ab0f456 100644 --- a/Framework/API/inc/MantidAPI/AlgorithmFactory.h +++ b/Framework/API/inc/MantidAPI/AlgorithmFactory.h @@ -129,9 +129,9 @@ private: /// Extract the name of an algorithm const std::string - extractAlgName(const boost::shared_ptr alg) const; + extractAlgName(const boost::shared_ptr &alg) const; /// Extract the version of an algorithm - int extractAlgVersion(const boost::shared_ptr alg) const; + int extractAlgVersion(const boost::shared_ptr &alg) const; /// Create an algorithm object with the specified name boost::shared_ptr createAlgorithm(const std::string &name, diff --git a/Framework/API/inc/MantidAPI/AlgorithmHistory.h b/Framework/API/inc/MantidAPI/AlgorithmHistory.h index 28c95f5a2470971cfc5b2038d434fcc79407214f..9da3a963252551ad9640aa8874f7d7bedbc5b6ed 100644 --- a/Framework/API/inc/MantidAPI/AlgorithmHistory.h +++ b/Framework/API/inc/MantidAPI/AlgorithmHistory.h @@ -63,7 +63,7 @@ public: bool isdefault, const unsigned int &direction = 99); /// add a child algorithm history record to this history object - void addChildHistory(AlgorithmHistory_sptr childHist); + void addChildHistory(const AlgorithmHistory_sptr &childHist); // get functions /// get name of algorithm in history const const std::string &name() const { return m_name; } diff --git a/Framework/API/inc/MantidAPI/AlgorithmManager.h b/Framework/API/inc/MantidAPI/AlgorithmManager.h index a881c7dab3c09dc34b66deabb3fa85927b93322d..3ad91d867e6d5bf6615f76b8293db63289dc8202 100644 --- a/Framework/API/inc/MantidAPI/AlgorithmManager.h +++ b/Framework/API/inc/MantidAPI/AlgorithmManager.h @@ -17,6 +17,7 @@ #include #include #include +#include namespace Mantid { namespace API { @@ -26,7 +27,7 @@ namespace API { class AlgorithmStartingNotification : public Poco::Notification { public: AlgorithmStartingNotification(IAlgorithm_sptr alg) - : Poco::Notification(), m_alg(alg) {} + : Poco::Notification(), m_alg(std::move(alg)) {} /// Returns the algorithm that is starting IAlgorithm_sptr getAlgorithm() const { return m_alg; } diff --git a/Framework/API/inc/MantidAPI/AlgorithmObserver.h b/Framework/API/inc/MantidAPI/AlgorithmObserver.h index 699204626d874a3f7ee78ec9331ea3096ff70aa6..3de449bd9cc157cc36b618951baea51553516e93 100644 --- a/Framework/API/inc/MantidAPI/AlgorithmObserver.h +++ b/Framework/API/inc/MantidAPI/AlgorithmObserver.h @@ -23,17 +23,17 @@ Hides Poco::Notification API from the user. class MANTID_API_DLL AlgorithmObserver { public: AlgorithmObserver(); - AlgorithmObserver(IAlgorithm_const_sptr alg); + AlgorithmObserver(const IAlgorithm_const_sptr &alg); virtual ~AlgorithmObserver(); - void observeAll(IAlgorithm_const_sptr alg); - void observeProgress(IAlgorithm_const_sptr alg); + void observeAll(const IAlgorithm_const_sptr &alg); + void observeProgress(const IAlgorithm_const_sptr &alg); void observeStarting(); - void observeStart(IAlgorithm_const_sptr alg); - void observeFinish(IAlgorithm_const_sptr alg); - void observeError(IAlgorithm_const_sptr alg); + void observeStart(const IAlgorithm_const_sptr &alg); + void observeFinish(const IAlgorithm_const_sptr &alg); + void observeError(const IAlgorithm_const_sptr &alg); - void stopObserving(IAlgorithm_const_sptr alg); + void stopObserving(const IAlgorithm_const_sptr &alg); void stopObserving(const Mantid::API::IAlgorithm *alg); void stopObservingManager(); diff --git a/Framework/API/inc/MantidAPI/AlgorithmProxy.h b/Framework/API/inc/MantidAPI/AlgorithmProxy.h index face35a487563e518e31b28e781ff402517b30d6..45490f3bcb7167232b937cf1df29b8dbcb575f88 100644 --- a/Framework/API/inc/MantidAPI/AlgorithmProxy.h +++ b/Framework/API/inc/MantidAPI/AlgorithmProxy.h @@ -50,7 +50,7 @@ http://proj-gaudi.web.cern.ch/proj-gaudi/) class MANTID_API_DLL AlgorithmProxy : public IAlgorithm, public Kernel::PropertyManagerOwner { public: - AlgorithmProxy(Algorithm_sptr alg); + AlgorithmProxy(const Algorithm_sptr &alg); AlgorithmProxy(const AlgorithmProxy &) = delete; AlgorithmProxy &operator=(const AlgorithmProxy &) = delete; ~AlgorithmProxy() override; diff --git a/Framework/API/inc/MantidAPI/BoostOptionalToAlgorithmProperty.h b/Framework/API/inc/MantidAPI/BoostOptionalToAlgorithmProperty.h index 15e7c685f887d8b6d9570c094dde1ce3e7808912..39af124f01c44922a82a2e0068345fbab9dced95 100644 --- a/Framework/API/inc/MantidAPI/BoostOptionalToAlgorithmProperty.h +++ b/Framework/API/inc/MantidAPI/BoostOptionalToAlgorithmProperty.h @@ -36,8 +36,9 @@ value of type boost::optional will be returned. */ template T checkForMandatoryInstrumentDefault( - Mantid::API::Algorithm *const alg, std::string propName, - Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name) { + Mantid::API::Algorithm *const alg, const std::string &propName, + const Mantid::Geometry::Instrument_const_sptr &instrument, + const std::string &idf_name) { auto algProperty = alg->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getNumberParameter(idf_name); @@ -68,8 +69,9 @@ T checkForMandatoryInstrumentDefault( */ template boost::optional checkForOptionalInstrumentDefault( - Mantid::API::Algorithm *const alg, std::string propName, - Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name) { + Mantid::API::Algorithm *const alg, const std::string &propName, + const Mantid::Geometry::Instrument_const_sptr &instrument, + const std::string &idf_name) { auto algProperty = alg->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getNumberParameter(idf_name); @@ -90,12 +92,14 @@ boost::optional checkForOptionalInstrumentDefault( */ template <> MANTID_API_DLL std::string checkForMandatoryInstrumentDefault( - Mantid::API::Algorithm *const alg, std::string propName, - Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name); + Mantid::API::Algorithm *const alg, const std::string &propName, + const Mantid::Geometry::Instrument_const_sptr &instrument, + const std::string &idf_name); template <> MANTID_API_DLL boost::optional checkForOptionalInstrumentDefault( - Mantid::API::Algorithm *const alg, std::string propName, - Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name); + Mantid::API::Algorithm *const alg, const std::string &propName, + const Mantid::Geometry::Instrument_const_sptr &instrument, + const std::string &idf_name); } // namespace API } // namespace Mantid diff --git a/Framework/API/inc/MantidAPI/BoxController.h b/Framework/API/inc/MantidAPI/BoxController.h index 0a2b93a421e481b3a2efa9580f16290f6bd6bad1..9c52e87a400d197b29c6fa9a83fe45e1cb463a3b 100644 --- a/Framework/API/inc/MantidAPI/BoxController.h +++ b/Framework/API/inc/MantidAPI/BoxController.h @@ -399,7 +399,7 @@ public: IBoxControllerIO *getFileIO() { return m_fileIO.get(); } /// makes box controller file based by providing class, responsible for /// fileIO. - void setFileBacked(boost::shared_ptr newFileIO, + void setFileBacked(const boost::shared_ptr &newFileIO, const std::string &fileName = ""); void clearFileBacked(); //----------------------------------------------------------------------------------- diff --git a/Framework/API/inc/MantidAPI/CompositeCatalog.h b/Framework/API/inc/MantidAPI/CompositeCatalog.h index 630d9c37419e66667fd6a74e1cfcb70c13eb8dfb..b4ebf7022f981e57079ddab9bd6167edba3713b9 100644 --- a/Framework/API/inc/MantidAPI/CompositeCatalog.h +++ b/Framework/API/inc/MantidAPI/CompositeCatalog.h @@ -25,7 +25,7 @@ public: /// Constructor CompositeCatalog(); /// Adds a catalog to the list of catalogs (m_catalogs) - void add(const ICatalog_sptr catalog); + void add(const ICatalog_sptr &catalog); /// Log the user into the catalog system. CatalogSession_sptr login(const std::string &username, const std::string &password, diff --git a/Framework/API/inc/MantidAPI/CompositeDomainMD.h b/Framework/API/inc/MantidAPI/CompositeDomainMD.h index fb48245da0d522359b09568ce9582b7d08f4f767..0ef223294d2acd1febee0f5a92ee25abe798d1be 100644 --- a/Framework/API/inc/MantidAPI/CompositeDomainMD.h +++ b/Framework/API/inc/MantidAPI/CompositeDomainMD.h @@ -27,7 +27,7 @@ class FunctionDomainMD; */ class MANTID_API_DLL CompositeDomainMD : public CompositeDomain { public: - CompositeDomainMD(IMDWorkspace_const_sptr ws, size_t maxDomainSize); + CompositeDomainMD(const IMDWorkspace_const_sptr &ws, size_t maxDomainSize); ~CompositeDomainMD() override; /// Return the total number of arguments in the domain size_t size() const override { return m_totalSize; } diff --git a/Framework/API/inc/MantidAPI/CompositeFunction.h b/Framework/API/inc/MantidAPI/CompositeFunction.h index 602389ba1a056fbf0c024b85c919f2186654b6cb..d7034583b1de25f7cb6a899d8452267c94685c49 100644 --- a/Framework/API/inc/MantidAPI/CompositeFunction.h +++ b/Framework/API/inc/MantidAPI/CompositeFunction.h @@ -148,9 +148,10 @@ public: /// Remove a function void removeFunction(size_t i); /// Replace a function - void replaceFunction(size_t i, IFunction_sptr f); + void replaceFunction(size_t i, const IFunction_sptr &f); /// Replace a function - void replaceFunctionPtr(const IFunction_sptr f_old, IFunction_sptr f_new); + void replaceFunctionPtr(const IFunction_sptr &f_old, + const IFunction_sptr &f_new); /// Get the function index std::size_t functionIndex(std::size_t i) const; /// Returns the index of parameter i as it declared in its function diff --git a/Framework/API/inc/MantidAPI/DataProcessorAlgorithm.h b/Framework/API/inc/MantidAPI/DataProcessorAlgorithm.h index 49db7621c3d62e9426743b37e5e25e6513f93919..ae1dfeb7cb6b7f0949853938934b92e5ea3f6172 100644 --- a/Framework/API/inc/MantidAPI/DataProcessorAlgorithm.h +++ b/Framework/API/inc/MantidAPI/DataProcessorAlgorithm.h @@ -45,7 +45,7 @@ protected: void setPropManagerPropName(const std::string &propName); void mapPropertyName(const std::string &nameInProp, const std::string &nameInPropManager); - void copyProperty(API::Algorithm_sptr alg, const std::string &name); + void copyProperty(const API::Algorithm_sptr &alg, const std::string &name); virtual ITableWorkspace_sptr determineChunk(const std::string &filename); virtual MatrixWorkspace_sptr loadChunk(const size_t rowIndex); Workspace_sptr load(const std::string &inputData, diff --git a/Framework/API/inc/MantidAPI/DetectorSearcher.h b/Framework/API/inc/MantidAPI/DetectorSearcher.h index 22af6d76cfedd300f574c2d38addf24c8fe3396e..27c4a4f7b2c328c5b5c80250f8fccac67b62a8bc 100644 --- a/Framework/API/inc/MantidAPI/DetectorSearcher.h +++ b/Framework/API/inc/MantidAPI/DetectorSearcher.h @@ -43,7 +43,7 @@ public: using DetectorSearchResult = std::tuple; /// Create a new DetectorSearcher with the given instrument & detectors - DetectorSearcher(Geometry::Instrument_const_sptr instrument, + DetectorSearcher(const Geometry::Instrument_const_sptr &instrument, const Geometry::DetectorInfo &detInfo); /// Find a detector that intsects with the given Qlab vector DetectorSearchResult findDetectorIndex(const Kernel::V3D &q); diff --git a/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h b/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h index 30160436a5c2e304b10a1cfe5f64365f76e93414..a849731c9ff0b40f705049907931d981704495f9 100644 --- a/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h +++ b/Framework/API/inc/MantidAPI/EnabledWhenWorkspaceIsType.h @@ -6,6 +6,8 @@ // SPDX - License - Identifier: GPL - 3.0 + #pragma once +#include + #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/Workspace_fwd.h" #include "MantidKernel/DataService.h" @@ -35,7 +37,7 @@ public: */ EnabledWhenWorkspaceIsType(std::string otherPropName, bool enabledSetting = true) - : IPropertySettings(), m_otherPropName(otherPropName), + : IPropertySettings(), m_otherPropName(std::move(otherPropName)), m_enabledSetting(enabledSetting) {} //-------------------------------------------------------------------------------------------- diff --git a/Framework/API/inc/MantidAPI/ExperimentInfo.h b/Framework/API/inc/MantidAPI/ExperimentInfo.h index fd15de6045e6431a6c2a72021a6ee336c10eba30..4d3134e9e43b522603e5027801d9abed8ec84d8c 100644 --- a/Framework/API/inc/MantidAPI/ExperimentInfo.h +++ b/Framework/API/inc/MantidAPI/ExperimentInfo.h @@ -107,9 +107,9 @@ public: /// Easy access to the efixed value for this run & detector ID double getEFixed(const detid_t detID) const; /// Easy access to the efixed value for this run & optional detector - double getEFixed(const boost::shared_ptr detector = - boost::shared_ptr{ - nullptr}) const; + double + getEFixed(const boost::shared_ptr &detector = + boost::shared_ptr{nullptr}) const; /// Set the efixed value for a given detector ID void setEFixed(const detid_t detID, const double value); diff --git a/Framework/API/inc/MantidAPI/FunctionDomainGeneral.h b/Framework/API/inc/MantidAPI/FunctionDomainGeneral.h index 333bfd46ac3858233f7aa90658135e0f7a75a5e0..d87f3d7c9d5cbfb9221805de9309a5d85e039d9a 100644 --- a/Framework/API/inc/MantidAPI/FunctionDomainGeneral.h +++ b/Framework/API/inc/MantidAPI/FunctionDomainGeneral.h @@ -25,7 +25,7 @@ public: /// Get the number of columns size_t columnCount() const; /// Add a new column. All columns must have the same size. - void addColumn(boost::shared_ptr column); + void addColumn(const boost::shared_ptr &column); /// Get i-th column boost::shared_ptr getColumn(size_t i) const; diff --git a/Framework/API/inc/MantidAPI/FunctionDomainMD.h b/Framework/API/inc/MantidAPI/FunctionDomainMD.h index d1641310378773cea9a64923a39e5bb3f97782e8..43ebc9efa049ac4ea93b8f8593986d6f8fa01790 100644 --- a/Framework/API/inc/MantidAPI/FunctionDomainMD.h +++ b/Framework/API/inc/MantidAPI/FunctionDomainMD.h @@ -22,7 +22,7 @@ namespace API { class MANTID_API_DLL FunctionDomainMD : public FunctionDomain { public: /// Constructor. - FunctionDomainMD(IMDWorkspace_const_sptr ws, size_t start = 0, + FunctionDomainMD(const IMDWorkspace_const_sptr &ws, size_t start = 0, size_t length = 0); /// Destructor. ~FunctionDomainMD() override; diff --git a/Framework/API/inc/MantidAPI/FunctionFactory.h b/Framework/API/inc/MantidAPI/FunctionFactory.h index b77dd2a80be5ecedca10d20adcf74a0320b45aad..bfb3b208013176d2586d9ba89ad8d17fdf7688d7 100644 --- a/Framework/API/inc/MantidAPI/FunctionFactory.h +++ b/Framework/API/inc/MantidAPI/FunctionFactory.h @@ -90,19 +90,21 @@ private: /// Throw an exception void inputError(const std::string &str = "") const; /// Add constraints to the created function - void addConstraints(boost::shared_ptr fun, + void addConstraints(const boost::shared_ptr &fun, const Expression &expr) const; /// Add a single constraint to the created function - void addConstraint(boost::shared_ptr fun, + void addConstraint(const boost::shared_ptr &fun, const Expression &expr) const; /// Add a single constraint to the created function with non-default penalty - void addConstraint(boost::shared_ptr fun, + void addConstraint(const boost::shared_ptr &fun, const Expression &constraint_expr, const Expression &penalty_expr) const; /// Add ties to the created function - void addTies(boost::shared_ptr fun, const Expression &expr) const; + void addTies(const boost::shared_ptr &fun, + const Expression &expr) const; /// Add a tie to the created function - void addTie(boost::shared_ptr fun, const Expression &expr) const; + void addTie(const boost::shared_ptr &fun, + const Expression &expr) const; mutable std::map> m_cachedFunctionNames; mutable std::mutex m_mutex; diff --git a/Framework/API/inc/MantidAPI/FunctionGenerator.h b/Framework/API/inc/MantidAPI/FunctionGenerator.h index 61bdc373d3a8dc121e6b6be46e7c6267d58317de..68fafe0b7a0808c401e389862bcf5c4c854978c9 100644 --- a/Framework/API/inc/MantidAPI/FunctionGenerator.h +++ b/Framework/API/inc/MantidAPI/FunctionGenerator.h @@ -31,7 +31,7 @@ belongs to. By default if a name has the signature of a composite function class MANTID_API_DLL FunctionGenerator : public IFunction { public: /// Constructor - FunctionGenerator(IFunction_sptr source); + FunctionGenerator(const IFunction_sptr &source); /// @name Overrides implementing composition of two functions: /// m_source and m_target. diff --git a/Framework/API/inc/MantidAPI/GridDomain1D.h b/Framework/API/inc/MantidAPI/GridDomain1D.h index b0d95f18ce8b087f510fbed4db259c7e56aec05e..2ba4ac5047bc3fa24565d5901653d0825a5367cb 100644 --- a/Framework/API/inc/MantidAPI/GridDomain1D.h +++ b/Framework/API/inc/MantidAPI/GridDomain1D.h @@ -26,7 +26,8 @@ namespace API { class MANTID_API_DLL GridDomain1D : public API::GridDomain { public: /// initialize - void initialize(double &startX, double &endX, size_t &n, std::string scaling); + void initialize(double &startX, double &endX, size_t &n, + const std::string &scaling); /// number of grid point s size_t size() const override { return m_points.size(); } /// number of dimensions in the grid diff --git a/Framework/API/inc/MantidAPI/GroupingLoader.h b/Framework/API/inc/MantidAPI/GroupingLoader.h index ed18239a7e16ec493a5f21a8cc88038e357a756f..622e9090e26362b8179ab297b5003c0189549d75 100644 --- a/Framework/API/inc/MantidAPI/GroupingLoader.h +++ b/Framework/API/inc/MantidAPI/GroupingLoader.h @@ -33,7 +33,7 @@ public: ~Grouping(); /// Construct a Grouping from a table - Grouping(ITableWorkspace_sptr table); + Grouping(const ITableWorkspace_sptr &table); /// Convert to grouping table ITableWorkspace_sptr toTable() const; diff --git a/Framework/API/inc/MantidAPI/IFunction.h b/Framework/API/inc/MantidAPI/IFunction.h index 36a5f4032921a76766630fb7aac3ef7c37d05b84..327f1c190a4de2328f89d4bf41d837e4fd3f50e4 100644 --- a/Framework/API/inc/MantidAPI/IFunction.h +++ b/Framework/API/inc/MantidAPI/IFunction.h @@ -24,6 +24,8 @@ #endif #include +#include + #include #ifdef _WIN32 @@ -521,7 +523,8 @@ public: /// Calculate numerical derivatives void calNumericalDeriv(const FunctionDomain &domain, Jacobian &jacobian); /// Set the covariance matrix - void setCovarianceMatrix(boost::shared_ptr> covar); + void + setCovarianceMatrix(const boost::shared_ptr> &covar); /// Get the covariance matrix boost::shared_ptr> getCovarianceMatrix() const { return m_covar; @@ -562,11 +565,11 @@ protected: /// Convert a value from one unit (inUnit) to unit defined in workspace (ws) double convertValue(double value, Kernel::Unit_sptr &outUnit, - boost::shared_ptr ws, + const boost::shared_ptr &ws, size_t wsIndex) const; void convertValue(std::vector &values, Kernel::Unit_sptr &outUnit, - boost::shared_ptr ws, + const boost::shared_ptr &ws, size_t wsIndex) const; /// Override to declare function attributes @@ -635,7 +638,7 @@ using IFunction_const_sptr = boost::shared_ptr; class FunctionHandler { public: /// Constructor - FunctionHandler(IFunction_sptr fun) : m_fun(fun) {} + FunctionHandler(IFunction_sptr fun) : m_fun(std::move(fun)) {} /// Virtual destructor virtual ~FunctionHandler() = default; /// abstract init method. It is called after setting handler to the function diff --git a/Framework/API/inc/MantidAPI/ITableWorkspace.h b/Framework/API/inc/MantidAPI/ITableWorkspace.h index 9beba0fae1d344a39010a446daf16a8b1f8975b3..74a11149ce6c455800b18a3cf58bfdfab475b35d 100644 --- a/Framework/API/inc/MantidAPI/ITableWorkspace.h +++ b/Framework/API/inc/MantidAPI/ITableWorkspace.h @@ -22,6 +22,7 @@ #endif #include +#include namespace Mantid { @@ -349,7 +350,7 @@ public: } } /// Construct directly from column - ColumnVector(Column_sptr column) : m_column(column) { + ColumnVector(Column_sptr column) : m_column(std::move(column)) { if (!m_column->isType()) { std::stringstream mess; mess << "Type mismatch when creating a ColumnVector<" << typeid(T).name() @@ -387,7 +388,7 @@ public: } } /// Construct directly from column - ConstColumnVector(Column_const_sptr column) : m_column(column) { + ConstColumnVector(Column_const_sptr column) : m_column(std::move(column)) { if (!m_column->isType()) { std::stringstream mess; mess << "Type mismatch when creating a ColumnVector<" << typeid(T).name() diff --git a/Framework/API/inc/MantidAPI/IndexProperty.h b/Framework/API/inc/MantidAPI/IndexProperty.h index 99918f926eb21c78322fefdefe505eaa2e32ea9b..f6261fe2e2397d073874d1e06a1e97971bee2deb 100644 --- a/Framework/API/inc/MantidAPI/IndexProperty.h +++ b/Framework/API/inc/MantidAPI/IndexProperty.h @@ -32,7 +32,7 @@ public: IndexProperty(const std::string &name, const IWorkspaceProperty &workspaceProp, const IndexTypeProperty &indexTypeProp, - Kernel::IValidator_sptr validator = + const Kernel::IValidator_sptr &validator = Kernel::IValidator_sptr(new Kernel::NullValidator)); IndexProperty *clone() const override; diff --git a/Framework/API/inc/MantidAPI/JointDomain.h b/Framework/API/inc/MantidAPI/JointDomain.h index b027938aeae8f8b986652736685100b3af140d49..1fd5eb6b4ee714148c21989e09e79368b2650038 100644 --- a/Framework/API/inc/MantidAPI/JointDomain.h +++ b/Framework/API/inc/MantidAPI/JointDomain.h @@ -31,7 +31,7 @@ public: size_t getNParts() const override; /// Return i-th domain const FunctionDomain &getDomain(size_t i) const override; - void addDomain(FunctionDomain_sptr domain); + void addDomain(const FunctionDomain_sptr &domain); protected: /// Vector with member domains. diff --git a/Framework/API/inc/MantidAPI/MDGeometry.h b/Framework/API/inc/MantidAPI/MDGeometry.h index d46ecaf20003a11c9949743f713d0d9b2ce6cd48..d97cbfbe2feb2d04fc4469e99db7989ec835679d 100644 --- a/Framework/API/inc/MantidAPI/MDGeometry.h +++ b/Framework/API/inc/MantidAPI/MDGeometry.h @@ -64,7 +64,8 @@ public: std::string getGeometryXML() const; - void addDimension(boost::shared_ptr dim); + void + addDimension(const boost::shared_ptr &dim); void addDimension(Mantid::Geometry::IMDDimension *dim); // -------------------------------------------------------------------------------------------- diff --git a/Framework/API/inc/MantidAPI/MultiPeriodGroupWorker.h b/Framework/API/inc/MantidAPI/MultiPeriodGroupWorker.h index 8a68f6fa3d6d30c54bf5bebbeaf6b6dc9d70b087..e787848a1b6675d7b77e1e0f4230341089f1b385 100644 --- a/Framework/API/inc/MantidAPI/MultiPeriodGroupWorker.h +++ b/Framework/API/inc/MantidAPI/MultiPeriodGroupWorker.h @@ -52,7 +52,7 @@ private: /// Try ot add a workspace to the group of input workspaces. void tryAddInputWorkspaceToInputGroups( - Workspace_sptr ws, VecWSGroupType &vecMultiPeriodWorkspaceGroups, + const Workspace_sptr &ws, VecWSGroupType &vecMultiPeriodWorkspaceGroups, VecWSGroupType &vecWorkspaceGroups) const; /// Copy input workspace properties to spawned algorithm. diff --git a/Framework/API/inc/MantidAPI/MultipleExperimentInfos.h b/Framework/API/inc/MantidAPI/MultipleExperimentInfos.h index db9b5c2e68d088a70be46230d89ca4eb664a3675..58a11c8c6b0f89f339edfdc6db07d244ff9f3629 100644 --- a/Framework/API/inc/MantidAPI/MultipleExperimentInfos.h +++ b/Framework/API/inc/MantidAPI/MultipleExperimentInfos.h @@ -27,7 +27,7 @@ public: ExperimentInfo_const_sptr getExperimentInfo(const uint16_t runIndex) const; - uint16_t addExperimentInfo(ExperimentInfo_sptr ei); + uint16_t addExperimentInfo(const ExperimentInfo_sptr &ei); void setExperimentInfo(const uint16_t runIndex, ExperimentInfo_sptr ei); diff --git a/Framework/API/inc/MantidAPI/NotebookBuilder.h b/Framework/API/inc/MantidAPI/NotebookBuilder.h index fcd244028726bc032c2a2c5ee97a605f8de41717..5e620037130aaef9aaa1d11d1e62374883f57ebc 100644 --- a/Framework/API/inc/MantidAPI/NotebookBuilder.h +++ b/Framework/API/inc/MantidAPI/NotebookBuilder.h @@ -26,20 +26,21 @@ namespace API { class MANTID_API_DLL NotebookBuilder { public: - NotebookBuilder(boost::shared_ptr view, + NotebookBuilder(const boost::shared_ptr &view, std::string versionSpecificity = "old"); virtual ~NotebookBuilder() = default; /// build an ipython notebook from the history view - const std::string build(std::string ws_name, std::string ws_title, - std::string ws_comment); + const std::string build(const std::string &ws_name, + const std::string &ws_title, + const std::string &ws_comment); private: void writeHistoryToStream(std::vector::const_iterator &iter); void buildChildren(std::vector::const_iterator &iter); const std::string - buildAlgorithmString(AlgorithmHistory_const_sptr algHistory); - const std::string - buildPropertyString(Mantid::Kernel::PropertyHistory_const_sptr propHistory); + buildAlgorithmString(const AlgorithmHistory_const_sptr &algHistory); + const std::string buildPropertyString( + const Mantid::Kernel::PropertyHistory_const_sptr &propHistory); const std::vector m_historyItems; std::string m_output; diff --git a/Framework/API/inc/MantidAPI/NotebookWriter.h b/Framework/API/inc/MantidAPI/NotebookWriter.h index 039b58c2af15b15a505d03d01116b6b4e1bb483d..d9d914f17e230284a77b67f52a1d7cbf2445d598 100644 --- a/Framework/API/inc/MantidAPI/NotebookWriter.h +++ b/Framework/API/inc/MantidAPI/NotebookWriter.h @@ -24,8 +24,8 @@ class MANTID_API_DLL NotebookWriter { public: NotebookWriter(); virtual ~NotebookWriter() = default; - std::string markdownCell(std::string string_text); - std::string codeCell(std::string string_code); + std::string markdownCell(const std::string &string_text); + std::string codeCell(const std::string &string_code); std::string writeNotebook(); private: diff --git a/Framework/API/inc/MantidAPI/RemoteJobManagerFactory.h b/Framework/API/inc/MantidAPI/RemoteJobManagerFactory.h index 30a18555469505addb870aab9797395828b6dc5a..5646d0da63e9e3347c68f2594f504319bbf5c9da 100644 --- a/Framework/API/inc/MantidAPI/RemoteJobManagerFactory.h +++ b/Framework/API/inc/MantidAPI/RemoteJobManagerFactory.h @@ -47,8 +47,8 @@ public: /// alternative (lower level) create where the specific type of /// manager and base URL are directly given - IRemoteJobManager_sptr create(const std::string baseURL, - const std::string jobManagerType) const; + IRemoteJobManager_sptr create(const std::string &baseURL, + const std::string &jobManagerType) const; private: /// So that the singleton can be created (cons/destructor are private) diff --git a/Framework/API/inc/MantidAPI/Sample.h b/Framework/API/inc/MantidAPI/Sample.h index 5004a47d8e0113b9576d3e8f1797c65dd66e2cf7..dc70c2391fa669bfebce66789eef89b700e5092b 100644 --- a/Framework/API/inc/MantidAPI/Sample.h +++ b/Framework/API/inc/MantidAPI/Sample.h @@ -45,7 +45,7 @@ public: /// the number of samples std::size_t size() const; /// Adds a sample to the list - void addSample(boost::shared_ptr childSample); + void addSample(const boost::shared_ptr &childSample); /// Returns the name of the sample const std::string &getName() const; diff --git a/Framework/API/inc/MantidAPI/ScopedWorkspace.h b/Framework/API/inc/MantidAPI/ScopedWorkspace.h index e8e513de799d7dc4cafcf8dfe9ad4c4dd4b5b14b..00ddb510e2beb391d963c5e1405f7c180a19ba15 100644 --- a/Framework/API/inc/MantidAPI/ScopedWorkspace.h +++ b/Framework/API/inc/MantidAPI/ScopedWorkspace.h @@ -37,7 +37,7 @@ public: ScopedWorkspace(); /// Workspace constructor - ScopedWorkspace(Workspace_sptr ws); + ScopedWorkspace(const Workspace_sptr &ws); /// Destructor virtual ~ScopedWorkspace(); @@ -61,7 +61,7 @@ public: operator bool() const; /// Make ADS entry to point to the given workspace - void set(Workspace_sptr newWS); + void set(const Workspace_sptr &newWS); private: /// ADS name of the workspace diff --git a/Framework/API/inc/MantidAPI/ScriptBuilder.h b/Framework/API/inc/MantidAPI/ScriptBuilder.h index e852d99d7dac3fb5f7007fd7ea79dfdf7e24f29d..eba2f95a206f56e822ab8a9f2b44fa8c17a47cbe 100644 --- a/Framework/API/inc/MantidAPI/ScriptBuilder.h +++ b/Framework/API/inc/MantidAPI/ScriptBuilder.h @@ -31,7 +31,7 @@ namespace API { class MANTID_API_DLL ScriptBuilder { public: ScriptBuilder( - boost::shared_ptr view, + const boost::shared_ptr &view, std::string versionSpecificity = "old", bool appendTimestamp = false, std::vector ignoreTheseAlgs = {}, std::vector> ignoreTheseAlgProperties = {}, diff --git a/Framework/API/inc/MantidAPI/SpectrumDetectorMapping.h b/Framework/API/inc/MantidAPI/SpectrumDetectorMapping.h index 2f2b218194e8b23d700802bbb083d20f75a15c55..08885eb4bc9ea62cf770966d60717cf0a2abdff3 100644 --- a/Framework/API/inc/MantidAPI/SpectrumDetectorMapping.h +++ b/Framework/API/inc/MantidAPI/SpectrumDetectorMapping.h @@ -31,7 +31,7 @@ class MANTID_API_DLL SpectrumDetectorMapping { using sdmap = std::unordered_map>; public: - explicit SpectrumDetectorMapping(MatrixWorkspace_const_sptr workspace, + explicit SpectrumDetectorMapping(const MatrixWorkspace_const_sptr &workspace, const bool useSpecNoIndex = true); SpectrumDetectorMapping( const std::vector &spectrumNumbers, diff --git a/Framework/API/inc/MantidAPI/WorkspaceHistory.h b/Framework/API/inc/MantidAPI/WorkspaceHistory.h index cc7097afbf995655e3894e46f834ecffa09e31c2..153651206cce5e7707e6db53a5578dd0ec6f6001 100644 --- a/Framework/API/inc/MantidAPI/WorkspaceHistory.h +++ b/Framework/API/inc/MantidAPI/WorkspaceHistory.h @@ -79,9 +79,9 @@ public: private: /// Recursive function to load the algorithm history tree from file - void loadNestedHistory( - ::NeXus::File *file, - AlgorithmHistory_sptr parent = boost::shared_ptr()); + void loadNestedHistory(::NeXus::File *file, + const AlgorithmHistory_sptr &parent = + boost::shared_ptr()); /// Parse an algorithm history string loaded from file AlgorithmHistory_sptr parseAlgorithmHistory(const std::string &rawData); /// Find the history entries at this level in the file. diff --git a/Framework/API/inc/MantidAPI/WorkspaceOpOverloads.h b/Framework/API/inc/MantidAPI/WorkspaceOpOverloads.h index 06eaa10debe52e82f781ef5dc39f76e7b8d90c64..f40c7b19dbea0f2c6a3030caa43a5c787b00dc76 100644 --- a/Framework/API/inc/MantidAPI/WorkspaceOpOverloads.h +++ b/Framework/API/inc/MantidAPI/WorkspaceOpOverloads.h @@ -22,51 +22,51 @@ DLLExport ResultType executeBinaryOperation( bool rethrow = false); } // namespace OperatorOverloads -bool MANTID_API_DLL equals(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs, +bool MANTID_API_DLL equals(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs, double tolerance = 0.0); // Workspace operator overloads -MatrixWorkspace_sptr MANTID_API_DLL operator+(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator-(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator*(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator/(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator+(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator-(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator*(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator/(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator+(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr MANTID_API_DLL operator+(const MatrixWorkspace_sptr &lhs, const double &rhsValue); -MatrixWorkspace_sptr MANTID_API_DLL operator-(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr MANTID_API_DLL operator-(const MatrixWorkspace_sptr &lhs, const double &rhsValue); MatrixWorkspace_sptr MANTID_API_DLL operator-(const double &lhsValue, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator*(const MatrixWorkspace_sptr lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator*(const MatrixWorkspace_sptr &lhs, const double &rhsValue); MatrixWorkspace_sptr MANTID_API_DLL operator*(const double &lhsValue, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator/(const MatrixWorkspace_sptr lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator/(const MatrixWorkspace_sptr &lhs, const double &rhsValue); MatrixWorkspace_sptr MANTID_API_DLL operator/(const double &lhsValue, - const MatrixWorkspace_sptr rhs); + const MatrixWorkspace_sptr &rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator+=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator-=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator*=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator/=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator+=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator-=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator*=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); +MatrixWorkspace_sptr MANTID_API_DLL operator/=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs); -MatrixWorkspace_sptr MANTID_API_DLL operator+=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr MANTID_API_DLL operator+=(const MatrixWorkspace_sptr &lhs, const double &rhsValue); -MatrixWorkspace_sptr MANTID_API_DLL operator-=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr MANTID_API_DLL operator-=(const MatrixWorkspace_sptr &lhs, const double &rhsValue); -MatrixWorkspace_sptr MANTID_API_DLL operator*=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr MANTID_API_DLL operator*=(const MatrixWorkspace_sptr &lhs, const double &rhsValue); -MatrixWorkspace_sptr MANTID_API_DLL operator/=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr MANTID_API_DLL operator/=(const MatrixWorkspace_sptr &lhs, const double &rhsValue); /** A collection of static functions for use with workspaces @@ -83,7 +83,7 @@ struct MANTID_API_DLL WorkspaceHelpers { static bool sharedXData(const MatrixWorkspace &WS); // Divides the data in a workspace by the bin width to make it a distribution // (or the reverse) - static void makeDistribution(MatrixWorkspace_sptr workspace, + static void makeDistribution(const MatrixWorkspace_sptr &workspace, const bool forwards = true); }; diff --git a/Framework/API/inc/MantidAPI/WorkspaceProperty.h b/Framework/API/inc/MantidAPI/WorkspaceProperty.h index 487b29032f5ce1506243b7834842eaeab9a76ed1..0b0a32d2c3b0fc09ee3365e5b98d8b261ac5b63c 100644 --- a/Framework/API/inc/MantidAPI/WorkspaceProperty.h +++ b/Framework/API/inc/MantidAPI/WorkspaceProperty.h @@ -59,20 +59,20 @@ public: explicit WorkspaceProperty( const std::string &name, const std::string &wsName, const unsigned int direction, - Kernel::IValidator_sptr validator = + const Kernel::IValidator_sptr &validator = Kernel::IValidator_sptr(new Kernel::NullValidator)); explicit WorkspaceProperty( const std::string &name, const std::string &wsName, const unsigned int direction, const PropertyMode::Type optional, - Kernel::IValidator_sptr validator = + const Kernel::IValidator_sptr &validator = Kernel::IValidator_sptr(new Kernel::NullValidator)); explicit WorkspaceProperty( const std::string &name, const std::string &wsName, const unsigned int direction, const PropertyMode::Type optional, const LockMode::Type locking, - Kernel::IValidator_sptr validator = + const Kernel::IValidator_sptr &validator = Kernel::IValidator_sptr(new Kernel::NullValidator)); WorkspaceProperty(const WorkspaceProperty &right); @@ -118,7 +118,8 @@ public: void setIsMasterRank(bool isMasterRank) override; private: - std::string isValidGroup(boost::shared_ptr wsGroup) const; + std::string + isValidGroup(const boost::shared_ptr &wsGroup) const; std::string isValidOutputWs() const; diff --git a/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc b/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc index b60627596e43036bb11b3859cb5d5e2f1d964a92..6908bc7a6c25efeac00301d96c1a643f119d7b95 100644 --- a/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc +++ b/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc @@ -29,10 +29,9 @@ namespace API { * Direction enum (i.e. 0-2) */ template -WorkspaceProperty::WorkspaceProperty(const std::string &name, - const std::string &wsName, - const unsigned int direction, - Kernel::IValidator_sptr validator) +WorkspaceProperty::WorkspaceProperty( + const std::string &name, const std::string &wsName, + const unsigned int direction, const Kernel::IValidator_sptr &validator) : Kernel::PropertyWithValue>( name, boost::shared_ptr(), validator, direction), m_workspaceName(wsName), m_initialWSName(wsName), @@ -51,11 +50,10 @@ WorkspaceProperty::WorkspaceProperty(const std::string &name, * Direction enum (i.e. 0-2) */ template -WorkspaceProperty::WorkspaceProperty(const std::string &name, - const std::string &wsName, - const unsigned int direction, - const PropertyMode::Type optional, - Kernel::IValidator_sptr validator) +WorkspaceProperty::WorkspaceProperty( + const std::string &name, const std::string &wsName, + const unsigned int direction, const PropertyMode::Type optional, + const Kernel::IValidator_sptr &validator) : Kernel::PropertyWithValue>( name, boost::shared_ptr(), validator, direction), m_workspaceName(wsName), m_initialWSName(wsName), m_optional(optional), @@ -78,12 +76,10 @@ WorkspaceProperty::WorkspaceProperty(const std::string &name, * Direction enum (i.e. 0-2) */ template -WorkspaceProperty::WorkspaceProperty(const std::string &name, - const std::string &wsName, - const unsigned int direction, - const PropertyMode::Type optional, - const LockMode::Type locking, - Kernel::IValidator_sptr validator) +WorkspaceProperty::WorkspaceProperty( + const std::string &name, const std::string &wsName, + const unsigned int direction, const PropertyMode::Type optional, + const LockMode::Type locking, const Kernel::IValidator_sptr &validator) : Kernel::PropertyWithValue>( name, boost::shared_ptr(), validator, direction), m_workspaceName(wsName), m_initialWSName(wsName), m_optional(optional), @@ -410,7 +406,7 @@ void WorkspaceProperty::setIsMasterRank(bool isMasterRank) { */ template std::string WorkspaceProperty::isValidGroup( - boost::shared_ptr wsGroup) const { + const boost::shared_ptr &wsGroup) const { g_log.debug() << " Input WorkspaceGroup found \n"; std::vector wsGroupNames = wsGroup->getNames(); diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp index 1bd805d03f9568b52ef6584a02beb3815b4fb4d4..8a96b5f46197db6fb9c111209e5daba26c2e241b 100644 --- a/Framework/API/src/Algorithm.cpp +++ b/Framework/API/src/Algorithm.cpp @@ -39,6 +39,7 @@ #include #include +#include // Index property handling template definitions #include "MantidAPI/Algorithm.tcc" @@ -845,7 +846,7 @@ Algorithm_sptr Algorithm::createChildAlgorithm(const std::string &name, * Can also be used manually for algorithms created otherwise. This allows * running algorithms that are not declared into the factory as child * algorithms. */ -void Algorithm::setupAsChildAlgorithm(Algorithm_sptr alg, +void Algorithm::setupAsChildAlgorithm(const Algorithm_sptr &alg, const double startProgress, const double endProgress, const bool enableLogging) { @@ -1077,7 +1078,7 @@ void Algorithm::linkHistoryWithLastChild() { void Algorithm::trackAlgorithmHistory( boost::shared_ptr parentHist) { enableHistoryRecordingForChild(true); - m_parentHistory = parentHist; + m_parentHistory = std::move(parentHist); } /** Check if we are tracking history for this algorithm diff --git a/Framework/API/src/AlgorithmFactory.cpp b/Framework/API/src/AlgorithmFactory.cpp index 778a83eba0638eec7e82ff942bf92496be4786b7..5379a1b6dfc67d9d11645d3c62e50c4671647dea 100644 --- a/Framework/API/src/AlgorithmFactory.cpp +++ b/Framework/API/src/AlgorithmFactory.cpp @@ -406,7 +406,7 @@ void AlgorithmFactoryImpl::fillHiddenCategories( * @returns the name of the algroithm */ const std::string AlgorithmFactoryImpl::extractAlgName( - const boost::shared_ptr alg) const { + const boost::shared_ptr &alg) const { return alg->name(); } @@ -415,7 +415,7 @@ const std::string AlgorithmFactoryImpl::extractAlgName( * @returns the version of the algroithm */ int AlgorithmFactoryImpl::extractAlgVersion( - const boost::shared_ptr alg) const { + const boost::shared_ptr &alg) const { return alg->version(); } diff --git a/Framework/API/src/AlgorithmHistory.cpp b/Framework/API/src/AlgorithmHistory.cpp index 388b498f0303fd410f4c47867a1a13479214d1da..fd4208da5e549e1061a3d2c1a56aaf42c63ebaaa 100644 --- a/Framework/API/src/AlgorithmHistory.cpp +++ b/Framework/API/src/AlgorithmHistory.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace Mantid { namespace API { @@ -85,7 +86,7 @@ AlgorithmHistory::AlgorithmHistory(const std::string &name, int vers, std::size_t uexeccount) : m_name(name), m_version(vers), m_executionDate(start), m_executionDuration(duration), m_execCount(uexeccount), - m_childHistories(), m_uuid(uuid) {} + m_childHistories(), m_uuid(std::move(uuid)) {} /** * Set the history properties for an algorithm pointer @@ -162,7 +163,7 @@ void AlgorithmHistory::addProperty(const std::string &name, /** Add a child algorithm history to history * @param childHist :: The child history */ -void AlgorithmHistory::addChildHistory(AlgorithmHistory_sptr childHist) { +void AlgorithmHistory::addChildHistory(const AlgorithmHistory_sptr &childHist) { // Don't copy one's own history onto oneself if (this == &(*childHist)) { return; diff --git a/Framework/API/src/AlgorithmObserver.cpp b/Framework/API/src/AlgorithmObserver.cpp index d8bd534c9201ac7aaed0004700d8bff284245144..5fb257a1a9a2b8f1353d60106fc7bceb95b87d29 100644 --- a/Framework/API/src/AlgorithmObserver.cpp +++ b/Framework/API/src/AlgorithmObserver.cpp @@ -7,8 +7,10 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidAPI/AlgorithmObserver.h" +#include + #include "MantidAPI/AlgorithmManager.h" +#include "MantidAPI/AlgorithmObserver.h" namespace Mantid { namespace API { @@ -26,13 +28,13 @@ AlgorithmObserver::AlgorithmObserver() alg. @param alg :: Algorithm to be observed */ -AlgorithmObserver::AlgorithmObserver(IAlgorithm_const_sptr alg) +AlgorithmObserver::AlgorithmObserver(const IAlgorithm_const_sptr &alg) : m_progressObserver(*this, &AlgorithmObserver::_progressHandle), m_startObserver(*this, &AlgorithmObserver::_startHandle), m_finishObserver(*this, &AlgorithmObserver::_finishHandle), m_errorObserver(*this, &AlgorithmObserver::_errorHandle), m_startingObserver(*this, &AlgorithmObserver::_startingHandle) { - observeAll(alg); + observeAll(std::move(alg)); } /// Virtual destructor @@ -41,7 +43,7 @@ AlgorithmObserver::~AlgorithmObserver() = default; /** Connect to algorithm alg and observe all its notifications @param alg :: Algorithm to be observed */ -void AlgorithmObserver::observeAll(IAlgorithm_const_sptr alg) { +void AlgorithmObserver::observeAll(const IAlgorithm_const_sptr &alg) { alg->addObserver(m_progressObserver); alg->addObserver(m_startObserver); alg->addObserver(m_finishObserver); @@ -51,7 +53,7 @@ void AlgorithmObserver::observeAll(IAlgorithm_const_sptr alg) { /** Connect to algorithm alg and observe its progress notification @param alg :: Algorithm to be observed */ -void AlgorithmObserver::observeProgress(IAlgorithm_const_sptr alg) { +void AlgorithmObserver::observeProgress(const IAlgorithm_const_sptr &alg) { alg->addObserver(m_progressObserver); } @@ -65,21 +67,21 @@ void AlgorithmObserver::observeStarting() { /** Connect to algorithm alg and observe its start notification @param alg :: Algorithm to be observed */ -void AlgorithmObserver::observeStart(IAlgorithm_const_sptr alg) { +void AlgorithmObserver::observeStart(const IAlgorithm_const_sptr &alg) { alg->addObserver(m_startObserver); } /** Connect to algorithm alg and observe its finish notification @param alg :: Algorithm to be observed */ -void AlgorithmObserver::observeFinish(IAlgorithm_const_sptr alg) { +void AlgorithmObserver::observeFinish(const IAlgorithm_const_sptr &alg) { alg->addObserver(m_finishObserver); } /** Connect to algorithm alg and observe its error notification @param alg :: Algorithm to be observed */ -void AlgorithmObserver::observeError(IAlgorithm_const_sptr alg) { +void AlgorithmObserver::observeError(const IAlgorithm_const_sptr &alg) { alg->addObserver(m_errorObserver); } @@ -87,7 +89,7 @@ void AlgorithmObserver::observeError(IAlgorithm_const_sptr alg) { inherited classes. @param alg :: Algorithm to be disconnected */ -void AlgorithmObserver::stopObserving(IAlgorithm_const_sptr alg) { +void AlgorithmObserver::stopObserving(const IAlgorithm_const_sptr &alg) { this->stopObserving(alg.get()); } diff --git a/Framework/API/src/AlgorithmProperty.cpp b/Framework/API/src/AlgorithmProperty.cpp index 31e3f471c899de26e11693896114b67c054314a7..512ae7a5bfef738a0f1db92e7eadb45b6a6d4af9 100644 --- a/Framework/API/src/AlgorithmProperty.cpp +++ b/Framework/API/src/AlgorithmProperty.cpp @@ -12,6 +12,8 @@ #include +#include + namespace Mantid { namespace API { @@ -29,8 +31,8 @@ namespace API { AlgorithmProperty::AlgorithmProperty(const std::string &propName, Kernel::IValidator_sptr validator, unsigned int direction) - : Kernel::PropertyWithValue(propName, HeldType(), validator, - direction), + : Kernel::PropertyWithValue(propName, HeldType(), + std::move(validator), direction), m_algmStr() {} /** diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp index 4730a275f43568c6ad7720db257256b3f65801f8..876a9b51d1b1b2504dd0b0551f8f9870860d3b5c 100644 --- a/Framework/API/src/AlgorithmProxy.cpp +++ b/Framework/API/src/AlgorithmProxy.cpp @@ -21,7 +21,7 @@ namespace Mantid { namespace API { /// Constructor -AlgorithmProxy::AlgorithmProxy(Algorithm_sptr alg) +AlgorithmProxy::AlgorithmProxy(const Algorithm_sptr &alg) : PropertyManagerOwner(), m_executeAsync(new Poco::ActiveMethod( this, &AlgorithmProxy::executeAsyncImpl)), diff --git a/Framework/API/src/BoostOptionalToAlgorithmProperty.cpp b/Framework/API/src/BoostOptionalToAlgorithmProperty.cpp index 109e56d0a3a75da9bd287dea64304784c222b0ac..ca6898c604e185cb9f9b3252aec7145f25743c84 100644 --- a/Framework/API/src/BoostOptionalToAlgorithmProperty.cpp +++ b/Framework/API/src/BoostOptionalToAlgorithmProperty.cpp @@ -10,8 +10,9 @@ namespace Mantid { namespace API { template <> std::string checkForMandatoryInstrumentDefault( - Mantid::API::Algorithm *const alg, std::string propName, - Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name) { + Mantid::API::Algorithm *const alg, const std::string &propName, + const Mantid::Geometry::Instrument_const_sptr &instrument, + const std::string &idf_name) { auto algProperty = alg->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getStringParameter(idf_name); @@ -28,8 +29,9 @@ std::string checkForMandatoryInstrumentDefault( template <> boost::optional checkForOptionalInstrumentDefault( - Mantid::API::Algorithm *const alg, std::string propName, - Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name) { + Mantid::API::Algorithm *const alg, const std::string &propName, + const Mantid::Geometry::Instrument_const_sptr &instrument, + const std::string &idf_name) { auto algProperty = alg->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getStringParameter(idf_name); diff --git a/Framework/API/src/BoxController.cpp b/Framework/API/src/BoxController.cpp index 16e8a31e11b9c626a89a522f12215322038c217c..1590696cb4cac060808f12cca60badaec360afb4 100644 --- a/Framework/API/src/BoxController.cpp +++ b/Framework/API/src/BoxController.cpp @@ -296,8 +296,9 @@ void BoxController::clearFileBacked() { *@param fileName -- if newFileIO comes without opened file, this is the file *name to open for the file based IO operations */ -void BoxController::setFileBacked(boost::shared_ptr newFileIO, - const std::string &fileName) { +void BoxController::setFileBacked( + const boost::shared_ptr &newFileIO, + const std::string &fileName) { if (!newFileIO->isOpened()) newFileIO->openFile(fileName, "w"); diff --git a/Framework/API/src/CompositeCatalog.cpp b/Framework/API/src/CompositeCatalog.cpp index d6e50e3b97d59f19146487aa80c2b9c013bb6025..f838b719ca0c8c51905710f78fba0bcebee01ce4 100644 --- a/Framework/API/src/CompositeCatalog.cpp +++ b/Framework/API/src/CompositeCatalog.cpp @@ -16,7 +16,7 @@ CompositeCatalog::CompositeCatalog() : m_catalogs() {} * Add a catalog to the catalog container. * @param catalog :: The catalog to add to the container. */ -void CompositeCatalog::add(const ICatalog_sptr catalog) { +void CompositeCatalog::add(const ICatalog_sptr &catalog) { m_catalogs.emplace_back(catalog); } diff --git a/Framework/API/src/CompositeDomainMD.cpp b/Framework/API/src/CompositeDomainMD.cpp index cd4ac3479235d5970a2e1dd570f40102ea044afc..6762e9be597c90814b65cba3a8147223193a11fa 100644 --- a/Framework/API/src/CompositeDomainMD.cpp +++ b/Framework/API/src/CompositeDomainMD.cpp @@ -21,7 +21,7 @@ namespace API { * @param ws :: Pointer to a workspace. * @param maxDomainSize :: The maximum size each domain can have. */ -CompositeDomainMD::CompositeDomainMD(IMDWorkspace_const_sptr ws, +CompositeDomainMD::CompositeDomainMD(const IMDWorkspace_const_sptr &ws, size_t maxDomainSize) : m_iterator(ws->createIterator()) { m_totalSize = m_iterator->getDataSize(); diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp index ec17675164b006a70fbba23ad0879387cdbb19cf..39c4976ea00adaa57409e58eb98048ca756b2474 100644 --- a/Framework/API/src/CompositeFunction.cpp +++ b/Framework/API/src/CompositeFunction.cpp @@ -19,6 +19,7 @@ #include #include #include +#include namespace Mantid { namespace API { @@ -468,21 +469,21 @@ void CompositeFunction::removeFunction(size_t i) { * a member of this composite function nothing happens * @param f_new :: A pointer to the new function */ -void CompositeFunction::replaceFunctionPtr(const IFunction_sptr f_old, - IFunction_sptr f_new) { +void CompositeFunction::replaceFunctionPtr(const IFunction_sptr &f_old, + const IFunction_sptr &f_new) { std::vector::const_iterator it = std::find(m_functions.begin(), m_functions.end(), f_old); if (it == m_functions.end()) return; std::vector::difference_type iFun = it - m_functions.begin(); - replaceFunction(iFun, f_new); + replaceFunction(iFun, std::move(f_new)); } /** Replace a function with a new one. The old function is deleted. * @param i :: The index of the function to replace * @param f :: A pointer to the new function */ -void CompositeFunction::replaceFunction(size_t i, IFunction_sptr f) { +void CompositeFunction::replaceFunction(size_t i, const IFunction_sptr &f) { if (i >= nFunctions()) { throw std::out_of_range("Function index (" + std::to_string(i) + ") out of range (" + std::to_string(nFunctions()) + diff --git a/Framework/API/src/DataProcessorAlgorithm.cpp b/Framework/API/src/DataProcessorAlgorithm.cpp index 4f82c06e981672c2229587c83695dd2847d28c95..ebd21763b9c7e1e444324b5317e4aff75978a652 100644 --- a/Framework/API/src/DataProcessorAlgorithm.cpp +++ b/Framework/API/src/DataProcessorAlgorithm.cpp @@ -19,6 +19,8 @@ #include "MantidKernel/System.h" #include "Poco/Path.h" #include +#include + #ifdef MPI_BUILD #include #endif @@ -135,7 +137,7 @@ void GenericDataProcessorAlgorithm::mapPropertyName( */ template void GenericDataProcessorAlgorithm::copyProperty( - API::Algorithm_sptr alg, const std::string &name) { + const API::Algorithm_sptr &alg, const std::string &name) { if (!alg->existsProperty(name)) { std::stringstream msg; msg << "Algorithm \"" << alg->name() << "\" does not have property \"" @@ -232,7 +234,7 @@ GenericDataProcessorAlgorithm::loadChunk(const size_t rowIndex) { template Workspace_sptr GenericDataProcessorAlgorithm::assemble(Workspace_sptr partialWS) { - Workspace_sptr outputWS = partialWS; + Workspace_sptr outputWS = std::move(partialWS); #ifdef MPI_BUILD IAlgorithm_sptr gatherAlg = createChildAlgorithm("GatherWorkspaces"); gatherAlg->setLogging(true); diff --git a/Framework/API/src/DetectorSearcher.cpp b/Framework/API/src/DetectorSearcher.cpp index a183c4841f6145d61a5b2a1180e377a94dc421d2..cd25bce0e98fc5cc3caa06aef7d12a31c0394379 100644 --- a/Framework/API/src/DetectorSearcher.cpp +++ b/Framework/API/src/DetectorSearcher.cpp @@ -30,8 +30,9 @@ double getQSign() { * @param instrument :: the instrument to find detectors in * @param detInfo :: the Geometry::DetectorInfo object for this instrument */ -DetectorSearcher::DetectorSearcher(Geometry::Instrument_const_sptr instrument, - const Geometry::DetectorInfo &detInfo) +DetectorSearcher::DetectorSearcher( + const Geometry::Instrument_const_sptr &instrument, + const Geometry::DetectorInfo &detInfo) : m_usingFullRayTrace(instrument->containsRectDetectors() == Geometry::Instrument::ContainsState::Full), m_crystallography_convention(getQSign()), m_detInfo(detInfo), diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp index f369dad741b023c66dab71574b2be4578c276fab..5310526a330bf1496b4808dd2d838595f0fa5f2b 100644 --- a/Framework/API/src/ExperimentInfo.cpp +++ b/Framework/API/src/ExperimentInfo.cpp @@ -711,7 +711,7 @@ double ExperimentInfo::getEFixed(const detid_t detID) const { * @return The current efixed value */ double ExperimentInfo::getEFixed( - const boost::shared_ptr detector) const { + const boost::shared_ptr &detector) const { populateIfNotLoaded(); Kernel::DeltaEMode::Type emode = getEMode(); if (emode == Kernel::DeltaEMode::Direct) { diff --git a/Framework/API/src/FunctionDomainGeneral.cpp b/Framework/API/src/FunctionDomainGeneral.cpp index 6be66bafb29538278b7edcbd50bc541c1b84c97d..7000ed1580f542480c395fbc9dd9c65dfdd5b42a 100644 --- a/Framework/API/src/FunctionDomainGeneral.cpp +++ b/Framework/API/src/FunctionDomainGeneral.cpp @@ -22,7 +22,7 @@ size_t FunctionDomainGeneral::size() const { size_t FunctionDomainGeneral::columnCount() const { return m_columns.size(); } /// Add a new column. All columns must have the same size. -void FunctionDomainGeneral::addColumn(boost::shared_ptr column) { +void FunctionDomainGeneral::addColumn(const boost::shared_ptr &column) { if (!column) { throw std::runtime_error( "Cannot add null column to FunctionDomainGeneral."); diff --git a/Framework/API/src/FunctionDomainMD.cpp b/Framework/API/src/FunctionDomainMD.cpp index 4dab31a2fae950f503b4be0c25e205b9831ef5c3..51cf298b927935a356f514a04d026627daa0e297 100644 --- a/Framework/API/src/FunctionDomainMD.cpp +++ b/Framework/API/src/FunctionDomainMD.cpp @@ -21,8 +21,8 @@ namespace API { * @param start :: Index of the first iterator in this domain. * @param length :: Size of this domain. If 0 use all workspace. */ -FunctionDomainMD::FunctionDomainMD(IMDWorkspace_const_sptr ws, size_t start, - size_t length) +FunctionDomainMD::FunctionDomainMD(const IMDWorkspace_const_sptr &ws, + size_t start, size_t length) : m_iterator(ws->createIterator()), m_startIndex(start), m_currentIndex(0), m_justReset(true), m_workspace(ws) { size_t dataSize = m_iterator->getDataSize(); diff --git a/Framework/API/src/FunctionFactory.cpp b/Framework/API/src/FunctionFactory.cpp index 79936f3668d00fe95f26eb3b4d28cd55201a410d..9ada8ccf36c5515052cacfa808779f896a212dad 100644 --- a/Framework/API/src/FunctionFactory.cpp +++ b/Framework/API/src/FunctionFactory.cpp @@ -271,7 +271,7 @@ void FunctionFactoryImpl::inputError(const std::string &str) const { * separated by commas ',' * and enclosed in brackets "(...)" . */ -void FunctionFactoryImpl::addConstraints(IFunction_sptr fun, +void FunctionFactoryImpl::addConstraints(const IFunction_sptr &fun, const Expression &expr) const { if (expr.name() == ",") { for (auto it = expr.begin(); it != expr.end(); ++it) { @@ -305,7 +305,7 @@ void FunctionFactoryImpl::addConstraints(IFunction_sptr fun, * @param fun :: The function * @param expr :: The constraint expression. */ -void FunctionFactoryImpl::addConstraint(boost::shared_ptr fun, +void FunctionFactoryImpl::addConstraint(const boost::shared_ptr &fun, const Expression &expr) const { auto c = std::unique_ptr( ConstraintFactory::Instance().createInitialized(fun.get(), expr)); @@ -319,7 +319,7 @@ void FunctionFactoryImpl::addConstraint(boost::shared_ptr fun, * @param constraint_expr :: The constraint expression. * @param penalty_expr :: The penalty expression. */ -void FunctionFactoryImpl::addConstraint(boost::shared_ptr fun, +void FunctionFactoryImpl::addConstraint(const boost::shared_ptr &fun, const Expression &constraint_expr, const Expression &penalty_expr) const { auto c = std::unique_ptr( @@ -335,7 +335,7 @@ void FunctionFactoryImpl::addConstraint(boost::shared_ptr fun, * @param expr :: The tie expression: either parName = TieString or a list * of name = string pairs */ -void FunctionFactoryImpl::addTies(IFunction_sptr fun, +void FunctionFactoryImpl::addTies(const IFunction_sptr &fun, const Expression &expr) const { if (expr.name() == "=") { addTie(fun, expr); @@ -350,7 +350,7 @@ void FunctionFactoryImpl::addTies(IFunction_sptr fun, * @param fun :: The function * @param expr :: The tie expression: parName = TieString */ -void FunctionFactoryImpl::addTie(IFunction_sptr fun, +void FunctionFactoryImpl::addTie(const IFunction_sptr &fun, const Expression &expr) const { if (expr.size() > 1) { // if size > 2 it is interpreted as setting a tie (last // expr.term) to multiple parameters, e.g diff --git a/Framework/API/src/FunctionGenerator.cpp b/Framework/API/src/FunctionGenerator.cpp index 5a601242606cc5c92d3cb8af33a8c44635af30b7..a5b08fe53618f43f57d0f0b94922293fb9be7704 100644 --- a/Framework/API/src/FunctionGenerator.cpp +++ b/Framework/API/src/FunctionGenerator.cpp @@ -4,6 +4,8 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + +#include + #include "MantidAPI/FunctionGenerator.h" #include "MantidAPI/IConstraint.h" #include "MantidAPI/ParameterTie.h" @@ -14,7 +16,7 @@ namespace API { using namespace Kernel; /// Constructor -FunctionGenerator::FunctionGenerator(IFunction_sptr source) +FunctionGenerator::FunctionGenerator(const IFunction_sptr &source) : m_source(source), m_dirty(true) { if (source) { m_nOwnParams = source->nParams(); @@ -27,7 +29,7 @@ void FunctionGenerator::init() {} /// Set the source function /// @param source :: New source function. void FunctionGenerator::setSource(IFunction_sptr source) const { - m_source = source; + m_source = std::move(source); } /// Set i-th parameter diff --git a/Framework/API/src/GridDomain1D.cpp b/Framework/API/src/GridDomain1D.cpp index b177e7c0d10bd43fda81d4b36062fd80c015a7de..3f076e75acaccff830558fb19ce019053d38c821 100644 --- a/Framework/API/src/GridDomain1D.cpp +++ b/Framework/API/src/GridDomain1D.cpp @@ -17,7 +17,7 @@ namespace Mantid { namespace API { void GridDomain1D::initialize(double &startX, double &endX, size_t &n, - const std::string scaling) { + const std::string &scaling) { m_points.resize(n); m_points.front() = startX; m_points.back() = endX; diff --git a/Framework/API/src/GroupingLoader.cpp b/Framework/API/src/GroupingLoader.cpp index 527ad4d151b26269239388af22713524ac675f25..d34c9b75864d048ac16a798dc72555797326c83a 100644 --- a/Framework/API/src/GroupingLoader.cpp +++ b/Framework/API/src/GroupingLoader.cpp @@ -16,6 +16,7 @@ #include #include #include +#include using namespace Poco::XML; @@ -27,7 +28,7 @@ namespace API { * @param instrument :: [input] Instrument */ GroupingLoader::GroupingLoader(Geometry::Instrument_const_sptr instrument) - : m_instrument(instrument) {} + : m_instrument(std::move(instrument)) {} /** Constructor with field direction * @param instrument :: [input] Instrument @@ -35,7 +36,8 @@ GroupingLoader::GroupingLoader(Geometry::Instrument_const_sptr instrument) */ GroupingLoader::GroupingLoader(Geometry::Instrument_const_sptr instrument, const std::string &mainFieldDirection) - : m_instrument(instrument), m_mainFieldDirection(mainFieldDirection) {} + : m_instrument(std::move(instrument)), + m_mainFieldDirection(mainFieldDirection) {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -248,7 +250,7 @@ boost::shared_ptr GroupingLoader::getDummyGrouping() { * Construct a Grouping from a table * @param table :: [input] Table to construct from */ -Grouping::Grouping(ITableWorkspace_sptr table) { +Grouping::Grouping(const ITableWorkspace_sptr &table) { for (size_t row = 0; row < table->rowCount(); ++row) { std::vector detectors = table->cell>(row, 0); diff --git a/Framework/API/src/HistoryItem.cpp b/Framework/API/src/HistoryItem.cpp index 917e1d076ea490bb2f49cac713823841331d643e..34208d196c36e70196457d07265f97fc87015613 100644 --- a/Framework/API/src/HistoryItem.cpp +++ b/Framework/API/src/HistoryItem.cpp @@ -7,13 +7,15 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- +#include + #include "MantidAPI/HistoryItem.h" namespace Mantid { namespace API { HistoryItem::HistoryItem(AlgorithmHistory_const_sptr algHist) - : m_algorithmHistory(algHist), m_unrolled(false) {} + : m_algorithmHistory(std::move(algHist)), m_unrolled(false) {} } // namespace API } // namespace Mantid diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index 848edf8ec09cf89005295f7abf955a753dd916ff..43c5e4b1e69667f868acc6958a6cccb22ef2dd74 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -38,6 +38,7 @@ #include #include #include +#include namespace Mantid { namespace API { @@ -87,7 +88,7 @@ boost::shared_ptr IFunction::clone() const { */ void IFunction::setProgressReporter( boost::shared_ptr reporter) { - m_progReporter = reporter; + m_progReporter = std::move(reporter); m_progReporter->setNotifyStep(0.01); } @@ -1241,9 +1242,10 @@ void IFunction::setMatrixWorkspace( * @param wsIndex :: workspace index * @return converted value */ -double IFunction::convertValue(double value, Kernel::Unit_sptr &outUnit, - boost::shared_ptr ws, - size_t wsIndex) const { +double +IFunction::convertValue(double value, Kernel::Unit_sptr &outUnit, + const boost::shared_ptr &ws, + size_t wsIndex) const { // only required if formula or look-up-table different from ws unit const auto &wsUnit = ws->getAxis(0)->unit(); if (outUnit->unitID() == wsUnit->unitID()) @@ -1271,7 +1273,7 @@ double IFunction::convertValue(double value, Kernel::Unit_sptr &outUnit, */ void IFunction::convertValue(std::vector &values, Kernel::Unit_sptr &outUnit, - boost::shared_ptr ws, + const boost::shared_ptr &ws, size_t wsIndex) const { // only required if formula or look-up-table different from ws unit const auto &wsUnit = ws->getAxis(0)->unit(); @@ -1448,7 +1450,7 @@ void IFunction::storeReadOnlyAttribute( * @param covar :: A matrix to set. */ void IFunction::setCovarianceMatrix( - boost::shared_ptr> covar) { + const boost::shared_ptr> &covar) { // the matrix shouldn't be empty if (!covar) { throw std::invalid_argument( diff --git a/Framework/API/src/IMDWorkspace.cpp b/Framework/API/src/IMDWorkspace.cpp index 4933089184a59665a7e9003060eb2178335b303c..4e84206a2f8bab302f14d857b61751c1cfc0a740 100644 --- a/Framework/API/src/IMDWorkspace.cpp +++ b/Framework/API/src/IMDWorkspace.cpp @@ -12,6 +12,7 @@ #include "MantidKernel/VMD.h" #include +#include using Mantid::Kernel::VMD; @@ -53,7 +54,7 @@ std::string IMDWorkspace::getConvention() const { return m_convention; } /** @return the convention */ void IMDWorkspace::setConvention(std::string convention) { - m_convention = convention; + m_convention = std::move(convention); } //--------------------------------------------------------------------------------------------- diff --git a/Framework/API/src/IndexProperty.cpp b/Framework/API/src/IndexProperty.cpp index e26dd75e5075ea6b4f7311f89e19fd0011539545..e1b5e3b54995bcf8ca4ea45bd5d0b3129366ca78 100644 --- a/Framework/API/src/IndexProperty.cpp +++ b/Framework/API/src/IndexProperty.cpp @@ -4,6 +4,8 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + +#include + #include "MantidAPI/IndexProperty.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidIndexing/GlobalSpectrumIndex.h" @@ -16,9 +18,10 @@ namespace API { IndexProperty::IndexProperty(const std::string &name, const IWorkspaceProperty &workspaceProp, const IndexTypeProperty &indexTypeProp, - Kernel::IValidator_sptr validator) - : ArrayProperty(name, "", validator), m_workspaceProp(workspaceProp), - m_indexTypeProp(indexTypeProp), m_indices(0), m_indicesExtracted(false) {} + const Kernel::IValidator_sptr &validator) + : ArrayProperty(name, "", std::move(validator)), + m_workspaceProp(workspaceProp), m_indexTypeProp(indexTypeProp), + m_indices(0), m_indicesExtracted(false) {} IndexProperty *IndexProperty::clone() const { return new IndexProperty(*this); } diff --git a/Framework/API/src/JointDomain.cpp b/Framework/API/src/JointDomain.cpp index b77efd802930226720e2d2c256b2b20548f98ef3..f6b6490db31bf4bc277be1cfea7b35ce73b5591b 100644 --- a/Framework/API/src/JointDomain.cpp +++ b/Framework/API/src/JointDomain.cpp @@ -33,7 +33,7 @@ const FunctionDomain &JointDomain::getDomain(size_t i) const { * Add a new domain. * @param domain :: A shared pointer to a domain. */ -void JointDomain::addDomain(FunctionDomain_sptr domain) { +void JointDomain::addDomain(const FunctionDomain_sptr &domain) { m_domains.emplace_back(domain); } diff --git a/Framework/API/src/MDGeometry.cpp b/Framework/API/src/MDGeometry.cpp index 8c0291e077c1b25e1587a90fa4409abbdc76a0ed..08de2f9e6dd324482c192b15656bfacf38f9cdd7 100644 --- a/Framework/API/src/MDGeometry.cpp +++ b/Framework/API/src/MDGeometry.cpp @@ -14,6 +14,7 @@ #include #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -244,7 +245,7 @@ size_t MDGeometry::getDimensionIndexById(const std::string &id) const { /** Add a dimension * @param dim :: shared pointer to the dimension object */ void MDGeometry::addDimension( - boost::shared_ptr dim) { + const boost::shared_ptr &dim) { m_dimensions.emplace_back(dim); } @@ -382,7 +383,7 @@ void MDGeometry::setOriginalWorkspace(boost::shared_ptr ws, size_t index) { if (index >= m_originalWorkspaces.size()) m_originalWorkspaces.resize(index + 1); - m_originalWorkspaces[index] = ws; + m_originalWorkspaces[index] = std::move(ws); m_notificationHelper->watchForWorkspaceDeletions(); } diff --git a/Framework/API/src/MultiPeriodGroupWorker.cpp b/Framework/API/src/MultiPeriodGroupWorker.cpp index 0631fe5d508960782034edfbcc24be48f1893ed4..19e2b1ba6e4cbfd3196b0b34d68dcc45e283acac 100644 --- a/Framework/API/src/MultiPeriodGroupWorker.cpp +++ b/Framework/API/src/MultiPeriodGroupWorker.cpp @@ -36,7 +36,7 @@ MultiPeriodGroupWorker::MultiPeriodGroupWorker( * @param vecWorkspaceGroups: Vector of non-multi period workspace groups. */ void MultiPeriodGroupWorker::tryAddInputWorkspaceToInputGroups( - Workspace_sptr ws, + const Workspace_sptr &ws, MultiPeriodGroupWorker::VecWSGroupType &vecMultiPeriodWorkspaceGroups, MultiPeriodGroupWorker::VecWSGroupType &vecWorkspaceGroups) const { WorkspaceGroup_sptr inputGroup = diff --git a/Framework/API/src/MultipleExperimentInfos.cpp b/Framework/API/src/MultipleExperimentInfos.cpp index 9906877314c69a2655beed6ec75bb9cea5d317bc..7433e6efa12965ef5f8f4c9059fcf3a5f22db27e 100644 --- a/Framework/API/src/MultipleExperimentInfos.cpp +++ b/Framework/API/src/MultipleExperimentInfos.cpp @@ -11,6 +11,7 @@ #include #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -62,7 +63,8 @@ MultipleExperimentInfos::getExperimentInfo(const uint16_t runIndex) const { * @return the runIndex at which it was added * @throw std::runtime_error if you reach the limit of 65536 entries. */ -uint16_t MultipleExperimentInfos::addExperimentInfo(ExperimentInfo_sptr ei) { +uint16_t +MultipleExperimentInfos::addExperimentInfo(const ExperimentInfo_sptr &ei) { m_expInfos.emplace_back(ei); if (m_expInfos.size() >= static_cast(std::numeric_limits::max())) @@ -82,7 +84,7 @@ void MultipleExperimentInfos::setExperimentInfo(const uint16_t runIndex, if (size_t(runIndex) >= m_expInfos.size()) throw std::invalid_argument( "MDEventWorkspace::setExperimentInfo(): runIndex is out of range."); - m_expInfos[runIndex] = ei; + m_expInfos[runIndex] = std::move(ei); } //----------------------------------------------------------------------------------------------- diff --git a/Framework/API/src/NotebookBuilder.cpp b/Framework/API/src/NotebookBuilder.cpp index f74ac2867491e6f51fb5bd18acd070b94acfecaf..e3f2bcc48ddd6a6ccef2a1834f235bc54c08ac5e 100644 --- a/Framework/API/src/NotebookBuilder.cpp +++ b/Framework/API/src/NotebookBuilder.cpp @@ -14,6 +14,7 @@ #include "MantidKernel/Property.h" #include +#include namespace Mantid { namespace API { @@ -25,10 +26,10 @@ namespace { Mantid::Kernel::Logger g_log("NotebookBuilder"); } -NotebookBuilder::NotebookBuilder(boost::shared_ptr view, +NotebookBuilder::NotebookBuilder(const boost::shared_ptr &view, std::string versionSpecificity) : m_historyItems(view->getAlgorithmsList()), m_output(), - m_versionSpecificity(versionSpecificity), + m_versionSpecificity(std::move(versionSpecificity)), m_nb_writer(new NotebookWriter()) {} /** @@ -39,9 +40,9 @@ NotebookBuilder::NotebookBuilder(boost::shared_ptr view, * @param ws_comment :: workspace comment * @return a formatted ipython notebook string of the history */ -const std::string NotebookBuilder::build(std::string ws_name, - std::string ws_title, - std::string ws_comment) { +const std::string NotebookBuilder::build(const std::string &ws_name, + const std::string &ws_title, + const std::string &ws_comment) { // record workspace details in notebook std::string workspace_details; workspace_details = "Workspace History: " + ws_name + "\n"; @@ -109,8 +110,8 @@ void NotebookBuilder::buildChildren( * @param algHistory :: pointer to an algorithm history object * @returns std::string to run this algorithm */ -const std::string -NotebookBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) { +const std::string NotebookBuilder::buildAlgorithmString( + const AlgorithmHistory_const_sptr &algHistory) { std::ostringstream properties; const std::string name = algHistory->name(); std::string prop; @@ -159,8 +160,8 @@ NotebookBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) { * @param propHistory :: reference to a property history object * @returns std::string for this property */ -const std::string -NotebookBuilder::buildPropertyString(PropertyHistory_const_sptr propHistory) { +const std::string NotebookBuilder::buildPropertyString( + const PropertyHistory_const_sptr &propHistory) { using Mantid::Kernel::Direction; // Create a vector of all non workspace property type names diff --git a/Framework/API/src/NotebookWriter.cpp b/Framework/API/src/NotebookWriter.cpp index e61de82600f8e4fdb9fbe79aadfff6401e87aeb5..25d7e80de99609a6ab251a631dd0a8077906199e 100644 --- a/Framework/API/src/NotebookWriter.cpp +++ b/Framework/API/src/NotebookWriter.cpp @@ -4,6 +4,8 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + +#include + #include "MantidAPI/NotebookWriter.h" #include "MantidKernel/Logger.h" #include "MantidKernel/MantidVersion.h" @@ -34,7 +36,7 @@ void NotebookWriter::codeCell(Json::Value array_code) { cell_data["cell_type"] = "code"; cell_data["collapsed"] = false; - cell_data["input"] = array_code; + cell_data["input"] = std::move(array_code); cell_data["language"] = "python"; cell_data["metadata"] = empty; cell_data["outputs"] = Json::Value(Json::arrayValue); @@ -47,7 +49,7 @@ void NotebookWriter::codeCell(Json::Value array_code) { * * @param string_code :: string containing the python for the code cell */ -std::string NotebookWriter::codeCell(std::string string_code) { +std::string NotebookWriter::codeCell(const std::string &string_code) { Json::Value cell_data; const Json::Value empty = Json::Value(Json::ValueType::objectValue); @@ -77,7 +79,7 @@ void NotebookWriter::markdownCell(Json::Value string_array) { cell_data["cell_type"] = "markdown"; cell_data["metadata"] = empty; - cell_data["source"] = string_array; + cell_data["source"] = std::move(string_array); m_cell_buffer.append(cell_data); } @@ -87,7 +89,7 @@ void NotebookWriter::markdownCell(Json::Value string_array) { * * @param string_text :: string containing the python code for the code cell */ -std::string NotebookWriter::markdownCell(std::string string_text) { +std::string NotebookWriter::markdownCell(const std::string &string_text) { Json::Value cell_data; const Json::Value empty = Json::Value(Json::ValueType::objectValue); diff --git a/Framework/API/src/RemoteJobManagerFactory.cpp b/Framework/API/src/RemoteJobManagerFactory.cpp index 08709cac5ca74d31426f9f98ea143ccad311b076..1231e13dde9fb50d64bb5c2bbff418c128f850c2 100644 --- a/Framework/API/src/RemoteJobManagerFactory.cpp +++ b/Framework/API/src/RemoteJobManagerFactory.cpp @@ -65,8 +65,8 @@ IRemoteJobManager_sptr RemoteJobManagerFactoryImpl::create( * the type (for example the type is not recognized). */ Mantid::API::IRemoteJobManager_sptr -RemoteJobManagerFactoryImpl::create(const std::string baseURL, - const std::string jobManagerType) const { +RemoteJobManagerFactoryImpl::create(const std::string &baseURL, + const std::string &jobManagerType) const { Mantid::API::IRemoteJobManager_sptr jm; // use the inherited/generic create method diff --git a/Framework/API/src/Sample.cpp b/Framework/API/src/Sample.cpp index 36b92ab36b62be70764b1249a2e47bdf18c4ca87..b26a1a04bafcfe80d37d1636cde7ddfa7e3900b1 100644 --- a/Framework/API/src/Sample.cpp +++ b/Framework/API/src/Sample.cpp @@ -284,7 +284,7 @@ std::size_t Sample::size() const { return m_samples.size() + 1; } * Adds a sample to the sample collection * @param childSample The child sample to be added */ -void Sample::addSample(boost::shared_ptr childSample) { +void Sample::addSample(const boost::shared_ptr &childSample) { m_samples.emplace_back(childSample); } diff --git a/Framework/API/src/ScopedWorkspace.cpp b/Framework/API/src/ScopedWorkspace.cpp index 177288a3f3ad39adad0e8f7dc664573ad844de7d..58a5085d27558f07c3e26bf369f540fc6d972e87 100644 --- a/Framework/API/src/ScopedWorkspace.cpp +++ b/Framework/API/src/ScopedWorkspace.cpp @@ -4,8 +4,10 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidAPI/ScopedWorkspace.h" +#include + #include "MantidAPI/AnalysisDataService.h" +#include "MantidAPI/ScopedWorkspace.h" #include "MantidAPI/WorkspaceGroup.h" namespace Mantid { @@ -22,9 +24,9 @@ ScopedWorkspace::ScopedWorkspace() : m_name(generateUniqueName()) {} /** * Workspace constructor */ -ScopedWorkspace::ScopedWorkspace(Workspace_sptr ws) +ScopedWorkspace::ScopedWorkspace(const Workspace_sptr &ws) : m_name(generateUniqueName()) { - set(ws); + set(std::move(ws)); } //---------------------------------------------------------------------------------------------- @@ -77,7 +79,7 @@ void ScopedWorkspace::remove() { /** * Make ADS entry to point to the given workspace. */ -void ScopedWorkspace::set(Workspace_sptr newWS) { +void ScopedWorkspace::set(const Workspace_sptr &newWS) { AnalysisDataServiceImpl &ads = AnalysisDataService::Instance(); if (!newWS->getName().empty() && ads.doesExist(newWS->getName())) diff --git a/Framework/API/src/ScriptBuilder.cpp b/Framework/API/src/ScriptBuilder.cpp index 127f9380be24eb4d0249442c256941ca503db093..07d800bebdf57a329d6e3adc186deee14d2cc080 100644 --- a/Framework/API/src/ScriptBuilder.cpp +++ b/Framework/API/src/ScriptBuilder.cpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace Mantid { namespace API { @@ -36,14 +37,15 @@ Mantid::Kernel::Logger g_log("ScriptBuilder"); const std::string COMMENT_ALG = "Comment"; ScriptBuilder::ScriptBuilder( - boost::shared_ptr view, std::string versionSpecificity, + const boost::shared_ptr &view, std::string versionSpecificity, bool appendTimestamp, std::vector ignoreTheseAlgs, std::vector> ignoreTheseAlgProperties, bool appendExecCount) : m_historyItems(view->getAlgorithmsList()), m_output(), - m_versionSpecificity(versionSpecificity), - m_timestampCommands(appendTimestamp), m_algsToIgnore(ignoreTheseAlgs), - m_propertiesToIgnore(ignoreTheseAlgProperties), + m_versionSpecificity(std::move(versionSpecificity)), + m_timestampCommands(appendTimestamp), + m_algsToIgnore(std::move(ignoreTheseAlgs)), + m_propertiesToIgnore(std::move(ignoreTheseAlgProperties)), m_execCount(appendExecCount) {} /** diff --git a/Framework/API/src/SpectrumDetectorMapping.cpp b/Framework/API/src/SpectrumDetectorMapping.cpp index 6a1213489a939970ec232de5115c7c414f57a988..c05ed206e8dba917df65d38bf14327ece602e6f1 100644 --- a/Framework/API/src/SpectrumDetectorMapping.cpp +++ b/Framework/API/src/SpectrumDetectorMapping.cpp @@ -15,7 +15,7 @@ namespace API { * @throws std::invalid_argument if a null workspace pointer is passed in */ SpectrumDetectorMapping::SpectrumDetectorMapping( - MatrixWorkspace_const_sptr workspace, const bool useSpecNoIndex) + const MatrixWorkspace_const_sptr &workspace, const bool useSpecNoIndex) : m_indexIsSpecNo(useSpecNoIndex) { if (!workspace) { throw std::invalid_argument( diff --git a/Framework/API/src/WorkspaceHistory.cpp b/Framework/API/src/WorkspaceHistory.cpp index 167409dbd6c23d9bb57748ccbc8db5c89537f4cf..dfa12b0cafccbc78c015afeb0b69a69e6521b93c 100644 --- a/Framework/API/src/WorkspaceHistory.cpp +++ b/Framework/API/src/WorkspaceHistory.cpp @@ -317,7 +317,7 @@ void WorkspaceHistory::loadNexus(::NeXus::File *file) { * the workspace history. */ void WorkspaceHistory::loadNestedHistory(::NeXus::File *file, - AlgorithmHistory_sptr parent) { + const AlgorithmHistory_sptr &parent) { // historyNumbers should be sorted by number std::set historyNumbers = findHistoryEntries(file); for (auto historyNumber : historyNumbers) { diff --git a/Framework/API/src/WorkspaceOpOverloads.cpp b/Framework/API/src/WorkspaceOpOverloads.cpp index 770c1b8b9b2273dd87e29b31c7945c6d36a86f82..e640abf0cdde4500de7899c1d26178be7d609411 100644 --- a/Framework/API/src/WorkspaceOpOverloads.cpp +++ b/Framework/API/src/WorkspaceOpOverloads.cpp @@ -141,7 +141,7 @@ template MANTID_API_DLL IMDHistoWorkspace_sptr executeBinaryOperation( * @param tolerance :: acceptable difference for floating point numbers * @return bool, true if workspaces match */ -bool equals(const MatrixWorkspace_sptr lhs, const MatrixWorkspace_sptr rhs, +bool equals(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs, double tolerance) { IAlgorithm_sptr alg = AlgorithmManager::Instance().createUnmanaged("CompareWorkspaces"); @@ -180,8 +180,8 @@ using OperatorOverloads::executeBinaryOperation; * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Plus", lhs, rhs); } @@ -191,7 +191,7 @@ MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -203,8 +203,8 @@ MatrixWorkspace_sptr operator+(const MatrixWorkspace_sptr lhs, * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Minus", lhs, rhs); } @@ -214,7 +214,7 @@ MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -227,7 +227,7 @@ MatrixWorkspace_sptr operator-(const MatrixWorkspace_sptr lhs, * @return The result in a workspace shared pointer */ MatrixWorkspace_sptr operator-(const double &lhsValue, - const MatrixWorkspace_sptr rhs) { + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation( "Minus", createWorkspaceSingleValue(lhsValue), rhs); @@ -237,8 +237,8 @@ MatrixWorkspace_sptr operator-(const double &lhsValue, * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Multiply", lhs, rhs); } @@ -248,7 +248,7 @@ MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -262,7 +262,7 @@ MatrixWorkspace_sptr operator*(const MatrixWorkspace_sptr lhs, * @return The result in a workspace shared pointer */ MatrixWorkspace_sptr operator*(const double &lhsValue, - const MatrixWorkspace_sptr rhs) { + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation( "Multiply", createWorkspaceSingleValue(lhsValue), rhs); @@ -273,8 +273,8 @@ MatrixWorkspace_sptr operator*(const double &lhsValue, * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Divide", lhs, rhs); } @@ -284,7 +284,7 @@ MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -298,7 +298,7 @@ MatrixWorkspace_sptr operator/(const MatrixWorkspace_sptr lhs, * @return The result in a workspace shared pointer */ MatrixWorkspace_sptr operator/(const double &lhsValue, - const MatrixWorkspace_sptr rhs) { + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation( "Divide", createWorkspaceSingleValue(lhsValue), rhs); @@ -309,8 +309,8 @@ MatrixWorkspace_sptr operator/(const double &lhsValue, * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Plus", lhs, rhs, true); } @@ -320,7 +320,7 @@ MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -332,8 +332,8 @@ MatrixWorkspace_sptr operator+=(const MatrixWorkspace_sptr lhs, * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Minus", lhs, rhs, true); } @@ -343,7 +343,7 @@ MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -355,8 +355,8 @@ MatrixWorkspace_sptr operator-=(const MatrixWorkspace_sptr lhs, * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Multiply", lhs, rhs, true); @@ -367,7 +367,7 @@ MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -379,8 +379,8 @@ MatrixWorkspace_sptr operator*=(const MatrixWorkspace_sptr lhs, * @param rhs :: right hand side workspace shared pointer * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator/=(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs) { +MatrixWorkspace_sptr operator/=(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs) { return executeBinaryOperation("Divide", lhs, rhs, true); } @@ -390,7 +390,7 @@ MatrixWorkspace_sptr operator/=(const MatrixWorkspace_sptr lhs, * @param rhsValue :: the single value * @return The result in a workspace shared pointer */ -MatrixWorkspace_sptr operator/=(const MatrixWorkspace_sptr lhs, +MatrixWorkspace_sptr operator/=(const MatrixWorkspace_sptr &lhs, const double &rhsValue) { return executeBinaryOperation( @@ -490,7 +490,7 @@ bool WorkspaceHelpers::sharedXData(const MatrixWorkspace &WS) { * @param forwards :: If true (the default) divides by bin width, if false * multiplies */ -void WorkspaceHelpers::makeDistribution(MatrixWorkspace_sptr workspace, +void WorkspaceHelpers::makeDistribution(const MatrixWorkspace_sptr &workspace, const bool forwards) { // If we're not able to get a writable reference to Y, then this is an event // workspace, which we can't operate on. diff --git a/Framework/API/test/AlgorithmHistoryTest.h b/Framework/API/test/AlgorithmHistoryTest.h index f3025039cdb106bf302337fa0f8dcd85f29f4449..735c71f5fa40df0e2f3f60991194130fb2ecb820 100644 --- a/Framework/API/test/AlgorithmHistoryTest.h +++ b/Framework/API/test/AlgorithmHistoryTest.h @@ -239,7 +239,7 @@ private: return AlgorithmHistory(&alg, execTime, 14.0, m_execCount++); } - AlgorithmHistory createFromTestAlg(std::string paramValue) { + AlgorithmHistory createFromTestAlg(const std::string ¶mValue) { Algorithm *testInput = new testalg; testInput->initialize(); testInput->setPropertyValue("arg1_param", paramValue); diff --git a/Framework/API/test/AlgorithmProxyTest.h b/Framework/API/test/AlgorithmProxyTest.h index 8dc5017571a8a8141e80adde264ebe7f4ae010a9..bff605adc012261bb356f7708ac5b2d8b8d5d7e2 100644 --- a/Framework/API/test/AlgorithmProxyTest.h +++ b/Framework/API/test/AlgorithmProxyTest.h @@ -17,6 +17,7 @@ #include #include +#include using namespace Mantid::API; using namespace Mantid::Kernel; @@ -121,7 +122,8 @@ public: TestProxyObserver() : AlgorithmObserver(), start(false), progress(false), finish(false) {} TestProxyObserver(IAlgorithm_const_sptr alg) - : AlgorithmObserver(alg), start(false), progress(false), finish(false) {} + : AlgorithmObserver(std::move(alg)), start(false), progress(false), + finish(false) {} void startHandle(const IAlgorithm *) override { start = true; } void progressHandle(const IAlgorithm *, double p, const std::string &msg) override { diff --git a/Framework/API/test/AlgorithmTest.h b/Framework/API/test/AlgorithmTest.h index cc5350719e3d039c446f9d0bc68fc8172a9ab8cd..e0d91c1adc03f77bef83b83464e5e92f75d51912 100644 --- a/Framework/API/test/AlgorithmTest.h +++ b/Framework/API/test/AlgorithmTest.h @@ -27,6 +27,7 @@ #include "MantidTestHelpers/FakeObjects.h" #include "PropertyManagerHelper.h" #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -511,8 +512,9 @@ public: /** Test of setting read and/or write locks * for various combinations of input/output workspaces. */ - void do_test_locking(std::string in1, std::string in2, std::string inout, - std::string out1, std::string out2) { + void do_test_locking(const std::string &in1, const std::string &in2, + const std::string &inout, const std::string &out1, + const std::string &out2) { for (size_t i = 0; i < 6; i++) { boost::shared_ptr ws = boost::make_shared(); @@ -586,7 +588,8 @@ public: * Make no group if blank, just 1 workspace * @return The new WorkspaceGroup object */ - Workspace_sptr makeWorkspaceGroup(std::string group1, std::string contents1) { + Workspace_sptr makeWorkspaceGroup(const std::string &group1, + std::string contents1) { auto &ads = AnalysisDataService::Instance(); if (contents1.empty()) { if (group1.empty()) @@ -614,14 +617,14 @@ public: } //------------------------------------------------------------------------ - WorkspaceGroup_sptr do_test_groups(std::string group1, std::string contents1, - std::string group2, std::string contents2, - std::string group3, std::string contents3, - bool expectFail = false, - int expectedNumber = 3) { - makeWorkspaceGroup(group1, contents1); - makeWorkspaceGroup(group2, contents2); - makeWorkspaceGroup(group3, contents3); + WorkspaceGroup_sptr + do_test_groups(const std::string &group1, std::string contents1, + const std::string &group2, std::string contents2, + const std::string &group3, std::string contents3, + bool expectFail = false, int expectedNumber = 3) { + makeWorkspaceGroup(group1, std::move(contents1)); + makeWorkspaceGroup(group2, std::move(contents2)); + makeWorkspaceGroup(group3, std::move(contents3)); StubbedWorkspaceAlgorithm alg; alg.initialize(); diff --git a/Framework/API/test/AnalysisDataServiceObserverTest.h b/Framework/API/test/AnalysisDataServiceObserverTest.h index 11240363aeb8f2b1d13fd77046b37b333a2b6f6b..46bbbee62718ee3357cdb86157f84a048bd3a140 100644 --- a/Framework/API/test/AnalysisDataServiceObserverTest.h +++ b/Framework/API/test/AnalysisDataServiceObserverTest.h @@ -109,7 +109,7 @@ public: m_mockInheritingClass = std::make_unique(); } - void addWorkspaceToADS(std::string name = "dummy") { + void addWorkspaceToADS(const std::string &name = "dummy") { IAlgorithm_sptr alg = Mantid::API::AlgorithmManager::Instance().createUnmanaged( "CreateSampleWorkspace"); diff --git a/Framework/API/test/ExperimentInfoTest.h b/Framework/API/test/ExperimentInfoTest.h index c7bb1f79bb94bfcdd7b0266a16541fbd3b9bafee..09cef48c58a4bb6a460faecbb51acc1fd84a5e0d 100644 --- a/Framework/API/test/ExperimentInfoTest.h +++ b/Framework/API/test/ExperimentInfoTest.h @@ -880,14 +880,14 @@ private: } Instrument_sptr - addInstrumentWithIndirectEmodeParameter(ExperimentInfo_sptr exptInfo) { + addInstrumentWithIndirectEmodeParameter(const ExperimentInfo_sptr &exptInfo) { Instrument_sptr inst = addInstrument(exptInfo); exptInfo->instrumentParameters().addString(inst.get(), "deltaE-mode", "indirect"); return inst; } - Instrument_sptr addInstrument(ExperimentInfo_sptr exptInfo) { + Instrument_sptr addInstrument(const ExperimentInfo_sptr &exptInfo) { Instrument_sptr inst = ComponentCreationHelper::createTestInstrumentCylindrical(1); exptInfo->setInstrument(inst); diff --git a/Framework/API/test/FunctionFactoryTest.h b/Framework/API/test/FunctionFactoryTest.h index 520179ff17a046a69dfafe53e1134e555c2ca4c0..71f77b73cceea6c06c0e101112edae00ed9c3e96 100644 --- a/Framework/API/test/FunctionFactoryTest.h +++ b/Framework/API/test/FunctionFactoryTest.h @@ -476,7 +476,7 @@ public: TS_ASSERT(second); // test each individual function - auto testFunc = [](CompositeFunction_sptr f) { + auto testFunc = [](const CompositeFunction_sptr &f) { if (f) { TS_ASSERT_EQUALS(f->nFunctions(), 2); TS_ASSERT_EQUALS(f->getFunction(0)->name(), diff --git a/Framework/API/test/LiveListenerFactoryTest.h b/Framework/API/test/LiveListenerFactoryTest.h index 6bcf7bf29dddd2ac1db3c6fe674a4b3ab52f6e1b..c3fa9bdc09557cdad7fca627fb9d44a034bc218f 100644 --- a/Framework/API/test/LiveListenerFactoryTest.h +++ b/Framework/API/test/LiveListenerFactoryTest.h @@ -14,6 +14,8 @@ #include #include +#include + using namespace Mantid; using namespace Mantid::API; @@ -29,7 +31,7 @@ class MockLiveListenerInstantiator public: MockLiveListenerInstantiator( boost::shared_ptr product) - : product(product) {} + : product(std::move(product)) {} boost::shared_ptr createInstance() const override { diff --git a/Framework/API/test/LogManagerTest.h b/Framework/API/test/LogManagerTest.h index aa677c3e04e495f0f9d8439a6ed68a791b6dd65d..fbcb69b8112365dbb894701ee39c29947344b842 100644 --- a/Framework/API/test/LogManagerTest.h +++ b/Framework/API/test/LogManagerTest.h @@ -63,7 +63,8 @@ void addTestTimeSeries(LogManager &run, const std::string &name) { } } // namespace -void addTimeSeriesEntry(LogManager &runInfo, std::string name, double val) { +void addTimeSeriesEntry(LogManager &runInfo, const std::string &name, + double val) { TimeSeriesProperty *tsp; tsp = new TimeSeriesProperty(name); tsp->addValue("2011-05-24T00:00:00", val); diff --git a/Framework/API/test/MultiPeriodGroupTestBase.h b/Framework/API/test/MultiPeriodGroupTestBase.h index a164ac160814f489e12977880755bf2a977074be..6a27600bb90b7afe45c1591bf4d0722278d80375 100644 --- a/Framework/API/test/MultiPeriodGroupTestBase.h +++ b/Framework/API/test/MultiPeriodGroupTestBase.h @@ -28,7 +28,7 @@ class MultiPeriodGroupTestBase { protected: // Helper method to add multiperiod logs to make a workspacegroup look like a // real multiperiod workspace group. - void add_periods_logs(WorkspaceGroup_sptr ws) { + void add_periods_logs(const WorkspaceGroup_sptr &ws) { int nperiods = static_cast(ws->size()); for (size_t i = 0; i < ws->size(); ++i) { MatrixWorkspace_sptr currentWS = @@ -45,7 +45,7 @@ protected: /// Helper to fabricate a workspace group consisting of equal sized /// matrixworkspaces. WorkspaceGroup_sptr - create_good_multiperiod_workspace_group(const std::string name) { + create_good_multiperiod_workspace_group(const std::string &name) { MatrixWorkspace_sptr a = MatrixWorkspace_sptr(new WorkspaceTester); MatrixWorkspace_sptr b = MatrixWorkspace_sptr(new WorkspaceTester); diff --git a/Framework/API/test/PeakFunctionIntegratorTest.h b/Framework/API/test/PeakFunctionIntegratorTest.h index 6c5730fc3bcec746bb14342f213384e1815d42c7..e6a3303cd4dde48305482f92f8dfd85be6222659 100644 --- a/Framework/API/test/PeakFunctionIntegratorTest.h +++ b/Framework/API/test/PeakFunctionIntegratorTest.h @@ -84,7 +84,8 @@ private: return gaussian; } - double getGaussianAnalyticalInfiniteIntegral(IPeakFunction_sptr gaussian) { + double + getGaussianAnalyticalInfiniteIntegral(const IPeakFunction_sptr &gaussian) { return gaussian->height() * gaussian->fwhm() / (2.0 * sqrt(M_LN2)) * sqrt(M_PI); } diff --git a/Framework/API/test/RunTest.h b/Framework/API/test/RunTest.h index e74db89faf05dbdb6c5a9362270d17e233e63e57..288ee1643e191765a5ec6a9651ada6561951b116 100644 --- a/Framework/API/test/RunTest.h +++ b/Framework/API/test/RunTest.h @@ -427,7 +427,7 @@ public: TS_ASSERT_EQUALS(runCopy.getGoniometer().getNumberAxes(), 3); } - void addTimeSeriesEntry(Run &runInfo, std::string name, double val) { + void addTimeSeriesEntry(Run &runInfo, const std::string &name, double val) { TimeSeriesProperty *tsp; tsp = new TimeSeriesProperty(name); tsp->addValue("2011-05-24T00:00:00", val); diff --git a/Framework/API/test/WorkspaceGroupTest.h b/Framework/API/test/WorkspaceGroupTest.h index 953000c8b23d5f4212ed0a57c8e311ed68bf83a9..37565ec2f0125c450b9ee63d35d6096932c8e2a9 100644 --- a/Framework/API/test/WorkspaceGroupTest.h +++ b/Framework/API/test/WorkspaceGroupTest.h @@ -50,7 +50,7 @@ public: class WorkspaceGroupTest : public CxxTest::TestSuite { private: /// Helper method to add an 'nperiods' log value to each workspace in a group. - void add_periods_logs(WorkspaceGroup_sptr ws, int nperiods = -1) { + void add_periods_logs(const WorkspaceGroup_sptr &ws, int nperiods = -1) { for (size_t i = 0; i < ws->size(); ++i) { MatrixWorkspace_sptr currentWS = boost::dynamic_pointer_cast(ws->getItem(i)); diff --git a/Framework/API/test/WorkspaceNearestNeighboursTest.h b/Framework/API/test/WorkspaceNearestNeighboursTest.h index 763903a9d9dcc75654b31e7e9e2d5dba44d98111..d5ec89e9485439b67fac4f776dd7ee075f22e499 100644 --- a/Framework/API/test/WorkspaceNearestNeighboursTest.h +++ b/Framework/API/test/WorkspaceNearestNeighboursTest.h @@ -59,7 +59,7 @@ private: : public Mantid::API::WorkspaceNearestNeighbours { public: ExposedNearestNeighbours(const SpectrumInfo &spectrumInfo, - const std::vector spectrumNumbers, + const std::vector &spectrumNumbers, bool ignoreMasked = false) : WorkspaceNearestNeighbours(8, spectrumInfo, spectrumNumbers, ignoreMasked) {} diff --git a/Framework/Algorithms/inc/MantidAlgorithms/AddSampleLog.h b/Framework/Algorithms/inc/MantidAlgorithms/AddSampleLog.h index fd2709dfec96be20c80c94a00dc98814d746a693..5f59e620a7bdc08bb02724ffd93db19a9fb84560 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/AddSampleLog.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/AddSampleLog.h @@ -76,21 +76,22 @@ private: Types::Core::DateAndTime getRunStart(API::Run &run_obj); /// get value vector of the integer TimeSeriesProperty entries - std::vector getIntValues(API::MatrixWorkspace_const_sptr dataws, + std::vector getIntValues(const API::MatrixWorkspace_const_sptr &dataws, int workspace_index); /// get value vector of the double TimeSeriesProperty entries - std::vector getDblValues(API::MatrixWorkspace_const_sptr dataws, - int workspace_index); + std::vector + getDblValues(const API::MatrixWorkspace_const_sptr &dataws, + int workspace_index); /// get the vector of times of the TimeSeriesProperty entries std::vector - getTimes(API::MatrixWorkspace_const_sptr dataws, int workspace_index, + getTimes(const API::MatrixWorkspace_const_sptr &dataws, int workspace_index, bool is_epoch, bool is_second, API::Run &run_obj); /// get meta data from input workspace or user input - void getMetaData(API::MatrixWorkspace_const_sptr dataws, bool &epochtime, - std::string &timeunit); + void getMetaData(const API::MatrixWorkspace_const_sptr &dataws, + bool &epochtime, std::string &timeunit); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/AlignDetectors.h b/Framework/Algorithms/inc/MantidAlgorithms/AlignDetectors.h index 262863c52e947411830ed47ae158706d82e5f61c..b2dba6d8716db4b3252f7a350b47245f59f04e81 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/AlignDetectors.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/AlignDetectors.h @@ -73,9 +73,9 @@ private: void align(const ConversionFactors &converter, API::Progress &progress, DataObjects::EventWorkspace &outputWS); - void loadCalFile(API::MatrixWorkspace_sptr inputWS, + void loadCalFile(const API::MatrixWorkspace_sptr &inputWS, const std::string &filename); - void getCalibrationWS(API::MatrixWorkspace_sptr inputWS); + void getCalibrationWS(const API::MatrixWorkspace_sptr &inputWS); Mantid::API::ITableWorkspace_sptr m_calibrationWS; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Bin2DPowderDiffraction.h b/Framework/Algorithms/inc/MantidAlgorithms/Bin2DPowderDiffraction.h index 8df86f65df339ee7a04969faf1ffe6c1d78bf2c2..5bd4f7d1bd5c6c8f3df6faa7f27c8c33f25b3342 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Bin2DPowderDiffraction.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Bin2DPowderDiffraction.h @@ -47,7 +47,7 @@ private: DataObjects::EventWorkspace_sptr m_inputWS; ///< Pointer to the input event workspace int m_numberOfSpectra; ///< The number of spectra in the workspace - void normalizeToBinArea(API::MatrixWorkspace_sptr outWS); + void normalizeToBinArea(const API::MatrixWorkspace_sptr &outWS); }; double calcD(double wavelength, double sintheta); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/BinaryOperation.h b/Framework/Algorithms/inc/MantidAlgorithms/BinaryOperation.h index 095d6e2c18ac7f2ed3722f7ab4d53578a45ad7f7..f8598c52cdf2b22216541b3d9968a09f78db9c47 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/BinaryOperation.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/BinaryOperation.h @@ -193,7 +193,7 @@ protected: (void)ans; }; - OperandType getOperandType(const API::MatrixWorkspace_const_sptr ws); + OperandType getOperandType(const API::MatrixWorkspace_const_sptr &ws); virtual void checkRequirements(); @@ -255,8 +255,8 @@ private: void doSingleColumn(); void do2D(bool mismatchedSpectra); - void propagateBinMasks(const API::MatrixWorkspace_const_sptr rhs, - API::MatrixWorkspace_sptr out); + void propagateBinMasks(const API::MatrixWorkspace_const_sptr &rhs, + const API::MatrixWorkspace_sptr &out); /// Progress reporting std::unique_ptr m_progress = nullptr; }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h index 3342d463b0fd87b4240ace76f93037d308cb5e03..f1be5292a6be993923b03832422a9cfcb6faa734 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h @@ -61,10 +61,10 @@ private: API::MatrixWorkspace_sptr createOutputWorkspace(const API::MatrixWorkspace_sptr &inputWS, - const std::string) const; - void deleteWorkspace(API::MatrixWorkspace_sptr workspace); + const std::string &) const; + void deleteWorkspace(const API::MatrixWorkspace_sptr &workspace); API::MatrixWorkspace_sptr - setUncertainties(API::MatrixWorkspace_sptr workspace); + setUncertainties(const API::MatrixWorkspace_sptr &workspace); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateDynamicRange.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateDynamicRange.h index 4af1002d855fe118c045ed9ca9117065836b000a..bdf3f4a5bfc4b05ce5f77be4098d99f77dfcfefa 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateDynamicRange.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateDynamicRange.h @@ -25,8 +25,8 @@ public: private: void init() override; void exec() override; - void calculateQMinMax(API::MatrixWorkspace_sptr, const std::vector &, - const std::string &); + void calculateQMinMax(const API::MatrixWorkspace_sptr &, + const std::vector &, const std::string &); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateEfficiency.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateEfficiency.h index a781121fb442011680b1d63f3c64a13334e92f5a..b88b74a74fa40b7352af657a57d96e7a6672a7a7 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateEfficiency.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateEfficiency.h @@ -70,19 +70,19 @@ private: void exec() override; /// Sum all detectors, excluding monitors and masked detectors - void sumUnmaskedDetectors(API::MatrixWorkspace_sptr rebinnedWS, double &sum, - double &error, int &nPixels); + void sumUnmaskedDetectors(const API::MatrixWorkspace_sptr &rebinnedWS, + double &sum, double &error, int &nPixels); /// Normalize all detectors to get the relative efficiency - void normalizeDetectors(API::MatrixWorkspace_sptr rebinnedWS, - API::MatrixWorkspace_sptr outputWS, double sum, + void normalizeDetectors(const API::MatrixWorkspace_sptr &rebinnedWS, + const API::MatrixWorkspace_sptr &outputWS, double sum, double error, int nPixels, double min_eff, double max_eff); void maskComponent(API::MatrixWorkspace &ws, const std::string &componentName); - void maskEdges(API::MatrixWorkspace_sptr ws, int high, int low, int left, - int right, const std::string &componentName); + void maskEdges(const API::MatrixWorkspace_sptr &ws, int high, int low, + int left, int right, const std::string &componentName); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateIqt.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateIqt.h index c2267bea170ee245cc0796c20acb6653142d1f5e..e060732d340ebfb03447639628ab3a4925add227 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateIqt.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateIqt.h @@ -28,24 +28,26 @@ private: std::map validateInputs() override; std::string rebinParamsAsString(); API::MatrixWorkspace_sptr - monteCarloErrorCalculation(API::MatrixWorkspace_sptr sample, - API::MatrixWorkspace_sptr resolution, + monteCarloErrorCalculation(const API::MatrixWorkspace_sptr &sample, + const API::MatrixWorkspace_sptr &resolution, const std::string &rebinParams, const int seed, const bool calculateErrors, const int nIterations); - API::MatrixWorkspace_sptr rebin(API::MatrixWorkspace_sptr workspace, + API::MatrixWorkspace_sptr rebin(const API::MatrixWorkspace_sptr &workspace, const std::string ¶ms); - API::MatrixWorkspace_sptr integration(API::MatrixWorkspace_sptr workspace); API::MatrixWorkspace_sptr - convertToPointData(API::MatrixWorkspace_sptr workspace); + integration(const API::MatrixWorkspace_sptr &workspace); API::MatrixWorkspace_sptr - extractFFTSpectrum(API::MatrixWorkspace_sptr workspace); - API::MatrixWorkspace_sptr divide(API::MatrixWorkspace_sptr lhsWorkspace, - API::MatrixWorkspace_sptr rhsWorkspace); - API::MatrixWorkspace_sptr cropWorkspace(API::MatrixWorkspace_sptr workspace, - const double xMax); + convertToPointData(const API::MatrixWorkspace_sptr &workspace); API::MatrixWorkspace_sptr - replaceSpecialValues(API::MatrixWorkspace_sptr workspace); + extractFFTSpectrum(const API::MatrixWorkspace_sptr &workspace); + API::MatrixWorkspace_sptr + divide(const API::MatrixWorkspace_sptr &lhsWorkspace, + const API::MatrixWorkspace_sptr &rhsWorkspace); + API::MatrixWorkspace_sptr + cropWorkspace(const API::MatrixWorkspace_sptr &workspace, const double xMax); + API::MatrixWorkspace_sptr + replaceSpecialValues(const API::MatrixWorkspace_sptr &workspace); API::MatrixWorkspace_sptr removeInvalidData(API::MatrixWorkspace_sptr workspace); @@ -54,7 +56,7 @@ private: const std::string &rebinParams); API::MatrixWorkspace_sptr calculateIqt(API::MatrixWorkspace_sptr workspace, - API::MatrixWorkspace_sptr resolutionWorkspace, + const API::MatrixWorkspace_sptr &resolutionWorkspace, const std::string &rebinParams); API::MatrixWorkspace_sptr doSimulation(API::MatrixWorkspace_sptr sample, API::MatrixWorkspace_sptr resolution, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmission.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmission.h index bd42d4ffaa665286b117432efb7d25420a6627ac..1a9c176f94447ceee85a412531eae1a93e600160 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmission.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmission.h @@ -80,27 +80,27 @@ private: void exec() override; /// Pull out a single spectrum from a 2D workspace - API::MatrixWorkspace_sptr extractSpectra(API::MatrixWorkspace_sptr ws, + API::MatrixWorkspace_sptr extractSpectra(const API::MatrixWorkspace_sptr &ws, const std::vector &indices); /// Returns a workspace with the evaulation of the fit to the calculated /// transmission fraction - API::MatrixWorkspace_sptr fit(API::MatrixWorkspace_sptr raw, + API::MatrixWorkspace_sptr fit(const API::MatrixWorkspace_sptr &raw, const std::vector &rebinParams, - const std::string fitMethod); + const std::string &fitMethod); /// Call the Linear fitting algorithm as a child algorithm - API::MatrixWorkspace_sptr fitData(API::MatrixWorkspace_sptr WS, double &grad, - double &offset); + API::MatrixWorkspace_sptr fitData(const API::MatrixWorkspace_sptr &WS, + double &grad, double &offset); /// Call the Polynomial fitting algorithm as a child algorithm - API::MatrixWorkspace_sptr fitPolynomial(API::MatrixWorkspace_sptr WS, + API::MatrixWorkspace_sptr fitPolynomial(const API::MatrixWorkspace_sptr &WS, int order, std::vector &coeficients); /// Calls the rebin algorithm API::MatrixWorkspace_sptr rebin(const std::vector &binParams, - API::MatrixWorkspace_sptr ws); + const API::MatrixWorkspace_sptr &ws); /// Outpus message to log if the detector at the given index is not a monitor /// in both input workspaces. - void logIfNotMonitor(API::MatrixWorkspace_sptr sampleWS, - API::MatrixWorkspace_sptr directWS, size_t index); + void logIfNotMonitor(const API::MatrixWorkspace_sptr &sampleWS, + const API::MatrixWorkspace_sptr &directWS, size_t index); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmissionBeamSpreader.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmissionBeamSpreader.h index 1e59400328374843dea53c76bb5d4487e08f31b7..ed1123c24199e4b23405f5550a290c26533c0c3c 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmissionBeamSpreader.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateTransmissionBeamSpreader.h @@ -85,12 +85,12 @@ private: void exec() override; /// Pull out a single spectrum from a 2D workspace - API::MatrixWorkspace_sptr extractSpectrum(API::MatrixWorkspace_sptr WS, + API::MatrixWorkspace_sptr extractSpectrum(const API::MatrixWorkspace_sptr &WS, const size_t index); /// Call the Linear fitting algorithm as a child algorithm - API::MatrixWorkspace_sptr fitToData(API::MatrixWorkspace_sptr WS); + API::MatrixWorkspace_sptr fitToData(const API::MatrixWorkspace_sptr &WS); /// Sum the total detector, excluding masked pixels and monitors - API::MatrixWorkspace_sptr sumSpectra(API::MatrixWorkspace_sptr WS); + API::MatrixWorkspace_sptr sumSpectra(const API::MatrixWorkspace_sptr &WS); bool logFit = false; ///< If true, will take log of transmission curve before fitting diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h b/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h index a2f95dfe92304354fd27ee9afcbd40e3b9b332f8..3077f12a103e26b77a9359fcf93507127650c4af 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h @@ -58,10 +58,10 @@ private: double coeff1, double coeff2, double coeff3, bool doAbs, bool doMS); - API::MatrixWorkspace_sptr multiply(const API::MatrixWorkspace_sptr lhsWS, - const API::MatrixWorkspace_sptr rhsWS); - API::MatrixWorkspace_sptr minus(const API::MatrixWorkspace_sptr lhsWS, - const API::MatrixWorkspace_sptr rhsWS); + API::MatrixWorkspace_sptr multiply(const API::MatrixWorkspace_sptr &lhsWS, + const API::MatrixWorkspace_sptr &rhsWS); + API::MatrixWorkspace_sptr minus(const API::MatrixWorkspace_sptr &lhsWS, + const API::MatrixWorkspace_sptr &rhsWS); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ChangeTimeZero.h b/Framework/Algorithms/inc/MantidAlgorithms/ChangeTimeZero.h index f2ce91329617827298a636d03c386c9fe8fbb174..ec2099ea8f25d8d51eec5fd3b5c8e1ecf41a8d12 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ChangeTimeZero.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ChangeTimeZero.h @@ -39,23 +39,24 @@ private: void exec() override; /// Create the output workspace Mantid::API::MatrixWorkspace_sptr - createOutputWS(Mantid::API::MatrixWorkspace_sptr input, double startProgress, - double stopProgress); + createOutputWS(const Mantid::API::MatrixWorkspace_sptr &input, + double startProgress, double stopProgress); /// Get the time shift - double getTimeShift(API::MatrixWorkspace_sptr ws) const; + double getTimeShift(const API::MatrixWorkspace_sptr &ws) const; /// Shift the time of the logs - void shiftTimeOfLogs(Mantid::API::MatrixWorkspace_sptr ws, double timeShift, - double startProgress, double stopProgress); + void shiftTimeOfLogs(const Mantid::API::MatrixWorkspace_sptr &ws, + double timeShift, double startProgress, + double stopProgress); /// Get the date and time of the first good frame of a workspace Mantid::Types::Core::DateAndTime - getStartTimeFromWorkspace(Mantid::API::MatrixWorkspace_sptr ws) const; + getStartTimeFromWorkspace(const Mantid::API::MatrixWorkspace_sptr &ws) const; /// Can the string be transformed to double - bool checkForDouble(std::string val) const; + bool checkForDouble(const std::string &val) const; /// Can the string be transformed to a DateTime bool checkForDateTime(const std::string &val) const; /// Time shift the log of a double series property - void shiftTimeInLogForTimeSeries(Mantid::API::MatrixWorkspace_sptr ws, + void shiftTimeInLogForTimeSeries(const Mantid::API::MatrixWorkspace_sptr &ws, Mantid::Kernel::Property *prop, double timeShift) const; /// Time shift the log of a string property @@ -63,7 +64,7 @@ private: Mantid::Kernel::PropertyWithValue *logEntry, double timeShift) const; // Shift the time of the neutrons - void shiftTimeOfNeutrons(Mantid::API::MatrixWorkspace_sptr ws, + void shiftTimeOfNeutrons(const Mantid::API::MatrixWorkspace_sptr &ws, double timeShift, double startProgress, double stopProgress); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CompareWorkspaces.h b/Framework/Algorithms/inc/MantidAlgorithms/CompareWorkspaces.h index 67af3faa165aca2f426339ed4bed5a6b7a74e38a..107db8a58bf43e244442a0e9206bf911c0a12f58 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CompareWorkspaces.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CompareWorkspaces.h @@ -95,28 +95,30 @@ private: bool processGroups() override; /// Process the two groups - void processGroups(boost::shared_ptr groupOne, - boost::shared_ptr groupTwo); + void + processGroups(const boost::shared_ptr &groupOne, + const boost::shared_ptr &groupTwo); void doComparison(); void doPeaksComparison(DataObjects::PeaksWorkspace_sptr tws1, DataObjects::PeaksWorkspace_sptr tws2); - void doTableComparison(API::ITableWorkspace_const_sptr tws1, - API::ITableWorkspace_const_sptr tws2); - void doMDComparison(API::Workspace_sptr w1, API::Workspace_sptr w2); + void doTableComparison(const API::ITableWorkspace_const_sptr &tws1, + const API::ITableWorkspace_const_sptr &tws2); + void doMDComparison(const API::Workspace_sptr &w1, + const API::Workspace_sptr &w2); bool compareEventWorkspaces(const DataObjects::EventWorkspace &ews1, const DataObjects::EventWorkspace &ews2); - bool checkData(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2); - bool checkAxes(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2); - bool checkSpectraMap(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2); - bool checkInstrument(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2); - bool checkMasking(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2); + bool checkData(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2); + bool checkAxes(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2); + bool checkSpectraMap(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2); + bool checkInstrument(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2); + bool checkMasking(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2); bool checkSample(const API::Sample &sample1, const API::Sample &sample2); bool checkRunProperties(const API::Run &run1, const API::Run &run2); @@ -130,7 +132,7 @@ private: size_t &numdiffweight) const; /// Records a mismatch in the Messages workspace and sets Result to false - void recordMismatch(std::string msg, std::string ws1 = "", + void recordMismatch(const std::string &msg, std::string ws1 = "", std::string ws2 = ""); bool relErr(double x1, double x2, double errorVal) const; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ConjoinXRuns.h b/Framework/Algorithms/inc/MantidAlgorithms/ConjoinXRuns.h index 382d9012d01b942a710d3381679a1a62343dde63..bd95f9d9988782ed3962573994b3df313135b119 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ConjoinXRuns.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ConjoinXRuns.h @@ -42,8 +42,8 @@ private: void init() override; void exec() override; - std::string checkLogEntry(API::MatrixWorkspace_sptr) const; - std::vector getXAxis(API::MatrixWorkspace_sptr) const; + std::string checkLogEntry(const API::MatrixWorkspace_sptr &) const; + std::vector getXAxis(const API::MatrixWorkspace_sptr &) const; void joinSpectrum(int64_t); /// Sample log entry name diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ConvertEmptyToTof.h b/Framework/Algorithms/inc/MantidAlgorithms/ConvertEmptyToTof.h index 064281492b0f2012cd1801fc49d42f5c2ca0c51a..ddb8efc44bf35ece27d37adfcc5d33717e50dbd7 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ConvertEmptyToTof.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ConvertEmptyToTof.h @@ -58,7 +58,8 @@ private: bool areEqual(double, double, double); int roundUp(double); std::vector makeTofAxis(int, double, size_t, double); - void setTofInWS(const std::vector &, API::MatrixWorkspace_sptr); + void setTofInWS(const std::vector &, + const API::MatrixWorkspace_sptr &); DataObjects::Workspace2D_sptr m_inputWS; API::MatrixWorkspace_sptr m_outputWS; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis.h b/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis.h index 16370d79ad3d2b4897690b1e8f7bc5f0625c448c..c901152c2a8bbceaf409ec0f41fdd1c4869e49d6 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ConvertSpectrumAxis.h @@ -61,7 +61,8 @@ private: void exec() override; /// Getting Efixed double getEfixed(const Mantid::Geometry::IDetector &detector, - API::MatrixWorkspace_const_sptr inputWS, int emode) const; + const API::MatrixWorkspace_const_sptr &inputWS, + int emode) const; }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ConvertToConstantL2.h b/Framework/Algorithms/inc/MantidAlgorithms/ConvertToConstantL2.h index 77ee90c93e77f18069c463f97d8133fe3b634096..0b7263119f73b4f0dae996dce28a484d827496bf 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ConvertToConstantL2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ConvertToConstantL2.h @@ -51,8 +51,8 @@ private: void init() override; void exec() override; void initWorkspaces(); - double getRunProperty(std::string); - double getInstrumentProperty(std::string); + double getRunProperty(const std::string &); + double getInstrumentProperty(const std::string &); double calculateTOF(double); /// The user selected (input) workspace diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ConvertUnits.h b/Framework/Algorithms/inc/MantidAlgorithms/ConvertUnits.h index 44ae9d412ba3a00bad84de8b5f52b7922bae531b..aef3ddfa017ab62fa36e41e4a8270af7d220f1f9 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ConvertUnits.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ConvertUnits.h @@ -69,12 +69,12 @@ public: protected: /// Reverses the workspace if X values are in descending order - void reverse(API::MatrixWorkspace_sptr WS); + void reverse(const API::MatrixWorkspace_sptr &WS); /// For conversions to energy transfer, removes bins corresponding to /// inaccessible values API::MatrixWorkspace_sptr - removeUnphysicalBins(const API::MatrixWorkspace_const_sptr workspace); + removeUnphysicalBins(const API::MatrixWorkspace_const_sptr &workspace); const std::string workspaceMethodName() const override { return "convertUnits"; @@ -87,21 +87,21 @@ protected: void init() override; void exec() override; - void setupMemberVariables(const API::MatrixWorkspace_const_sptr inputWS); + void setupMemberVariables(const API::MatrixWorkspace_const_sptr &inputWS); virtual void storeEModeOnWorkspace(API::MatrixWorkspace_sptr outputWS); API::MatrixWorkspace_sptr - setupOutputWorkspace(const API::MatrixWorkspace_const_sptr inputWS); + setupOutputWorkspace(const API::MatrixWorkspace_const_sptr &inputWS); /// Executes the main part of the algorithm that handles the conversion of the /// units API::MatrixWorkspace_sptr - executeUnitConversion(const API::MatrixWorkspace_sptr inputWS); + executeUnitConversion(const API::MatrixWorkspace_sptr &inputWS); /// Convert the workspace units according to a simple output = a * (input^b) /// relationship API::MatrixWorkspace_sptr - convertQuickly(API::MatrixWorkspace_const_sptr inputWS, const double &factor, - const double &power); + convertQuickly(const API::MatrixWorkspace_const_sptr &inputWS, + const double &factor, const double &power); /// Internal function to gather detector specific L2, theta and efixed values bool getDetectorValues(const API::SpectrumInfo &spectrumInfo, @@ -118,11 +118,11 @@ protected: // Calls Rebin as a Child Algorithm to align the bins of the output workspace API::MatrixWorkspace_sptr - alignBins(const API::MatrixWorkspace_sptr workspace); + alignBins(const API::MatrixWorkspace_sptr &workspace); const std::vector - calculateRebinParams(const API::MatrixWorkspace_const_sptr workspace) const; + calculateRebinParams(const API::MatrixWorkspace_const_sptr &workspace) const; - void putBackBinWidth(const API::MatrixWorkspace_sptr outputWS); + void putBackBinWidth(const API::MatrixWorkspace_sptr &outputWS); std::size_t m_numberOfSpectra{ 0}; ///< The number of spectra in the input workspace diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h b/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h index b6d92fc6624b8da2ada6db00e8d603d7fb067b84..3d802a8f70a232898e1ca7c767ec3a3145f724e0 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CorrectKiKf.h @@ -75,7 +75,7 @@ private: */ template void correctKiKfEventHelper(std::vector &wevector, double efixed, - const std::string emodeStr); + const std::string &emodeStr); void getEfixedFromParameterMap(double &Efi, int64_t i, const Mantid::API::SpectrumInfo &spectrumInfo, const Mantid::Geometry::ParameterMap &pmap); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CorrectTOFAxis.h b/Framework/Algorithms/inc/MantidAlgorithms/CorrectTOFAxis.h index 487e6eeefc09854e9d260198342be2d2cbbd2ecc..cc380fc5809a251fc2e578b4d8f5cb45918a897d 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CorrectTOFAxis.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CorrectTOFAxis.h @@ -43,8 +43,8 @@ private: void init() override; std::map validateInputs() override; void exec() override; - void useReferenceWorkspace(API::MatrixWorkspace_sptr outputWs); - void correctManually(API::MatrixWorkspace_sptr outputWs); + void useReferenceWorkspace(const API::MatrixWorkspace_sptr &outputWs); + void correctManually(const API::MatrixWorkspace_sptr &outputWs); double averageL2(const API::SpectrumInfo &spectrumInfo); void averageL2AndEPP(const API::SpectrumInfo &spectrumInfo, double &l2, double &epp); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CorrectToFile.h b/Framework/Algorithms/inc/MantidAlgorithms/CorrectToFile.h index b460a19d2ed7d4138bda54529641a937ae8dffa9..345a4d5f1c95aad8ebb2dd55ac9b5ebfec2f7215 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CorrectToFile.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CorrectToFile.h @@ -54,8 +54,9 @@ private: /// Load in the RKH file for that has the correction information API::MatrixWorkspace_sptr loadInFile(const std::string &corrFile); /// Multiply or divide the input workspace as specified by the user - void doWkspAlgebra(API::MatrixWorkspace_sptr lhs, - API::MatrixWorkspace_sptr rhs, const std::string &algName, + void doWkspAlgebra(const API::MatrixWorkspace_sptr &lhs, + const API::MatrixWorkspace_sptr &rhs, + const std::string &algName, API::MatrixWorkspace_sptr &result); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CreateFloodWorkspace.h b/Framework/Algorithms/inc/MantidAlgorithms/CreateFloodWorkspace.h index 0a6222f000c052be4e199c4c82c2722d82cb209b..5ee9bb5ebaae98f5eea734a5c109ca21b6387b32 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CreateFloodWorkspace.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CreateFloodWorkspace.h @@ -30,8 +30,8 @@ private: void exec() override; API::MatrixWorkspace_sptr getInputWorkspace(); std::string getBackgroundFunction(); - API::MatrixWorkspace_sptr integrate(API::MatrixWorkspace_sptr ws); - API::MatrixWorkspace_sptr transpose(API::MatrixWorkspace_sptr ws); + API::MatrixWorkspace_sptr integrate(const API::MatrixWorkspace_sptr &ws); + API::MatrixWorkspace_sptr transpose(const API::MatrixWorkspace_sptr &ws); bool shouldRemoveBackground(); void collectExcludedSpectra(); bool isExcludedSpectrum(double spec) const; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CreateLogTimeCorrection.h b/Framework/Algorithms/inc/MantidAlgorithms/CreateLogTimeCorrection.h index 1b5ac646c72b1b09a18cd77e84d82064486061d5..3b394e4a005198b9dbf42a54f27579fb1335e6d3 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CreateLogTimeCorrection.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CreateLogTimeCorrection.h @@ -65,7 +65,7 @@ private: const std::vector &corrections) const; /// Write correction map to a text file - void writeCorrectionToFile(const std::string filename, + void writeCorrectionToFile(const std::string &filename, const Geometry::DetectorInfo &detectorInfo, const std::vector &corrections) const; }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CreatePSDBleedMask.h b/Framework/Algorithms/inc/MantidAlgorithms/CreatePSDBleedMask.h index 983716706a5bd137f8474349813ea5d8aaa8ab85..eef18d270f10da0133c6f46b6e8be189bf21a7e4 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CreatePSDBleedMask.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CreatePSDBleedMask.h @@ -53,11 +53,11 @@ private: /// Process a tube bool performBleedTest(const std::vector &tubeIndices, - API::MatrixWorkspace_const_sptr inputWS, double maxRate, - int numIgnoredPixels); + const API::MatrixWorkspace_const_sptr &inputWS, + double maxRate, int numIgnoredPixels); /// Mask a tube with the given workspace indices void maskTube(const std::vector &tubeIndices, - API::MatrixWorkspace_sptr workspace); + const API::MatrixWorkspace_sptr &workspace); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CreateSampleWorkspace.h b/Framework/Algorithms/inc/MantidAlgorithms/CreateSampleWorkspace.h index ca5266bb9224c437b1d7dc0732126260835930cf..31f7422b0e544e75548d900e2f0a7fa423ece1ef 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CreateSampleWorkspace.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CreateSampleWorkspace.h @@ -42,16 +42,18 @@ private: DataObjects::EventWorkspace_sptr createEventWorkspace(int numPixels, int numBins, int numMonitors, int numEvents, double x0, double binDelta, - Geometry::Instrument_sptr inst, + const Geometry::Instrument_sptr &inst, const std::string &functionString, bool isRandom); API::MatrixWorkspace_sptr createHistogramWorkspace(int numPixels, int numBins, int numMonitors, double x0, double binDelta, - Geometry::Instrument_sptr inst, + const Geometry::Instrument_sptr &inst, const std::string &functionString, bool isRandom); - API::MatrixWorkspace_sptr createScanningWorkspace( - int numBins, double x0, double binDelta, Geometry::Instrument_sptr inst, - const std::string &functionString, bool isRandom, int numScanPoints); + API::MatrixWorkspace_sptr + createScanningWorkspace(int numBins, double x0, double binDelta, + const Geometry::Instrument_sptr &inst, + const std::string &functionString, bool isRandom, + int numScanPoints); Geometry::Instrument_sptr createTestInstrumentRectangular( API::Progress &progress, int numBanks, int numMonitors, int pixels, double pixelSpacing, const double bankDistanceFromSample, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace.h b/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace.h index 5d9c55fece6d12ee925720de802f93f1fbd1fcdf..2b0f5b58f403202174edacae001f9e066299ac5b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace.h @@ -35,7 +35,7 @@ private: const OptionalMinMax &wavelengthMonitorBackgroundInterval, const OptionalMinMax &wavelengthMonitorIntegrationInterval, const OptionalInteger &i0MonitorIndex, - API::MatrixWorkspace_sptr firstTransmissionRun, + const API::MatrixWorkspace_sptr &firstTransmissionRun, OptionalMatrixWorkspace_sptr secondTransmissionRun, const OptionalDouble &stitchingStart, const OptionalDouble &stitchingDelta, const OptionalDouble &stitchingEnd, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace2.h b/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace2.h index 5bb0688750848bdde85b1f9cb4f201985f1e17af..b277f7a731506e1228c68a030bd760ab495e1f22 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspace2.h @@ -36,15 +36,15 @@ private: /// Normalize by monitors API::MatrixWorkspace_sptr - normalizeDetectorsByMonitors(API::MatrixWorkspace_sptr IvsTOF); + normalizeDetectorsByMonitors(const API::MatrixWorkspace_sptr &IvsTOF); /// Get the run numbers of the input workspaces void getRunNumbers(); /// Get the run number of a given workspace std::string getRunNumber(std::string const &propertyName); /// Store a transition run in ADS - void setOutputTransmissionRun(int which, API::MatrixWorkspace_sptr ws); + void setOutputTransmissionRun(int which, const API::MatrixWorkspace_sptr &ws); /// Store the stitched transition workspace run in ADS - void setOutputWorkspace(API::MatrixWorkspace_sptr ws); + void setOutputWorkspace(const API::MatrixWorkspace_sptr &ws); /// Run numbers for the first/second transmission run std::string m_firstTransmissionRunNumber; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspaceAuto.h b/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspaceAuto.h index 471625df43a38e23d90ceec5d3c588d90e6eec60..75546c2e0858a3ec1d51a7809506bc73962eb8e6 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspaceAuto.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CreateTransmissionWorkspaceAuto.h @@ -36,7 +36,8 @@ private: void init() override; void exec() override; - template boost::optional isSet(std::string propName) const; + template + boost::optional isSet(const std::string &propName) const; }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/DetectorDiagnostic.h b/Framework/Algorithms/inc/MantidAlgorithms/DetectorDiagnostic.h index e0b95553eaf857d03a82d0792285cbb88ef5ac69..612883192212260bbadda9a33632d8098cb44849 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/DetectorDiagnostic.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/DetectorDiagnostic.h @@ -54,21 +54,21 @@ private: void init() override; void exec() override; /// Apply a given mask - void applyMask(API::MatrixWorkspace_sptr inputWS, - API::MatrixWorkspace_sptr maskWS); + void applyMask(const API::MatrixWorkspace_sptr &inputWS, + const API::MatrixWorkspace_sptr &maskWS); /// Perform checks on detector vanadium - API::MatrixWorkspace_sptr doDetVanTest(API::MatrixWorkspace_sptr inputWS, - int &nFails); + API::MatrixWorkspace_sptr + doDetVanTest(const API::MatrixWorkspace_sptr &inputWS, int &nFails); protected: /// Get the total counts for each spectra API::MatrixWorkspace_sptr - integrateSpectra(API::MatrixWorkspace_sptr inputWS, const int indexMin, + integrateSpectra(const API::MatrixWorkspace_sptr &inputWS, const int indexMin, const int indexMax, const double lower, const double upper, const bool outputWorkspace2D = false); DataObjects::MaskWorkspace_sptr - generateEmptyMask(API::MatrixWorkspace_const_sptr inputWS); + generateEmptyMask(const API::MatrixWorkspace_const_sptr &inputWS); /// Calculate the median of the given workspace. This assumes that the input /// workspace contains @@ -80,7 +80,8 @@ protected: API::MatrixWorkspace_sptr convertToRate(API::MatrixWorkspace_sptr workspace); /// method to check which spectra should be grouped when calculating the /// median - std::vector> makeMap(API::MatrixWorkspace_sptr countsWS); + std::vector> + makeMap(const API::MatrixWorkspace_sptr &countsWS); /// method to create the map with all spectra std::vector> makeInstrumentMap(const API::MatrixWorkspace &countsWS); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/DetectorEfficiencyVariation.h b/Framework/Algorithms/inc/MantidAlgorithms/DetectorEfficiencyVariation.h index 45618d558710456b6ada8eb1f6813b8280169979..205ada7ea22361b0f31514d046f73933cc9fe95c 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/DetectorEfficiencyVariation.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/DetectorEfficiencyVariation.h @@ -72,8 +72,8 @@ protected: API::MatrixWorkspace_sptr &whiteBeam2, double &variation, int &minSpec, int &maxSpec); /// Apply the detector test criterion - int doDetectorTests(API::MatrixWorkspace_const_sptr counts1, - API::MatrixWorkspace_const_sptr counts2, + int doDetectorTests(const API::MatrixWorkspace_const_sptr &counts1, + const API::MatrixWorkspace_const_sptr &counts2, const double average, double variation); private: diff --git a/Framework/Algorithms/inc/MantidAlgorithms/DiffractionEventCalibrateDetectors.h b/Framework/Algorithms/inc/MantidAlgorithms/DiffractionEventCalibrateDetectors.h index 059a5714105c44fa0e900952fdd24b8af1c9c279..1bf164a22f2f4725dc88258b22b027f51b689441 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/DiffractionEventCalibrateDetectors.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/DiffractionEventCalibrateDetectors.h @@ -49,12 +49,13 @@ public: } /// Function to optimize double intensity(double x, double y, double z, double rotx, double roty, - double rotz, std::string detname, std::string inname, - std::string outname, std::string peakOpt, - std::string rb_param, std::string groupWSName); + double rotz, const std::string &detname, + const std::string &inname, const std::string &outname, + const std::string &peakOpt, const std::string &rb_param, + const std::string &groupWSName); void movedetector(double x, double y, double z, double rotx, double roty, - double rotz, std::string detname, - Mantid::DataObjects::EventWorkspace_sptr inputW); + double rotz, const std::string &detname, + const Mantid::DataObjects::EventWorkspace_sptr &inputW); private: // Overridden Algorithm methods diff --git a/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h b/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h index 8795383fb3a05c2a48ae13c7d624d3b5ed2b05f3..ffe71bb24d0e090bd83f7d0c350ce684a70ad231 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/DiffractionFocussing.h @@ -78,7 +78,7 @@ private: void calculateRebinParams(const API::MatrixWorkspace_const_sptr &workspace, double &min, double &max, double &step); std::multimap - readGroupingFile(std::string groupingFileName); + readGroupingFile(const std::string &groupingFileName); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h b/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h index 65a3f8b9730479a233bd231ccad83cf10a9dcd39..3b131ab4ed52a5c9974261f237786bef68a667cb 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/EQSANSTofStructure.h @@ -60,12 +60,12 @@ private: void exec() override; // void execEvent(Mantid::DataObjects::EventWorkspace_sptr inputWS, bool // frame_skipping); - void execEvent(Mantid::DataObjects::EventWorkspace_sptr inputWS, + void execEvent(const Mantid::DataObjects::EventWorkspace_sptr &inputWS, double threshold, double frame_offset, double tof_frame_width, double tmp_frame_width, bool frame_skipping); /// Compute TOF offset - double getTofOffset(DataObjects::EventWorkspace_const_sptr inputWS, + double getTofOffset(const DataObjects::EventWorkspace_const_sptr &inputWS, bool frame_skipping); double frame_tof0; bool flight_path_correction; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ExportTimeSeriesLog.h b/Framework/Algorithms/inc/MantidAlgorithms/ExportTimeSeriesLog.h index 53771879bf564de1dcd993f605f5bbbf74991f6c..e2e3a903912d35914e64ec547ae4231ce9263a94 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ExportTimeSeriesLog.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ExportTimeSeriesLog.h @@ -58,7 +58,7 @@ private: const double &rel_start_time, size_t &i_start, const double &rel_stop_time, size_t &i_stop, const double &time_factor); - void exportLog(const std::string &logname, const std::string timeunit, + void exportLog(const std::string &logname, const std::string &timeunit, const double &starttime, const double &stoptime, const bool exportepoch, bool outputeventws, int numentries, bool cal_first_deriv); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h b/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h index 51caf074ea83d835478ade61e6f1234b5528771f..7c0173f5e99ec2fb0a521e2b91156649c7d3c82b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ExtractMaskToTable.h @@ -54,11 +54,11 @@ private: /// Parse input TableWorkspace to get a list of detectors IDs of which /// detector are already masked std::vector - parseMaskTable(DataObjects::TableWorkspace_sptr masktablews); + parseMaskTable(const DataObjects::TableWorkspace_sptr &masktablews); /// Parse a string containing list in format (x, xx-yy, x, x, ...) to a vector /// of detid_t - std::vector parseStringToVector(std::string liststr); + std::vector parseStringToVector(const std::string &liststr); /// Extract mask from a workspace to a list of detectors std::vector extractMaskFromMatrixWorkspace(); @@ -67,11 +67,12 @@ private: std::vector extractMaskFromMaskWorkspace(); /// Copy table workspace content from one workspace to another - void copyTableWorkspaceContent(DataObjects::TableWorkspace_sptr sourceWS, - DataObjects::TableWorkspace_sptr targetWS); + void + copyTableWorkspaceContent(const DataObjects::TableWorkspace_sptr &sourceWS, + const DataObjects::TableWorkspace_sptr &targetWS); /// Add a list of spectra (detector IDs) to the output table workspace - void addToTableWorkspace(DataObjects::TableWorkspace_sptr outws, + void addToTableWorkspace(const DataObjects::TableWorkspace_sptr &outws, std::vector maskeddetids, double xmin, double xmax, std::vector prevmaskedids); }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h b/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h index a91db4d2de5ab05abeeb8ae2c21a69d04755af07..95f0cedf2c8b31da6635ae8100bc297ff576cba2 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/FindPeaks.h @@ -170,8 +170,8 @@ private: /// Fit peak by calling 'FitPeak' double callFitPeak(const API::MatrixWorkspace_sptr &dataws, int wsindex, - const API::IPeakFunction_sptr peakfunction, - const API::IBackgroundFunction_sptr backgroundfunction, + const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &backgroundfunction, const std::vector &vec_fitwindow, const std::vector &vec_peakrange, int minGuessFWHM, int maxGuessFWHM, int guessedFWHMStep, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h b/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h index 2cf6b455d0cfa5bf7915d167dca9ae6065d5ae7c..692741c7a35052c6f5c57739356aac9ab3660c9b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/FitPeak.h @@ -38,14 +38,14 @@ public: } /// Set workspaces - void setWorskpace(API::MatrixWorkspace_sptr dataws, size_t wsindex); + void setWorskpace(const API::MatrixWorkspace_sptr &dataws, size_t wsindex); /// Set fitting method - void setFittingMethod(std::string minimizer, std::string costfunction); + void setFittingMethod(std::string minimizer, const std::string &costfunction); /// Set functions - void setFunctions(API::IPeakFunction_sptr peakfunc, - API::IBackgroundFunction_sptr bkgdfunc); + void setFunctions(const API::IPeakFunction_sptr &peakfunc, + const API::IBackgroundFunction_sptr &bkgdfunc); /// Set fit range void setFitWindow(double leftwindow, double rightwindow); @@ -95,52 +95,52 @@ private: bool hasSetupToFitPeak(std::string &errmsg); /// Estimate the peak height from a set of data containing pure peaks - double estimatePeakHeight(API::IPeakFunction_const_sptr peakfunc, - API::MatrixWorkspace_sptr dataws, size_t wsindex, - size_t ixmin, size_t ixmax); + double estimatePeakHeight(const API::IPeakFunction_const_sptr &peakfunc, + const API::MatrixWorkspace_sptr &dataws, + size_t wsindex, size_t ixmin, size_t ixmax); /// Check a peak function whether it is valid comparing to user specified /// criteria - double checkFittedPeak(API::IPeakFunction_sptr peakfunc, double costfuncvalue, - std::string &errorreason); + double checkFittedPeak(const API::IPeakFunction_sptr &peakfunc, + double costfuncvalue, std::string &errorreason); /// Fit peak function (flexible) - double fitPeakFunction(API::IPeakFunction_sptr peakfunc, - API::MatrixWorkspace_sptr dataws, size_t wsindex, - double startx, double endx); + double fitPeakFunction(const API::IPeakFunction_sptr &peakfunc, + const API::MatrixWorkspace_sptr &dataws, + size_t wsindex, double startx, double endx); /// Fit function in single domain double fitFunctionSD(API::IFunction_sptr fitfunc, - API::MatrixWorkspace_sptr dataws, size_t wsindex, + const API::MatrixWorkspace_sptr &dataws, size_t wsindex, double xmin, double xmax); /// Calculate chi-square of a single domain function - double calChiSquareSD(API::IFunction_sptr fitfunc, - API::MatrixWorkspace_sptr dataws, size_t wsindex, + double calChiSquareSD(const API::IFunction_sptr &fitfunc, + const API::MatrixWorkspace_sptr &dataws, size_t wsindex, double xmin, double xmax); /// Fit peak and background composite function - double fitCompositeFunction(API::IPeakFunction_sptr peakfunc, - API::IBackgroundFunction_sptr bkgdfunc, - API::MatrixWorkspace_sptr dataws, size_t wsindex, - double startx, double endx); + double fitCompositeFunction(const API::IPeakFunction_sptr &peakfunc, + const API::IBackgroundFunction_sptr &bkgdfunc, + const API::MatrixWorkspace_sptr &dataws, + size_t wsindex, double startx, double endx); /// Fit function in multiple-domain - double fitFunctionMD(API::IFunction_sptr fitfunc, - API::MatrixWorkspace_sptr dataws, size_t wsindex, + double fitFunctionMD(const API::IFunction_sptr &fitfunc, + const API::MatrixWorkspace_sptr &dataws, size_t wsindex, std::vector vec_xmin, std::vector vec_xmax); /// remove background - void removeBackground(API::MatrixWorkspace_sptr purePeakWS); + void removeBackground(const API::MatrixWorkspace_sptr &purePeakWS); /// Process and store fit result void processNStoreFitResult(double rwp, bool storebkgd); /// Back up fit result - std::map backup(API::IFunction_const_sptr func); + std::map backup(const API::IFunction_const_sptr &func); void pop(const std::map &funcparammap, - API::IFunction_sptr func); + const API::IFunction_sptr &func); /// Store function fitting error std::map @@ -316,14 +316,14 @@ private: /// Generate table workspace DataObjects::TableWorkspace_sptr - genOutputTableWS(API::IPeakFunction_sptr peakfunc, + genOutputTableWS(const API::IPeakFunction_sptr &peakfunc, std::map peakerrormap, - API::IBackgroundFunction_sptr bkgdfunc, + const API::IBackgroundFunction_sptr &bkgdfunc, std::map bkgderrormap); /// Add function's parameter names after peak function name std::vector - addFunctionParameterNames(std::vector funcnames); + addFunctionParameterNames(const std::vector &funcnames); /// Parse peak type from full peak type/parameter names string std::string parseFunctionTypeFull(const std::string &fullstring, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FitPeaks.h b/Framework/Algorithms/inc/MantidAlgorithms/FitPeaks.h index 44374d1f0733b41310d03a73c0db476d5db14098..286faf480dbb79b8440686e56a7caf196a3c8b8c 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/FitPeaks.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/FitPeaks.h @@ -43,7 +43,7 @@ public: double getParameterValue(size_t ipeak, size_t iparam) const; double getParameterError(size_t ipeak, size_t iparam) const; void setRecord(size_t ipeak, const double cost, const double peak_position, - const FitFunction fit_functions); + const FitFunction &fit_functions); void setBadRecord(size_t ipeak, const double peak_position); void setFunctionParameters(size_t ipeak, std::vector ¶m_values); @@ -122,46 +122,45 @@ private: /// fit peaks in a same spectrum void fitSpectrumPeaks( size_t wi, const std::vector &expected_peak_centers, - boost::shared_ptr fit_result); + const boost::shared_ptr &fit_result); /// fit background bool fitBackground(const size_t &ws_index, const std::pair &fit_window, const double &expected_peak_pos, - API::IBackgroundFunction_sptr bkgd_func); + const API::IBackgroundFunction_sptr &bkgd_func); // Peak fitting suite - double fitIndividualPeak(size_t wi, API::IAlgorithm_sptr fitter, + double fitIndividualPeak(size_t wi, const API::IAlgorithm_sptr &fitter, const double expected_peak_center, const std::pair &fitwindow, const bool observe_peak_params, - API::IPeakFunction_sptr peakfunction, - API::IBackgroundFunction_sptr bkgdfunc); + const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &bkgdfunc); /// Methods to fit functions (general) - double fitFunctionSD(API::IAlgorithm_sptr fit, - API::IPeakFunction_sptr peak_function, - API::IBackgroundFunction_sptr bkgd_function, - API::MatrixWorkspace_sptr dataws, size_t wsindex, + double fitFunctionSD(const API::IAlgorithm_sptr &fit, + const API::IPeakFunction_sptr &peak_function, + const API::IBackgroundFunction_sptr &bkgd_function, + const API::MatrixWorkspace_sptr &dataws, size_t wsindex, double xmin, double xmax, const double &expected_peak_center, bool observe_peak_shape, bool estimate_background); double fitFunctionMD(API::IFunction_sptr fit_function, - API::MatrixWorkspace_sptr dataws, size_t wsindex, + const API::MatrixWorkspace_sptr &dataws, size_t wsindex, std::vector &vec_xmin, std::vector &vec_xmax); /// fit a single peak with high background - double fitFunctionHighBackground(API::IAlgorithm_sptr fit, - const std::pair &fit_window, - const size_t &ws_index, - const double &expected_peak_center, - bool observe_peak_shape, - API::IPeakFunction_sptr peakfunction, - API::IBackgroundFunction_sptr bkgdfunc); - - void setupParameterTableWorkspace(API::ITableWorkspace_sptr table_ws, + double fitFunctionHighBackground( + const API::IAlgorithm_sptr &fit, + const std::pair &fit_window, const size_t &ws_index, + const double &expected_peak_center, bool observe_peak_shape, + const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &bkgdfunc); + + void setupParameterTableWorkspace(const API::ITableWorkspace_sptr &table_ws, const std::vector ¶m_names, bool with_chi2); @@ -171,7 +170,7 @@ private: std::vector &vec_e); /// Reduce background - void reduceByBackground(API::IBackgroundFunction_sptr bkgd_func, + void reduceByBackground(const API::IBackgroundFunction_sptr &bkgd_func, const std::vector &vec_x, std::vector &vec_y); @@ -183,7 +182,7 @@ private: /// Esitmate background by 'observation' void estimateBackground(const HistogramData::Histogram &histogram, const std::pair &peak_window, - API::IBackgroundFunction_sptr bkgd_function); + const API::IBackgroundFunction_sptr &bkgd_function); /// estimate linear background void estimateLinearBackground(const HistogramData::Histogram &histogram, double left_window_boundary, @@ -193,12 +192,12 @@ private: /// Estimate peak parameters by 'observation' int estimatePeakParameters(const HistogramData::Histogram &histogram, const std::pair &peak_window, - API::IPeakFunction_sptr peakfunction, - API::IBackgroundFunction_sptr bkgdfunction, + const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &bkgdfunction, bool observe_peak_width); bool decideToEstimatePeakParams(const bool firstPeakInSpectrum, - API::IPeakFunction_sptr peak_function); + const API::IPeakFunction_sptr &peak_function); /// observe peak center int observePeakCenter(const HistogramData::Histogram &histogram, @@ -215,8 +214,8 @@ private: void processSinglePeakFitResult( size_t wsindex, size_t peakindex, const double cost, const std::vector &expected_peak_positions, - FitPeaksAlgorithm::FitFunction fitfunction, - boost::shared_ptr fit_result); + const FitPeaksAlgorithm::FitFunction &fitfunction, + const boost::shared_ptr &fit_result); /// calculate peak+background for fitted void calculateFittedPeaks( @@ -224,8 +223,8 @@ private: fit_results); /// Get the parameter name for peak height (I or height or etc) - std::string - getPeakHeightParameterName(API::IPeakFunction_const_sptr peak_function); + std::string getPeakHeightParameterName( + const API::IPeakFunction_const_sptr &peak_function); /// Set the workspaces and etc to output properties void processOutputs( @@ -235,7 +234,7 @@ private: /// Write result of peak fit per spectrum to output analysis workspaces void writeFitResult( size_t wi, const std::vector &expected_positions, - boost::shared_ptr fit_result); + const boost::shared_ptr &fit_result); /// check whether FitPeaks supports observation on a certain peak profile's /// parameters (width!) diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h b/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h index bb65b15ab66cf8f2166c511e7ce15afbe706a9c3..5326180be0858270ae48fda558b1d3caf5978f80 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h @@ -76,7 +76,7 @@ private: void processInputTime(); void setFilterByTimeOnly(); - void setFilterByLogValue(std::string logname); + void setFilterByLogValue(const std::string &logname); void processSingleValueFilter(double minvalue, double maxvalue, bool filterincrease, bool filterdecrease); @@ -93,7 +93,7 @@ private: /// Make multiple-log-value filters in serial void makeMultipleFiltersByValues(std::map indexwsindexmap, - std::vector logvalueranges, + const std::vector &logvalueranges, bool centre, bool filterIncrease, bool filterDecrease, Types::Core::DateAndTime startTime, @@ -101,17 +101,19 @@ private: /// Make multiple-log-value filters in serial in parallel void makeMultipleFiltersByValuesParallel( - std::map indexwsindexmap, std::vector logvalueranges, - bool centre, bool filterIncrease, bool filterDecrease, + const std::map &indexwsindexmap, + const std::vector &logvalueranges, bool centre, + bool filterIncrease, bool filterDecrease, Types::Core::DateAndTime startTime, Types::Core::DateAndTime stopTime); /// Generate event splitters for partial sample log (serial) void makeMultipleFiltersByValuesPartialLog( int istart, int iend, std::vector &vecSplitTime, std::vector &vecSplitGroup, std::map indexwsindexmap, - const std::vector &logvalueranges, Types::Core::time_duration tol, - bool filterIncrease, bool filterDecrease, - Types::Core::DateAndTime startTime, Types::Core::DateAndTime stopTime); + const std::vector &logvalueranges, + const Types::Core::time_duration &tol, bool filterIncrease, + bool filterDecrease, Types::Core::DateAndTime startTime, + Types::Core::DateAndTime stopTime); /// Generate event filters for integer sample log void processIntegerValueFilter(int minvalue, int maxvalue, @@ -124,7 +126,7 @@ private: /// Add a splitter void addNewTimeFilterSplitter(Types::Core::DateAndTime starttime, Types::Core::DateAndTime stoptime, int wsindex, - std::string info); + const std::string &info); /// Create a splitter and add to the vector of time splitters Types::Core::DateAndTime diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GeneratePeaks.h b/Framework/Algorithms/inc/MantidAlgorithms/GeneratePeaks.h index 68e1fad7954bebd42c28aaa8659ed5fdbb06cafd..b10f8c3c6deaa673b2e50db2477f4e4630440489 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GeneratePeaks.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GeneratePeaks.h @@ -69,10 +69,11 @@ private: const std::map>> &functionmap, - API::MatrixWorkspace_sptr dataWS); + const API::MatrixWorkspace_sptr &dataWS); /// Check whether function has a certain parameter - bool hasParameter(API::IFunction_sptr function, std::string paramname); + bool hasParameter(const API::IFunction_sptr &function, + const std::string ¶mname); /// Create output workspace API::MatrixWorkspace_sptr createOutputWorkspace(); @@ -82,14 +83,15 @@ private: void createFunction(std::string &peaktype, std::string &bkgdtype); - void getSpectraSet(DataObjects::TableWorkspace_const_sptr peakParmsWS); + void getSpectraSet(const DataObjects::TableWorkspace_const_sptr &peakParmsWS); /// Get the IPeakFunction part in the input function - API::IPeakFunction_sptr getPeakFunction(API::IFunction_sptr infunction); + API::IPeakFunction_sptr + getPeakFunction(const API::IFunction_sptr &infunction); /// Add function parameter names to std::vector - addFunctionParameterNames(std::vector funcnames); + addFunctionParameterNames(const std::vector &funcnames); /// Peak function API::IPeakFunction_sptr m_peakFunction; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GetDetOffsetsMultiPeaks.h b/Framework/Algorithms/inc/MantidAlgorithms/GetDetOffsetsMultiPeaks.h index 455a940dc7bac78582519abdec29a2feaad16335..acdd85574617520b751566f61ebcc953c164bcd1 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GetDetOffsetsMultiPeaks.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GetDetOffsetsMultiPeaks.h @@ -80,11 +80,11 @@ private: /// Main function to calculate all detectors' offsets void calculateDetectorsOffsets(); - void - importFitWindowTableWorkspace(DataObjects::TableWorkspace_sptr windowtablews); + void importFitWindowTableWorkspace( + const DataObjects::TableWorkspace_sptr &windowtablews); /// Call Gaussian as a Child Algorithm to fit the peak in a spectrum - int fitSpectra(const int64_t wi, API::MatrixWorkspace_sptr inputW, + int fitSpectra(const int64_t wi, const API::MatrixWorkspace_sptr &inputW, const std::vector &peakPositions, const std::vector &fitWindows, size_t &nparams, double &minD, double &maxD, std::vector &peakPosToFit, @@ -94,7 +94,7 @@ private: /// Add peak fitting and offset calculation information to information table /// workspaces per spectrum - void addInfoToReportWS(int wi, FitPeakOffsetResult offsetresult, + void addInfoToReportWS(int wi, const FitPeakOffsetResult &offsetresult, const std::vector &tofitpeakpositions, const std::vector &fittedpeakpositions); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h b/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h index d9733304bb1c61175a294d568ba36ee2b0f03b10..424499f333ca434da570da36447f62e1522bfa1a 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GetEi.h @@ -68,15 +68,15 @@ private: void init() override; void exec() override; - void getGeometry(API::MatrixWorkspace_const_sptr WS, specnum_t mon0Spec, - specnum_t mon1Spec, double &monitor0Dist, + void getGeometry(const API::MatrixWorkspace_const_sptr &WS, + specnum_t mon0Spec, specnum_t mon1Spec, double &monitor0Dist, double &monitor1Dist) const; - std::vector getMonitorWsIndexs(API::MatrixWorkspace_const_sptr WS, - specnum_t specNum1, - specnum_t specNum2) const; + std::vector + getMonitorWsIndexs(const API::MatrixWorkspace_const_sptr &WS, + specnum_t specNum1, specnum_t specNum2) const; double timeToFly(double s, double E_KE) const; - double getPeakCentre(API::MatrixWorkspace_const_sptr WS, const size_t monitIn, - const double peakTime); + double getPeakCentre(const API::MatrixWorkspace_const_sptr &WS, + const size_t monitIn, const double peakTime); void extractSpec(int wsInd, double start, double end); void getPeakEstimates(double &height, int64_t ¢reInd, double &background) const; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GetEi2.h b/Framework/Algorithms/inc/MantidAlgorithms/GetEi2.h index 56e478e4349cdea2015c3a68e9cadba714556d44..ac6fc8d9d710a35e248f6b4c98c345b17e785c29 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GetEi2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GetEi2.h @@ -84,16 +84,15 @@ private: API::MatrixWorkspace_sptr extractSpectrum(const size_t ws_index, const double start, const double end); /// Calculate peak width - double calculatePeakWidthAtHalfHeight(API::MatrixWorkspace_sptr data_ws, - const double prominence, - std::vector &peak_x, - std::vector &peak_y, - std::vector &peak_e) const; + double calculatePeakWidthAtHalfHeight( + const API::MatrixWorkspace_sptr &data_ws, const double prominence, + std::vector &peak_x, std::vector &peak_y, + std::vector &peak_e) const; /// Calculate the value of the first moment of the given spectrum - double calculateFirstMoment(API::MatrixWorkspace_sptr monitor_ws, + double calculateFirstMoment(const API::MatrixWorkspace_sptr &monitor_ws, const double prominence); /// Rebin the given workspace using the given parameters - API::MatrixWorkspace_sptr rebin(API::MatrixWorkspace_sptr monitor_ws, + API::MatrixWorkspace_sptr rebin(const API::MatrixWorkspace_sptr &monitor_ws, const double first, const double width, const double end); /// Integrate the point data diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GetQsInQENSData.h b/Framework/Algorithms/inc/MantidAlgorithms/GetQsInQENSData.h index d552b35ae5d714b91372ca197e3012d5f38856b1..26243e70c43f716e130e70b2ad97171444df3b70 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GetQsInQENSData.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GetQsInQENSData.h @@ -53,7 +53,7 @@ private: void exec() override; /// Extracts Q-values from the specified matrix workspace - MantidVec extractQValues(const Mantid::API::MatrixWorkspace_sptr workspace); + MantidVec extractQValues(const Mantid::API::MatrixWorkspace_sptr &workspace); }; } // namespace Algorithms } // namespace Mantid diff --git a/Framework/Algorithms/inc/MantidAlgorithms/GetTimeSeriesLogInformation.h b/Framework/Algorithms/inc/MantidAlgorithms/GetTimeSeriesLogInformation.h index 9ab9912083ee6583456e41b6261c878521a5bf30..d271bef466daa0e90fe6014a0c9bef0ab5e5e84b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/GetTimeSeriesLogInformation.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/GetTimeSeriesLogInformation.h @@ -89,7 +89,7 @@ private: void execQuickStatistics(); - void exportErrorLog(API::MatrixWorkspace_sptr ws, + void exportErrorLog(const API::MatrixWorkspace_sptr &ws, std::vector abstimevec, double dts); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/He3TubeEfficiency.h b/Framework/Algorithms/inc/MantidAlgorithms/He3TubeEfficiency.h index d9dcc5139400a8a0f25ddd80919d6eb6a83b5c9b..77c6a08bdd537237e1983d03cdb81c92b9b69119 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/He3TubeEfficiency.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/He3TubeEfficiency.h @@ -94,8 +94,9 @@ private: /// Log any errors with spectra that occurred void logErrors() const; /// Retrieve the detector parameters from workspace or detector properties - double getParameter(std::string wsPropName, std::size_t currentIndex, - std::string detPropName, const Geometry::IDetector &idet); + double getParameter(const std::string &wsPropName, std::size_t currentIndex, + const std::string &detPropName, + const Geometry::IDetector &idet); /// Helper for event handling template void eventHelper(std::vector &events, double expval); /// Function to calculate exponential contribution diff --git a/Framework/Algorithms/inc/MantidAlgorithms/IQTransform.h b/Framework/Algorithms/inc/MantidAlgorithms/IQTransform.h index e58b10754e764de26db396807b62ec536646a19e..6343d9f8392b6f216995ec9c7d1d4479507ea42b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/IQTransform.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/IQTransform.h @@ -67,10 +67,11 @@ private: void exec() override; inline API::MatrixWorkspace_sptr - subtractBackgroundWS(API::MatrixWorkspace_sptr ws, - API::MatrixWorkspace_sptr background); + subtractBackgroundWS(const API::MatrixWorkspace_sptr &ws, + const API::MatrixWorkspace_sptr &background); - using TransformFunc = void (IQTransform::*)(API::MatrixWorkspace_sptr); + using TransformFunc = + void (IQTransform::*)(const API::MatrixWorkspace_sptr &); using TransformMap = std::map; TransformMap m_transforms; ///< A map of transformation name and function pointers @@ -78,16 +79,16 @@ private: boost::shared_ptr m_label; // A function for each transformation - void guinierSpheres(API::MatrixWorkspace_sptr ws); - void guinierRods(API::MatrixWorkspace_sptr ws); - void guinierSheets(API::MatrixWorkspace_sptr ws); - void zimm(API::MatrixWorkspace_sptr ws); - void debyeBueche(API::MatrixWorkspace_sptr ws); - void kratky(API::MatrixWorkspace_sptr ws); - void porod(API::MatrixWorkspace_sptr ws); - void holtzer(API::MatrixWorkspace_sptr ws); - void logLog(API::MatrixWorkspace_sptr ws); - void general(API::MatrixWorkspace_sptr ws); + void guinierSpheres(const API::MatrixWorkspace_sptr &ws); + void guinierRods(const API::MatrixWorkspace_sptr &ws); + void guinierSheets(const API::MatrixWorkspace_sptr &ws); + void zimm(const API::MatrixWorkspace_sptr &ws); + void debyeBueche(const API::MatrixWorkspace_sptr &ws); + void kratky(const API::MatrixWorkspace_sptr &ws); + void porod(const API::MatrixWorkspace_sptr &ws); + void holtzer(const API::MatrixWorkspace_sptr &ws); + void logLog(const API::MatrixWorkspace_sptr &ws); + void general(const API::MatrixWorkspace_sptr &ws); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/IdentifyNoisyDetectors.h b/Framework/Algorithms/inc/MantidAlgorithms/IdentifyNoisyDetectors.h index 611e4f3f4de5da9a4ddc3d7ab0a56068081ef9a9..39b39f5bec5857b77cca4e9180cc60090fba3782 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/IdentifyNoisyDetectors.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/IdentifyNoisyDetectors.h @@ -49,8 +49,8 @@ private: void exec() override; ///< Executes the algorithm. void getStdDev(API::Progress &progress, - Mantid::API::MatrixWorkspace_sptr valid, - Mantid::API::MatrixWorkspace_sptr values); + const Mantid::API::MatrixWorkspace_sptr &valid, + const Mantid::API::MatrixWorkspace_sptr &values); }; } // namespace Algorithms } // namespace Mantid diff --git a/Framework/Algorithms/inc/MantidAlgorithms/IntegrateByComponent.h b/Framework/Algorithms/inc/MantidAlgorithms/IntegrateByComponent.h index 637e829e118822c084c902cf457849e4dc489a84..526d705d2a85e6f54f2c6eaee7279fb0759973aa 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/IntegrateByComponent.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/IntegrateByComponent.h @@ -34,11 +34,11 @@ private: void exec() override; /// method to check which spectra should be averaged - std::vector> makeMap(API::MatrixWorkspace_sptr countsWS, - int parents); + std::vector> + makeMap(const API::MatrixWorkspace_sptr &countsWS, int parents); /// method to create the map with all spectra std::vector> - makeInstrumentMap(API::MatrixWorkspace_sptr countsWS); + makeInstrumentMap(const API::MatrixWorkspace_sptr &countsWS); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Integration.h b/Framework/Algorithms/inc/MantidAlgorithms/Integration.h index b8265a5ed03a858160c447ef827bc9cfa780fc0e..d35d07f4742377db50ebd2cc1a0144d599ee70f0 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Integration.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Integration.h @@ -66,7 +66,7 @@ private: void exec() override; API::MatrixWorkspace_sptr - rangeFilterEventWorkspace(API::MatrixWorkspace_sptr workspace, + rangeFilterEventWorkspace(const API::MatrixWorkspace_sptr &workspace, double minRange, double maxRange); /// Get the input workspace diff --git a/Framework/Algorithms/inc/MantidAlgorithms/InterpolatingRebin.h b/Framework/Algorithms/inc/MantidAlgorithms/InterpolatingRebin.h index ea1e72ecefbce15186dfabaf8c8f4bc9c9094ede..fb5c7d267364d0dc7a1bbf475991b6c653c65f03 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/InterpolatingRebin.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/InterpolatingRebin.h @@ -78,9 +78,9 @@ protected: void init() override; void exec() override; - void outputYandEValues(API::MatrixWorkspace_const_sptr inputW, + void outputYandEValues(const API::MatrixWorkspace_const_sptr &inputW, const HistogramData::BinEdges &XValues_new, - API::MatrixWorkspace_sptr outputW); + const API::MatrixWorkspace_sptr &outputW); HistogramData::Histogram cubicInterpolation(const HistogramData::Histogram &oldHistogram, const HistogramData::BinEdges &xNew) const; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/MaskBinsFromTable.h b/Framework/Algorithms/inc/MantidAlgorithms/MaskBinsFromTable.h index 33628ee864ea601da3b294292d60d74f75293891..e5db169d12f3de85b4771f87f5e82c107ef697f3 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/MaskBinsFromTable.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/MaskBinsFromTable.h @@ -43,14 +43,15 @@ private: void exec() override; /// Process input Mask bin TableWorkspace. - void processMaskBinWorkspace(DataObjects::TableWorkspace_sptr masktblws, - API::MatrixWorkspace_sptr dataws); + void + processMaskBinWorkspace(const DataObjects::TableWorkspace_sptr &masktblws, + const API::MatrixWorkspace_sptr &dataws); /// Call MaskBins - void maskBins(API::MatrixWorkspace_sptr dataws); + void maskBins(const API::MatrixWorkspace_sptr &dataws); /// Convert a list of detector IDs list (string) to a list of /// spectra/workspace indexes list - std::string convertToSpectraList(API::MatrixWorkspace_sptr dataws, - std::string detidliststr); + std::string convertToSpectraList(const API::MatrixWorkspace_sptr &dataws, + const std::string &detidliststr); /// Column indexes of XMin, XMax, SpectraList, DetectorIDsList int id_xmin, id_xmax, id_spec, id_dets; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt.h b/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt.h index 3c3e7a6ce5ea9731d32780c23f936455bdb2d58f..970b3a383e905b272c60c64e4c603216901ab70e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt.h @@ -67,7 +67,7 @@ private: /// Updates the image std::vector updateImage(const std::vector &image, const std::vector &delta, - const std::vector> dirs); + const std::vector> &dirs); /// Populates the output workspace containing the reconstructed data void populateDataWS(API::MatrixWorkspace_const_sptr &inWS, size_t spec, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt/MaxentTransformMultiFourier.h b/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt/MaxentTransformMultiFourier.h index 1c3d348bab8f011bb842e6b842aee4d967210a81..69d1ac3e34c91faf04fc6d0ab807670faceedb15 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt/MaxentTransformMultiFourier.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/MaxEnt/MaxentTransformMultiFourier.h @@ -36,7 +36,7 @@ public: // Deleted default constructor MaxentTransformMultiFourier() = delete; // Constructor - MaxentTransformMultiFourier(MaxentSpaceComplex_sptr dataSpace, + MaxentTransformMultiFourier(const MaxentSpaceComplex_sptr &dataSpace, MaxentSpace_sptr imageSpace, size_t numSpec); // Transfoms form image space to data space std::vector imageToData(const std::vector &image) override; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h b/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h index a4bb40b58ab51df96bbcc24faa52a4b5d7b95b51..e1ab2d7c02cbb80b844512d486c71fadca709df0 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/MedianDetectorTest.h @@ -76,14 +76,14 @@ private: /// Calculates the sum of solid angles of detectors for each histogram API::MatrixWorkspace_sptr getSolidAngles(int firstSpec, int lastSpec); /// Mask the outlier values to get a better median value - int maskOutliers(const std::vector medianvec, - API::MatrixWorkspace_sptr countsWS, + int maskOutliers(const std::vector &medianvec, + const API::MatrixWorkspace_sptr &countsWS, std::vector> indexmap); /// Do the tests and mask those that fail - int doDetectorTests(const API::MatrixWorkspace_sptr countsWS, - const std::vector medianvec, + int doDetectorTests(const API::MatrixWorkspace_sptr &countsWS, + const std::vector &medianvec, std::vector> indexmap, - API::MatrixWorkspace_sptr maskWS); + const API::MatrixWorkspace_sptr &maskWS); API::MatrixWorkspace_sptr m_inputWS; /// The proportion of the median value below which a detector is considered diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Minus.h b/Framework/Algorithms/inc/MantidAlgorithms/Minus.h index f685724e2e73b9fdad1fa13241705898728b94fc..8dd896560879f1fcc343b22b789b7cbcab5035d7 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Minus.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Minus.h @@ -66,8 +66,8 @@ private: std::string checkSizeCompatibility( const API::MatrixWorkspace_const_sptr lhs, const API::MatrixWorkspace_const_sptr rhs) const override; - bool checkUnitCompatibility(const API::MatrixWorkspace_const_sptr lhs, - const API::MatrixWorkspace_const_sptr rhs) const; + bool checkUnitCompatibility(const API::MatrixWorkspace_const_sptr &lhs, + const API::MatrixWorkspace_const_sptr &rhs) const; bool checkCompatibility(const API::MatrixWorkspace_const_sptr lhs, const API::MatrixWorkspace_const_sptr rhs) const override; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByCurrent.h b/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByCurrent.h index 017061aa36962b172a86afbe63dfd2c80214c723..3fbe4eb3e86e867ea17e1153f57257a94effeab3 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByCurrent.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByCurrent.h @@ -55,8 +55,9 @@ private: void init() override; void exec() override; // Extract the charge value from the logs. - double extractCharge(boost::shared_ptr inputWS, - const bool integratePCharge) const; + double + extractCharge(const boost::shared_ptr &inputWS, + const bool integratePCharge) const; }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByDetector.h b/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByDetector.h index d7459788ebed7b6650bf07868313376d8b255ea4..6a9a6febdb011c353e63291f9525077eff5cad49 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByDetector.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/NormaliseByDetector.h @@ -48,16 +48,16 @@ private: /// Try to parse a function parameter and extract the correctly typed /// parameter. const Mantid::Geometry::FitParameter - tryParseFunctionParameter(Mantid::Geometry::Parameter_sptr parameter, + tryParseFunctionParameter(const Mantid::Geometry::Parameter_sptr ¶meter, const Geometry::IDetector &det); /// Block to process histograms. - boost::shared_ptr - processHistograms(boost::shared_ptr inWS); + boost::shared_ptr processHistograms( + const boost::shared_ptr &inWS); /// Process indivdual histogram. void processHistogram( size_t wsIndex, - boost::shared_ptr inWS, - boost::shared_ptr denominatorWS, + const boost::shared_ptr &inWS, + const boost::shared_ptr &denominatorWS, Mantid::API::Progress &prog); void init() override; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/NormaliseToMonitor.h b/Framework/Algorithms/inc/MantidAlgorithms/NormaliseToMonitor.h index ca162015c75cf861ce6e5732ada82ab71e171c73..c36d200e4f4e137d9f5eee9e94a2b716b06d4521 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/NormaliseToMonitor.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/NormaliseToMonitor.h @@ -166,7 +166,7 @@ private: mutable bool is_enabled; // auxiliary function to obtain list of monitor's ID-s (allowed_values) from a // workspace; - bool monitorIdReader(API::MatrixWorkspace_const_sptr inputWS) const; + bool monitorIdReader(const API::MatrixWorkspace_const_sptr &inputWS) const; }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/PDCalibration.h b/Framework/Algorithms/inc/MantidAlgorithms/PDCalibration.h index 5cfd7e9ef811464c3a55817c3add6ed448a4f41e..aa46946a5183c933090ac4b8875ef41a146e7a8f 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/PDCalibration.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/PDCalibration.h @@ -40,7 +40,7 @@ private: void exec() override; API::MatrixWorkspace_sptr loadAndBin(); API::MatrixWorkspace_sptr rebin(API::MatrixWorkspace_sptr wksp); - API::MatrixWorkspace_sptr load(const std::string filename); + API::MatrixWorkspace_sptr load(const std::string &filename); void createCalTableFromExisting(); void createCalTableNew(); void createInformationWorkspaces(); @@ -59,8 +59,9 @@ private: /// NEW: convert peak positions in dSpacing to peak centers workspace std::pair - createTOFPeakCenterFitWindowWorkspaces(API::MatrixWorkspace_sptr dataws, - const double peakWindowMaxInDSpacing); + createTOFPeakCenterFitWindowWorkspaces( + const API::MatrixWorkspace_sptr &dataws, + const double peakWindowMaxInDSpacing); API::ITableWorkspace_sptr sortTableWorkspace(API::ITableWorkspace_sptr &table); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/PaddingAndApodization.h b/Framework/Algorithms/inc/MantidAlgorithms/PaddingAndApodization.h index a047a942567a2e67895d05150804a81bfbf3cb64..748cb88668927fa071f43fadc974f6d688b24a80 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/PaddingAndApodization.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/PaddingAndApodization.h @@ -53,7 +53,7 @@ private: void init() override; void exec() override; using fptr = double (*)(const double, const double); - fptr getApodizationFunction(const std::string method); + fptr getApodizationFunction(const std::string &method); HistogramData::Histogram applyApodizationFunction(const HistogramData::Histogram &histogram, const double decayConstant, fptr function); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ParallaxCorrection.h b/Framework/Algorithms/inc/MantidAlgorithms/ParallaxCorrection.h index 6eab498ba75fe8dd80d32b4eca443a4fb38dbeec..d3d2bf817b965adad15b72e899cff4309ef3ebda 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ParallaxCorrection.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ParallaxCorrection.h @@ -25,8 +25,9 @@ public: private: void init() override; void exec() override; - void performCorrection(API::MatrixWorkspace_sptr, const std::vector &, - const std::string &, const std::string &); + void performCorrection(const API::MatrixWorkspace_sptr &, + const std::vector &, const std::string &, + const std::string &); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Plus.h b/Framework/Algorithms/inc/MantidAlgorithms/Plus.h index 3f850d029a9d0d3c6f6d768e517cf89764496b4d..c6c7a6d1b4f9f9a4477a913d24f6a96fa26b1f54 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Plus.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Plus.h @@ -75,8 +75,8 @@ private: API::Run &ans) const override; // Overridden event-specific operation - bool checkUnitCompatibility(const API::MatrixWorkspace_const_sptr lhs, - const API::MatrixWorkspace_const_sptr rhs) const; + bool checkUnitCompatibility(const API::MatrixWorkspace_const_sptr &lhs, + const API::MatrixWorkspace_const_sptr &rhs) const; }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrectionFredrikze.h b/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrectionFredrikze.h index 92674758de7406046ad71f0c78a64074a65def45..e6586dbb8051a84ccd2389ca4279237d92925d8b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrectionFredrikze.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/PolarizationCorrectionFredrikze.h @@ -41,9 +41,9 @@ private: boost::shared_ptr getEfficiencyWorkspace(const std::string &label); boost::shared_ptr - execPA(boost::shared_ptr inWS); + execPA(const boost::shared_ptr &inWS); boost::shared_ptr - execPNR(boost::shared_ptr inWS); + execPNR(const boost::shared_ptr &inWS); boost::shared_ptr add(boost::shared_ptr &lhsWS, const double &rhs); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/PolarizationEfficiencyCor.h b/Framework/Algorithms/inc/MantidAlgorithms/PolarizationEfficiencyCor.h index aa9679f544639a8466595cb737fd1bdf8e172278..46d3da8102a5b0fdbca9f8ff6cbe785ffcc51ab9 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/PolarizationEfficiencyCor.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/PolarizationEfficiencyCor.h @@ -45,8 +45,9 @@ private: API::MatrixWorkspace const &inWS) const; API::MatrixWorkspace_sptr convertToHistogram(API::MatrixWorkspace_sptr efficiencies); - API::MatrixWorkspace_sptr interpolate(API::MatrixWorkspace_sptr efficiencies, - API::MatrixWorkspace_sptr inWS); + API::MatrixWorkspace_sptr + interpolate(const API::MatrixWorkspace_sptr &efficiencies, + const API::MatrixWorkspace_sptr &inWS); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h b/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h index 386d8278273f295c96ca8802944ead770d3a69c3..a930255c0c5f7f5daf548b1c637190a6438bdaa6 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Q1D2.h @@ -63,13 +63,13 @@ private: // these are the steps that are run on each individual spectrum void calculateNormalization(const size_t wavStart, const size_t wsIndex, - API::MatrixWorkspace_const_sptr pixelAdj, - API::MatrixWorkspace_const_sptr wavePixelAdj, + const API::MatrixWorkspace_const_sptr &pixelAdj, + const API::MatrixWorkspace_const_sptr &wavePixelAdj, double const *const binNorms, double const *const binNormEs, HistogramData::HistogramY::iterator norm, HistogramData::HistogramY::iterator normETo2) const; - void pixelWeight(API::MatrixWorkspace_const_sptr pixelAdj, + void pixelWeight(const API::MatrixWorkspace_const_sptr &pixelAdj, const size_t wsIndex, double &weight, double &error) const; void addWaveAdj(const double *c, const double *Dc, HistogramData::HistogramY::iterator bInOut, diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Q1DWeighted.h b/Framework/Algorithms/inc/MantidAlgorithms/Q1DWeighted.h index 7404e96a708c556b9920cc92904ba3cafedbebed..a542b5ee4fc74137f0c3ae7ad33764d1bc82ca4a 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Q1DWeighted.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Q1DWeighted.h @@ -70,12 +70,12 @@ public: private: /// Create an output workspace API::MatrixWorkspace_sptr - createOutputWorkspace(API::MatrixWorkspace_const_sptr, const size_t, + createOutputWorkspace(const API::MatrixWorkspace_const_sptr &, const size_t, const std::vector &); - void bootstrap(API::MatrixWorkspace_const_sptr); - void calculate(API::MatrixWorkspace_const_sptr); - void finalize(API::MatrixWorkspace_const_sptr); + void bootstrap(const API::MatrixWorkspace_const_sptr &); + void calculate(const API::MatrixWorkspace_const_sptr &); + void finalize(const API::MatrixWorkspace_const_sptr &); std::vector>> m_intensities; std::vector>> m_errors; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h b/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h index 53ade307e5cd607081c2e0d22875e80f7da7fbfe..30d9028be9c94cffcae53adc3909abe6684d1f43 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Qhelper.h @@ -19,22 +19,23 @@ namespace Algorithms { */ class Qhelper { public: - void examineInput(API::MatrixWorkspace_const_sptr dataWS, - API::MatrixWorkspace_const_sptr binAdj, - API::MatrixWorkspace_const_sptr detectAdj, - API::MatrixWorkspace_const_sptr qResolution); + void examineInput(const API::MatrixWorkspace_const_sptr &dataWS, + const API::MatrixWorkspace_const_sptr &binAdj, + const API::MatrixWorkspace_const_sptr &detectAdj, + const API::MatrixWorkspace_const_sptr &qResolution); - void examineInput(API::MatrixWorkspace_const_sptr dataWS, - API::MatrixWorkspace_const_sptr binAdj, - API::MatrixWorkspace_const_sptr detectAdj); + void examineInput(const API::MatrixWorkspace_const_sptr &dataWS, + const API::MatrixWorkspace_const_sptr &binAdj, + const API::MatrixWorkspace_const_sptr &detectAdj); - size_t waveLengthCutOff(API::MatrixWorkspace_const_sptr dataWS, + size_t waveLengthCutOff(const API::MatrixWorkspace_const_sptr &dataWS, const API::SpectrumInfo &spectrumInfo, const double RCut, const double WCut, const size_t wsInd) const; - void outputParts(API::Algorithm *alg, API::MatrixWorkspace_sptr sumOfCounts, - API::MatrixWorkspace_sptr sumOfNormFactors); + void outputParts(API::Algorithm *alg, + const API::MatrixWorkspace_sptr &sumOfCounts, + const API::MatrixWorkspace_sptr &sumOfNormFactors); private: /// the experimental workspace with counts across the detector diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Qxy.h b/Framework/Algorithms/inc/MantidAlgorithms/Qxy.h index f290e9fe824a963e8a292f94e866ea830072e589..49b1cef9c863c4f1c37343cc4536fcfa0292701e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Qxy.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Qxy.h @@ -55,7 +55,7 @@ private: std::vector logBinning(double min, double max, int num); API::MatrixWorkspace_sptr - setUpOutputWorkspace(API::MatrixWorkspace_const_sptr inputWorkspace); + setUpOutputWorkspace(const API::MatrixWorkspace_const_sptr &inputWorkspace); double getQminFromWs(const API::MatrixWorkspace &inputWorkspace); }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/RadiusSum.h b/Framework/Algorithms/inc/MantidAlgorithms/RadiusSum.h index 0e216e6066955300b0e96d3c95e3d1f8d47d7bdd..1a10f80ca0ec3e26a07770a0962f7be7f2e01272 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/RadiusSum.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/RadiusSum.h @@ -35,13 +35,14 @@ public: } const std::string category() const override; - static bool inputWorkspaceHasInstrumentAssociated(API::MatrixWorkspace_sptr); + static bool + inputWorkspaceHasInstrumentAssociated(const API::MatrixWorkspace_sptr &); static std::vector - getBoundariesOfNumericImage(API::MatrixWorkspace_sptr); + getBoundariesOfNumericImage(const API::MatrixWorkspace_sptr &); static std::vector - getBoundariesOfInstrument(API::MatrixWorkspace_sptr); + getBoundariesOfInstrument(const API::MatrixWorkspace_sptr &); static void centerIsInsideLimits(const std::vector ¢re, const std::vector &boundaries); @@ -71,8 +72,8 @@ private: API::MatrixWorkspace_sptr inputWS; double min_radius = 0.0, max_radius = 0.0; - double getMinBinSizeForInstrument(API::MatrixWorkspace_sptr); - double getMinBinSizeForNumericImage(API::MatrixWorkspace_sptr); + double getMinBinSizeForInstrument(const API::MatrixWorkspace_sptr &); + double getMinBinSizeForNumericImage(const API::MatrixWorkspace_sptr &); /** Return the bin position for a given distance * From the input, it is defined the limits of distances as: diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Rebin.h b/Framework/Algorithms/inc/MantidAlgorithms/Rebin.h index 3c2e64c67dc51e552672a943020d0a0c04104426..d46fda033bb8af861c4b9d98804629cf29a22b9e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Rebin.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Rebin.h @@ -76,8 +76,8 @@ protected: void init() override; void exec() override; - void propagateMasks(API::MatrixWorkspace_const_sptr inputWS, - API::MatrixWorkspace_sptr outputWS, int hist); + void propagateMasks(const API::MatrixWorkspace_const_sptr &inputWS, + const API::MatrixWorkspace_sptr &outputWS, int hist); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBackgroundSubtraction.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBackgroundSubtraction.h index 78d3cef28277803663ef5a14ef6717e970daab6f..c24eb84ccb91e0b76d719ac95bec1a4240d6a300 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBackgroundSubtraction.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBackgroundSubtraction.h @@ -27,13 +27,13 @@ public: private: void - calculateAverageSpectrumBackground(API::MatrixWorkspace_sptr inputWS, + calculateAverageSpectrumBackground(const API::MatrixWorkspace_sptr &inputWS, const std::vector &spectraList); void calculatePolynomialBackground(API::MatrixWorkspace_sptr inputWS, const std::vector &spectrumRanges); std::vector findSpectrumRanges(const std::vector &spectraList); - void calculatePixelBackground(API::MatrixWorkspace_sptr inputWS, + void calculatePixelBackground(const API::MatrixWorkspace_sptr &inputWS, const std::vector &indexRanges); /** Overridden Algorithm methods **/ diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBeamStatistics.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBeamStatistics.h index 459e89e6862017df4caa023fa088f1f993a2fe18..9f995f2f39e101f43f4f4188f789e1bb9fdde718 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBeamStatistics.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryBeamStatistics.h @@ -26,9 +26,9 @@ public: const static std::string SAMPLE_WAVINESS; const static std::string SECOND_SLIT_ANGULAR_SPREAD; }; - static double slitSeparation(Geometry::Instrument_const_sptr instrument, - const std::string &slit1Name, - const std::string &slit2Name); + static double + slitSeparation(const Geometry::Instrument_const_sptr &instrument, + const std::string &slit1Name, const std::string &slit2Name); const std::string name() const override; int version() const override; const std::string category() const override; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOne2.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOne2.h index 17cc0d6f69a41441d2768f9b289d1f72cc6f2b3c..4c720c38d542fffdd6f4f3662e1164bc79462cbf 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOne2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOne2.h @@ -66,30 +66,30 @@ private: directBeamCorrection(Mantid::API::MatrixWorkspace_sptr detectorWS); // Performs transmission or algorithm correction Mantid::API::MatrixWorkspace_sptr - transOrAlgCorrection(Mantid::API::MatrixWorkspace_sptr detectorWS, + transOrAlgCorrection(const Mantid::API::MatrixWorkspace_sptr &detectorWS, const bool detectorWSReduced); // Performs background subtraction Mantid::API::MatrixWorkspace_sptr backgroundSubtraction(Mantid::API::MatrixWorkspace_sptr detectorWS); // Performs transmission corrections Mantid::API::MatrixWorkspace_sptr - transmissionCorrection(Mantid::API::MatrixWorkspace_sptr detectorWS, + transmissionCorrection(const Mantid::API::MatrixWorkspace_sptr &detectorWS, const bool detectorWSReduced); // Performs transmission corrections using alternative correction algorithms Mantid::API::MatrixWorkspace_sptr - algorithmicCorrection(Mantid::API::MatrixWorkspace_sptr detectorWS); + algorithmicCorrection(const Mantid::API::MatrixWorkspace_sptr &detectorWS); // Performs monitor corrections Mantid::API::MatrixWorkspace_sptr monitorCorrection(Mantid::API::MatrixWorkspace_sptr detectorWS); // convert to momentum transfer Mantid::API::MatrixWorkspace_sptr - convertToQ(Mantid::API::MatrixWorkspace_sptr inputWS); + convertToQ(const Mantid::API::MatrixWorkspace_sptr &inputWS); // Get the twoTheta width of a given detector double getDetectorTwoThetaRange(const size_t spectrumIdx); // Utility function to create name for diagnostic workspaces std::string createDebugWorkspaceName(const std::string &inputName); // Utility function to output a diagnostic workspace to the ADS - void outputDebugWorkspace(API::MatrixWorkspace_sptr ws, + void outputDebugWorkspace(const API::MatrixWorkspace_sptr &ws, const std::string &wsName, const std::string &wsSuffix, const bool debug, int &step); @@ -97,7 +97,7 @@ private: Mantid::API::MatrixWorkspace_sptr makeIvsLam(); // Do the reduction by summation in Q Mantid::API::MatrixWorkspace_sptr - sumInQ(API::MatrixWorkspace_sptr detectorWS); + sumInQ(const API::MatrixWorkspace_sptr &detectorWS); // Do the summation in Q for a single input value void sumInQProcessValue(const int inputIdx, const double twoTheta, const double bTwoTheta, @@ -106,23 +106,23 @@ private: const HistogramData::HistogramE &inputE, const std::vector &detectors, const size_t outSpecIdx, - API::MatrixWorkspace_sptr IvsLam, + const API::MatrixWorkspace_sptr &IvsLam, std::vector &outputE); // Share counts to a projected value for summation in Q void sumInQShareCounts(const double inputCounts, const double inputErr, const double bLambda, const double lambdaMin, const double lambdaMax, const size_t outSpecIdx, - API::MatrixWorkspace_sptr IvsLam, + const API::MatrixWorkspace_sptr &IvsLam, std::vector &outputE); - void findWavelengthMinMax(API::MatrixWorkspace_sptr inputWS); + void findWavelengthMinMax(const API::MatrixWorkspace_sptr &inputWS); // Construct the output workspace - void findIvsLamRange(API::MatrixWorkspace_sptr detectorWS, + void findIvsLamRange(const API::MatrixWorkspace_sptr &detectorWS, const std::vector &detectors, const double lambdaMin, const double lambdaMax, double &projectedMin, double &projectedMax); // Construct the output workspace Mantid::API::MatrixWorkspace_sptr - constructIvsLamWS(API::MatrixWorkspace_sptr detectorWS); + constructIvsLamWS(const API::MatrixWorkspace_sptr &detectorWS); // Whether summation should be done in Q or the default lambda bool summingInQ(); // Get projected coordinates onto twoThetaR @@ -132,8 +132,8 @@ private: double &lambdaTop, double &lambdaBot, const bool outerCorners = true); // Check whether two spectrum maps match - void verifySpectrumMaps(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2); + void verifySpectrumMaps(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2); // Find and cache constants void findDetectorGroups(); @@ -149,10 +149,10 @@ private: double wavelengthMax() { return m_wavelengthMax; }; size_t findIvsLamRangeMinDetector(const std::vector &detectors); size_t findIvsLamRangeMaxDetector(const std::vector &detectors); - double findIvsLamRangeMin(Mantid::API::MatrixWorkspace_sptr detectorWS, + double findIvsLamRangeMin(const Mantid::API::MatrixWorkspace_sptr &detectorWS, const std::vector &detectors, const double lambda); - double findIvsLamRangeMax(Mantid::API::MatrixWorkspace_sptr detectorWS, + double findIvsLamRangeMax(const Mantid::API::MatrixWorkspace_sptr &detectorWS, const std::vector &detectors, const double lambda); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto2.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto2.h index 57a153afa8a3e379759d771474e83276f4c27ec4..e769ba96ff556e4bc69d5498504155aa40b1fee2 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto2.h @@ -47,7 +47,7 @@ private: class RebinParams { public: RebinParams(const double qMin, const bool qMinIsDefault, const double qMax, - const bool qMaxIsDefault, const boost::optional qStep) + const bool qMaxIsDefault, const boost::optional &qStep) : m_qMin(qMin), m_qMinIsDefault(qMinIsDefault), m_qMax(qMax), m_qMaxIsDefault(qMaxIsDefault), m_qStep(qStep){}; @@ -72,33 +72,34 @@ private: void init() override; void exec() override; std::string - getRunNumberForWorkspaceGroup(WorkspaceGroup_const_sptr workspace); + getRunNumberForWorkspaceGroup(const WorkspaceGroup_const_sptr &workspace); WorkspaceNames getOutputWorkspaceNames(); void setDefaultOutputWorkspaceNames(); /// Get the name of the detectors of interest based on processing instructions std::vector - getDetectorNames(Mantid::API::MatrixWorkspace_sptr inputWS); + getDetectorNames(const Mantid::API::MatrixWorkspace_sptr &inputWS); /// Correct detector positions vertically Mantid::API::MatrixWorkspace_sptr correctDetectorPositions(Mantid::API::MatrixWorkspace_sptr inputWS, const double twoTheta); /// Calculate theta - double calculateTheta(Mantid::API::MatrixWorkspace_sptr inputWS); + double calculateTheta(const Mantid::API::MatrixWorkspace_sptr &inputWS); /// Find cropping and binning parameters - RebinParams getRebinParams(MatrixWorkspace_sptr inputWS, const double theta); - boost::optional getQStep(MatrixWorkspace_sptr inputWS, + RebinParams getRebinParams(const MatrixWorkspace_sptr &inputWS, + const double theta); + boost::optional getQStep(const MatrixWorkspace_sptr &inputWS, const double theta); /// Rebin and scale a workspace in Q Mantid::API::MatrixWorkspace_sptr - rebinAndScale(Mantid::API::MatrixWorkspace_sptr inputWS, + rebinAndScale(const Mantid::API::MatrixWorkspace_sptr &inputWS, RebinParams const ¶ms); /// Crop a workspace in Q - MatrixWorkspace_sptr cropQ(MatrixWorkspace_sptr inputWS, + MatrixWorkspace_sptr cropQ(const MatrixWorkspace_sptr &inputWS, RebinParams const ¶ms); /// Populate algorithmic correction properties void populateAlgorithmicCorrectionProperties( - Mantid::API::IAlgorithm_sptr alg, - Mantid::Geometry::Instrument_const_sptr instrument); + const Mantid::API::IAlgorithm_sptr &alg, + const Mantid::Geometry::Instrument_const_sptr &instrument); /// Get a polarization efficiencies workspace. std::tuple getPolarizationEfficiencies(); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto3.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto3.h index 61b931ff3751ea0ce503196e59b3cbb535b6658d..7c0193309122668aab971e68b207638c5c5bd2f3 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto3.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryReductionOneAuto3.h @@ -58,35 +58,37 @@ private: void init() override; void exec() override; std::string - getRunNumberForWorkspaceGroup(WorkspaceGroup_const_sptr workspace); + getRunNumberForWorkspaceGroup(const WorkspaceGroup_const_sptr &workspace); WorkspaceNames getOutputWorkspaceNames(); void setDefaultOutputWorkspaceNames(); /// Get the name of the detectors of interest based on processing instructions std::vector - getDetectorNames(Mantid::API::MatrixWorkspace_sptr inputWS); + getDetectorNames(const Mantid::API::MatrixWorkspace_sptr &inputWS); /// Correct detector positions vertically Mantid::API::MatrixWorkspace_sptr correctDetectorPositions(Mantid::API::MatrixWorkspace_sptr inputWS, const double twoTheta); /// Calculate theta - double calculateTheta(Mantid::API::MatrixWorkspace_sptr inputWS); + double calculateTheta(const Mantid::API::MatrixWorkspace_sptr &inputWS); /// Find cropping and binning parameters - RebinParams getRebinParams(MatrixWorkspace_sptr inputWS, const double theta); - boost::optional getQStep(MatrixWorkspace_sptr inputWS, + RebinParams getRebinParams(const MatrixWorkspace_sptr &inputWS, + const double theta); + boost::optional getQStep(const MatrixWorkspace_sptr &inputWS, const double theta); // Optionally scale a workspace Mantid::API::MatrixWorkspace_sptr scale(Mantid::API::MatrixWorkspace_sptr inputWS); /// Rebin a workspace in Q Mantid::API::MatrixWorkspace_sptr - rebin(Mantid::API::MatrixWorkspace_sptr inputWS, const RebinParams ¶ms); + rebin(const Mantid::API::MatrixWorkspace_sptr &inputWS, + const RebinParams ¶ms); /// Optionally crop a workspace in Q MatrixWorkspace_sptr cropQ(MatrixWorkspace_sptr inputWS, const RebinParams ¶ms); /// Populate algorithmic correction properties void populateAlgorithmicCorrectionProperties( - Mantid::API::IAlgorithm_sptr alg, - Mantid::Geometry::Instrument_const_sptr instrument); + const Mantid::API::IAlgorithm_sptr &alg, + const Mantid::Geometry::Instrument_const_sptr &instrument); /// Get a polarization efficiencies workspace. std::tuple getPolarizationEfficiencies(); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase.h index 81d13a755d15f347d9890f7dd3edbbced3ee6515..f79bd7b6713a48af8941276f98d1fb4e83e4fb1d 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase.h @@ -44,9 +44,9 @@ public: /// Convert the input workspace to wavelength, splitting according to the /// properties provided. DetectorMonitorWorkspacePair - toLam(Mantid::API::MatrixWorkspace_sptr toConvert, + toLam(const Mantid::API::MatrixWorkspace_sptr &toConvert, const std::string &processingCommands, - const OptionalInteger monitorIndex, const MinMax &wavelengthMinMax, + const OptionalInteger &monitorIndex, const MinMax &wavelengthMinMax, const OptionalMinMax &backgroundMinMax); /// Convert the detector spectrum of the input workspace to wavelength @@ -70,12 +70,11 @@ protected: /// Get the min/max property values MinMax getMinMax(const std::string &minProperty, const std::string &maxProperty) const; - OptionalMinMax getOptionalMinMax(Mantid::API::Algorithm *const alg, - const std::string &minProperty, - const std::string &maxProperty, - Mantid::Geometry::Instrument_const_sptr inst, - std::string minIdfName, - std::string maxIdfName) const; + OptionalMinMax getOptionalMinMax( + Mantid::API::Algorithm *const alg, const std::string &minProperty, + const std::string &maxProperty, + const Mantid::Geometry::Instrument_const_sptr &inst, + const std::string &minIdfName, const std::string &maxIdfName) const; /// Get the transmission correction properties void getTransmissionRunInfo( OptionalMatrixWorkspace_sptr &firstTransmissionRun, @@ -102,7 +101,7 @@ private: /// Convert the monitor parts of the input workspace to wavelength API::MatrixWorkspace_sptr toLamMonitor(const API::MatrixWorkspace_sptr &toConvert, - const OptionalInteger monitorIndex, + const OptionalInteger &monitorIndex, const OptionalMinMax &backgroundMinMax); /// Make a unity workspace diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase2.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase2.h index 9962e1cb063bbff0ed7c498595b8b20172e31371..6b28e816c9d2eef0bc15a76b301c471e22de9571 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase2.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometryWorkflowBase2.h @@ -54,10 +54,10 @@ protected: std::map validateWavelengthRanges() const; /// Convert a workspace from TOF to wavelength Mantid::API::MatrixWorkspace_sptr - convertToWavelength(Mantid::API::MatrixWorkspace_sptr inputWS); + convertToWavelength(const Mantid::API::MatrixWorkspace_sptr &inputWS); /// Crop a workspace in wavelength Mantid::API::MatrixWorkspace_sptr - cropWavelength(Mantid::API::MatrixWorkspace_sptr inputWS, + cropWavelength(const Mantid::API::MatrixWorkspace_sptr &inputWS, const bool useArgs = false, const double argMin = 0.0, const double argMax = 0.0); // Create a detector workspace from input workspace in wavelength @@ -66,43 +66,44 @@ protected: const bool convert = true, const bool sum = true); // Create a monitor workspace from input workspace in wavelength Mantid::API::MatrixWorkspace_sptr - makeMonitorWS(Mantid::API::MatrixWorkspace_sptr inputWS, + makeMonitorWS(const Mantid::API::MatrixWorkspace_sptr &inputWS, bool integratedMonitors); // Rebin detectors to monitors Mantid::API::MatrixWorkspace_sptr - rebinDetectorsToMonitors(Mantid::API::MatrixWorkspace_sptr detectorWS, - Mantid::API::MatrixWorkspace_sptr monitorWS); + rebinDetectorsToMonitors(const Mantid::API::MatrixWorkspace_sptr &detectorWS, + const Mantid::API::MatrixWorkspace_sptr &monitorWS); // Read monitor properties from instrument - void - populateMonitorProperties(Mantid::API::IAlgorithm_sptr alg, - Mantid::Geometry::Instrument_const_sptr instrument); + void populateMonitorProperties( + const Mantid::API::IAlgorithm_sptr &alg, + const Mantid::Geometry::Instrument_const_sptr &instrument); /// Populate processing instructions - std::string - findProcessingInstructions(Mantid::Geometry::Instrument_const_sptr instrument, - Mantid::API::MatrixWorkspace_sptr inputWS) const; + std::string findProcessingInstructions( + const Mantid::Geometry::Instrument_const_sptr &instrument, + const Mantid::API::MatrixWorkspace_sptr &inputWS) const; /// Populate transmission properties - bool populateTransmissionProperties(Mantid::API::IAlgorithm_sptr alg) const; + bool + populateTransmissionProperties(const Mantid::API::IAlgorithm_sptr &alg) const; /// Find theta from a named log value - double getThetaFromLogs(Mantid::API::MatrixWorkspace_sptr inputWs, + double getThetaFromLogs(const Mantid::API::MatrixWorkspace_sptr &inputWs, const std::string &logName); // Retrieve the run number from the logs of the input workspace. std::string getRunNumber(Mantid::API::MatrixWorkspace const &ws) const; - void convertProcessingInstructions(Instrument_const_sptr instrument, - MatrixWorkspace_sptr inputWS); - void convertProcessingInstructions(MatrixWorkspace_sptr inputWS); + void convertProcessingInstructions(const Instrument_const_sptr &instrument, + const MatrixWorkspace_sptr &inputWS); + void convertProcessingInstructions(const MatrixWorkspace_sptr &inputWS); std::string m_processingInstructionsWorkspaceIndex; std::string m_processingInstructions; protected: - std::string - convertToSpectrumNumber(const std::string &workspaceIndex, - Mantid::API::MatrixWorkspace_const_sptr ws) const; + std::string convertToSpectrumNumber( + const std::string &workspaceIndex, + const Mantid::API::MatrixWorkspace_const_sptr &ws) const; std::string convertProcessingInstructionsToSpectrumNumbers( const std::string &instructions, - Mantid::API::MatrixWorkspace_const_sptr ws) const; + const Mantid::API::MatrixWorkspace_const_sptr &ws) const; - void setWorkspacePropertyFromChild(Algorithm_sptr alg, + void setWorkspacePropertyFromChild(const Algorithm_sptr &alg, std::string const &propertyName); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ResetNegatives.h b/Framework/Algorithms/inc/MantidAlgorithms/ResetNegatives.h index c07cf9fd8902e86dbf103d80a6c45e1956b24f6e..f39ddda72208170fb41dcb6aaf871cb725fb3632 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ResetNegatives.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ResetNegatives.h @@ -30,11 +30,12 @@ public: private: void init() override; void exec() override; - void pushMinimum(API::MatrixWorkspace_const_sptr minWS, - API::MatrixWorkspace_sptr wksp, API::Progress &prog); - void changeNegatives(API::MatrixWorkspace_const_sptr minWS, + void pushMinimum(const API::MatrixWorkspace_const_sptr &minWS, + const API::MatrixWorkspace_sptr &wksp, API::Progress &prog); + void changeNegatives(const API::MatrixWorkspace_const_sptr &minWS, const double spectrumNegativeValues, - API::MatrixWorkspace_sptr wksp, API::Progress &prog); + const API::MatrixWorkspace_sptr &wksp, + API::Progress &prog); }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h b/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h index b22d34fdca63943cc502059d1337626c5b1930c0..40d04682f612dee3e4636f4a9330105366e72938 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/RingProfile.h @@ -47,17 +47,18 @@ private: /// get the bin position for the given angle int fromAngleToBin(double angle, bool degree = true); /// validate the inputs of the algorithm for instrument based workspace - void checkInputsForSpectraWorkspace(const API::MatrixWorkspace_sptr); + void checkInputsForSpectraWorkspace(const API::MatrixWorkspace_sptr &); /// validate the inputs of the algorithm for 2d matrix based instrument - void checkInputsForNumericWorkspace(const API::MatrixWorkspace_sptr); + void checkInputsForNumericWorkspace(const API::MatrixWorkspace_sptr &); /// process ring profile for instrument based workspace - void processInstrumentRingProfile(const API::MatrixWorkspace_sptr inputWS, + void processInstrumentRingProfile(const API::MatrixWorkspace_sptr &inputWS, std::vector &output_bins); /// process ring profile for image based workspace - void processNumericImageRingProfile(const API::MatrixWorkspace_sptr inputWS, + void processNumericImageRingProfile(const API::MatrixWorkspace_sptr &inputWS, std::vector &output_bins); /// identify the bin position for the given pixel in the image based workspace - void getBinForPixel(const API::MatrixWorkspace_sptr, int, std::vector &); + void getBinForPixel(const API::MatrixWorkspace_sptr &, int, + std::vector &); //// identify the bin position for the pixel related to the given detector int getBinForPixel(const Kernel::V3D &position); /// copy of the minRadius input diff --git a/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h b/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h index f4ba79010032905efcc778984225c96c8cbb8cdf..5f9c62603467ef292a74ee3260a2bc4477a748e3 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/RunCombinationHelper.h @@ -30,9 +30,9 @@ static const std::string FAIL_BEHAVIOUR = "Fail"; class MANTID_ALGORITHMS_DLL RunCombinationHelper { public: - std::string checkCompatibility(API::MatrixWorkspace_sptr, + std::string checkCompatibility(const API::MatrixWorkspace_sptr &, bool checkNumberHistograms = false); - void setReferenceProperties(API::MatrixWorkspace_sptr); + void setReferenceProperties(const API::MatrixWorkspace_sptr &); static std::vector unWrapGroups(const std::vector &); std::list diff --git a/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/SampleLogsBehaviour.h b/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/SampleLogsBehaviour.h index ef7f695bb9b2563163a724cf5efe3ba52da7bada..81a1e521e5d13da19156cec65f9c3233243e9dd1 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/SampleLogsBehaviour.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/RunCombinationHelpers/SampleLogsBehaviour.h @@ -69,17 +69,18 @@ public: std::string sampleLogsFailTolerances; }; - SampleLogsBehaviour(API::MatrixWorkspace_sptr ws, Kernel::Logger &logger, + SampleLogsBehaviour(const API::MatrixWorkspace_sptr &ws, + Kernel::Logger &logger, const SampleLogNames &logEntries = {}, const ParameterName &parName = {}); /// Create and update sample logs according to instrument parameters - void mergeSampleLogs(API::MatrixWorkspace_sptr addeeWS, - API::MatrixWorkspace_sptr outWS); - void setUpdatedSampleLogs(API::MatrixWorkspace_sptr outWS); - void removeSampleLogsFromWorkspace(API::MatrixWorkspace_sptr addeeWS); - void readdSampleLogToWorkspace(API::MatrixWorkspace_sptr addeeWS); - void resetSampleLogs(API::MatrixWorkspace_sptr ws); + void mergeSampleLogs(const API::MatrixWorkspace_sptr &addeeWS, + const API::MatrixWorkspace_sptr &outWS); + void setUpdatedSampleLogs(const API::MatrixWorkspace_sptr &outWS); + void removeSampleLogsFromWorkspace(const API::MatrixWorkspace_sptr &addeeWS); + void readdSampleLogToWorkspace(const API::MatrixWorkspace_sptr &addeeWS); + void resetSampleLogs(const API::MatrixWorkspace_sptr &ws); private: Kernel::Logger &m_logger; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SANSCollimationLengthEstimator.h b/Framework/Algorithms/inc/MantidAlgorithms/SANSCollimationLengthEstimator.h index 384b5ef152aeef38e70c1be9dc453950efa30c90..77290e6f4783f4aef90e6e05524bb7862e2e7e2f 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SANSCollimationLengthEstimator.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SANSCollimationLengthEstimator.h @@ -15,11 +15,12 @@ namespace Mantid { namespace Algorithms { class MANTID_ALGORITHMS_DLL SANSCollimationLengthEstimator { public: - double provideCollimationLength(Mantid::API::MatrixWorkspace_sptr workspace); + double + provideCollimationLength(const Mantid::API::MatrixWorkspace_sptr &workspace); private: double getCollimationLengthWithGuides( - Mantid::API::MatrixWorkspace_sptr inOutWS, const double L1, + const Mantid::API::MatrixWorkspace_sptr &inOutWS, const double L1, const double collimationLengthCorrection) const; double getGuideValue(Mantid::Kernel::Property *prop) const; }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCAbsorptionStrategy.h b/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCAbsorptionStrategy.h index 620b2eefde7be7054fedc57a6067fa268e86798c..f418bb49411b822eb7609310e82b8e07efc09d04 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCAbsorptionStrategy.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCAbsorptionStrategy.h @@ -47,7 +47,8 @@ public: Kernel::Logger &logger); void calculate(Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &finalPos, - Mantid::HistogramData::Points lambdas, double lambdaFixed, + const Mantid::HistogramData::Points &lambdas, + double lambdaFixed, Mantid::API::ISpectrum &attenuationFactorsSpectrum); private: diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h b/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h index 24e1bc56b2e064d2ae831c98db533c724aa02178..3faf5a6651ce9102e482a5bfdeeda69586ce9042 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SmoothNeighbours.h @@ -105,7 +105,7 @@ private: void setupNewInstrument(API::MatrixWorkspace &outws) const; /// Build the instrument/detector setup in workspace - void spreadPixels(API::MatrixWorkspace_sptr outws); + void spreadPixels(const API::MatrixWorkspace_sptr &outws); /// Non rectangular detector group name static const std::string NON_UNIFORM_GROUP; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SofQWPolygon.h b/Framework/Algorithms/inc/MantidAlgorithms/SofQWPolygon.h index aaab8d15c76b8c01e1ceb72696bb5b21405c97a2..7bcad9d82b43a12c091fa675c2757554ffb7bb7f 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SofQWPolygon.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SofQWPolygon.h @@ -65,7 +65,7 @@ private: /// Run the algorithm void exec() override; /// Init variables cache base on the given workspace - void initCachedValues(API::MatrixWorkspace_const_sptr workspace); + void initCachedValues(const API::MatrixWorkspace_const_sptr &workspace); /// Init the theta index void initThetaCache(const API::MatrixWorkspace &workspace); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SortXAxis.h b/Framework/Algorithms/inc/MantidAlgorithms/SortXAxis.h index 138f3a768338ad0c409f79af36526fd1c7b33818..c55bd2ba79f83a12ad06d1e26d8b86708628b20f 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SortXAxis.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SortXAxis.h @@ -34,7 +34,7 @@ private: std::vector createIndexes(const size_t); void sortIndicesByX(std::vector &workspaceIndecies, - std::string order, + const std::string &order, const Mantid::API::MatrixWorkspace &inputWorkspace, unsigned int specNum); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionAlgorithm.h b/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionAlgorithm.h index 2203dc9218367fe1f487e702fb10bd4c3cb9d9e6..2a5b2f7fa4cec9b428e47cd924e6ebb1d534bd0f 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionAlgorithm.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionAlgorithm.h @@ -25,12 +25,12 @@ protected: SpecularReflectionAlgorithm() = default; /// Get the surface sample component - Mantid::Geometry::IComponent_const_sptr - getSurfaceSampleComponent(Mantid::Geometry::Instrument_const_sptr inst) const; + Mantid::Geometry::IComponent_const_sptr getSurfaceSampleComponent( + const Mantid::Geometry::Instrument_const_sptr &inst) const; /// Get the detector component Mantid::Geometry::IComponent_const_sptr - getDetectorComponent(Mantid::API::MatrixWorkspace_sptr workspace, + getDetectorComponent(const Mantid::API::MatrixWorkspace_sptr &workspace, const bool isPointDetector) const; /// Does the property have a default value. diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionPositionCorrect.h b/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionPositionCorrect.h index b3801e1e06263bd960a3ab4df37a8c77dc6a89c3..06fb59bbfaf030cff78c5e1869eab2fece74ed24 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionPositionCorrect.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SpecularReflectionPositionCorrect.h @@ -34,15 +34,15 @@ private: void exec() override; /// Correct detector positions. - void correctPosition(API::MatrixWorkspace_sptr toCorrect, + void correctPosition(const API::MatrixWorkspace_sptr &toCorrect, const double &twoThetaInDeg, - Geometry::IComponent_const_sptr sample, - Geometry::IComponent_const_sptr detector); + const Geometry::IComponent_const_sptr &sample, + const Geometry::IComponent_const_sptr &detector); /// Move detectors. - void moveDetectors(API::MatrixWorkspace_sptr toCorrect, + void moveDetectors(const API::MatrixWorkspace_sptr &toCorrect, Geometry::IComponent_const_sptr detector, - Geometry::IComponent_const_sptr sample, + const Geometry::IComponent_const_sptr &sample, const double &upOffset, const double &acrossOffset, const Mantid::Kernel::V3D &detectorPosition); }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Stitch1D.h b/Framework/Algorithms/inc/MantidAlgorithms/Stitch1D.h index f7d3b702ebcd76a1912ead03c884f612a42f4ec6..bd3f19787a9a214239eec539335f34557f5d5585 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Stitch1D.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Stitch1D.h @@ -84,7 +84,7 @@ private: /// Mask out everything but the data in the ranges, but do it inplace. void maskInPlace(int a1, int a2, Mantid::API::MatrixWorkspace_sptr &source); /// Add back in any special values - void reinsertSpecialValues(Mantid::API::MatrixWorkspace_sptr ws); + void reinsertSpecialValues(const Mantid::API::MatrixWorkspace_sptr &ws); /// Range tolerance static const double range_tolerance; /// Scaling factors diff --git a/Framework/Algorithms/inc/MantidAlgorithms/StripPeaks.h b/Framework/Algorithms/inc/MantidAlgorithms/StripPeaks.h index 90e588a8845653466cd343997093f2e4da87abf5..6e5db58f75b305c5e5e2ba6ee5660377755ae11e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/StripPeaks.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/StripPeaks.h @@ -62,9 +62,10 @@ private: /// Execution code void exec() override; - API::ITableWorkspace_sptr findPeaks(API::MatrixWorkspace_sptr WS); - API::MatrixWorkspace_sptr removePeaks(API::MatrixWorkspace_const_sptr input, - API::ITableWorkspace_sptr peakslist); + API::ITableWorkspace_sptr findPeaks(const API::MatrixWorkspace_sptr &WS); + API::MatrixWorkspace_sptr + removePeaks(const API::MatrixWorkspace_const_sptr &input, + const API::ITableWorkspace_sptr &peakslist); double m_maxChiSq{0.0}; }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SumEventsByLogValue.h b/Framework/Algorithms/inc/MantidAlgorithms/SumEventsByLogValue.h index 81709e58b400e6bddf4acfb476a7774ffa0ee985..fc92892ce814bd106f8c7f4fa47e8a188bb95985 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SumEventsByLogValue.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SumEventsByLogValue.h @@ -55,7 +55,7 @@ private: const int maxVal, const Kernel::TimeSeriesProperty *log, std::vector &Y); - void addMonitorCounts(API::ITableWorkspace_sptr outputWorkspace, + void addMonitorCounts(const API::ITableWorkspace_sptr &outputWorkspace, const Kernel::TimeSeriesProperty *log, const int minVal, const int maxVal); std::vector> diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SumSpectra.h b/Framework/Algorithms/inc/MantidAlgorithms/SumSpectra.h index cddb3e3e886a0f35101621c92b74bc80ed53b556..1c5e291c7b37bcded8ce6448e6a827a8ede5fbb3 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SumSpectra.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SumSpectra.h @@ -60,21 +60,22 @@ public: private: /// Handle logic for RebinnedOutput workspaces - void doFractionalSum(API::MatrixWorkspace_sptr outputWorkspace, + void doFractionalSum(const API::MatrixWorkspace_sptr &outputWorkspace, API::Progress &progress, size_t &numSpectra, size_t &numMasked, size_t &numZeros); /// Handle logic for Workspace2D workspaces - void doSimpleSum(API::MatrixWorkspace_sptr outputWorkspace, + void doSimpleSum(const API::MatrixWorkspace_sptr &outputWorkspace, API::Progress &progress, size_t &numSpectra, size_t &numMasked, size_t &numZeros); // Overridden Algorithm methods void init() override; void exec() override; - void execEvent(API::MatrixWorkspace_sptr outputWorkspace, + void execEvent(const API::MatrixWorkspace_sptr &outputWorkspace, API::Progress &progress, size_t &numSpectra, size_t &numMasked, size_t &numZeros); - specnum_t getOutputSpecNo(API::MatrixWorkspace_const_sptr localworkspace); + specnum_t + getOutputSpecNo(const API::MatrixWorkspace_const_sptr &localworkspace); API::MatrixWorkspace_sptr replaceSpecialValues(); void determineIndices(const size_t numberOfSpectra); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/TOFSANSResolutionByPixel.h b/Framework/Algorithms/inc/MantidAlgorithms/TOFSANSResolutionByPixel.h index dc97f7594f4b6ce6c320a743b76ffddeab4c1747..7ab48b1ff4783dcc31ff3656b1a51b188136f941 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/TOFSANSResolutionByPixel.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/TOFSANSResolutionByPixel.h @@ -58,13 +58,13 @@ private: double provideDefaultLCollimationLength( Mantid::API::MatrixWorkspace_sptr inWS) const; /// Check input - void checkInput(Mantid::API::MatrixWorkspace_sptr inWS); + void checkInput(const Mantid::API::MatrixWorkspace_sptr &inWS); /// Get the moderator workspace - Mantid::API::MatrixWorkspace_sptr - getModeratorWorkspace(Mantid::API::MatrixWorkspace_sptr inputWorkspace); + Mantid::API::MatrixWorkspace_sptr getModeratorWorkspace( + const Mantid::API::MatrixWorkspace_sptr &inputWorkspace); /// Create an output workspace Mantid::API::MatrixWorkspace_sptr - setupOutputWorkspace(Mantid::API::MatrixWorkspace_sptr inputWorkspace); + setupOutputWorkspace(const Mantid::API::MatrixWorkspace_sptr &inputWorkspace); /// Wavelength resolution (constant for all wavelengths) double m_wl_resolution; }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/TimeAtSampleStrategyDirect.h b/Framework/Algorithms/inc/MantidAlgorithms/TimeAtSampleStrategyDirect.h index 595d6efe549abb41fa73f371b929b03e3d411077..6ba3418f9a37bd195bb44c8a16d4321182cb7f5e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/TimeAtSampleStrategyDirect.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/TimeAtSampleStrategyDirect.h @@ -23,7 +23,8 @@ class MANTID_ALGORITHMS_DLL TimeAtSampleStrategyDirect : public TimeAtSampleStrategy { public: TimeAtSampleStrategyDirect( - boost::shared_ptr ws, double ei); + const boost::shared_ptr &ws, + double ei); Correction calculate(const size_t &workspace_index) const override; private: diff --git a/Framework/Algorithms/inc/MantidAlgorithms/Transpose.h b/Framework/Algorithms/inc/MantidAlgorithms/Transpose.h index 00640af1f88a275ffe82bf7a9b9f65c067c22a77..db1e2c7b70fbbc935b34627e6c516dbfcce4a3f3 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/Transpose.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/Transpose.h @@ -56,9 +56,10 @@ private: void exec() override; /// Create the output workspace API::MatrixWorkspace_sptr - createOutputWorkspace(API::MatrixWorkspace_const_sptr inputWorkspace); + createOutputWorkspace(const API::MatrixWorkspace_const_sptr &inputWorkspace); /// Return the vertical axis on the workspace, throwing if it is not valid - API::Axis *getVerticalAxis(API::MatrixWorkspace_const_sptr workspace) const; + API::Axis * + getVerticalAxis(const API::MatrixWorkspace_const_sptr &workspace) const; }; } // namespace Algorithms diff --git a/Framework/Algorithms/inc/MantidAlgorithms/WienerSmooth.h b/Framework/Algorithms/inc/MantidAlgorithms/WienerSmooth.h index 49c7772d6eb25cda965922d69db556ffdb3a7e06..f7888fff4df99aaee5c4645e69ebe6f9d7c484e0 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/WienerSmooth.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/WienerSmooth.h @@ -35,7 +35,7 @@ private: std::pair getStartEnd(const Mantid::HistogramData::HistogramX &X, bool isHistogram) const; - API::MatrixWorkspace_sptr copyInput(API::MatrixWorkspace_sptr inputWS, + API::MatrixWorkspace_sptr copyInput(const API::MatrixWorkspace_sptr &inputWS, size_t wsIndex); API::MatrixWorkspace_sptr smoothSingleSpectrum(API::MatrixWorkspace_sptr inputWS, size_t wsIndex); diff --git a/Framework/Algorithms/inc/MantidAlgorithms/XDataConverter.h b/Framework/Algorithms/inc/MantidAlgorithms/XDataConverter.h index 2f6cdc8cf15749a3ed700a7d5cb1ead32a82d844..b15e66e66bc674f306118ab2f5fa4d514c3e13a0 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/XDataConverter.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/XDataConverter.h @@ -51,11 +51,11 @@ private: /// Override exec void exec() override; - std::size_t getNewYSize(const API::MatrixWorkspace_sptr inputWS); + std::size_t getNewYSize(const API::MatrixWorkspace_sptr &inputWS); /// Set the X data on given spectra - void setXData(API::MatrixWorkspace_sptr outputWS, - const API::MatrixWorkspace_sptr inputWS, const int index); + void setXData(const API::MatrixWorkspace_sptr &outputWS, + const API::MatrixWorkspace_sptr &inputWS, const int index); /// Flag if the X data is shared bool m_sharedX; diff --git a/Framework/Algorithms/src/AddSampleLog.cpp b/Framework/Algorithms/src/AddSampleLog.cpp index 3227abe3460adfbd29c90f1994a791999f79311f..4f49a04355892b673ce1e94e99a3be27d8ed30b3 100644 --- a/Framework/Algorithms/src/AddSampleLog.cpp +++ b/Framework/Algorithms/src/AddSampleLog.cpp @@ -369,7 +369,7 @@ void AddSampleLog::setTimeSeriesData(Run &run_obj, * @return */ std::vector -AddSampleLog::getTimes(API::MatrixWorkspace_const_sptr dataws, +AddSampleLog::getTimes(const API::MatrixWorkspace_const_sptr &dataws, int workspace_index, bool is_epoch, bool is_second, API::Run &run_obj) { // get run start time @@ -421,7 +421,7 @@ Types::Core::DateAndTime AddSampleLog::getRunStart(API::Run &run_obj) { * @return */ std::vector -AddSampleLog::getDblValues(API::MatrixWorkspace_const_sptr dataws, +AddSampleLog::getDblValues(const API::MatrixWorkspace_const_sptr &dataws, int workspace_index) { std::vector valuevec; size_t vecsize = dataws->readY(workspace_index).size(); @@ -439,7 +439,7 @@ AddSampleLog::getDblValues(API::MatrixWorkspace_const_sptr dataws, * @return */ std::vector -AddSampleLog::getIntValues(API::MatrixWorkspace_const_sptr dataws, +AddSampleLog::getIntValues(const API::MatrixWorkspace_const_sptr &dataws, int workspace_index) { std::vector valuevec; size_t vecsize = dataws->readY(workspace_index).size(); @@ -455,7 +455,7 @@ AddSampleLog::getIntValues(API::MatrixWorkspace_const_sptr dataws, * @param epochtime * @param timeunit */ -void AddSampleLog::getMetaData(API::MatrixWorkspace_const_sptr dataws, +void AddSampleLog::getMetaData(const API::MatrixWorkspace_const_sptr &dataws, bool &epochtime, std::string &timeunit) { bool auto_meta = getProperty("AutoMetaData"); if (auto_meta) { diff --git a/Framework/Algorithms/src/AlignDetectors.cpp b/Framework/Algorithms/src/AlignDetectors.cpp index 60d3cea2e8c0792eb6bffe881a95a55fef964619..5df9f9c859b0d9a20e38502de988ef05935727d3 100644 --- a/Framework/Algorithms/src/AlignDetectors.cpp +++ b/Framework/Algorithms/src/AlignDetectors.cpp @@ -24,6 +24,7 @@ #include #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -41,7 +42,7 @@ namespace { // anonymous namespace class ConversionFactors { public: - explicit ConversionFactors(ITableWorkspace_const_sptr table) + explicit ConversionFactors(const ITableWorkspace_const_sptr &table) : m_difcCol(table->getColumn("difc")), m_difaCol(table->getColumn("difa")), m_tzeroCol(table->getColumn("tzero")) { @@ -70,7 +71,7 @@ public: } private: - void generateDetidToRow(ITableWorkspace_const_sptr table) { + void generateDetidToRow(const ITableWorkspace_const_sptr &table) { ConstColumnVector detIDs = table->getVector("detid"); const size_t numDets = detIDs.size(); for (size_t i = 0; i < numDets; ++i) { @@ -188,7 +189,7 @@ std::map AlignDetectors::validateInputs() { return result; } -void AlignDetectors::loadCalFile(MatrixWorkspace_sptr inputWS, +void AlignDetectors::loadCalFile(const MatrixWorkspace_sptr &inputWS, const std::string &filename) { IAlgorithm_sptr alg = createChildAlgorithm("LoadDiffCal"); alg->setProperty("InputWorkspace", inputWS); @@ -202,7 +203,7 @@ void AlignDetectors::loadCalFile(MatrixWorkspace_sptr inputWS, m_calibrationWS = alg->getProperty("OutputCalWorkspace"); } -void AlignDetectors::getCalibrationWS(MatrixWorkspace_sptr inputWS) { +void AlignDetectors::getCalibrationWS(const MatrixWorkspace_sptr &inputWS) { m_calibrationWS = getProperty("CalibrationWorkspace"); if (m_calibrationWS) return; // nothing more to do @@ -220,14 +221,14 @@ void AlignDetectors::getCalibrationWS(MatrixWorkspace_sptr inputWS) { const std::string calFileName = getPropertyValue("CalibrationFile"); if (!calFileName.empty()) { progress(0.0, "Reading calibration file"); - loadCalFile(inputWS, calFileName); + loadCalFile(std::move(inputWS), calFileName); return; } throw std::runtime_error("Failed to determine calibration information"); } -void setXAxisUnits(API::MatrixWorkspace_sptr outputWS) { +void setXAxisUnits(const API::MatrixWorkspace_sptr &outputWS) { outputWS->getAxis(0)->unit() = UnitFactory::Instance().create("dSpacing"); } diff --git a/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp b/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp index 2b555c68c0f0a059288211a2d7956ac2caa9c30f..1ec74a6976e6d04afe727f5273ea7efb658cb900 100644 --- a/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp +++ b/Framework/Algorithms/src/Bin2DPowderDiffraction.cpp @@ -365,7 +365,8 @@ size_t Bin2DPowderDiffraction::UnifyXBins( return max_size; } -void Bin2DPowderDiffraction::normalizeToBinArea(MatrixWorkspace_sptr outWS) { +void Bin2DPowderDiffraction::normalizeToBinArea( + const MatrixWorkspace_sptr &outWS) { NumericAxis *verticalAxis = dynamic_cast(outWS->getAxis(1)); const std::vector &yValues = verticalAxis->getValues(); auto nhist = outWS->getNumberHistograms(); diff --git a/Framework/Algorithms/src/BinaryOperation.cpp b/Framework/Algorithms/src/BinaryOperation.cpp index 62954e801bb067ef3d3f707004e305be19309015..df4143ea17c09bf4446ceb68024cdc061394f1ba 100644 --- a/Framework/Algorithms/src/BinaryOperation.cpp +++ b/Framework/Algorithms/src/BinaryOperation.cpp @@ -795,7 +795,8 @@ void BinaryOperation::do2D(bool mismatchedSpectra) { * @param out :: The result workspace */ void BinaryOperation::propagateBinMasks( - const API::MatrixWorkspace_const_sptr rhs, API::MatrixWorkspace_sptr out) { + const API::MatrixWorkspace_const_sptr &rhs, + const API::MatrixWorkspace_sptr &out) { const int64_t outHists = out->getNumberHistograms(); const int64_t rhsHists = rhs->getNumberHistograms(); for (int64_t i = 0; i < outHists; ++i) { @@ -876,7 +877,7 @@ void BinaryOperation::performEventBinaryOperation(DataObjects::EventList &lhs, * @return OperandType describing what type of workspace it will be operated as. */ OperandType -BinaryOperation::getOperandType(const API::MatrixWorkspace_const_sptr ws) { +BinaryOperation::getOperandType(const API::MatrixWorkspace_const_sptr &ws) { // An event workspace? EventWorkspace_const_sptr ews = boost::dynamic_pointer_cast(ws); diff --git a/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp b/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp index c0d62145aa1d349217515905cb8c8a6151453a19..7d2997186d538952750887c6f703510d5d6b2332 100644 --- a/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp +++ b/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp @@ -413,7 +413,7 @@ void CalculateCarpenterSampleCorrection::calculate_ms_correction( } MatrixWorkspace_sptr CalculateCarpenterSampleCorrection::createOutputWorkspace( - const MatrixWorkspace_sptr &inputWksp, const std::string ylabel) const { + const MatrixWorkspace_sptr &inputWksp, const std::string &ylabel) const { MatrixWorkspace_sptr outputWS = create(*inputWksp); // The algorithm computes the signal values at bin centres so they should // be treated as a distribution @@ -424,7 +424,7 @@ MatrixWorkspace_sptr CalculateCarpenterSampleCorrection::createOutputWorkspace( } MatrixWorkspace_sptr CalculateCarpenterSampleCorrection::setUncertainties( - MatrixWorkspace_sptr workspace) { + const MatrixWorkspace_sptr &workspace) { auto alg = this->createChildAlgorithm("SetUncertainties"); alg->initialize(); alg->setProperty("InputWorkspace", workspace); @@ -433,7 +433,7 @@ MatrixWorkspace_sptr CalculateCarpenterSampleCorrection::setUncertainties( } void CalculateCarpenterSampleCorrection::deleteWorkspace( - MatrixWorkspace_sptr workspace) { + const MatrixWorkspace_sptr &workspace) { auto alg = this->createChildAlgorithm("DeleteWorkspace"); alg->initialize(); alg->setChild(true); diff --git a/Framework/Algorithms/src/CalculateDynamicRange.cpp b/Framework/Algorithms/src/CalculateDynamicRange.cpp index 50e7b95c74eeb982cd4b983a7c912af5d0f7f8c0..c379339928254015cf5f4e413036607dd335d62f 100644 --- a/Framework/Algorithms/src/CalculateDynamicRange.cpp +++ b/Framework/Algorithms/src/CalculateDynamicRange.cpp @@ -73,9 +73,9 @@ void CalculateDynamicRange::init() { * @param indices : the list of workspace indices * @param compName : the name of the detector component */ -void CalculateDynamicRange::calculateQMinMax(MatrixWorkspace_sptr workspace, - const std::vector &indices, - const std::string &compName = "") { +void CalculateDynamicRange::calculateQMinMax( + const MatrixWorkspace_sptr &workspace, const std::vector &indices, + const std::string &compName = "") { const auto &spectrumInfo = workspace->spectrumInfo(); double min = std::numeric_limits::max(), max = std::numeric_limits::min(); diff --git a/Framework/Algorithms/src/CalculateEfficiency.cpp b/Framework/Algorithms/src/CalculateEfficiency.cpp index 84a379264dbaa8b6d0255e71e1590ce980faac7e..97d115ef78c156580aab0089f12d3389b9eae123 100644 --- a/Framework/Algorithms/src/CalculateEfficiency.cpp +++ b/Framework/Algorithms/src/CalculateEfficiency.cpp @@ -156,9 +156,9 @@ void CalculateEfficiency::exec() { * @param error: error on sum (counts) * @param nPixels: number of unmasked detector pixels that contributed to sum */ -void CalculateEfficiency::sumUnmaskedDetectors(MatrixWorkspace_sptr rebinnedWS, - double &sum, double &error, - int &nPixels) { +void CalculateEfficiency::sumUnmaskedDetectors( + const MatrixWorkspace_sptr &rebinnedWS, double &sum, double &error, + int &nPixels) { // Number of spectra const auto numberOfSpectra = static_cast(rebinnedWS->getNumberHistograms()); @@ -200,11 +200,10 @@ void CalculateEfficiency::sumUnmaskedDetectors(MatrixWorkspace_sptr rebinnedWS, * @param nPixels: number of unmasked detector pixels that contributed to sum */ -void CalculateEfficiency::normalizeDetectors(MatrixWorkspace_sptr rebinnedWS, - MatrixWorkspace_sptr outputWS, - double sum, double error, - int nPixels, double min_eff, - double max_eff) { +void CalculateEfficiency::normalizeDetectors( + const MatrixWorkspace_sptr &rebinnedWS, + const MatrixWorkspace_sptr &outputWS, double sum, double error, int nPixels, + double min_eff, double max_eff) { // Number of spectra const size_t numberOfSpectra = rebinnedWS->getNumberHistograms(); @@ -337,7 +336,7 @@ void CalculateEfficiency::maskComponent(MatrixWorkspace &ws, * @param low :: number of rows to mask Bottom * @param componentName :: Must be a RectangularDetector */ -void CalculateEfficiency::maskEdges(MatrixWorkspace_sptr ws, int left, +void CalculateEfficiency::maskEdges(const MatrixWorkspace_sptr &ws, int left, int right, int high, int low, const std::string &componentName) { diff --git a/Framework/Algorithms/src/CalculateIqt.cpp b/Framework/Algorithms/src/CalculateIqt.cpp index ee3a5012c42545563e6f591fc888211a60a30327..6d18d84ed86bd681ed5024a77f975136b646a952 100644 --- a/Framework/Algorithms/src/CalculateIqt.cpp +++ b/Framework/Algorithms/src/CalculateIqt.cpp @@ -15,6 +15,7 @@ #include #include #include +#include using namespace Mantid::Algorithms; using namespace Mantid::API; @@ -90,7 +91,7 @@ allYValuesAtIndex(const std::vector &workspaces, return yValues; } -int getWorkspaceNumberOfHistograms(MatrixWorkspace_sptr workspace) { +int getWorkspaceNumberOfHistograms(const MatrixWorkspace_sptr &workspace) { return boost::numeric_cast(workspace->getNumberHistograms()); } @@ -172,7 +173,7 @@ std::string CalculateIqt::rebinParamsAsString() { } MatrixWorkspace_sptr CalculateIqt::monteCarloErrorCalculation( - MatrixWorkspace_sptr sample, MatrixWorkspace_sptr resolution, + const MatrixWorkspace_sptr &sample, const MatrixWorkspace_sptr &resolution, const std::string &rebinParams, const int seed, const bool calculateErrors, const int nIterations) { auto outputWorkspace = calculateIqt(sample, resolution, rebinParams); @@ -211,7 +212,7 @@ std::map CalculateIqt::validateInputs() { return issues; } -MatrixWorkspace_sptr CalculateIqt::rebin(MatrixWorkspace_sptr workspace, +MatrixWorkspace_sptr CalculateIqt::rebin(const MatrixWorkspace_sptr &workspace, const std::string ¶ms) { IAlgorithm_sptr rebinAlgorithm = this->createChildAlgorithm("Rebin"); rebinAlgorithm->initialize(); @@ -222,7 +223,8 @@ MatrixWorkspace_sptr CalculateIqt::rebin(MatrixWorkspace_sptr workspace, return rebinAlgorithm->getProperty("OutputWorkspace"); } -MatrixWorkspace_sptr CalculateIqt::integration(MatrixWorkspace_sptr workspace) { +MatrixWorkspace_sptr +CalculateIqt::integration(const MatrixWorkspace_sptr &workspace) { IAlgorithm_sptr integrationAlgorithm = this->createChildAlgorithm("Integration"); integrationAlgorithm->initialize(); @@ -233,7 +235,7 @@ MatrixWorkspace_sptr CalculateIqt::integration(MatrixWorkspace_sptr workspace) { } MatrixWorkspace_sptr -CalculateIqt::convertToPointData(MatrixWorkspace_sptr workspace) { +CalculateIqt::convertToPointData(const MatrixWorkspace_sptr &workspace) { IAlgorithm_sptr pointDataAlgorithm = this->createChildAlgorithm("ConvertToPointData"); pointDataAlgorithm->initialize(); @@ -244,7 +246,7 @@ CalculateIqt::convertToPointData(MatrixWorkspace_sptr workspace) { } MatrixWorkspace_sptr -CalculateIqt::extractFFTSpectrum(MatrixWorkspace_sptr workspace) { +CalculateIqt::extractFFTSpectrum(const MatrixWorkspace_sptr &workspace) { IAlgorithm_sptr FFTAlgorithm = this->createChildAlgorithm("ExtractFFTSpectrum"); FFTAlgorithm->initialize(); @@ -255,8 +257,9 @@ CalculateIqt::extractFFTSpectrum(MatrixWorkspace_sptr workspace) { return FFTAlgorithm->getProperty("OutputWorkspace"); } -MatrixWorkspace_sptr CalculateIqt::divide(MatrixWorkspace_sptr lhsWorkspace, - MatrixWorkspace_sptr rhsWorkspace) { +MatrixWorkspace_sptr +CalculateIqt::divide(const MatrixWorkspace_sptr &lhsWorkspace, + const MatrixWorkspace_sptr &rhsWorkspace) { IAlgorithm_sptr divideAlgorithm = this->createChildAlgorithm("Divide"); divideAlgorithm->initialize(); divideAlgorithm->setProperty("LHSWorkspace", lhsWorkspace); @@ -266,8 +269,9 @@ MatrixWorkspace_sptr CalculateIqt::divide(MatrixWorkspace_sptr lhsWorkspace, return divideAlgorithm->getProperty("OutputWorkspace"); } -MatrixWorkspace_sptr CalculateIqt::cropWorkspace(MatrixWorkspace_sptr workspace, - const double xMax) { +MatrixWorkspace_sptr +CalculateIqt::cropWorkspace(const MatrixWorkspace_sptr &workspace, + const double xMax) { IAlgorithm_sptr cropAlgorithm = this->createChildAlgorithm("CropWorkspace"); cropAlgorithm->initialize(); cropAlgorithm->setProperty("InputWorkspace", workspace); @@ -278,7 +282,7 @@ MatrixWorkspace_sptr CalculateIqt::cropWorkspace(MatrixWorkspace_sptr workspace, } MatrixWorkspace_sptr -CalculateIqt::replaceSpecialValues(MatrixWorkspace_sptr workspace) { +CalculateIqt::replaceSpecialValues(const MatrixWorkspace_sptr &workspace) { IAlgorithm_sptr specialValuesAlgorithm = this->createChildAlgorithm("ReplaceSpecialValues"); specialValuesAlgorithm->initialize(); @@ -311,18 +315,19 @@ CalculateIqt::normalizedFourierTransform(MatrixWorkspace_sptr workspace, MatrixWorkspace_sptr CalculateIqt::calculateIqt(MatrixWorkspace_sptr workspace, - MatrixWorkspace_sptr resolutionWorkspace, + const MatrixWorkspace_sptr &resolutionWorkspace, const std::string &rebinParams) { workspace = normalizedFourierTransform(workspace, rebinParams); - return divide(workspace, resolutionWorkspace); + return divide(workspace, std::move(resolutionWorkspace)); } MatrixWorkspace_sptr CalculateIqt::doSimulation(MatrixWorkspace_sptr sample, MatrixWorkspace_sptr resolution, const std::string &rebinParams, MersenneTwister &mTwister) { - auto simulatedWorkspace = randomizeWorkspaceWithinError(sample, mTwister); - return calculateIqt(simulatedWorkspace, resolution, rebinParams); + auto simulatedWorkspace = + randomizeWorkspaceWithinError(std::move(sample), mTwister); + return calculateIqt(simulatedWorkspace, std::move(resolution), rebinParams); } MatrixWorkspace_sptr CalculateIqt::setErrorsToStandardDeviation( diff --git a/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp b/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp index 4869be6a5d0bb502f8e4a06cebf14723057afbce..9db3a1f2615d036badab8c2af2e4ab020c746f40 100644 --- a/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp +++ b/Framework/Algorithms/src/CalculatePlaczekSelfScattering.cpp @@ -21,7 +21,7 @@ namespace Mantid { namespace Algorithms { std::map> -getSampleSpeciesInfo(const API::MatrixWorkspace_const_sptr ws) { +getSampleSpeciesInfo(const API::MatrixWorkspace_const_sptr &ws) { // get sample information : mass, total scattering length, and concentration // of each species double totalStoich = 0.0; diff --git a/Framework/Algorithms/src/CalculateTransmission.cpp b/Framework/Algorithms/src/CalculateTransmission.cpp index a4534b3209f2c7b0e99310004a63eadebef37dd5..e2269b9791d5418b9ec30b5cae0413a0fe357a35 100644 --- a/Framework/Algorithms/src/CalculateTransmission.cpp +++ b/Framework/Algorithms/src/CalculateTransmission.cpp @@ -25,6 +25,7 @@ #include #include +#include namespace Mantid { namespace Algorithms { @@ -264,7 +265,7 @@ void CalculateTransmission::exec() { *execution */ API::MatrixWorkspace_sptr -CalculateTransmission::extractSpectra(API::MatrixWorkspace_sptr ws, +CalculateTransmission::extractSpectra(const API::MatrixWorkspace_sptr &ws, const std::vector &indices) { // Compile a comma separated list of indices that we can pass to SumSpectra. std::vector indexStrings(indices.size()); @@ -301,11 +302,11 @@ CalculateTransmission::extractSpectra(API::MatrixWorkspace_sptr ws, * execution */ API::MatrixWorkspace_sptr -CalculateTransmission::fit(API::MatrixWorkspace_sptr raw, +CalculateTransmission::fit(const API::MatrixWorkspace_sptr &raw, const std::vector &rebinParams, - const std::string fitMethod) { + const std::string &fitMethod) { MatrixWorkspace_sptr output = - this->extractSpectra(raw, std::vector(1, 0)); + this->extractSpectra(std::move(raw), std::vector(1, 0)); Progress progress(this, m_done, 1.0, 4); progress.report("CalculateTransmission: Performing fit"); @@ -403,8 +404,8 @@ CalculateTransmission::fit(API::MatrixWorkspace_sptr raw, * @throw runtime_error if the Linear algorithm fails during execution */ API::MatrixWorkspace_sptr -CalculateTransmission::fitData(API::MatrixWorkspace_sptr WS, double &grad, - double &offset) { +CalculateTransmission::fitData(const API::MatrixWorkspace_sptr &WS, + double &grad, double &offset) { g_log.information("Fitting the experimental transmission curve"); double start = m_done; IAlgorithm_sptr childAlg = createChildAlgorithm("Fit", start, m_done + 0.9); @@ -436,7 +437,8 @@ CalculateTransmission::fitData(API::MatrixWorkspace_sptr WS, double &grad, * @param[out] coeficients of the polynomial. c[0] + c[1]x + c[2]x^2 + ... */ API::MatrixWorkspace_sptr -CalculateTransmission::fitPolynomial(API::MatrixWorkspace_sptr WS, int order, +CalculateTransmission::fitPolynomial(const API::MatrixWorkspace_sptr &WS, + int order, std::vector &coeficients) { g_log.notice("Fitting the experimental transmission curve fitpolyno"); double start = m_done; @@ -473,7 +475,7 @@ CalculateTransmission::fitPolynomial(API::MatrixWorkspace_sptr WS, int order, */ API::MatrixWorkspace_sptr CalculateTransmission::rebin(const std::vector &binParams, - API::MatrixWorkspace_sptr ws) { + const API::MatrixWorkspace_sptr &ws) { double start = m_done; IAlgorithm_sptr childAlg = createChildAlgorithm("Rebin", start, m_done += 0.05); @@ -493,9 +495,9 @@ CalculateTransmission::rebin(const std::vector &binParams, * @param directWS :: the input direct workspace * @param index :: the index of the detector to checked */ -void CalculateTransmission::logIfNotMonitor(API::MatrixWorkspace_sptr sampleWS, - API::MatrixWorkspace_sptr directWS, - size_t index) { +void CalculateTransmission::logIfNotMonitor( + const API::MatrixWorkspace_sptr &sampleWS, + const API::MatrixWorkspace_sptr &directWS, size_t index) { const std::string message = "The detector at index " + std::to_string(index) + " is not a monitor in the "; if (!sampleWS->spectrumInfo().isMonitor(index)) diff --git a/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp b/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp index 19df98df700a5cb4e0270c17fd3b92e6e9fd60c5..2fde4715f04155e90ec6e462f9e1faf3aaac0797 100644 --- a/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp +++ b/Framework/Algorithms/src/CalculateTransmissionBeamSpreader.cpp @@ -240,8 +240,8 @@ void CalculateTransmissionBeamSpreader::exec() { * @param WS :: The workspace containing the spectrum to sum * @return A Workspace2D containing the sum */ -API::MatrixWorkspace_sptr -CalculateTransmissionBeamSpreader::sumSpectra(API::MatrixWorkspace_sptr WS) { +API::MatrixWorkspace_sptr CalculateTransmissionBeamSpreader::sumSpectra( + const API::MatrixWorkspace_sptr &WS) { Algorithm_sptr childAlg = createChildAlgorithm("SumSpectra"); childAlg->setProperty("InputWorkspace", WS); childAlg->setProperty("IncludeMonitors", false); @@ -255,9 +255,8 @@ CalculateTransmissionBeamSpreader::sumSpectra(API::MatrixWorkspace_sptr WS) { * @param index :: The workspace index of the spectrum to extract * @return A Workspace2D containing the extracted spectrum */ -API::MatrixWorkspace_sptr -CalculateTransmissionBeamSpreader::extractSpectrum(API::MatrixWorkspace_sptr WS, - const size_t index) { +API::MatrixWorkspace_sptr CalculateTransmissionBeamSpreader::extractSpectrum( + const API::MatrixWorkspace_sptr &WS, const size_t index) { // Check that given spectra are monitors if (!WS->spectrumInfo().isMonitor(index)) { g_log.information( @@ -277,8 +276,8 @@ CalculateTransmissionBeamSpreader::extractSpectrum(API::MatrixWorkspace_sptr WS, * @param WS :: The single-spectrum workspace to fit * @return A workspace containing the fit */ -API::MatrixWorkspace_sptr -CalculateTransmissionBeamSpreader::fitToData(API::MatrixWorkspace_sptr WS) { +API::MatrixWorkspace_sptr CalculateTransmissionBeamSpreader::fitToData( + const API::MatrixWorkspace_sptr &WS) { g_log.information("Fitting the experimental transmission curve"); Algorithm_sptr childAlg = createChildAlgorithm("Linear", 0.6, 1.0); childAlg->setProperty("InputWorkspace", WS); diff --git a/Framework/Algorithms/src/CarpenterSampleCorrection.cpp b/Framework/Algorithms/src/CarpenterSampleCorrection.cpp index 87e2af3caa1bd3a3e7cbbd7f530cc31ec5d78f07..404c19988b3dafda7b0afa4420f5d2d7f5df965c 100644 --- a/Framework/Algorithms/src/CarpenterSampleCorrection.cpp +++ b/Framework/Algorithms/src/CarpenterSampleCorrection.cpp @@ -131,8 +131,8 @@ WorkspaceGroup_sptr CarpenterSampleCorrection::calculateCorrection( } MatrixWorkspace_sptr -CarpenterSampleCorrection::minus(const MatrixWorkspace_sptr lhsWS, - const MatrixWorkspace_sptr rhsWS) { +CarpenterSampleCorrection::minus(const MatrixWorkspace_sptr &lhsWS, + const MatrixWorkspace_sptr &rhsWS) { auto minus = this->createChildAlgorithm("Minus", 0.5, 0.75); minus->setProperty("LHSWorkspace", lhsWS); minus->setProperty("RHSWorkspace", rhsWS); @@ -142,8 +142,8 @@ CarpenterSampleCorrection::minus(const MatrixWorkspace_sptr lhsWS, } MatrixWorkspace_sptr -CarpenterSampleCorrection::multiply(const MatrixWorkspace_sptr lhsWS, - const MatrixWorkspace_sptr rhsWS) { +CarpenterSampleCorrection::multiply(const MatrixWorkspace_sptr &lhsWS, + const MatrixWorkspace_sptr &rhsWS) { auto multiply = this->createChildAlgorithm("Multiply", 0.75, 1.0); multiply->setProperty("LHSWorkspace", lhsWS); multiply->setProperty("RHSWorkspace", rhsWS); diff --git a/Framework/Algorithms/src/ChangeTimeZero.cpp b/Framework/Algorithms/src/ChangeTimeZero.cpp index 201a387d5bfc471f8f656eff2ee5a1b306b4cf56..f8375d2062a6071b66c89b2b04e28786fd13db92 100644 --- a/Framework/Algorithms/src/ChangeTimeZero.cpp +++ b/Framework/Algorithms/src/ChangeTimeZero.cpp @@ -20,6 +20,7 @@ #include #include +#include namespace Mantid { namespace Algorithms { @@ -111,7 +112,7 @@ void ChangeTimeZero::exec() { * @returns :: pointer to the outputworkspace */ API::MatrixWorkspace_sptr -ChangeTimeZero::createOutputWS(API::MatrixWorkspace_sptr input, +ChangeTimeZero::createOutputWS(const API::MatrixWorkspace_sptr &input, double startProgress, double stopProgress) { MatrixWorkspace_sptr output = getProperty("OutputWorkspace"); // Check whether input == output to see whether a new workspace is required. @@ -134,13 +135,13 @@ ChangeTimeZero::createOutputWS(API::MatrixWorkspace_sptr input, * @param ws :: a workspace with time stamp information * @returns A time shift in seconds */ -double ChangeTimeZero::getTimeShift(API::MatrixWorkspace_sptr ws) const { +double ChangeTimeZero::getTimeShift(const API::MatrixWorkspace_sptr &ws) const { auto timeShift = m_defaultTimeShift; // Check if we are dealing with an absolute time std::string timeOffset = getProperty("AbsoluteTimeOffset"); if (isAbsoluteTimeShift(timeOffset)) { DateAndTime desiredTime(timeOffset); - DateAndTime originalTime(getStartTimeFromWorkspace(ws)); + DateAndTime originalTime(getStartTimeFromWorkspace(std::move(ws))); timeShift = DateAndTime::secondsFromDuration(desiredTime - originalTime); } else { timeShift = getProperty("RelativeTimeOffset"); @@ -155,9 +156,9 @@ double ChangeTimeZero::getTimeShift(API::MatrixWorkspace_sptr ws) const { * @param startProgress :: start point of the progress * @param stopProgress :: end point of the progress */ -void ChangeTimeZero::shiftTimeOfLogs(Mantid::API::MatrixWorkspace_sptr ws, - double timeShift, double startProgress, - double stopProgress) { +void ChangeTimeZero::shiftTimeOfLogs( + const Mantid::API::MatrixWorkspace_sptr &ws, double timeShift, + double startProgress, double stopProgress) { // We need to change the entries for each log which can be: // 1. any time series: here we change the time values // 2. string properties: here we change the values if they are ISO8601 times @@ -183,7 +184,7 @@ void ChangeTimeZero::shiftTimeOfLogs(Mantid::API::MatrixWorkspace_sptr ws, * @param timeShift :: the time shift in seconds */ void ChangeTimeZero::shiftTimeInLogForTimeSeries( - Mantid::API::MatrixWorkspace_sptr ws, Mantid::Kernel::Property *prop, + const Mantid::API::MatrixWorkspace_sptr &ws, Mantid::Kernel::Property *prop, double timeShift) const { if (auto timeSeries = dynamic_cast(prop)) { @@ -215,9 +216,9 @@ void ChangeTimeZero::shiftTimeOfLogForStringProperty( * @param startProgress :: start point of the progress * @param stopProgress :: end point of the progress */ -void ChangeTimeZero::shiftTimeOfNeutrons(Mantid::API::MatrixWorkspace_sptr ws, - double timeShift, double startProgress, - double stopProgress) { +void ChangeTimeZero::shiftTimeOfNeutrons( + const Mantid::API::MatrixWorkspace_sptr &ws, double timeShift, + double startProgress, double stopProgress) { if (auto eventWs = boost::dynamic_pointer_cast(ws)) { // Use the change pulse time algorithm to change the neutron time stamp @@ -236,8 +237,8 @@ void ChangeTimeZero::shiftTimeOfNeutrons(Mantid::API::MatrixWorkspace_sptr ws, * @param ws :: a workspace * @returns the date and time of the first good frame */ -DateAndTime -ChangeTimeZero::getStartTimeFromWorkspace(API::MatrixWorkspace_sptr ws) const { +DateAndTime ChangeTimeZero::getStartTimeFromWorkspace( + const API::MatrixWorkspace_sptr &ws) const { auto run = ws->run(); // Check for the first good frame in the log Mantid::Kernel::TimeSeriesProperty *goodFrame = nullptr; @@ -317,7 +318,7 @@ std::map ChangeTimeZero::validateInputs() { * @param val :: value to check * @return True if the string can be cast to double and otherwise false. */ -bool ChangeTimeZero::checkForDouble(std::string val) const { +bool ChangeTimeZero::checkForDouble(const std::string &val) const { auto isDouble = false; try { boost::lexical_cast(val); diff --git a/Framework/Algorithms/src/CompareWorkspaces.cpp b/Framework/Algorithms/src/CompareWorkspaces.cpp index abeba3b054afba854555568e88629217ac4852e5..156043256c193b0c8571b16a52999a0a4764181e 100644 --- a/Framework/Algorithms/src/CompareWorkspaces.cpp +++ b/Framework/Algorithms/src/CompareWorkspaces.cpp @@ -262,8 +262,8 @@ bool CompareWorkspaces::processGroups() { * @param groupTwo */ void CompareWorkspaces::processGroups( - boost::shared_ptr groupOne, - boost::shared_ptr groupTwo) { + const boost::shared_ptr &groupOne, + const boost::shared_ptr &groupTwo) { // Check their sizes const auto totalNum = static_cast(groupOne->getNumberOfEntries()); @@ -618,8 +618,8 @@ bool CompareWorkspaces::compareEventWorkspaces( * @retval true The data matches * @retval false The data does not matches */ -bool CompareWorkspaces::checkData(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2) { +bool CompareWorkspaces::checkData(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2) { // Cache a few things for later use const size_t numHists = ws1->getNumberHistograms(); const size_t numBins = ws1->blocksize(); @@ -712,8 +712,8 @@ bool CompareWorkspaces::checkData(API::MatrixWorkspace_const_sptr ws1, * @retval true The axes match * @retval false The axes do not match */ -bool CompareWorkspaces::checkAxes(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2) { +bool CompareWorkspaces::checkAxes(const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2) { const int numAxes = ws1->axes(); if (numAxes != ws2->axes()) { @@ -790,8 +790,8 @@ bool CompareWorkspaces::checkAxes(API::MatrixWorkspace_const_sptr ws1, /// @param ws2 :: the second sp det map /// @retval true The maps match /// @retval false The maps do not match -bool CompareWorkspaces::checkSpectraMap(MatrixWorkspace_const_sptr ws1, - MatrixWorkspace_const_sptr ws2) { +bool CompareWorkspaces::checkSpectraMap(const MatrixWorkspace_const_sptr &ws1, + const MatrixWorkspace_const_sptr &ws2) { if (ws1->getNumberHistograms() != ws2->getNumberHistograms()) { recordMismatch("Number of spectra mismatch"); return false; @@ -832,8 +832,9 @@ bool CompareWorkspaces::checkSpectraMap(MatrixWorkspace_const_sptr ws1, /// @param ws2 :: the second workspace /// @retval true The instruments match /// @retval false The instruments do not match -bool CompareWorkspaces::checkInstrument(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2) { +bool CompareWorkspaces::checkInstrument( + const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2) { // First check the name matches if (ws1->getInstrument()->getName() != ws2->getInstrument()->getName()) { g_log.debug() << "Instrument names: WS1 = " @@ -871,8 +872,9 @@ bool CompareWorkspaces::checkInstrument(API::MatrixWorkspace_const_sptr ws1, /// @param ws2 :: the second workspace /// @retval true The masking matches /// @retval false The masking does not match -bool CompareWorkspaces::checkMasking(API::MatrixWorkspace_const_sptr ws1, - API::MatrixWorkspace_const_sptr ws2) { +bool CompareWorkspaces::checkMasking( + const API::MatrixWorkspace_const_sptr &ws1, + const API::MatrixWorkspace_const_sptr &ws2) { const auto numHists = static_cast(ws1->getNumberHistograms()); for (int i = 0; i < numHists; ++i) { @@ -1111,8 +1113,8 @@ void CompareWorkspaces::doPeaksComparison(PeaksWorkspace_sptr tws1, //------------------------------------------------------------------------------------------------ void CompareWorkspaces::doTableComparison( - API::ITableWorkspace_const_sptr tws1, - API::ITableWorkspace_const_sptr tws2) { + const API::ITableWorkspace_const_sptr &tws1, + const API::ITableWorkspace_const_sptr &tws2) { // First the easy things const auto numCols = tws1->columnCount(); if (numCols != tws2->columnCount()) { @@ -1177,7 +1179,8 @@ void CompareWorkspaces::doTableComparison( } //------------------------------------------------------------------------------------------------ -void CompareWorkspaces::doMDComparison(Workspace_sptr w1, Workspace_sptr w2) { +void CompareWorkspaces::doMDComparison(const Workspace_sptr &w1, + const Workspace_sptr &w2) { IMDWorkspace_sptr mdws1, mdws2; mdws1 = boost::dynamic_pointer_cast(w1); mdws2 = boost::dynamic_pointer_cast(w2); @@ -1204,7 +1207,7 @@ void CompareWorkspaces::doMDComparison(Workspace_sptr w1, Workspace_sptr w2) { * @param ws1 Name of first workspace being compared * @param ws2 Name of second workspace being compared */ -void CompareWorkspaces::recordMismatch(std::string msg, std::string ws1, +void CompareWorkspaces::recordMismatch(const std::string &msg, std::string ws1, std::string ws2) { // Workspace names default to the workspaces currently being compared if (ws1.empty()) { diff --git a/Framework/Algorithms/src/ConjoinXRuns.cpp b/Framework/Algorithms/src/ConjoinXRuns.cpp index 6af9ed086e1d9e74263b9372839a4b1535ac6de0..0378cc1110100093ecd06c1e7a1053c883f8728a 100644 --- a/Framework/Algorithms/src/ConjoinXRuns.cpp +++ b/Framework/Algorithms/src/ConjoinXRuns.cpp @@ -198,7 +198,7 @@ std::map ConjoinXRuns::validateInputs() { * @return : empty if the log exists, is numeric, and matches the size of the * workspace, error message otherwise */ -std::string ConjoinXRuns::checkLogEntry(MatrixWorkspace_sptr ws) const { +std::string ConjoinXRuns::checkLogEntry(const MatrixWorkspace_sptr &ws) const { std::string result; if (!m_logEntry.empty()) { @@ -250,7 +250,8 @@ std::string ConjoinXRuns::checkLogEntry(MatrixWorkspace_sptr ws) const { * @param ws : the input workspace * @return : the x-axis to use for the output workspace */ -std::vector ConjoinXRuns::getXAxis(MatrixWorkspace_sptr ws) const { +std::vector +ConjoinXRuns::getXAxis(const MatrixWorkspace_sptr &ws) const { std::vector axis; axis.reserve(ws->y(0).size()); diff --git a/Framework/Algorithms/src/ConvertDiffCal.cpp b/Framework/Algorithms/src/ConvertDiffCal.cpp index 988c023d2488a7f7717c2f1a5a52af530feb8839..a8c0718a3f566b5c161565732086765b6e9f0b1d 100644 --- a/Framework/Algorithms/src/ConvertDiffCal.cpp +++ b/Framework/Algorithms/src/ConvertDiffCal.cpp @@ -69,7 +69,8 @@ void ConvertDiffCal::init() { * @param index * @return The proper detector id. */ -detid_t getDetID(OffsetsWorkspace_const_sptr offsetsWS, const size_t index) { +detid_t getDetID(const OffsetsWorkspace_const_sptr &offsetsWS, + const size_t index) { auto detIDs = offsetsWS->getSpectrum(index).getDetectorIDs(); if (detIDs.size() != 1) { std::stringstream msg; @@ -86,7 +87,8 @@ detid_t getDetID(OffsetsWorkspace_const_sptr offsetsWS, const size_t index) { * @param detid * @return The offset value or zero if not specified. */ -double getOffset(OffsetsWorkspace_const_sptr offsetsWS, const detid_t detid) { +double getOffset(const OffsetsWorkspace_const_sptr &offsetsWS, + const detid_t detid) { const double offset = offsetsWS->getValue(detid, 0.0); if (offset <= -1.) { // non-physical std::stringstream msg; @@ -104,7 +106,8 @@ double getOffset(OffsetsWorkspace_const_sptr offsetsWS, const detid_t detid) { * @param spectrumInfo * @return The offset adjusted value of DIFC */ -double calculateDIFC(OffsetsWorkspace_const_sptr offsetsWS, const size_t index, +double calculateDIFC(const OffsetsWorkspace_const_sptr &offsetsWS, + const size_t index, const Mantid::API::SpectrumInfo &spectrumInfo) { const detid_t detid = getDetID(offsetsWS, index); const double offset = getOffset(offsetsWS, detid); diff --git a/Framework/Algorithms/src/ConvertEmptyToTof.cpp b/Framework/Algorithms/src/ConvertEmptyToTof.cpp index 2a462a7bd7503969c2bfef90189716ef914d9885..70dd3af9bf6a278de0d8eed1fdd2a9983b08f7e7 100644 --- a/Framework/Algorithms/src/ConvertEmptyToTof.cpp +++ b/Framework/Algorithms/src/ConvertEmptyToTof.cpp @@ -500,7 +500,7 @@ std::vector ConvertEmptyToTof::makeTofAxis(int epp, double epTof, } void ConvertEmptyToTof::setTofInWS(const std::vector &tofAxis, - API::MatrixWorkspace_sptr outputWS) { + const API::MatrixWorkspace_sptr &outputWS) { const size_t numberOfSpectra = m_inputWS->getNumberHistograms(); diff --git a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp index a3d5eda58629a8b568bbf0a36bfd2899f06a7678..4445fa6829efb517574a111caec27dd2628a7f95 100644 --- a/Framework/Algorithms/src/ConvertSpectrumAxis.cpp +++ b/Framework/Algorithms/src/ConvertSpectrumAxis.cpp @@ -186,7 +186,7 @@ void ConvertSpectrumAxis::exec() { double ConvertSpectrumAxis::getEfixed(const Mantid::Geometry::IDetector &detector, - MatrixWorkspace_const_sptr inputWS, + const MatrixWorkspace_const_sptr &inputWS, int emode) const { double efixed(0); double efixedProp = getProperty("Efixed"); diff --git a/Framework/Algorithms/src/ConvertToConstantL2.cpp b/Framework/Algorithms/src/ConvertToConstantL2.cpp index d49e9e967504774b4d6b4b670e4468297d786376..d863ded28228c97068ed78e99a214fa2e8bd0f7e 100644 --- a/Framework/Algorithms/src/ConvertToConstantL2.cpp +++ b/Framework/Algorithms/src/ConvertToConstantL2.cpp @@ -141,7 +141,7 @@ void ConvertToConstantL2::exec() { * @s - input property name * */ -double ConvertToConstantL2::getRunProperty(std::string s) { +double ConvertToConstantL2::getRunProperty(const std::string &s) { const auto &run = m_inputWS->run(); if (!run.hasProperty(s)) { throw Exception::NotFoundError("Sample log property not found", s); @@ -160,7 +160,7 @@ double ConvertToConstantL2::getRunProperty(std::string s) { * @s - input property name * */ -double ConvertToConstantL2::getInstrumentProperty(std::string s) { +double ConvertToConstantL2::getInstrumentProperty(const std::string &s) { std::vector prop = m_instrument->getStringParameter(s); if (prop.empty()) { const std::string mesg = "Property <" + s + "> doesn't exist!"; diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp index df6cb856adb21f062998de1318052a535cc33c05..fd8d9fbe29039bdcb683ca6a7f24e4884432f50d 100644 --- a/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Framework/Algorithms/src/ConvertUnits.cpp @@ -186,7 +186,7 @@ void ConvertUnits::exec() { * @return A pointer to a MatrixWorkspace_sptr that contains the converted units */ MatrixWorkspace_sptr -ConvertUnits::executeUnitConversion(const API::MatrixWorkspace_sptr inputWS) { +ConvertUnits::executeUnitConversion(const API::MatrixWorkspace_sptr &inputWS) { // A WS holding BinEdges cannot have less than 2 values, as a bin has // 2 edges, having less than 2 values would mean that the WS contains Points @@ -251,7 +251,7 @@ ConvertUnits::executeUnitConversion(const API::MatrixWorkspace_sptr inputWS) { * @param inputWS The input workspace */ void ConvertUnits::setupMemberVariables( - const API::MatrixWorkspace_const_sptr inputWS) { + const API::MatrixWorkspace_const_sptr &inputWS) { m_numberOfSpectra = inputWS->getNumberHistograms(); // In the context of this algorithm, we treat things as a distribution if // the flag is set AND the data are not dimensionless @@ -271,7 +271,7 @@ void ConvertUnits::setupMemberVariables( * @param inputWS The input workspace */ API::MatrixWorkspace_sptr ConvertUnits::setupOutputWorkspace( - const API::MatrixWorkspace_const_sptr inputWS) { + const API::MatrixWorkspace_const_sptr &inputWS) { MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace"); // If input and output workspaces are NOT the same, create a new workspace @@ -328,7 +328,7 @@ void ConvertUnits::storeEModeOnWorkspace(API::MatrixWorkspace_sptr outputWS) { * @returns A shared pointer to the output workspace */ MatrixWorkspace_sptr -ConvertUnits::convertQuickly(API::MatrixWorkspace_const_sptr inputWS, +ConvertUnits::convertQuickly(const API::MatrixWorkspace_const_sptr &inputWS, const double &factor, const double &power) { Progress prog(this, 0.2, 1.0, m_numberOfSpectra); auto numberOfSpectra_i = @@ -603,7 +603,7 @@ ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUnit, /// Calls Rebin as a Child Algorithm to align the bins API::MatrixWorkspace_sptr -ConvertUnits::alignBins(API::MatrixWorkspace_sptr workspace) { +ConvertUnits::alignBins(const API::MatrixWorkspace_sptr &workspace) { if (communicator().size() != 1) throw std::runtime_error( "ConvertUnits: Parallel support for aligning bins not implemented."); @@ -623,7 +623,7 @@ ConvertUnits::alignBins(API::MatrixWorkspace_sptr workspace) { /// The Rebin parameters should cover the full range of the converted unit, /// with the same number of bins const std::vector ConvertUnits::calculateRebinParams( - const API::MatrixWorkspace_const_sptr workspace) const { + const API::MatrixWorkspace_const_sptr &workspace) const { const auto &spectrumInfo = workspace->spectrumInfo(); // Need to loop round and find the full range double XMin = DBL_MAX, XMax = DBL_MIN; @@ -650,7 +650,7 @@ const std::vector ConvertUnits::calculateRebinParams( /** Reverses the workspace if X values are in descending order * @param WS The workspace to operate on */ -void ConvertUnits::reverse(API::MatrixWorkspace_sptr WS) { +void ConvertUnits::reverse(const API::MatrixWorkspace_sptr &WS) { EventWorkspace_sptr eventWS = boost::dynamic_pointer_cast(WS); auto isInputEvents = static_cast(eventWS); size_t numberOfSpectra = WS->getNumberHistograms(); @@ -700,7 +700,7 @@ void ConvertUnits::reverse(API::MatrixWorkspace_sptr WS) { * @return The workspace after bins have been removed */ API::MatrixWorkspace_sptr ConvertUnits::removeUnphysicalBins( - const Mantid::API::MatrixWorkspace_const_sptr workspace) { + const Mantid::API::MatrixWorkspace_const_sptr &workspace) { MatrixWorkspace_sptr result; const auto &spectrumInfo = workspace->spectrumInfo(); @@ -786,7 +786,7 @@ API::MatrixWorkspace_sptr ConvertUnits::removeUnphysicalBins( /** Divide by the bin width if workspace is a distribution * @param outputWS The workspace to operate on */ -void ConvertUnits::putBackBinWidth(const API::MatrixWorkspace_sptr outputWS) { +void ConvertUnits::putBackBinWidth(const API::MatrixWorkspace_sptr &outputWS) { const size_t outSize = outputWS->blocksize(); for (size_t i = 0; i < m_numberOfSpectra; ++i) { diff --git a/Framework/Algorithms/src/CopyDataRange.cpp b/Framework/Algorithms/src/CopyDataRange.cpp index f7d36388c84a8458600780d3b960aaa2388b71ae..1697ef5f70d78264c65b6b1c2b41a93fc3f5a932 100644 --- a/Framework/Algorithms/src/CopyDataRange.cpp +++ b/Framework/Algorithms/src/CopyDataRange.cpp @@ -11,6 +11,7 @@ #include "MantidKernel/BoundedValidator.h" #include +#include using namespace Mantid::API; using namespace Mantid::Kernel; @@ -18,9 +19,9 @@ using namespace Mantid::HistogramData; namespace { -void copyDataRange(MatrixWorkspace_const_sptr inputWorkspace, - MatrixWorkspace_sptr destWorkspace, int const &specMin, - int const &specMax, int const &xMinIndex, +void copyDataRange(const MatrixWorkspace_const_sptr &inputWorkspace, + const MatrixWorkspace_sptr &destWorkspace, + int const &specMin, int const &specMax, int const &xMinIndex, int const &xMaxIndex, int yInsertionIndex, int const &xInsertionIndex) { for (auto specIndex = specMin; specIndex <= specMax; ++specIndex) { @@ -36,17 +37,18 @@ void copyDataRange(MatrixWorkspace_const_sptr inputWorkspace, } } -void copyDataRange(MatrixWorkspace_const_sptr inputWorkspace, - MatrixWorkspace_sptr destWorkspace, int const &specMin, - int const &specMax, double const &xMin, double const &xMax, - int yInsertionIndex, int const &xInsertionIndex) { +void copyDataRange(const MatrixWorkspace_const_sptr &inputWorkspace, + const MatrixWorkspace_sptr &destWorkspace, + int const &specMin, int const &specMax, double const &xMin, + double const &xMax, int yInsertionIndex, + int const &xInsertionIndex) { auto const xMinIndex = static_cast(inputWorkspace->yIndexOfX(xMin, 0, 0.000001)); auto const xMaxIndex = static_cast(inputWorkspace->yIndexOfX(xMax, 0, 0.000001)); - copyDataRange(inputWorkspace, destWorkspace, specMin, specMax, xMinIndex, - xMaxIndex, yInsertionIndex, xInsertionIndex); + copyDataRange(inputWorkspace, std::move(destWorkspace), specMin, specMax, + xMinIndex, xMaxIndex, yInsertionIndex, xInsertionIndex); } } // namespace diff --git a/Framework/Algorithms/src/CorrectKiKf.cpp b/Framework/Algorithms/src/CorrectKiKf.cpp index 4c7d5f401a2700cb5e8a91a3181ff25b94f3dd09..492a047143adf2a1020dda3af83cc1e81da88727 100644 --- a/Framework/Algorithms/src/CorrectKiKf.cpp +++ b/Framework/Algorithms/src/CorrectKiKf.cpp @@ -279,7 +279,7 @@ void CorrectKiKf::execEvent() { template void CorrectKiKf::correctKiKfEventHelper(std::vector &wevector, double efixed, - const std::string emodeStr) { + const std::string &emodeStr) { double Ei, Ef; float kioverkf; typename std::vector::iterator it; diff --git a/Framework/Algorithms/src/CorrectTOFAxis.cpp b/Framework/Algorithms/src/CorrectTOFAxis.cpp index 804ec046dd07a2821332b116511fdd2d90bec2ca..c6840afcdee04eb9d86d19c62e35dc39694a7480 100644 --- a/Framework/Algorithms/src/CorrectTOFAxis.cpp +++ b/Framework/Algorithms/src/CorrectTOFAxis.cpp @@ -105,7 +105,7 @@ template size_t mapIndex(const int index, const Map &indexMap) { * @return A workspace index corresponding to index. */ size_t toWorkspaceIndex(const int index, const std::string &indexType, - API::MatrixWorkspace_const_sptr ws) { + const API::MatrixWorkspace_const_sptr &ws) { if (indexType == IndexTypes::DETECTOR_ID) { const auto indexMap = ws->getDetectorIDToWorkspaceIndexMap(); return mapIndex(index, indexMap); @@ -345,7 +345,8 @@ void CorrectTOFAxis::exec() { * corrected workspace. * @param outputWs The corrected workspace */ -void CorrectTOFAxis::useReferenceWorkspace(API::MatrixWorkspace_sptr outputWs) { +void CorrectTOFAxis::useReferenceWorkspace( + const API::MatrixWorkspace_sptr &outputWs) { const auto histogramCount = static_cast(m_referenceWs->getNumberHistograms()); PARALLEL_FOR_IF(threadSafe(*m_referenceWs, *outputWs)) @@ -377,7 +378,8 @@ void CorrectTOFAxis::useReferenceWorkspace(API::MatrixWorkspace_sptr outputWs) { * specifically, also adjusts the 'Ei' and 'wavelength' sample logs. * @param outputWs The corrected workspace */ -void CorrectTOFAxis::correctManually(API::MatrixWorkspace_sptr outputWs) { +void CorrectTOFAxis::correctManually( + const API::MatrixWorkspace_sptr &outputWs) { const auto &spectrumInfo = m_inputWs->spectrumInfo(); const double l1 = spectrumInfo.l1(); double l2 = 0; diff --git a/Framework/Algorithms/src/CorrectToFile.cpp b/Framework/Algorithms/src/CorrectToFile.cpp index a45c30bfadf39337a78ca9105230a41641145f92..8c426ffa0f5a0121d24041ff1ae316ff8b079137 100644 --- a/Framework/Algorithms/src/CorrectToFile.cpp +++ b/Framework/Algorithms/src/CorrectToFile.cpp @@ -186,8 +186,8 @@ MatrixWorkspace_sptr CorrectToFile::loadInFile(const std::string &corrFile) { * @throw NotFoundError if requested algorithm requested doesn't exist * @throw runtime_error if algorithm encounters an error */ -void CorrectToFile::doWkspAlgebra(API::MatrixWorkspace_sptr lhs, - API::MatrixWorkspace_sptr rhs, +void CorrectToFile::doWkspAlgebra(const API::MatrixWorkspace_sptr &lhs, + const API::MatrixWorkspace_sptr &rhs, const std::string &algName, API::MatrixWorkspace_sptr &result) { g_log.information() << "Initalising the algorithm " << algName << '\n'; diff --git a/Framework/Algorithms/src/CreateEPP.cpp b/Framework/Algorithms/src/CreateEPP.cpp index 285b6743a131fa0308f5f455c4d0142f35e34f9a..0efb5dc39549f1133941f5dec5dece08eeb8ed12 100644 --- a/Framework/Algorithms/src/CreateEPP.cpp +++ b/Framework/Algorithms/src/CreateEPP.cpp @@ -49,7 +49,7 @@ const static std::string STATUS("FitStatus"); * * @param ws The TableWorkspace to add the columns to. */ -void addEPPColumns(API::ITableWorkspace_sptr ws) { +void addEPPColumns(const API::ITableWorkspace_sptr &ws) { ws->addColumn("int", ColumnNames::WS_INDEX); ws->addColumn("double", ColumnNames::PEAK_CENTRE); ws->addColumn("double", ColumnNames::PEAK_CENTRE_ERR); diff --git a/Framework/Algorithms/src/CreateFloodWorkspace.cpp b/Framework/Algorithms/src/CreateFloodWorkspace.cpp index 6d281c5b536574024d7c94fb1d90bbfea6a8b6ef..c7099c8ccc6226ccfbe99f822c20cc99ac38ceee 100644 --- a/Framework/Algorithms/src/CreateFloodWorkspace.cpp +++ b/Framework/Algorithms/src/CreateFloodWorkspace.cpp @@ -129,7 +129,8 @@ std::string CreateFloodWorkspace::getBackgroundFunction() { return funMap.at(getPropertyValue(Prop::BACKGROUND)); } -MatrixWorkspace_sptr CreateFloodWorkspace::integrate(MatrixWorkspace_sptr ws) { +MatrixWorkspace_sptr +CreateFloodWorkspace::integrate(const MatrixWorkspace_sptr &ws) { auto alg = createChildAlgorithm("Integration"); alg->setProperty("InputWorkspace", ws); alg->setProperty("OutputWorkspace", "dummy"); @@ -145,7 +146,8 @@ MatrixWorkspace_sptr CreateFloodWorkspace::integrate(MatrixWorkspace_sptr ws) { return alg->getProperty("OutputWorkspace"); } -MatrixWorkspace_sptr CreateFloodWorkspace::transpose(MatrixWorkspace_sptr ws) { +MatrixWorkspace_sptr +CreateFloodWorkspace::transpose(const MatrixWorkspace_sptr &ws) { auto alg = createChildAlgorithm("Transpose"); alg->setProperty("InputWorkspace", ws); alg->setProperty("OutputWorkspace", "dummy"); diff --git a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp index 05cfbd7ce3a6808e63216e1b539e08ea55a47a39..63eea8809ca28d90709ec116a6d283afccd611ca 100644 --- a/Framework/Algorithms/src/CreateGroupingWorkspace.cpp +++ b/Framework/Algorithms/src/CreateGroupingWorkspace.cpp @@ -19,6 +19,7 @@ #include #include #include +#include namespace { Mantid::Kernel::Logger g_log("CreateGroupingWorkspace"); @@ -207,10 +208,9 @@ std::map readGroupingFile(const std::string &groupingFileName, * @param prog Progress reporter * @returns :: Map of detector IDs to group number */ -std::map makeGroupingByNumGroups(const std::string compName, - int numGroups, - Instrument_const_sptr inst, - Progress &prog) { +std::map +makeGroupingByNumGroups(const std::string &compName, int numGroups, + const Instrument_const_sptr &inst, Progress &prog) { std::map detIDtoGroup; // Get detectors for given instument component @@ -250,14 +250,14 @@ std::map makeGroupingByNumGroups(const std::string compName, bool groupnumber(std::string groupi, std::string groupj) { int i = 0; - std::string groupName = groupi; + std::string groupName = std::move(groupi); // Take out the "group" part of the group name and convert to an int groupName.erase( remove_if(groupName.begin(), groupName.end(), std::not_fn(::isdigit)), groupName.end()); Strings::convert(groupName, i); int j = 0; - groupName = groupj; + groupName = std::move(groupj); // Take out the "group" part of the group name and convert to an int groupName.erase( remove_if(groupName.begin(), groupName.end(), std::not_fn(::isdigit)), @@ -276,7 +276,7 @@ bool groupnumber(std::string groupi, std::string groupj) { * @returns:: map of detID to group number */ std::map makeGroupingByNames(std::string GroupNames, - Instrument_const_sptr inst, + const Instrument_const_sptr &inst, Progress &prog, bool sortnames) { // This will contain the grouping std::map detIDtoGroup; diff --git a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp index 98618d4b31c737972dfa16c4722359cf12dc0c4c..9eed0c6079e0788f992f916f424545ff9b7a7d81 100644 --- a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp +++ b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp @@ -149,7 +149,7 @@ TableWorkspace_sptr CreateLogTimeCorrection::generateCorrectionTable( /** Write correction map to a text file */ void CreateLogTimeCorrection::writeCorrectionToFile( - const string filename, const Geometry::DetectorInfo &detectorInfo, + const string &filename, const Geometry::DetectorInfo &detectorInfo, const std::vector &corrections) const { ofstream ofile; ofile.open(filename.c_str()); diff --git a/Framework/Algorithms/src/CreatePSDBleedMask.cpp b/Framework/Algorithms/src/CreatePSDBleedMask.cpp index 66f62ba851ffddbae94c7cbaeea06835aedad295..8b1aba621f7c5bdfa0ab9d455f1c90e87e9d528c 100644 --- a/Framework/Algorithms/src/CreatePSDBleedMask.cpp +++ b/Framework/Algorithms/src/CreatePSDBleedMask.cpp @@ -201,7 +201,7 @@ void CreatePSDBleedMask::exec() { */ bool CreatePSDBleedMask::performBleedTest( const std::vector &tubeIndices, - API::MatrixWorkspace_const_sptr inputWS, double maxRate, + const API::MatrixWorkspace_const_sptr &inputWS, double maxRate, int numIgnoredPixels) { // Require ordered pixels so that we can define the centre. @@ -263,7 +263,7 @@ bool CreatePSDBleedMask::performBleedTest( * @param workspace :: The workspace to accumulate the masking */ void CreatePSDBleedMask::maskTube(const std::vector &tubeIndices, - API::MatrixWorkspace_sptr workspace) { + const API::MatrixWorkspace_sptr &workspace) { const double deadValue(1.0); // delete the data for (auto tubeIndice : tubeIndices) { workspace->mutableY(tubeIndice)[0] = deadValue; diff --git a/Framework/Algorithms/src/CreateSampleWorkspace.cpp b/Framework/Algorithms/src/CreateSampleWorkspace.cpp index 42352e54aceb39f1958d23c79e828be2612b1e93..300a2842a67df0f4f8795979075a0ff3345ff693 100644 --- a/Framework/Algorithms/src/CreateSampleWorkspace.cpp +++ b/Framework/Algorithms/src/CreateSampleWorkspace.cpp @@ -309,7 +309,7 @@ void CreateSampleWorkspace::addChopperParameters( */ MatrixWorkspace_sptr CreateSampleWorkspace::createHistogramWorkspace( int numPixels, int numBins, int numMonitors, double x0, double binDelta, - Geometry::Instrument_sptr inst, const std::string &functionString, + const Geometry::Instrument_sptr &inst, const std::string &functionString, bool isRandom) { BinEdges x(numBins + 1, LinearGenerator(x0, binDelta)); @@ -330,8 +330,9 @@ MatrixWorkspace_sptr CreateSampleWorkspace::createHistogramWorkspace( /** Create scanning histogram workspace */ MatrixWorkspace_sptr CreateSampleWorkspace::createScanningWorkspace( - int numBins, double x0, double binDelta, Geometry::Instrument_sptr inst, - const std::string &functionString, bool isRandom, int numScanPoints) { + int numBins, double x0, double binDelta, + const Geometry::Instrument_sptr &inst, const std::string &functionString, + bool isRandom, int numScanPoints) { auto builder = ScanningWorkspaceBuilder(inst, numScanPoints, numBins); auto angles = std::vector(); @@ -359,7 +360,7 @@ MatrixWorkspace_sptr CreateSampleWorkspace::createScanningWorkspace( */ EventWorkspace_sptr CreateSampleWorkspace::createEventWorkspace( int numPixels, int numBins, int numMonitors, int numEvents, double x0, - double binDelta, Geometry::Instrument_sptr inst, + double binDelta, const Geometry::Instrument_sptr &inst, const std::string &functionString, bool isRandom) { DateAndTime run_start("2010-01-01T00:00:00"); diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp index 1a51af9c5f506c85fe783215ef6542eb52917a47..a4332c2603fa162fd8a4e7fc64ecc3c7053f0e6e 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp @@ -4,8 +4,10 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidAlgorithms/CreateTransmissionWorkspace.h" +#include + #include "MantidAPI/BoostOptionalToAlgorithmProperty.h" +#include "MantidAlgorithms/CreateTransmissionWorkspace.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceUnitValidator.h" @@ -154,7 +156,7 @@ MatrixWorkspace_sptr CreateTransmissionWorkspace::makeTransmissionCorrection( const OptionalMinMax &wavelengthMonitorBackgroundInterval, const OptionalMinMax &wavelengthMonitorIntegrationInterval, const OptionalInteger &i0MonitorIndex, - MatrixWorkspace_sptr firstTransmissionRun, + const MatrixWorkspace_sptr &firstTransmissionRun, OptionalMatrixWorkspace_sptr secondTransmissionRun, const OptionalDouble &stitchingStart, const OptionalDouble &stitchingDelta, const OptionalDouble &stitchingEnd, @@ -163,7 +165,7 @@ MatrixWorkspace_sptr CreateTransmissionWorkspace::makeTransmissionCorrection( /*make struct of optional inputs to refactor method arguments*/ /*make a using statements defining OptionalInteger for MonitorIndex*/ auto trans1InLam = - toLam(firstTransmissionRun, processingCommands, i0MonitorIndex, + toLam(std::move(firstTransmissionRun), processingCommands, i0MonitorIndex, wavelengthInterval, wavelengthMonitorBackgroundInterval); MatrixWorkspace_sptr trans1Detector = trans1InLam.get<0>(); MatrixWorkspace_sptr trans1Monitor = trans1InLam.get<1>(); diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspace2.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspace2.cpp index 5010dbffc411acf4e0c3251357f0de21919d4b6d..bf6b018ee136954709a06d22ac9d7b870ace1616 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspace2.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspace2.cpp @@ -183,7 +183,7 @@ void CreateTransmissionWorkspace2::exec() { * @return :: the normalized workspace in Wavelength */ MatrixWorkspace_sptr CreateTransmissionWorkspace2::normalizeDetectorsByMonitors( - const MatrixWorkspace_sptr IvsTOF) { + const MatrixWorkspace_sptr &IvsTOF) { // Detector workspace MatrixWorkspace_sptr detectorWS = makeDetectorWS(IvsTOF); @@ -249,7 +249,7 @@ CreateTransmissionWorkspace2::getRunNumber(std::string const &propertyName) { * @param ws A workspace to store. */ void CreateTransmissionWorkspace2::setOutputTransmissionRun( - int which, MatrixWorkspace_sptr ws) { + int which, const MatrixWorkspace_sptr &ws) { bool const isDebug = getProperty("Debug"); if (!isDebug) return; @@ -291,7 +291,7 @@ void CreateTransmissionWorkspace2::setOutputTransmissionRun( * be found */ void CreateTransmissionWorkspace2::setOutputWorkspace( - API::MatrixWorkspace_sptr ws) { + const API::MatrixWorkspace_sptr &ws) { // If the user provided an output name, just set the value if (!isDefault("OutputWorkspace")) { setProperty("OutputWorkspace", ws); diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp index 8ada727d00476c6646852d37ac65f5d9bb51911b..132efa67800b69173914c73520fef9b296d7ae90 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspaceAuto.cpp @@ -240,7 +240,7 @@ void CreateTransmissionWorkspaceAuto::exec() { template boost::optional -CreateTransmissionWorkspaceAuto::isSet(std::string propName) const { +CreateTransmissionWorkspaceAuto::isSet(const std::string &propName) const { auto algProperty = this->getPointerToProperty(propName); if (algProperty->isDefault()) { return boost::optional(); diff --git a/Framework/Algorithms/src/DetectorDiagnostic.cpp b/Framework/Algorithms/src/DetectorDiagnostic.cpp index e46cd0743cea4dba5dbf07d9f8aa3c980eb9d959..816779e650d9caf470a175c147bc72aa836a483f 100644 --- a/Framework/Algorithms/src/DetectorDiagnostic.cpp +++ b/Framework/Algorithms/src/DetectorDiagnostic.cpp @@ -376,8 +376,8 @@ void DetectorDiagnostic::exec() { * @param inputWS : the workspace to mask * @param maskWS : the workspace containing the masking information */ -void DetectorDiagnostic::applyMask(API::MatrixWorkspace_sptr inputWS, - API::MatrixWorkspace_sptr maskWS) { +void DetectorDiagnostic::applyMask(const API::MatrixWorkspace_sptr &inputWS, + const API::MatrixWorkspace_sptr &maskWS) { IAlgorithm_sptr maskAlg = createChildAlgorithm("MaskDetectors"); // should set progress bar maskAlg->setProperty("Workspace", inputWS); @@ -394,7 +394,7 @@ void DetectorDiagnostic::applyMask(API::MatrixWorkspace_sptr inputWS, * @return : the resulting mask from the checks */ API::MatrixWorkspace_sptr -DetectorDiagnostic::doDetVanTest(API::MatrixWorkspace_sptr inputWS, +DetectorDiagnostic::doDetVanTest(const API::MatrixWorkspace_sptr &inputWS, int &nFails) { MatrixWorkspace_sptr localMask; @@ -483,7 +483,7 @@ DetectorDiagnostic::DetectorDiagnostic() * @returns A workspace containing the integrated counts */ MatrixWorkspace_sptr DetectorDiagnostic::integrateSpectra( - MatrixWorkspace_sptr inputWS, const int indexMin, const int indexMax, + const MatrixWorkspace_sptr &inputWS, const int indexMin, const int indexMax, const double lower, const double upper, const bool outputWorkspace2D) { g_log.debug() << "Integrating input spectra.\n"; // If the input spectra only has one bin, assume it has been integrated @@ -525,8 +525,8 @@ MatrixWorkspace_sptr DetectorDiagnostic::integrateSpectra( * @param inputWS The workspace to initialize from. The instrument is copied *from this. */ -DataObjects::MaskWorkspace_sptr -DetectorDiagnostic::generateEmptyMask(API::MatrixWorkspace_const_sptr inputWS) { +DataObjects::MaskWorkspace_sptr DetectorDiagnostic::generateEmptyMask( + const API::MatrixWorkspace_const_sptr &inputWS) { // Create a new workspace for the results, copy from the input to ensure that // we copy over the instrument and current masking auto maskWS = @@ -547,7 +547,7 @@ DetectorDiagnostic::makeInstrumentMap(const API::MatrixWorkspace &countsWS) { * */ std::vector> -DetectorDiagnostic::makeMap(API::MatrixWorkspace_sptr countsWS) { +DetectorDiagnostic::makeMap(const API::MatrixWorkspace_sptr &countsWS) { std::multimap mymap; Geometry::Instrument_const_sptr instrument = countsWS->getInstrument(); diff --git a/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp b/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp index 6192db26833a047ddd1ec0080ed8a24c037bd02e..cba50b3442bef9daebb8d77a581afc220e176cff 100644 --- a/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp +++ b/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp @@ -187,8 +187,8 @@ void DetectorEfficiencyVariation::retrieveProperties( * @return number of detectors for which tests failed */ int DetectorEfficiencyVariation::doDetectorTests( - API::MatrixWorkspace_const_sptr counts1, - API::MatrixWorkspace_const_sptr counts2, const double average, + const API::MatrixWorkspace_const_sptr &counts1, + const API::MatrixWorkspace_const_sptr &counts2, const double average, double variation) { // DIAG in libISIS did this. A variation of less than 1 doesn't make sense in // this algorithm diff --git a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp index be8054b8933e2ccc4f4deb43781d2c7123c16a0e..de4557eec625df285d7391efc920046c35d6705a 100644 --- a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp +++ b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp @@ -84,7 +84,7 @@ static double gsl_costFunction(const gsl_vector *v, void *params) { void DiffractionEventCalibrateDetectors::movedetector( double x, double y, double z, double rotx, double roty, double rotz, - std::string detname, EventWorkspace_sptr inputW) { + const std::string &detname, const EventWorkspace_sptr &inputW) { IAlgorithm_sptr alg1 = createChildAlgorithm("MoveInstrumentComponent"); alg1->setProperty("Workspace", inputW); @@ -145,8 +145,9 @@ void DiffractionEventCalibrateDetectors::movedetector( double DiffractionEventCalibrateDetectors::intensity( double x, double y, double z, double rotx, double roty, double rotz, - std::string detname, std::string inname, std::string outname, - std::string peakOpt, std::string rb_param, std::string groupWSName) { + const std::string &detname, const std::string &inname, + const std::string &outname, const std::string &peakOpt, + const std::string &rb_param, const std::string &groupWSName) { EventWorkspace_sptr inputW = boost::dynamic_pointer_cast( AnalysisDataService::Instance().retrieve(inname)); diff --git a/Framework/Algorithms/src/DiffractionFocussing.cpp b/Framework/Algorithms/src/DiffractionFocussing.cpp index 7afe73b2de87d698c371b4032961288b7bfbda32..94c575cc38c61dedb943269f0443cce7d80724b5 100644 --- a/Framework/Algorithms/src/DiffractionFocussing.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing.cpp @@ -241,7 +241,7 @@ void DiffractionFocussing::calculateRebinParams( * @throws FileError if can't read the file */ std::multimap -DiffractionFocussing::readGroupingFile(std::string groupingFileName) { +DiffractionFocussing::readGroupingFile(const std::string &groupingFileName) { std::ifstream grFile(groupingFileName.c_str()); if (!grFile) { g_log.error() << "Unable to open grouping file " << groupingFileName diff --git a/Framework/Algorithms/src/EQSANSTofStructure.cpp b/Framework/Algorithms/src/EQSANSTofStructure.cpp index 4f03cdac926b30d04a497a991def598ea2dcba07..b7c89f3708e672944c39092f05946a29a03f28e8 100644 --- a/Framework/Algorithms/src/EQSANSTofStructure.cpp +++ b/Framework/Algorithms/src/EQSANSTofStructure.cpp @@ -118,7 +118,7 @@ void EQSANSTofStructure::exec() { } void EQSANSTofStructure::execEvent( - Mantid::DataObjects::EventWorkspace_sptr inputWS, double threshold, + const Mantid::DataObjects::EventWorkspace_sptr &inputWS, double threshold, double frame_offset, double tof_frame_width, double tmp_frame_width, bool frame_skipping) { const size_t numHists = inputWS->getNumberHistograms(); @@ -190,8 +190,9 @@ void EQSANSTofStructure::execEvent( PARALLEL_CHECK_INTERUPT_REGION } -double EQSANSTofStructure::getTofOffset(EventWorkspace_const_sptr inputWS, - bool frame_skipping) { +double +EQSANSTofStructure::getTofOffset(const EventWorkspace_const_sptr &inputWS, + bool frame_skipping) { //# Storage for chopper information read from the logs double chopper_set_phase[4] = {0, 0, 0, 0}; double chopper_speed[4] = {0, 0, 0, 0}; diff --git a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp index 7efca9a462b0c7fc0fece03b652cf87cef0fb43d..8b373182922ca145651ee606d0a179d342707147 100644 --- a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp +++ b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp @@ -131,7 +131,7 @@ void ExportTimeSeriesLog::exec() { * @param cal_first_deriv :: flag to calcualte the first derivative */ void ExportTimeSeriesLog::exportLog(const std::string &logname, - const std::string timeunit, + const std::string &timeunit, const double &starttime, const double &stoptime, const bool exportepoch, bool outputeventws, diff --git a/Framework/Algorithms/src/ExtractMaskToTable.cpp b/Framework/Algorithms/src/ExtractMaskToTable.cpp index 112ea04cd6be0ae6aa7f01125498a77c539459b9..d3fbe14f280df1eefe255a5e907734678c30a64e 100644 --- a/Framework/Algorithms/src/ExtractMaskToTable.cpp +++ b/Framework/Algorithms/src/ExtractMaskToTable.cpp @@ -124,7 +124,7 @@ void ExtractMaskToTable::exec() { * @returns :: vector of detector IDs that are masked */ std::vector ExtractMaskToTable::parseMaskTable( - DataObjects::TableWorkspace_sptr masktablews) { + const DataObjects::TableWorkspace_sptr &masktablews) { // Output vector std::vector maskeddetectorids; @@ -174,7 +174,7 @@ std::vector ExtractMaskToTable::parseMaskTable( * @returns :: vector genrated from input string containing the list */ std::vector -ExtractMaskToTable::parseStringToVector(std::string liststr) { +ExtractMaskToTable::parseStringToVector(const std::string &liststr) { std::vector detidvec; // Use ArrayProperty to parse the list @@ -264,7 +264,7 @@ std::vector ExtractMaskToTable::extractMaskFromMaskWorkspace() { * @param targetWS :: table workspace to which the content is copied; */ void ExtractMaskToTable::copyTableWorkspaceContent( - TableWorkspace_sptr sourceWS, TableWorkspace_sptr targetWS) { + const TableWorkspace_sptr &sourceWS, const TableWorkspace_sptr &targetWS) { // Compare the column names. They must be exactly the same vector sourcecolnames = sourceWS->getColumnNames(); vector targetcolnames = targetWS->getColumnNames(); @@ -310,7 +310,7 @@ void ExtractMaskToTable::copyTableWorkspaceContent( * @param xmax :: maximum x * @param prevmaskedids :: vector of previous masked detector IDs */ -void ExtractMaskToTable::addToTableWorkspace(TableWorkspace_sptr outws, +void ExtractMaskToTable::addToTableWorkspace(const TableWorkspace_sptr &outws, vector maskeddetids, double xmin, double xmax, vector prevmaskedids) { diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp index 726c8055ad69f1bae83c8b749133bd7d65f41ae3..f3e7414505010263d2773512fc243ac38eb61595 100644 --- a/Framework/Algorithms/src/FindPeaks.cpp +++ b/Framework/Algorithms/src/FindPeaks.cpp @@ -1508,8 +1508,8 @@ void FindPeaks::createFunctions() { */ double FindPeaks::callFitPeak(const MatrixWorkspace_sptr &dataws, int wsindex, - const API::IPeakFunction_sptr peakfunction, - const API::IBackgroundFunction_sptr backgroundfunction, + const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &backgroundfunction, const std::vector &vec_fitwindow, const std::vector &vec_peakrange, int minGuessFWHM, int maxGuessFWHM, int guessedFWHMStep, diff --git a/Framework/Algorithms/src/FitPeak.cpp b/Framework/Algorithms/src/FitPeak.cpp index 7710091f923cff2128aebdab3e2b3b580a9bf8d1..98a8764daf55ae1b5fd8590e5d721425961cd5c2 100644 --- a/Framework/Algorithms/src/FitPeak.cpp +++ b/Framework/Algorithms/src/FitPeak.cpp @@ -7,7 +7,8 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidAlgorithms/FitPeak.h" +#include + #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/FuncMinimizerFactory.h" @@ -17,6 +18,7 @@ #include "MantidAPI/MultiDomainFunction.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/WorkspaceProperty.h" +#include "MantidAlgorithms/FitPeak.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/WorkspaceCreation.h" @@ -62,7 +64,7 @@ FitOneSinglePeak::FitOneSinglePeak() //---------------------------------------------------------------------------------------------- /** Set workspaces */ -void FitOneSinglePeak::setWorskpace(API::MatrixWorkspace_sptr dataws, +void FitOneSinglePeak::setWorskpace(const API::MatrixWorkspace_sptr &dataws, size_t wsindex) { if (dataws) { m_dataWS = dataws; @@ -80,8 +82,8 @@ void FitOneSinglePeak::setWorskpace(API::MatrixWorkspace_sptr dataws, //---------------------------------------------------------------------------------------------- /** Set peaks */ -void FitOneSinglePeak::setFunctions(IPeakFunction_sptr peakfunc, - IBackgroundFunction_sptr bkgdfunc) { +void FitOneSinglePeak::setFunctions(const IPeakFunction_sptr &peakfunc, + const IBackgroundFunction_sptr &bkgdfunc) { if (peakfunc) m_peakFunc = peakfunc; @@ -129,8 +131,8 @@ void FitOneSinglePeak::setPeakRange(double xpeakleft, double xpeakright) { * @param costfunction :: string of the name of the cost function */ void FitOneSinglePeak::setFittingMethod(std::string minimizer, - std::string costfunction) { - m_minimizer = minimizer; + const std::string &costfunction) { + m_minimizer = std::move(minimizer); if (costfunction == "Chi-Square") { m_costFunction = "Least squares"; } else if (costfunction == "Rwp") { @@ -387,8 +389,9 @@ API::MatrixWorkspace_sptr FitOneSinglePeak::genFitWindowWS() { /** Estimate the peak height from a set of data containing pure peaks */ double FitOneSinglePeak::estimatePeakHeight( - API::IPeakFunction_const_sptr peakfunc, MatrixWorkspace_sptr dataws, - size_t wsindex, size_t ixmin, size_t ixmax) { + const API::IPeakFunction_const_sptr &peakfunc, + const MatrixWorkspace_sptr &dataws, size_t wsindex, size_t ixmin, + size_t ixmax) { // Get current peak height: from current peak centre (previously setup) double peakcentre = peakfunc->centre(); vector svvec(1, peakcentre); @@ -424,7 +427,8 @@ double FitOneSinglePeak::estimatePeakHeight( /** Make a pure peak WS in the fit window region from m_background_function * @param purePeakWS :: workspace containing pure peak (w/ background removed) */ -void FitOneSinglePeak::removeBackground(MatrixWorkspace_sptr purePeakWS) { +void FitOneSinglePeak::removeBackground( + const MatrixWorkspace_sptr &purePeakWS) { // Calculate background // FIXME - This can be costly to use FunctionDomain and FunctionValue auto &vecX = purePeakWS->x(0); @@ -449,10 +453,10 @@ void FitOneSinglePeak::removeBackground(MatrixWorkspace_sptr purePeakWS) { * some fit with unphysical result. * @return :: chi-square/Rwp */ -double FitOneSinglePeak::fitPeakFunction(API::IPeakFunction_sptr peakfunc, - MatrixWorkspace_sptr dataws, - size_t wsindex, double startx, - double endx) { +double +FitOneSinglePeak::fitPeakFunction(const API::IPeakFunction_sptr &peakfunc, + const MatrixWorkspace_sptr &dataws, + size_t wsindex, double startx, double endx) { // Check validity and debug output if (!peakfunc) throw std::runtime_error( @@ -461,7 +465,8 @@ double FitOneSinglePeak::fitPeakFunction(API::IPeakFunction_sptr peakfunc, m_sstream << "Function (to fit): " << peakfunc->asString() << " From " << startx << " to " << endx << ".\n"; - double goodness = fitFunctionSD(peakfunc, dataws, wsindex, startx, endx); + double goodness = + fitFunctionSD(peakfunc, std::move(dataws), wsindex, startx, endx); return goodness; } @@ -574,7 +579,7 @@ void FitOneSinglePeak::highBkgdFit() { * @returns :: map to store function parameter's names and value */ std::map -FitOneSinglePeak::backup(IFunction_const_sptr func) { +FitOneSinglePeak::backup(const IFunction_const_sptr &func) { std::map funcparammap; // Set up @@ -614,7 +619,7 @@ FitOneSinglePeak::storeFunctionError(const IFunction_const_sptr &func) { /** Restore the parameters value to a function from a string/double map */ void FitOneSinglePeak::pop(const std::map &funcparammap, - API::IFunction_sptr func) { + const API::IFunction_sptr &func) { std::map::const_iterator miter; for (miter = funcparammap.begin(); miter != funcparammap.end(); ++miter) { string parname = miter->first; @@ -633,8 +638,8 @@ void FitOneSinglePeak::pop(const std::map &funcparammap, * @param xmax * @return */ -double FitOneSinglePeak::calChiSquareSD(IFunction_sptr fitfunc, - MatrixWorkspace_sptr dataws, +double FitOneSinglePeak::calChiSquareSD(const IFunction_sptr &fitfunc, + const MatrixWorkspace_sptr &dataws, size_t wsindex, double xmin, double xmax) { // Set up sub algorithm fit @@ -675,7 +680,7 @@ double FitOneSinglePeak::calChiSquareSD(IFunction_sptr fitfunc, * return DBL_MAX */ double FitOneSinglePeak::fitFunctionSD(IFunction_sptr fitfunc, - MatrixWorkspace_sptr dataws, + const MatrixWorkspace_sptr &dataws, size_t wsindex, double xmin, double xmax) { // Set up sub algorithm fit @@ -733,8 +738,8 @@ double FitOneSinglePeak::fitFunctionSD(IFunction_sptr fitfunc, * @param vec_xmin :: minimin values of domains * @param vec_xmax :: maximim values of domains */ -double FitOneSinglePeak::fitFunctionMD(IFunction_sptr fitfunc, - MatrixWorkspace_sptr dataws, +double FitOneSinglePeak::fitFunctionMD(const IFunction_sptr &fitfunc, + const MatrixWorkspace_sptr &dataws, size_t wsindex, vector vec_xmin, vector vec_xmax) { // Validate @@ -823,8 +828,9 @@ double FitOneSinglePeak::fitFunctionMD(IFunction_sptr fitfunc, * @return :: Rwp/chi2 */ double FitOneSinglePeak::fitCompositeFunction( - API::IPeakFunction_sptr peakfunc, API::IBackgroundFunction_sptr bkgdfunc, - API::MatrixWorkspace_sptr dataws, size_t wsindex, double startx, + const API::IPeakFunction_sptr &peakfunc, + const API::IBackgroundFunction_sptr &bkgdfunc, + const API::MatrixWorkspace_sptr &dataws, size_t wsindex, double startx, double endx) { // Construct composit function boost::shared_ptr compfunc = @@ -883,7 +889,7 @@ double FitOneSinglePeak::fitCompositeFunction( /** Check the fitted peak value to see whether it is valid * @return :: Rwp/chi2 */ -double FitOneSinglePeak::checkFittedPeak(IPeakFunction_sptr peakfunc, +double FitOneSinglePeak::checkFittedPeak(const IPeakFunction_sptr &peakfunc, double costfuncvalue, std::string &errorreason) { if (costfuncvalue < DBL_MAX) { @@ -1234,7 +1240,7 @@ void FitPeak::exec() { /** Add function's parameter names after peak function name */ std::vector -FitPeak::addFunctionParameterNames(std::vector funcnames) { +FitPeak::addFunctionParameterNames(const std::vector &funcnames) { vector vec_funcparnames; for (auto &funcname : funcnames) { @@ -1599,9 +1605,11 @@ size_t getIndex(const HistogramX &vecx, double x) { //---------------------------------------------------------------------------------------------- /** Generate table workspace */ -TableWorkspace_sptr FitPeak::genOutputTableWS( - IPeakFunction_sptr peakfunc, map peakerrormap, - IBackgroundFunction_sptr bkgdfunc, map bkgderrormap) { +TableWorkspace_sptr +FitPeak::genOutputTableWS(const IPeakFunction_sptr &peakfunc, + map peakerrormap, + const IBackgroundFunction_sptr &bkgdfunc, + map bkgderrormap) { // Empty table TableWorkspace_sptr outtablews = boost::make_shared(); outtablews->addColumn("str", "Name"); diff --git a/Framework/Algorithms/src/FitPeaks.cpp b/Framework/Algorithms/src/FitPeaks.cpp index 3db4f98a3d2589b55507c51209d63f1ee68a445e..c1d1fce015488b4182b795d9b9449202e8ef3095 100644 --- a/Framework/Algorithms/src/FitPeaks.cpp +++ b/Framework/Algorithms/src/FitPeaks.cpp @@ -34,6 +34,7 @@ #include "boost/algorithm/string.hpp" #include "boost/algorithm/string/trim.hpp" #include +#include using namespace Mantid; using namespace Mantid::API; @@ -148,7 +149,7 @@ double PeakFitResult::getCost(size_t ipeak) const { return m_costs[ipeak]; } /// set the peak fitting record/parameter for one peak void PeakFitResult::setRecord(size_t ipeak, const double cost, const double peak_position, - const FitFunction fit_functions) { + const FitFunction &fit_functions) { // check input if (ipeak >= m_costs.size()) throw std::runtime_error("Peak index is out of range."); @@ -1026,7 +1027,7 @@ double numberCounts(const Histogram &histogram, const double xmin, */ void FitPeaks::fitSpectrumPeaks( size_t wi, const std::vector &expected_peak_centers, - boost::shared_ptr fit_result) { + const boost::shared_ptr &fit_result) { if (numberCounts(m_inputMatrixWS->histogram(wi)) <= m_minPeakHeight) { for (size_t i = 0; i < fit_result->getNumberPeaks(); ++i) fit_result->setBadRecord(i, -1.); @@ -1131,7 +1132,8 @@ void FitPeaks::fitSpectrumPeaks( * @return :: flag whether the peak width shall be observed */ bool FitPeaks::decideToEstimatePeakParams( - const bool firstPeakInSpectrum, API::IPeakFunction_sptr peak_function) { + const bool firstPeakInSpectrum, + const API::IPeakFunction_sptr &peak_function) { // should observe the peak width if the user didn't supply all of the peak // function parameters bool observe_peak_shape(m_initParamIndexes.size() != @@ -1173,8 +1175,8 @@ bool FitPeaks::decideToEstimatePeakParams( void FitPeaks::processSinglePeakFitResult( size_t wsindex, size_t peakindex, const double cost, const std::vector &expected_peak_positions, - FitPeaksAlgorithm::FitFunction fitfunction, - boost::shared_ptr fit_result) { + const FitPeaksAlgorithm::FitFunction &fitfunction, + const boost::shared_ptr &fit_result) { // determine peak position tolerance double postol(DBL_MAX); bool case23(false); @@ -1403,9 +1405,9 @@ vector calculateMomentsAboutMean(const Histogram &histogram, * First, algorithm FindPeakBackground will be tried; * If it fails, then a linear background estimator will be called. */ -void FitPeaks::estimateBackground(const Histogram &histogram, - const std::pair &peak_window, - API::IBackgroundFunction_sptr bkgd_function) { +void FitPeaks::estimateBackground( + const Histogram &histogram, const std::pair &peak_window, + const API::IBackgroundFunction_sptr &bkgd_function) { if (peak_window.first >= peak_window.second) throw std::runtime_error("Invalid peak window"); @@ -1440,8 +1442,9 @@ void FitPeaks::estimateBackground(const Histogram &histogram, */ int FitPeaks::estimatePeakParameters( const Histogram &histogram, const std::pair &peak_window, - API::IPeakFunction_sptr peakfunction, - API::IBackgroundFunction_sptr bkgdfunction, bool observe_peak_width) { + const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &bkgdfunction, + bool observe_peak_width) { // get the range of start and stop to construct a function domain const auto &vector_x = histogram.points(); @@ -1608,7 +1611,7 @@ double FitPeaks::observePeakWidth(const Histogram &histogram, bool FitPeaks::fitBackground(const size_t &ws_index, const std::pair &fit_window, const double &expected_peak_pos, - API::IBackgroundFunction_sptr bkgd_func) { + const API::IBackgroundFunction_sptr &bkgd_func) { // find out how to fit background const auto &points = m_inputMatrixWS->histogram(ws_index).points(); @@ -1656,12 +1659,13 @@ bool FitPeaks::fitBackground(const size_t &ws_index, //---------------------------------------------------------------------------------------------- /** Fit an individual peak */ -double FitPeaks::fitIndividualPeak(size_t wi, API::IAlgorithm_sptr fitter, - const double expected_peak_center, - const std::pair &fitwindow, - const bool observe_peak_params, - API::IPeakFunction_sptr peakfunction, - API::IBackgroundFunction_sptr bkgdfunc) { +double +FitPeaks::fitIndividualPeak(size_t wi, const API::IAlgorithm_sptr &fitter, + const double expected_peak_center, + const std::pair &fitwindow, + const bool observe_peak_params, + const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &bkgdfunc) { double cost(DBL_MAX); // confirm that there is something to fit @@ -1690,14 +1694,12 @@ double FitPeaks::fitIndividualPeak(size_t wi, API::IAlgorithm_sptr fitter, * This is the core fitting algorithm to deal with the simplest situation * @exception :: Fit.isExecuted is false (cannot be executed) */ -double FitPeaks::fitFunctionSD(IAlgorithm_sptr fit, - API::IPeakFunction_sptr peak_function, - API::IBackgroundFunction_sptr bkgd_function, - API::MatrixWorkspace_sptr dataws, size_t wsindex, - double xmin, double xmax, - const double &expected_peak_center, - bool observe_peak_shape, - bool estimate_background) { +double FitPeaks::fitFunctionSD( + const IAlgorithm_sptr &fit, const API::IPeakFunction_sptr &peak_function, + const API::IBackgroundFunction_sptr &bkgd_function, + const API::MatrixWorkspace_sptr &dataws, size_t wsindex, double xmin, + double xmax, const double &expected_peak_center, bool observe_peak_shape, + bool estimate_background) { std::stringstream errorid; errorid << "(WorkspaceIndex=" << wsindex << " PeakCentre=" << expected_peak_center << ")"; @@ -1784,8 +1786,8 @@ double FitPeaks::fitFunctionSD(IAlgorithm_sptr fit, //---------------------------------------------------------------------------------------------- double FitPeaks::fitFunctionMD(API::IFunction_sptr fit_function, - API::MatrixWorkspace_sptr dataws, size_t wsindex, - std::vector &vec_xmin, + const API::MatrixWorkspace_sptr &dataws, + size_t wsindex, std::vector &vec_xmin, std::vector &vec_xmax) { // Validate if (vec_xmin.size() != vec_xmax.size()) @@ -1854,10 +1856,10 @@ double FitPeaks::fitFunctionMD(API::IFunction_sptr fit_function, //---------------------------------------------------------------------------------------------- /// Fit peak with high background double FitPeaks::fitFunctionHighBackground( - IAlgorithm_sptr fit, const std::pair &fit_window, + const IAlgorithm_sptr &fit, const std::pair &fit_window, const size_t &ws_index, const double &expected_peak_center, - bool observe_peak_shape, API::IPeakFunction_sptr peakfunction, - API::IBackgroundFunction_sptr bkgdfunc) { + bool observe_peak_shape, const API::IPeakFunction_sptr &peakfunction, + const API::IBackgroundFunction_sptr &bkgdfunc) { // high background to reduce API::IBackgroundFunction_sptr high_bkgd_function(nullptr); if (m_linearBackgroundFunction) @@ -1954,7 +1956,7 @@ void FitPeaks::generateOutputPeakPositionWS() { * @param with_chi2:: flag to append chi^2 to the table */ void FitPeaks::setupParameterTableWorkspace( - API::ITableWorkspace_sptr table_ws, + const API::ITableWorkspace_sptr &table_ws, const std::vector ¶m_names, bool with_chi2) { // add columns @@ -2063,7 +2065,7 @@ void FitPeaks::processOutputs( // optional if (m_fittedPeakWS && m_fittedParamTable) { g_log.debug("about to calcualte fitted peaks"); - calculateFittedPeaks(fit_result_vec); + calculateFittedPeaks(std::move(fit_result_vec)); setProperty(PropertyNames::OUTPUT_WKSP_MODEL, m_fittedPeakWS); } } @@ -2215,9 +2217,9 @@ void FitPeaks::getRangeData(size_t iws, * @param vec_x :: vector of X valye * @param vec_y :: (input/output) vector Y to be reduced by background function */ -void FitPeaks::reduceByBackground(API::IBackgroundFunction_sptr bkgd_func, - const std::vector &vec_x, - std::vector &vec_y) { +void FitPeaks::reduceByBackground( + const API::IBackgroundFunction_sptr &bkgd_func, + const std::vector &vec_x, std::vector &vec_y) { // calculate the background FunctionDomain1DVector vectorx(vec_x.begin(), vec_x.end()); FunctionValues vector_bkgd(vectorx); @@ -2278,7 +2280,7 @@ void FitPeaks::estimateLinearBackground(const Histogram &histogram, */ void FitPeaks::writeFitResult( size_t wi, const std::vector &expected_positions, - boost::shared_ptr fit_result) { + const boost::shared_ptr &fit_result) { // convert to size_t out_wi = wi - m_startWorkspaceIndex; if (out_wi >= m_outputPeakPositionWorkspace->getNumberHistograms()) { @@ -2395,7 +2397,7 @@ void FitPeaks::writeFitResult( //---------------------------------------------------------------------------------------------- std::string FitPeaks::getPeakHeightParameterName( - API::IPeakFunction_const_sptr peak_function) { + const API::IPeakFunction_const_sptr &peak_function) { std::string height_name(""); std::vector peak_parameters = peak_function->getParameterNames(); diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index 653f4cfb2c8e91df2c5fe40399845b40fd76e7ad..d0be0289a76b9d895528d4c181e365f718bec960 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -18,6 +18,7 @@ #include "MantidKernel/VisibleWhenProperty.h" #include +#include using namespace Mantid; using namespace Mantid::Kernel; @@ -500,7 +501,7 @@ void GenerateEventsFilter::setFilterByTimeOnly() { /** Generate filters by log values. * @param logname :: name of the log to filter with */ -void GenerateEventsFilter::setFilterByLogValue(std::string logname) { +void GenerateEventsFilter::setFilterByLogValue(const std::string &logname) { // Obtain reference of sample log to filter with m_dblLog = dynamic_cast *>( m_dataWS->run().getProperty(logname)); @@ -962,7 +963,7 @@ bool GenerateEventsFilter::identifyLogEntry( * @param stopTime :: Stop time. */ void GenerateEventsFilter::makeMultipleFiltersByValues( - map indexwsindexmap, vector logvalueranges, + map indexwsindexmap, const vector &logvalueranges, bool centre, bool filterIncrease, bool filterDecrease, DateAndTime startTime, DateAndTime stopTime) { g_log.notice("Starting method 'makeMultipleFiltersByValues'. "); @@ -994,8 +995,9 @@ void GenerateEventsFilter::makeMultipleFiltersByValues( auto iend = static_cast(logsize - 1); makeMultipleFiltersByValuesPartialLog( - istart, iend, m_vecSplitterTime, m_vecSplitterGroup, indexwsindexmap, - logvalueranges, tol, filterIncrease, filterDecrease, startTime, stopTime); + istart, iend, m_vecSplitterTime, m_vecSplitterGroup, + std::move(indexwsindexmap), logvalueranges, tol, filterIncrease, + filterDecrease, startTime, stopTime); progress(1.0); } @@ -1018,9 +1020,9 @@ void GenerateEventsFilter::makeMultipleFiltersByValues( * @param stopTime :: Stop time. */ void GenerateEventsFilter::makeMultipleFiltersByValuesParallel( - map indexwsindexmap, vector logvalueranges, - bool centre, bool filterIncrease, bool filterDecrease, - DateAndTime startTime, DateAndTime stopTime) { + const map &indexwsindexmap, + const vector &logvalueranges, bool centre, bool filterIncrease, + bool filterDecrease, DateAndTime startTime, DateAndTime stopTime) { // Return if the log is empty. int logsize = m_dblLog->size(); if (logsize == 0) { @@ -1178,7 +1180,7 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesParallel( void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog( int istart, int iend, std::vector &vecSplitTime, std::vector &vecSplitGroup, map indexwsindexmap, - const vector &logvalueranges, time_duration tol, + const vector &logvalueranges, const time_duration &tol, bool filterIncrease, bool filterDecrease, DateAndTime startTime, DateAndTime stopTime) { // Check @@ -1662,7 +1664,7 @@ int GenerateEventsFilter::determineChangingDirection(int startindex) { */ void GenerateEventsFilter::addNewTimeFilterSplitter( Types::Core::DateAndTime starttime, Types::Core::DateAndTime stoptime, - int wsindex, string info) { + int wsindex, const string &info) { if (m_forFastLog) { // For MatrixWorkspace splitter // Start of splitter diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp index 5cdb134dad8cbfa9f465f6df97125a92eebee683..d694db8a4a7920e575acf5abe5d854f3eda04369 100644 --- a/Framework/Algorithms/src/GeneratePeaks.cpp +++ b/Framework/Algorithms/src/GeneratePeaks.cpp @@ -429,7 +429,7 @@ void GeneratePeaks::generatePeaks( const std::map>> &functionmap, - API::MatrixWorkspace_sptr dataWS) { + const API::MatrixWorkspace_sptr &dataWS) { // Calcualte function std::map>>::const_iterator @@ -627,7 +627,7 @@ void GeneratePeaks::processTableColumnNames() { * Algorithm supports multiple peaks in multiple spectra */ void GeneratePeaks::getSpectraSet( - DataObjects::TableWorkspace_const_sptr peakParmsWS) { + const DataObjects::TableWorkspace_const_sptr &peakParmsWS) { size_t numpeaks = peakParmsWS->rowCount(); API::Column_const_sptr col = peakParmsWS->getColumn("spectrum"); @@ -652,7 +652,7 @@ void GeneratePeaks::getSpectraSet( /** Get the IPeakFunction part in the input function */ API::IPeakFunction_sptr -GeneratePeaks::getPeakFunction(API::IFunction_sptr infunction) { +GeneratePeaks::getPeakFunction(const API::IFunction_sptr &infunction) { // Not a composite function API::CompositeFunction_sptr compfunc = boost::dynamic_pointer_cast(infunction); @@ -678,8 +678,8 @@ GeneratePeaks::getPeakFunction(API::IFunction_sptr infunction) { //---------------------------------------------------------------------------------------------- /** Find out whether a function has a certain parameter */ -bool GeneratePeaks::hasParameter(API::IFunction_sptr function, - std::string paramname) { +bool GeneratePeaks::hasParameter(const API::IFunction_sptr &function, + const std::string ¶mname) { std::vector parnames = function->getParameterNames(); std::vector::iterator piter; piter = std::find(parnames.begin(), parnames.end(), paramname); @@ -793,8 +793,8 @@ GeneratePeaks::createDataWorkspace(std::vector binparameters) { /** Add function's parameter names after peak function name */ -std::vector -GeneratePeaks::addFunctionParameterNames(std::vector funcnames) { +std::vector GeneratePeaks::addFunctionParameterNames( + const std::vector &funcnames) { std::vector vec_funcparnames; for (auto &funcname : funcnames) { diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index 6dfb4ce07d7c669f831da820e0d5205fa716fd64..75a9b6a0e228dc1ab2f1470664a0c593117419b3 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -399,7 +399,7 @@ void GetDetOffsetsMultiPeaks::processProperties() { * @throw Exception::RuntimeError If ... ... */ void GetDetOffsetsMultiPeaks::importFitWindowTableWorkspace( - TableWorkspace_sptr windowtablews) { + const TableWorkspace_sptr &windowtablews) { // Check number of columns matches number of peaks size_t numcols = windowtablews->columnCount(); size_t numpeaks = m_peakPositions.size(); @@ -831,7 +831,7 @@ void deletePeaks(std::vector &banned, std::vector &peakPosToFit, * @return The number of peaks in range */ int GetDetOffsetsMultiPeaks::fitSpectra( - const int64_t wi, MatrixWorkspace_sptr inputW, + const int64_t wi, const MatrixWorkspace_sptr &inputW, const std::vector &peakPositions, const std::vector &fitWindows, size_t &nparams, double &minD, double &maxD, std::vector &peakPosToFit, @@ -1178,7 +1178,7 @@ void GetDetOffsetsMultiPeaks::createInformationWorkspaces() { * (thread-safe) */ void GetDetOffsetsMultiPeaks::addInfoToReportWS( - int wi, FitPeakOffsetResult offsetresult, + int wi, const FitPeakOffsetResult &offsetresult, const std::vector &tofitpeakpositions, const std::vector &fittedpeakpositions) { // Offset calculation status diff --git a/Framework/Algorithms/src/GetEi.cpp b/Framework/Algorithms/src/GetEi.cpp index 4887378a71892a477d22e65b733330c2782d66c5..0484e539f0343fe4da0c48a01ef760842df84fd1 100644 --- a/Framework/Algorithms/src/GetEi.cpp +++ b/Framework/Algorithms/src/GetEi.cpp @@ -163,9 +163,9 @@ void GetEi::exec() { * passed to this function second * @throw NotFoundError if no detector is found for the detector ID given */ -void GetEi::getGeometry(API::MatrixWorkspace_const_sptr WS, specnum_t mon0Spec, - specnum_t mon1Spec, double &monitor0Dist, - double &monitor1Dist) const { +void GetEi::getGeometry(const API::MatrixWorkspace_const_sptr &WS, + specnum_t mon0Spec, specnum_t mon1Spec, + double &monitor0Dist, double &monitor1Dist) const { const IComponent_const_sptr source = WS->getInstrument()->getSource(); // retrieve a pointer to the first detector and get its distance @@ -220,7 +220,7 @@ void GetEi::getGeometry(API::MatrixWorkspace_const_sptr WS, specnum_t mon0Spec, * in the workspace */ std::vector GetEi::getMonitorWsIndexs( - API::MatrixWorkspace_const_sptr WS, specnum_t specNum1, + const API::MatrixWorkspace_const_sptr &WS, specnum_t specNum1, specnum_t specNum2) const { // getting spectra numbers from detector IDs is // hard because the map works the other way, // getting index numbers from spectra numbers has @@ -285,7 +285,7 @@ double GetEi::timeToFly(double s, double E_KE) const { * @throw out_of_range if the peak runs off the edge of the histogram * @throw runtime_error a Child Algorithm just falls over */ -double GetEi::getPeakCentre(API::MatrixWorkspace_const_sptr WS, +double GetEi::getPeakCentre(const API::MatrixWorkspace_const_sptr &WS, const size_t monitIn, const double peakTime) { const auto ×Array = WS->x(monitIn); // we search for the peak only inside some window because there are often more diff --git a/Framework/Algorithms/src/GetEi2.cpp b/Framework/Algorithms/src/GetEi2.cpp index 794f6078f7faecf549d707226627f790c6bc26b5..205a6222d5eb9b4ae0fd15aae05e85aa9a5ea0fd 100644 --- a/Framework/Algorithms/src/GetEi2.cpp +++ b/Framework/Algorithms/src/GetEi2.cpp @@ -24,6 +24,7 @@ #include #include #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -395,7 +396,7 @@ GetEi2::extractSpectrum(size_t ws_index, const double start, const double end) { * @returns The width of the peak at half height */ double GetEi2::calculatePeakWidthAtHalfHeight( - API::MatrixWorkspace_sptr data_ws, const double prominence, + const API::MatrixWorkspace_sptr &data_ws, const double prominence, std::vector &peak_x, std::vector &peak_y, std::vector &peak_e) const { // Use WS->points() to create a temporary vector of bin_centre values to work @@ -622,11 +623,11 @@ double GetEi2::calculatePeakWidthAtHalfHeight( * considered a "real" peak * @return The calculated first moment */ -double GetEi2::calculateFirstMoment(API::MatrixWorkspace_sptr monitor_ws, +double GetEi2::calculateFirstMoment(const API::MatrixWorkspace_sptr &monitor_ws, const double prominence) { std::vector peak_x, peak_y, peak_e; - calculatePeakWidthAtHalfHeight(monitor_ws, prominence, peak_x, peak_y, - peak_e); + calculatePeakWidthAtHalfHeight(std::move(monitor_ws), prominence, peak_x, + peak_y, peak_e); // Area double area(0.0), dummy(0.0); @@ -649,9 +650,9 @@ double GetEi2::calculateFirstMoment(API::MatrixWorkspace_sptr monitor_ws, * @param end :: The maximum value for the new bin range * @returns The rebinned workspace */ -API::MatrixWorkspace_sptr GetEi2::rebin(API::MatrixWorkspace_sptr monitor_ws, - const double first, const double width, - const double end) { +API::MatrixWorkspace_sptr +GetEi2::rebin(const API::MatrixWorkspace_sptr &monitor_ws, const double first, + const double width, const double end) { IAlgorithm_sptr childAlg = createChildAlgorithm("Rebin"); childAlg->setProperty("InputWorkspace", monitor_ws); std::ostringstream binParams; diff --git a/Framework/Algorithms/src/GetQsInQENSData.cpp b/Framework/Algorithms/src/GetQsInQENSData.cpp index 090cf53942b5e49a658501c483cb0dfdf510df3e..1d70e67da631b9624a0cdcfab13f5b2ab2a2e5de 100644 --- a/Framework/Algorithms/src/GetQsInQENSData.cpp +++ b/Framework/Algorithms/src/GetQsInQENSData.cpp @@ -88,7 +88,7 @@ void GetQsInQENSData::exec() { * @return The extracted Q-values as a vector. */ MantidVec GetQsInQENSData::extractQValues( - const Mantid::API::MatrixWorkspace_sptr workspace) { + const Mantid::API::MatrixWorkspace_sptr &workspace) { size_t numSpectra = workspace->getNumberHistograms(); Axis *qAxis; diff --git a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp index 25e22a3ce72a8deb41efb693db9d362a9be509da..531e79371687406d82ed0fec125bb6d733bd3dc1 100644 --- a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp +++ b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp @@ -299,7 +299,7 @@ TableWorkspace_sptr GetTimeSeriesLogInformation::generateStatisticTable() { * * This algorithm should be reconsidered how to work with it. */ -void GetTimeSeriesLogInformation::exportErrorLog(MatrixWorkspace_sptr ws, +void GetTimeSeriesLogInformation::exportErrorLog(const MatrixWorkspace_sptr &ws, vector abstimevec, double dts) { std::string outputdir = getProperty("OutputDirectory"); diff --git a/Framework/Algorithms/src/He3TubeEfficiency.cpp b/Framework/Algorithms/src/He3TubeEfficiency.cpp index 8303b71d23fa16364c4e34b159dd6335d4f0fd17..2c71546a9c36d506b20ce5311a9b17e6c7aaae60 100644 --- a/Framework/Algorithms/src/He3TubeEfficiency.cpp +++ b/Framework/Algorithms/src/He3TubeEfficiency.cpp @@ -381,9 +381,9 @@ void He3TubeEfficiency::logErrors() const { * @param idet :: the current detector * @return the value of the detector property */ -double He3TubeEfficiency::getParameter(std::string wsPropName, +double He3TubeEfficiency::getParameter(const std::string &wsPropName, std::size_t currentIndex, - std::string detPropName, + const std::string &detPropName, const Geometry::IDetector &idet) { std::vector wsProp = this->getProperty(wsPropName); diff --git a/Framework/Algorithms/src/IQTransform.cpp b/Framework/Algorithms/src/IQTransform.cpp index a3418b84c13d232fe7f77380fd4bfbef29fc2c5a..4f289f16ee27a142c19425ccf7ab99008382ad10 100644 --- a/Framework/Algorithms/src/IQTransform.cpp +++ b/Framework/Algorithms/src/IQTransform.cpp @@ -7,12 +7,14 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidAlgorithms/IQTransform.h" +#include + #include "MantidAPI/Axis.h" #include "MantidAPI/IncreasingAxisValidator.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/RawCountValidator.h" #include "MantidAPI/WorkspaceUnitValidator.h" +#include "MantidAlgorithms/IQTransform.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/WorkspaceCreation.h" @@ -157,11 +159,11 @@ void IQTransform::exec() { * @param background The workspace containing the background values */ API::MatrixWorkspace_sptr -IQTransform::subtractBackgroundWS(API::MatrixWorkspace_sptr ws, - API::MatrixWorkspace_sptr background) { +IQTransform::subtractBackgroundWS(const API::MatrixWorkspace_sptr &ws, + const API::MatrixWorkspace_sptr &background) { g_log.debug() << "Subtracting the workspace " << background->getName() << " from the input workspace.\n"; - return ws - background; + return std::move(ws) - background; } /** @name Available transformation functions */ @@ -172,7 +174,7 @@ IQTransform::subtractBackgroundWS(API::MatrixWorkspace_sptr ws, * @throw std::range_error if an attempt is made to take log of a negative * number */ -void IQTransform::guinierSpheres(API::MatrixWorkspace_sptr ws) { +void IQTransform::guinierSpheres(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -192,7 +194,7 @@ void IQTransform::guinierSpheres(API::MatrixWorkspace_sptr ws) { * @throw std::range_error if an attempt is made to take log of a negative * number */ -void IQTransform::guinierRods(API::MatrixWorkspace_sptr ws) { +void IQTransform::guinierRods(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -215,7 +217,7 @@ void IQTransform::guinierRods(API::MatrixWorkspace_sptr ws) { * @throw std::range_error if an attempt is made to take log of a negative * number */ -void IQTransform::guinierSheets(API::MatrixWorkspace_sptr ws) { +void IQTransform::guinierSheets(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -237,7 +239,7 @@ void IQTransform::guinierSheets(API::MatrixWorkspace_sptr ws) { * The output is set to zero for negative input Y values * @param ws The workspace to be transformed */ -void IQTransform::zimm(API::MatrixWorkspace_sptr ws) { +void IQTransform::zimm(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -261,7 +263,7 @@ void IQTransform::zimm(API::MatrixWorkspace_sptr ws) { * The output is set to zero for negative input Y values * @param ws The workspace to be transformed */ -void IQTransform::debyeBueche(API::MatrixWorkspace_sptr ws) { +void IQTransform::debyeBueche(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -284,7 +286,7 @@ void IQTransform::debyeBueche(API::MatrixWorkspace_sptr ws) { /** Performs the Holtzer transformation: IQ v Q * @param ws The workspace to be transformed */ -void IQTransform::holtzer(API::MatrixWorkspace_sptr ws) { +void IQTransform::holtzer(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -299,7 +301,7 @@ void IQTransform::holtzer(API::MatrixWorkspace_sptr ws) { /** Performs the Kratky transformation: IQ^2 v Q * @param ws The workspace to be transformed */ -void IQTransform::kratky(API::MatrixWorkspace_sptr ws) { +void IQTransform::kratky(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -317,7 +319,7 @@ void IQTransform::kratky(API::MatrixWorkspace_sptr ws) { /** Performs the Porod transformation: IQ^4 v Q * @param ws The workspace to be transformed */ -void IQTransform::porod(API::MatrixWorkspace_sptr ws) { +void IQTransform::porod(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -337,7 +339,7 @@ void IQTransform::porod(API::MatrixWorkspace_sptr ws) { * @throw std::range_error if an attempt is made to take log of a negative * number */ -void IQTransform::logLog(API::MatrixWorkspace_sptr ws) { +void IQTransform::logLog(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); @@ -360,7 +362,7 @@ void IQTransform::logLog(API::MatrixWorkspace_sptr ws) { * @throw std::range_error if an attempt is made to take log of a negative * number */ -void IQTransform::general(API::MatrixWorkspace_sptr ws) { +void IQTransform::general(const API::MatrixWorkspace_sptr &ws) { auto &X = ws->mutableX(0); auto &Y = ws->mutableY(0); auto &E = ws->mutableE(0); diff --git a/Framework/Algorithms/src/IdentifyNoisyDetectors.cpp b/Framework/Algorithms/src/IdentifyNoisyDetectors.cpp index 68ff265fb3f7e863cd9592c93cea708af64a1b96..a60e373cc3918313aaea2ff815afff2435a2363a 100644 --- a/Framework/Algorithms/src/IdentifyNoisyDetectors.cpp +++ b/Framework/Algorithms/src/IdentifyNoisyDetectors.cpp @@ -149,8 +149,8 @@ void IdentifyNoisyDetectors::exec() { * @param values :: stddeviations of each spectra (I think) */ void IdentifyNoisyDetectors::getStdDev(API::Progress &progress, - MatrixWorkspace_sptr valid, - MatrixWorkspace_sptr values) { + const MatrixWorkspace_sptr &valid, + const MatrixWorkspace_sptr &values) { const auto nhist = static_cast(valid->getNumberHistograms()); int count = 0; double mean = 0.0; diff --git a/Framework/Algorithms/src/IntegrateByComponent.cpp b/Framework/Algorithms/src/IntegrateByComponent.cpp index 23676f58d092e7829ba2225604ab27b75cf4fd17..f0da9938dff934b73e7fb7b3b3d05d9d2a26cc7c 100644 --- a/Framework/Algorithms/src/IntegrateByComponent.cpp +++ b/Framework/Algorithms/src/IntegrateByComponent.cpp @@ -158,8 +158,8 @@ void IntegrateByComponent::exec() { * @return vector of vectors, containing each spectrum that belongs to each * group */ -std::vector> -IntegrateByComponent::makeInstrumentMap(API::MatrixWorkspace_sptr countsWS) { +std::vector> IntegrateByComponent::makeInstrumentMap( + const API::MatrixWorkspace_sptr &countsWS) { std::vector> mymap; std::vector single; @@ -178,7 +178,8 @@ IntegrateByComponent::makeInstrumentMap(API::MatrixWorkspace_sptr countsWS) { * group */ std::vector> -IntegrateByComponent::makeMap(API::MatrixWorkspace_sptr countsWS, int parents) { +IntegrateByComponent::makeMap(const API::MatrixWorkspace_sptr &countsWS, + int parents) { std::unordered_multimap mymap; if (parents == 0) // this should not happen in this file, but if one reuses diff --git a/Framework/Algorithms/src/Integration.cpp b/Framework/Algorithms/src/Integration.cpp index 2dcdd1121383359e76b0d4d96a0e6fc92d58a952..0db822108e6a91eaaddb5bc5f53c74aa6a61dc12 100644 --- a/Framework/Algorithms/src/Integration.cpp +++ b/Framework/Algorithms/src/Integration.cpp @@ -349,9 +349,9 @@ void Integration::exec() { /** * Uses rebin to reduce event workspaces to a single bin histogram */ -API::MatrixWorkspace_sptr -Integration::rangeFilterEventWorkspace(API::MatrixWorkspace_sptr workspace, - double minRange, double maxRange) { +API::MatrixWorkspace_sptr Integration::rangeFilterEventWorkspace( + const API::MatrixWorkspace_sptr &workspace, double minRange, + double maxRange) { bool childLog = g_log.is(Logger::Priority::PRIO_DEBUG); auto childAlg = createChildAlgorithm("Rebin", 0, 0.5, childLog); childAlg->setProperty("InputWorkspace", workspace); diff --git a/Framework/Algorithms/src/InterpolatingRebin.cpp b/Framework/Algorithms/src/InterpolatingRebin.cpp index 83d372c4125570f61744b191b03a33bda85997df..05466d4790c93ac2603e41b6c27ec219a2a16e96 100644 --- a/Framework/Algorithms/src/InterpolatingRebin.cpp +++ b/Framework/Algorithms/src/InterpolatingRebin.cpp @@ -144,9 +144,9 @@ void InterpolatingRebin::exec() { * the histograms must corrospond with the number of x-values in XValues_new */ void InterpolatingRebin::outputYandEValues( - API::MatrixWorkspace_const_sptr inputW, + const API::MatrixWorkspace_const_sptr &inputW, const HistogramData::BinEdges &XValues_new, - API::MatrixWorkspace_sptr outputW) { + const API::MatrixWorkspace_sptr &outputW) { g_log.debug() << "Preparing to calculate y-values using splines and estimate errors\n"; diff --git a/Framework/Algorithms/src/MaskBinsFromTable.cpp b/Framework/Algorithms/src/MaskBinsFromTable.cpp index 6ad76da2d7f7e597cd859eb3a8aab010e8e1ea2a..e951b48c5bf1c21f124a9448507793c0c05269f4 100644 --- a/Framework/Algorithms/src/MaskBinsFromTable.cpp +++ b/Framework/Algorithms/src/MaskBinsFromTable.cpp @@ -68,7 +68,7 @@ void MaskBinsFromTable::exec() { /** Call MaskBins * @param dataws :: MatrixWorkspace to mask bins for */ -void MaskBinsFromTable::maskBins(API::MatrixWorkspace_sptr dataws) { +void MaskBinsFromTable::maskBins(const API::MatrixWorkspace_sptr &dataws) { bool firstloop = true; API::MatrixWorkspace_sptr outputws; @@ -134,7 +134,8 @@ void MaskBinsFromTable::maskBins(API::MatrixWorkspace_sptr dataws) { * @param dataws :: MatrixWorkspace to mask */ void MaskBinsFromTable::processMaskBinWorkspace( - TableWorkspace_sptr masktblws, API::MatrixWorkspace_sptr dataws) { + const TableWorkspace_sptr &masktblws, + const API::MatrixWorkspace_sptr &dataws) { // Check input if (!masktblws) throw std::invalid_argument("Input workspace is not a table workspace."); @@ -213,8 +214,8 @@ void MaskBinsFromTable::processMaskBinWorkspace( * @return :: list of spectra/workspace index IDs in string format */ std::string -MaskBinsFromTable::convertToSpectraList(API::MatrixWorkspace_sptr dataws, - std::string detidliststr) { +MaskBinsFromTable::convertToSpectraList(const API::MatrixWorkspace_sptr &dataws, + const std::string &detidliststr) { // Use array property to get a list of detectors vector detidvec; ArrayProperty parser("detids", detidliststr); diff --git a/Framework/Algorithms/src/MaxEnt.cpp b/Framework/Algorithms/src/MaxEnt.cpp index 4807fa4ecb75266e580209bdb8dac7b7ac0a87ac..bfbf95127907bc20710ec00d24315ace441bd0aa 100644 --- a/Framework/Algorithms/src/MaxEnt.cpp +++ b/Framework/Algorithms/src/MaxEnt.cpp @@ -826,7 +826,7 @@ std::vector MaxEnt::applyDistancePenalty( std::vector MaxEnt::updateImage(const std::vector &image, const std::vector &delta, - const std::vector> dirs) { + const std::vector> &dirs) { if (image.empty() || dirs.empty() || (delta.size() != dirs.size())) { throw std::runtime_error("Cannot calculate new image"); diff --git a/Framework/Algorithms/src/MaxEnt/MaxentCalculator.cpp b/Framework/Algorithms/src/MaxEnt/MaxentCalculator.cpp index 412b37d2bb3e6f91ff7e86e529040c1c48953ff4..4b9603e8f2b861bd3a2d4493ef45d1b6121b79f1 100644 --- a/Framework/Algorithms/src/MaxEnt/MaxentCalculator.cpp +++ b/Framework/Algorithms/src/MaxEnt/MaxentCalculator.cpp @@ -6,6 +6,7 @@ // SPDX - License - Identifier: GPL - 3.0 + #include "MantidAlgorithms/MaxEnt/MaxentCalculator.h" #include +#include namespace Mantid { namespace Algorithms { @@ -21,7 +22,7 @@ MaxentCalculator::MaxentCalculator(MaxentEntropy_sptr entropy, MaxentTransform_sptr transform) : m_data(), m_errors(), m_image(), m_dataCalc(), m_background(1.0), m_angle(-1.), m_chisq(-1.), m_directionsIm(), m_coeffs(), - m_entropy(entropy), m_transform(transform) {} + m_entropy(std::move(entropy)), m_transform(std::move(transform)) {} /** * Calculates the gradient of chi-square using the experimental data, calculated diff --git a/Framework/Algorithms/src/MaxEnt/MaxentTransformFourier.cpp b/Framework/Algorithms/src/MaxEnt/MaxentTransformFourier.cpp index 560af008dbe233d6b8e581080f29f37a966d1503..ed0aabea5546a4eaadc44f1c60548a702c1c728a 100644 --- a/Framework/Algorithms/src/MaxEnt/MaxentTransformFourier.cpp +++ b/Framework/Algorithms/src/MaxEnt/MaxentTransformFourier.cpp @@ -6,6 +6,8 @@ // SPDX - License - Identifier: GPL - 3.0 + #include "MantidAlgorithms/MaxEnt/MaxentTransformFourier.h" #include +#include + #include namespace Mantid { @@ -14,7 +16,7 @@ namespace Algorithms { /** Constructor */ MaxentTransformFourier::MaxentTransformFourier(MaxentSpace_sptr dataSpace, MaxentSpace_sptr imageSpace) - : m_dataSpace(dataSpace), m_imageSpace(imageSpace) {} + : m_dataSpace(std::move(dataSpace)), m_imageSpace(std::move(imageSpace)) {} /** * Transforms a 1D signal from image space to data space, performing an diff --git a/Framework/Algorithms/src/MaxEnt/MaxentTransformMultiFourier.cpp b/Framework/Algorithms/src/MaxEnt/MaxentTransformMultiFourier.cpp index fe3a9aabcaced2af6358f6fd2a578d40167a8ba3..7b9e4f392cf82279089da2617ef269244ff7731e 100644 --- a/Framework/Algorithms/src/MaxEnt/MaxentTransformMultiFourier.cpp +++ b/Framework/Algorithms/src/MaxEnt/MaxentTransformMultiFourier.cpp @@ -7,15 +7,17 @@ #include "MantidAlgorithms/MaxEnt/MaxentTransformMultiFourier.h" #include +#include + namespace Mantid { namespace Algorithms { /** Constructor */ MaxentTransformMultiFourier::MaxentTransformMultiFourier( - MaxentSpaceComplex_sptr dataSpace, MaxentSpace_sptr imageSpace, + const MaxentSpaceComplex_sptr &dataSpace, MaxentSpace_sptr imageSpace, size_t numSpec) - : MaxentTransformFourier(dataSpace, imageSpace), m_numSpec(numSpec), - m_linearAdjustments(), m_constAdjustments() {} + : MaxentTransformFourier(dataSpace, std::move(imageSpace)), + m_numSpec(numSpec), m_linearAdjustments(), m_constAdjustments() {} /** * Transforms a 1D signal from image space to data space, performing an diff --git a/Framework/Algorithms/src/MedianDetectorTest.cpp b/Framework/Algorithms/src/MedianDetectorTest.cpp index c86b91516d201c4bea0e99e32c04ef3b1a6ac5ab..e385cbf6f9e4301f93ed55c0af35c1f9281f0152 100644 --- a/Framework/Algorithms/src/MedianDetectorTest.cpp +++ b/Framework/Algorithms/src/MedianDetectorTest.cpp @@ -238,7 +238,8 @@ API::MatrixWorkspace_sptr MedianDetectorTest::getSolidAngles(int firstSpec, * @returns The number failed. */ int MedianDetectorTest::maskOutliers( - const std::vector medianvec, API::MatrixWorkspace_sptr countsWS, + const std::vector &medianvec, + const API::MatrixWorkspace_sptr &countsWS, std::vector> indexmap) { // Fractions of the median @@ -300,10 +301,10 @@ int MedianDetectorTest::maskOutliers( * skipped. */ int MedianDetectorTest::doDetectorTests( - const API::MatrixWorkspace_sptr countsWS, - const std::vector medianvec, + const API::MatrixWorkspace_sptr &countsWS, + const std::vector &medianvec, std::vector> indexmap, - API::MatrixWorkspace_sptr maskWS) { + const API::MatrixWorkspace_sptr &maskWS) { g_log.debug("Applying the criteria to find failing detectors"); // A spectra can't fail if the statistics show its value is consistent with diff --git a/Framework/Algorithms/src/Minus.cpp b/Framework/Algorithms/src/Minus.cpp index 08319d1e2e88f92419f51f5d1734cdc1041afcfe..12999ca54492af943a544ab43cf462b8c8d49c5f 100644 --- a/Framework/Algorithms/src/Minus.cpp +++ b/Framework/Algorithms/src/Minus.cpp @@ -137,8 +137,8 @@ void Minus::checkRequirements() { * @return workspace unit compatibility flag */ bool Minus::checkUnitCompatibility( - const API::MatrixWorkspace_const_sptr lhs, - const API::MatrixWorkspace_const_sptr rhs) const { + const API::MatrixWorkspace_const_sptr &lhs, + const API::MatrixWorkspace_const_sptr &rhs) const { if (lhs->size() > 1 && rhs->size() > 1) { if (lhs->YUnit() != rhs->YUnit()) { g_log.error("The two workspaces are not compatible because they have " diff --git a/Framework/Algorithms/src/NormaliseByCurrent.cpp b/Framework/Algorithms/src/NormaliseByCurrent.cpp index b563a9730096cf1e5d1f148e1c127c87f6425e93..fce8815e6c6d02bcfc7a2450a5edf127c6c3abb8 100644 --- a/Framework/Algorithms/src/NormaliseByCurrent.cpp +++ b/Framework/Algorithms/src/NormaliseByCurrent.cpp @@ -45,7 +45,7 @@ void NormaliseByCurrent::init() { * workspace logs or if the values are invalid (0) */ double NormaliseByCurrent::extractCharge( - boost::shared_ptr inputWS, + const boost::shared_ptr &inputWS, const bool integratePCharge) const { // Get the good proton charge and check it's valid double charge(-1.0); diff --git a/Framework/Algorithms/src/NormaliseByDetector.cpp b/Framework/Algorithms/src/NormaliseByDetector.cpp index db0469b3fb0873be0a7e48f5adeb419c23c13fe4..a118ba7e13e61db4d457783f18513ad89b6e9750 100644 --- a/Framework/Algorithms/src/NormaliseByDetector.cpp +++ b/Framework/Algorithms/src/NormaliseByDetector.cpp @@ -73,7 +73,7 @@ void NormaliseByDetector::init() { } const Geometry::FitParameter NormaliseByDetector::tryParseFunctionParameter( - Geometry::Parameter_sptr parameter, const Geometry::IDetector &det) { + const Geometry::Parameter_sptr ¶meter, const Geometry::IDetector &det) { if (parameter == nullptr) { std::stringstream stream; stream << det.getName() @@ -99,10 +99,9 @@ normalisation routine. use. @param prog: progress reporting object. */ -void NormaliseByDetector::processHistogram(size_t wsIndex, - MatrixWorkspace_const_sptr inWS, - MatrixWorkspace_sptr denominatorWS, - Progress &prog) { +void NormaliseByDetector::processHistogram( + size_t wsIndex, const MatrixWorkspace_const_sptr &inWS, + const MatrixWorkspace_sptr &denominatorWS, Progress &prog) { const auto ¶mMap = inWS->constInstrumentParameters(); const auto &spectrumInfo = inWS->spectrumInfo(); const auto &det = spectrumInfo.detector(wsIndex); @@ -164,7 +163,7 @@ sequentially. use. */ MatrixWorkspace_sptr -NormaliseByDetector::processHistograms(MatrixWorkspace_sptr inWS) { +NormaliseByDetector::processHistograms(const MatrixWorkspace_sptr &inWS) { const size_t nHistograms = inWS->getNumberHistograms(); const auto progress_items = static_cast(double(nHistograms) * 1.2); Progress prog(this, 0.0, 1.0, progress_items); diff --git a/Framework/Algorithms/src/NormaliseToMonitor.cpp b/Framework/Algorithms/src/NormaliseToMonitor.cpp index 5be68fb0999742662affed31fb1d9a7c2ec4aad1..bad96c37993a3e24f3bacb9263c0d2ecc818b242 100644 --- a/Framework/Algorithms/src/NormaliseToMonitor.cpp +++ b/Framework/Algorithms/src/NormaliseToMonitor.cpp @@ -102,7 +102,7 @@ void MonIDPropChanger::applyChanges(const IPropertyManager *algo, // read the monitors list from the workspace and try to do it once for any // particular ws; bool MonIDPropChanger::monitorIdReader( - MatrixWorkspace_const_sptr inputWS) const { + const MatrixWorkspace_const_sptr &inputWS) const { // no workspace if (!inputWS) return false; diff --git a/Framework/Algorithms/src/PDCalibration.cpp b/Framework/Algorithms/src/PDCalibration.cpp index 3edaa4e0f412c559ec5e5dd5dfd8bcdb9baab135..e0ea9546981a1e70761e2faed9a73af8e311fe75 100644 --- a/Framework/Algorithms/src/PDCalibration.cpp +++ b/Framework/Algorithms/src/PDCalibration.cpp @@ -70,7 +70,7 @@ const auto isNonZero = [](const double value) { return value != 0.; }; /// private inner class class PDCalibration::FittedPeaks { public: - FittedPeaks(API::MatrixWorkspace_const_sptr wksp, + FittedPeaks(const API::MatrixWorkspace_const_sptr &wksp, const std::size_t wkspIndex) { this->wkspIndex = wkspIndex; @@ -108,7 +108,7 @@ public: void setPositions(const std::vector &peaksInD, const std::vector &peaksInDWindows, - std::function toTof) { + const std::function &toTof) { // clear out old values inDPos.clear(); inTofPos.clear(); @@ -307,7 +307,7 @@ std::map PDCalibration::validateInputs() { namespace { -bool hasDasIDs(API::ITableWorkspace_const_sptr table) { +bool hasDasIDs(const API::ITableWorkspace_const_sptr &table) { const auto columnNames = table->getColumnNames(); return (std::find(columnNames.begin(), columnNames.end(), std::string("dasid")) != columnNames.end()); @@ -939,7 +939,7 @@ vector PDCalibration::getTOFminmax(const double difc, const double difa, return tofminmax; } -MatrixWorkspace_sptr PDCalibration::load(const std::string filename) { +MatrixWorkspace_sptr PDCalibration::load(const std::string &filename) { // TODO this assumes that all files are event-based const double maxChunkSize = getProperty("MaxChunkSize"); const double filterBadPulses = getProperty("FilterBadPulses"); @@ -1186,7 +1186,8 @@ PDCalibration::sortTableWorkspace(API::ITableWorkspace_sptr &table) { /// NEW: convert peak positions in dSpacing to peak centers workspace std::pair PDCalibration::createTOFPeakCenterFitWindowWorkspaces( - API::MatrixWorkspace_sptr dataws, const double peakWindowMaxInDSpacing) { + const API::MatrixWorkspace_sptr &dataws, + const double peakWindowMaxInDSpacing) { // calculate from peaks in dpsacing to peak fit window in dspacing const auto windowsInDSpacing = diff --git a/Framework/Algorithms/src/PaddingAndApodization.cpp b/Framework/Algorithms/src/PaddingAndApodization.cpp index 9aaad011702141a9ae6dafe0c6cf8bb8d343979a..c4222210c4b5a5beaed425bdcd6808e4841971fb 100644 --- a/Framework/Algorithms/src/PaddingAndApodization.cpp +++ b/Framework/Algorithms/src/PaddingAndApodization.cpp @@ -144,7 +144,7 @@ using fptr = double (*)(const double, const double); * @param method :: [input] The name of the chosen function * @returns :: pointer to the function */ -fptr PaddingAndApodization::getApodizationFunction(const std::string method) { +fptr PaddingAndApodization::getApodizationFunction(const std::string &method) { if (method == "None") { return ApodizationFunctions::none; } else if (method == "Lorentz") { diff --git a/Framework/Algorithms/src/ParallaxCorrection.cpp b/Framework/Algorithms/src/ParallaxCorrection.cpp index 040288fdf7553a5b92695983b5e15e0c6c6e18c2..7d93a5df9d6aa57f81ac55b2784398ddbab1573c 100644 --- a/Framework/Algorithms/src/ParallaxCorrection.cpp +++ b/Framework/Algorithms/src/ParallaxCorrection.cpp @@ -104,10 +104,9 @@ void ParallaxCorrection::init() { * @param parallax : the correction formula for the bank * @param direction : the tube direction in the bank */ -void ParallaxCorrection::performCorrection(API::MatrixWorkspace_sptr outWS, - const std::vector &indices, - const std::string ¶llax, - const std::string &direction) { +void ParallaxCorrection::performCorrection( + const API::MatrixWorkspace_sptr &outWS, const std::vector &indices, + const std::string ¶llax, const std::string &direction) { double t; mu::Parser muParser; muParser.DefineVar("t", &t); diff --git a/Framework/Algorithms/src/PerformIndexOperations.cpp b/Framework/Algorithms/src/PerformIndexOperations.cpp index 13f8589c3e94d33d661e67c86d21c835b98806fd..9ba817654d218e7e3464a0c17d70b11871b31d34 100644 --- a/Framework/Algorithms/src/PerformIndexOperations.cpp +++ b/Framework/Algorithms/src/PerformIndexOperations.cpp @@ -10,6 +10,7 @@ #include "MantidKernel/Strings.h" #include #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -31,7 +32,7 @@ public: if (!this->isValid()) { return toAppend; } else { - MatrixWorkspace_sptr current = this->execute(inputWS); + MatrixWorkspace_sptr current = this->execute(std::move(inputWS)); Mantid::API::AlgorithmManagerImpl &factory = Mantid::API::AlgorithmManager::Instance(); auto conjoinWorkspaceAlg = factory.create("ConjoinWorkspaces"); diff --git a/Framework/Algorithms/src/Plus.cpp b/Framework/Algorithms/src/Plus.cpp index b23ee7b1397d7275496bb7094e3d4f742081204b..94d98002c264b3e558a13eca2b56b46dad987c4d 100644 --- a/Framework/Algorithms/src/Plus.cpp +++ b/Framework/Algorithms/src/Plus.cpp @@ -145,8 +145,8 @@ void Plus::checkRequirements() { * @return workspace unit compatibility flag */ bool Plus::checkUnitCompatibility( - const API::MatrixWorkspace_const_sptr lhs, - const API::MatrixWorkspace_const_sptr rhs) const { + const API::MatrixWorkspace_const_sptr &lhs, + const API::MatrixWorkspace_const_sptr &rhs) const { if (lhs->size() > 1 && rhs->size() > 1) { if (lhs->YUnit() != rhs->YUnit()) { g_log.error("The two workspaces are not compatible because they have " diff --git a/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp b/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp index ae19aba09686296600756d1e6c96d9c96a3222eb..12e68df35d18d8aa05e345170d69fc7d36db9fbf 100644 --- a/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp +++ b/Framework/Algorithms/src/PolarizationCorrectionFredrikze.cpp @@ -206,7 +206,7 @@ void PolarizationCorrectionFredrikze::init() { } WorkspaceGroup_sptr -PolarizationCorrectionFredrikze::execPA(WorkspaceGroup_sptr inWS) { +PolarizationCorrectionFredrikze::execPA(const WorkspaceGroup_sptr &inWS) { size_t itemIndex = 0; MatrixWorkspace_sptr Ipp = @@ -276,7 +276,7 @@ PolarizationCorrectionFredrikze::execPA(WorkspaceGroup_sptr inWS) { } WorkspaceGroup_sptr -PolarizationCorrectionFredrikze::execPNR(WorkspaceGroup_sptr inWS) { +PolarizationCorrectionFredrikze::execPNR(const WorkspaceGroup_sptr &inWS) { size_t itemIndex = 0; MatrixWorkspace_sptr Ip = boost::dynamic_pointer_cast(inWS->getItem(itemIndex++)); diff --git a/Framework/Algorithms/src/PolarizationCorrectionWildes.cpp b/Framework/Algorithms/src/PolarizationCorrectionWildes.cpp index 4d7d409f427c87fc35d0d8eff175cdf64e066577..328054b34486d1fcaedd1f801cb472ac3910944f 100644 --- a/Framework/Algorithms/src/PolarizationCorrectionWildes.cpp +++ b/Framework/Algorithms/src/PolarizationCorrectionWildes.cpp @@ -374,8 +374,8 @@ double twoInputsErrorEstimate10(const double i00, const double e00, return std::sqrt(e10_I00 + e10_I11 + e10_F1 + e10_F2 + e10_P1 + e10_P2); } -Mantid::API::MatrixWorkspace_sptr -createWorkspaceWithHistory(Mantid::API::MatrixWorkspace_const_sptr inputWS) { +Mantid::API::MatrixWorkspace_sptr createWorkspaceWithHistory( + const Mantid::API::MatrixWorkspace_const_sptr &inputWS) { Mantid::API::MatrixWorkspace_sptr outputWS = Mantid::DataObjects::create(*inputWS); outputWS->history().addHistory(inputWS->getHistory()); diff --git a/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp b/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp index 17af8f92b7768636bc1c443c4c934474fc90e3ab..fb26c987fcb8afa48ab48c626def7e27f11f8252 100644 --- a/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp +++ b/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp @@ -309,8 +309,8 @@ MatrixWorkspace_sptr PolarizationEfficiencyCor::convertToHistogram( //---------------------------------------------------------------------------------------------- /// Convert the efficiencies to histogram MatrixWorkspace_sptr -PolarizationEfficiencyCor::interpolate(MatrixWorkspace_sptr efficiencies, - MatrixWorkspace_sptr inWS) { +PolarizationEfficiencyCor::interpolate(const MatrixWorkspace_sptr &efficiencies, + const MatrixWorkspace_sptr &inWS) { efficiencies->setDistribution(true); auto alg = createChildAlgorithm("RebinToWorkspace"); diff --git a/Framework/Algorithms/src/Q1D2.cpp b/Framework/Algorithms/src/Q1D2.cpp index 2689b26c7d9f2269ca09483ce3fb5b891b8aad36..8a09881898619db57aaee4d2e15f9485202dbb24 100644 --- a/Framework/Algorithms/src/Q1D2.cpp +++ b/Framework/Algorithms/src/Q1D2.cpp @@ -4,7 +4,8 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidAlgorithms/Q1D2.h" +#include + #include "MantidAPI/Axis.h" #include "MantidAPI/CommonBinsValidator.h" #include "MantidAPI/HistogramValidator.h" @@ -14,6 +15,7 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/WorkspaceUnitValidator.h" #include "MantidAlgorithms/GravitySANSHelper.h" +#include "MantidAlgorithms/Q1D2.h" #include "MantidAlgorithms/Qhelper.h" #include "MantidDataObjects/Histogram1D.h" #include "MantidDataObjects/Workspace2D.h" @@ -409,12 +411,13 @@ Q1D2::setUpOutputWorkspace(const std::vector &binParams) const { */ void Q1D2::calculateNormalization( const size_t wavStart, const size_t wsIndex, - API::MatrixWorkspace_const_sptr pixelAdj, - API::MatrixWorkspace_const_sptr wavePixelAdj, double const *const binNorms, - double const *const binNormEs, HistogramData::HistogramY::iterator norm, + const API::MatrixWorkspace_const_sptr &pixelAdj, + const API::MatrixWorkspace_const_sptr &wavePixelAdj, + double const *const binNorms, double const *const binNormEs, + HistogramData::HistogramY::iterator norm, HistogramData::HistogramY::iterator normETo2) const { double detectorAdj, detAdjErr; - pixelWeight(pixelAdj, wsIndex, detectorAdj, detAdjErr); + pixelWeight(std::move(pixelAdj), wsIndex, detectorAdj, detAdjErr); // use that the normalization array ends at the start of the error array for (auto n = norm, e = normETo2; n != normETo2; ++n, ++e) { *n = detectorAdj; @@ -444,7 +447,7 @@ void Q1D2::calculateNormalization( * @param[out] error the error on the weight, only non-zero if pixelAdj * @throw LogicError if the solid angle is tiny or negative */ -void Q1D2::pixelWeight(API::MatrixWorkspace_const_sptr pixelAdj, +void Q1D2::pixelWeight(const API::MatrixWorkspace_const_sptr &pixelAdj, const size_t wsIndex, double &weight, double &error) const { const auto &detectorInfo = m_dataWS->detectorInfo(); diff --git a/Framework/Algorithms/src/Q1DWeighted.cpp b/Framework/Algorithms/src/Q1DWeighted.cpp index a01bcbade6732348b70f589fcc08af5edc488ed1..84c54c709cd8100fd0943dc7f7bb098ed4a3de64 100644 --- a/Framework/Algorithms/src/Q1DWeighted.cpp +++ b/Framework/Algorithms/src/Q1DWeighted.cpp @@ -105,7 +105,7 @@ void Q1DWeighted::exec() { * initializes the user inputs * @param inputWS : input workspace */ -void Q1DWeighted::bootstrap(MatrixWorkspace_const_sptr inputWS) { +void Q1DWeighted::bootstrap(const MatrixWorkspace_const_sptr &inputWS) { // Get pixel size and pixel sub-division m_pixelSizeX = getProperty("PixelSizeX"); m_pixelSizeY = getProperty("PixelSizeY"); @@ -167,7 +167,7 @@ void Q1DWeighted::bootstrap(MatrixWorkspace_const_sptr inputWS) { * Performs the azimuthal averaging for each wavelength bin * @param inputWS : the input workspace */ -void Q1DWeighted::calculate(MatrixWorkspace_const_sptr inputWS) { +void Q1DWeighted::calculate(const MatrixWorkspace_const_sptr &inputWS) { // Set up the progress Progress progress(this, 0.0, 1.0, m_nSpec * m_nLambda); @@ -313,7 +313,7 @@ void Q1DWeighted::calculate(MatrixWorkspace_const_sptr inputWS) { * performs final averaging and sets the output workspaces * @param inputWS : the input workspace */ -void Q1DWeighted::finalize(MatrixWorkspace_const_sptr inputWS) { +void Q1DWeighted::finalize(const MatrixWorkspace_const_sptr &inputWS) { MatrixWorkspace_sptr outputWS = createOutputWorkspace(inputWS, m_nQ, m_qBinEdges); setProperty("OutputWorkspace", outputWS); @@ -383,7 +383,7 @@ void Q1DWeighted::finalize(MatrixWorkspace_const_sptr inputWS) { * @return output I(Q) workspace */ MatrixWorkspace_sptr -Q1DWeighted::createOutputWorkspace(MatrixWorkspace_const_sptr parent, +Q1DWeighted::createOutputWorkspace(const MatrixWorkspace_const_sptr &parent, const size_t nBins, const std::vector &binEdges) { diff --git a/Framework/Algorithms/src/Qhelper.cpp b/Framework/Algorithms/src/Qhelper.cpp index 00a6d9d05cce97ac6d4c5baf57c712aed55506fe..d827741972e5227a653007d5a348e085d5982089 100644 --- a/Framework/Algorithms/src/Qhelper.cpp +++ b/Framework/Algorithms/src/Qhelper.cpp @@ -4,9 +4,11 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidAlgorithms/Qhelper.h" +#include + #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/SpectrumInfo.h" +#include "MantidAlgorithms/Qhelper.h" namespace Mantid { namespace Algorithms { @@ -25,13 +27,13 @@ using namespace Geometry; @param qResolution: the QResolution workspace @throw invalid_argument if the workspaces are not mututially compatible */ -void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS, - API::MatrixWorkspace_const_sptr binAdj, - API::MatrixWorkspace_const_sptr detectAdj, - API::MatrixWorkspace_const_sptr qResolution) { +void Qhelper::examineInput(const API::MatrixWorkspace_const_sptr &dataWS, + const API::MatrixWorkspace_const_sptr &binAdj, + const API::MatrixWorkspace_const_sptr &detectAdj, + const API::MatrixWorkspace_const_sptr &qResolution) { // Check the compatibility of dataWS, binAdj and detectAdj - examineInput(dataWS, binAdj, detectAdj); + examineInput(dataWS, std::move(binAdj), std::move(detectAdj)); // Check the compatibility of the QResolution workspace if (qResolution) { @@ -64,9 +66,9 @@ void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS, one bin @throw invalid_argument if the workspaces are not mututially compatible */ -void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS, - API::MatrixWorkspace_const_sptr binAdj, - API::MatrixWorkspace_const_sptr detectAdj) { +void Qhelper::examineInput(const API::MatrixWorkspace_const_sptr &dataWS, + const API::MatrixWorkspace_const_sptr &binAdj, + const API::MatrixWorkspace_const_sptr &detectAdj) { if (dataWS->getNumberHistograms() < 1) { throw std::invalid_argument( "Empty data workspace passed, can not continue"); @@ -152,7 +154,7 @@ void Qhelper::examineInput(API::MatrixWorkspace_const_sptr dataWS, * @param wsInd spectrum that is being analysed * @return index number of the first bin to include in the calculation */ -size_t Qhelper::waveLengthCutOff(API::MatrixWorkspace_const_sptr dataWS, +size_t Qhelper::waveLengthCutOff(const API::MatrixWorkspace_const_sptr &dataWS, const SpectrumInfo &spectrumInfo, const double RCut, const double WCut, const size_t wsInd) const { @@ -188,8 +190,8 @@ sumOfCounts/sumOfNormFactors equals the * @param sumOfNormFactors sum of normalisation factors */ void Qhelper::outputParts(API::Algorithm *alg, - API::MatrixWorkspace_sptr sumOfCounts, - API::MatrixWorkspace_sptr sumOfNormFactors) { + const API::MatrixWorkspace_sptr &sumOfCounts, + const API::MatrixWorkspace_sptr &sumOfNormFactors) { std::string baseName = alg->getPropertyValue("OutputWorkspace"); alg->declareProperty( diff --git a/Framework/Algorithms/src/Qxy.cpp b/Framework/Algorithms/src/Qxy.cpp index 91cf49b61f8b3bd7225006e313695c326d9aba17..72923aa7c0de8b9c9bbfdc35829705d07166988a 100644 --- a/Framework/Algorithms/src/Qxy.cpp +++ b/Framework/Algorithms/src/Qxy.cpp @@ -402,8 +402,8 @@ double Qxy::getQminFromWs(const API::MatrixWorkspace &inputWorkspace) { * Qx. * @return A pointer to the newly-created workspace */ -API::MatrixWorkspace_sptr -Qxy::setUpOutputWorkspace(API::MatrixWorkspace_const_sptr inputWorkspace) { +API::MatrixWorkspace_sptr Qxy::setUpOutputWorkspace( + const API::MatrixWorkspace_const_sptr &inputWorkspace) { const double max = getProperty("MaxQxy"); const double delta = getProperty("DeltaQ"); const bool log_binning = getProperty("IQxQyLogBinning"); diff --git a/Framework/Algorithms/src/RadiusSum.cpp b/Framework/Algorithms/src/RadiusSum.cpp index 3000143742d1260aa29fff73ec373b2b86da2054..1eb1c907f7253402874001b9bda592cafb2c0f50 100644 --- a/Framework/Algorithms/src/RadiusSum.cpp +++ b/Framework/Algorithms/src/RadiusSum.cpp @@ -272,7 +272,7 @@ void RadiusSum::inputValidationSanityCheck() { * @return True if it is an instrument related workspace. */ bool RadiusSum::inputWorkspaceHasInstrumentAssociated( - API::MatrixWorkspace_sptr inWS) { + const API::MatrixWorkspace_sptr &inWS) { return inWS->getAxis(1)->isSpectra(); } @@ -302,7 +302,7 @@ std::vector RadiusSum::getBoundariesOfInputWorkspace() { *Xmin, Xmax, Ymin, Ymax */ std::vector -RadiusSum::getBoundariesOfNumericImage(API::MatrixWorkspace_sptr inWS) { +RadiusSum::getBoundariesOfNumericImage(const API::MatrixWorkspace_sptr &inWS) { // horizontal axis @@ -359,7 +359,7 @@ RadiusSum::getBoundariesOfNumericImage(API::MatrixWorkspace_sptr inWS) { *Xmin, Xmax, Ymin, Ymax, Zmin, Zmax */ std::vector -RadiusSum::getBoundariesOfInstrument(API::MatrixWorkspace_sptr inWS) { +RadiusSum::getBoundariesOfInstrument(const API::MatrixWorkspace_sptr &inWS) { // This function is implemented based in the following assumption: // - The workspace is composed by spectrum with associated spectrum No which @@ -521,7 +521,8 @@ void RadiusSum::numBinsIsReasonable() { << '\n'; } -double RadiusSum::getMinBinSizeForInstrument(API::MatrixWorkspace_sptr inWS) { +double +RadiusSum::getMinBinSizeForInstrument(const API::MatrixWorkspace_sptr &inWS) { // Assumption made: the detectors are placed one after the other, so the // minimum // reasonalbe size for the bin is the width of one detector. @@ -538,7 +539,8 @@ double RadiusSum::getMinBinSizeForInstrument(API::MatrixWorkspace_sptr inWS) { throw std::invalid_argument("Did not find any non monitor detector position"); } -double RadiusSum::getMinBinSizeForNumericImage(API::MatrixWorkspace_sptr inWS) { +double +RadiusSum::getMinBinSizeForNumericImage(const API::MatrixWorkspace_sptr &inWS) { // The pixel dimensions: // - width: image width/ number of pixels in one row // - height: image height/ number of pixels in one column diff --git a/Framework/Algorithms/src/Rebin.cpp b/Framework/Algorithms/src/Rebin.cpp index 5e8993c4a931899c18926a9f76d92a7f4ea9eda2..7343535d6f43cc138787aadb5442ed3587b7678b 100644 --- a/Framework/Algorithms/src/Rebin.cpp +++ b/Framework/Algorithms/src/Rebin.cpp @@ -309,8 +309,9 @@ void Rebin::exec() { * @param outputWS :: The output workspace * @param hist :: The index of the current histogram */ -void Rebin::propagateMasks(API::MatrixWorkspace_const_sptr inputWS, - API::MatrixWorkspace_sptr outputWS, int hist) { +void Rebin::propagateMasks(const API::MatrixWorkspace_const_sptr &inputWS, + const API::MatrixWorkspace_sptr &outputWS, + int hist) { // Not too happy with the efficiency of this way of doing it, but it's a lot // simpler to use the // existing rebin algorithm to distribute the weights than to re-implement it diff --git a/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp b/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp index 28e19f92abc2fdffd4cb7c92b3b90b22c84d276b..76639056586c9ab9dee093d3ccee69a19bac62dd 100644 --- a/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp +++ b/Framework/Algorithms/src/ReflectometryBackgroundSubtraction.cpp @@ -50,7 +50,8 @@ const std::string ReflectometryBackgroundSubtraction::summary() const { * background */ void ReflectometryBackgroundSubtraction::calculateAverageSpectrumBackground( - MatrixWorkspace_sptr inputWS, const std::vector &spectraList) { + const MatrixWorkspace_sptr &inputWS, + const std::vector &spectraList) { auto alg = this->createChildAlgorithm("GroupDetectors"); alg->setProperty("InputWorkspace", inputWS); @@ -156,7 +157,7 @@ void ReflectometryBackgroundSubtraction::calculatePolynomialBackground( * @param indexList :: the ranges of the background region */ void ReflectometryBackgroundSubtraction::calculatePixelBackground( - MatrixWorkspace_sptr inputWS, const std::vector &indexList) { + const MatrixWorkspace_sptr &inputWS, const std::vector &indexList) { const std::vector backgroundRange{static_cast(indexList.front()), static_cast(indexList.back())}; diff --git a/Framework/Algorithms/src/ReflectometryBeamStatistics.cpp b/Framework/Algorithms/src/ReflectometryBeamStatistics.cpp index 38ddb2048d437c96b797b71e0a15085ed06e839d..5ccc81e765e4a1dd5a9dde6253562e8fbd92b272 100644 --- a/Framework/Algorithms/src/ReflectometryBeamStatistics.cpp +++ b/Framework/Algorithms/src/ReflectometryBeamStatistics.cpp @@ -66,8 +66,8 @@ const std::string * @return the slit gap, in meters */ double ReflectometryBeamStatistics::slitSeparation( - Geometry::Instrument_const_sptr instrument, const std::string &slit1Name, - const std::string &slit2Name) { + const Geometry::Instrument_const_sptr &instrument, + const std::string &slit1Name, const std::string &slit2Name) { auto slit1 = instrument->getComponentByName(slit1Name); auto slit2 = instrument->getComponentByName(slit2Name); return (slit1->getPos() - slit2->getPos()).norm(); diff --git a/Framework/Algorithms/src/ReflectometryReductionOne2.cpp b/Framework/Algorithms/src/ReflectometryReductionOne2.cpp index 9f887d7e93c6da671ab6168698fb8c4350fff4b1..b78e1286933688d1afa5ec3399aecfc88c88a633 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOne2.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOne2.cpp @@ -25,6 +25,7 @@ #include "MantidKernel/UnitFactory.h" #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -344,7 +345,7 @@ std::string ReflectometryReductionOne2::createDebugWorkspaceName( * and is incremented after the workspace is output */ void ReflectometryReductionOne2::outputDebugWorkspace( - MatrixWorkspace_sptr ws, const std::string &wsName, + const MatrixWorkspace_sptr &ws, const std::string &wsName, const std::string &wsSuffix, const bool debug, int &step) { // Nothing to do if debug is not enabled if (debug) { @@ -503,7 +504,7 @@ MatrixWorkspace_sptr ReflectometryReductionOne2::backgroundSubtraction( * @return : corrected workspace */ MatrixWorkspace_sptr ReflectometryReductionOne2::transOrAlgCorrection( - MatrixWorkspace_sptr detectorWS, const bool detectorWSReduced) { + const MatrixWorkspace_sptr &detectorWS, const bool detectorWSReduced) { MatrixWorkspace_sptr normalized; MatrixWorkspace_sptr transRun = getProperty("FirstTransmissionRun"); @@ -526,7 +527,7 @@ MatrixWorkspace_sptr ReflectometryReductionOne2::transOrAlgCorrection( * @return :: the input workspace normalized by transmission */ MatrixWorkspace_sptr ReflectometryReductionOne2::transmissionCorrection( - MatrixWorkspace_sptr detectorWS, const bool detectorWSReduced) { + const MatrixWorkspace_sptr &detectorWS, const bool detectorWSReduced) { MatrixWorkspace_sptr transmissionWS = getProperty("FirstTransmissionRun"); auto transmissionWSName = transmissionWS->getName(); @@ -615,7 +616,7 @@ MatrixWorkspace_sptr ReflectometryReductionOne2::transmissionCorrection( * @return : corrected workspace */ MatrixWorkspace_sptr ReflectometryReductionOne2::algorithmicCorrection( - MatrixWorkspace_sptr detectorWS) { + const MatrixWorkspace_sptr &detectorWS) { const std::string corrAlgName = getProperty("CorrectionAlgorithm"); @@ -643,7 +644,7 @@ MatrixWorkspace_sptr ReflectometryReductionOne2::algorithmicCorrection( * @return : output workspace in Q */ MatrixWorkspace_sptr -ReflectometryReductionOne2::convertToQ(MatrixWorkspace_sptr inputWS) { +ReflectometryReductionOne2::convertToQ(const MatrixWorkspace_sptr &inputWS) { bool const moreThanOneDetector = inputWS->getDetector(0)->nDets() > 1; bool const shouldCorrectAngle = !(*getProperty("ThetaIn")).isDefault() && !summingInQ(); @@ -807,7 +808,7 @@ size_t ReflectometryReductionOne2::twoThetaRDetectorIdx( } void ReflectometryReductionOne2::findWavelengthMinMax( - MatrixWorkspace_sptr inputWS) { + const MatrixWorkspace_sptr &inputWS) { // Get the max/min wavelength of region of interest const double lambdaMin = getProperty("WavelengthMin"); @@ -879,8 +880,8 @@ size_t ReflectometryReductionOne2::findIvsLamRangeMaxDetector( } double ReflectometryReductionOne2::findIvsLamRangeMin( - MatrixWorkspace_sptr detectorWS, const std::vector &detectors, - const double lambda) { + const MatrixWorkspace_sptr &detectorWS, + const std::vector &detectors, const double lambda) { double projectedMin = 0.0; const size_t spIdx = findIvsLamRangeMinDetector(detectors); @@ -898,8 +899,8 @@ double ReflectometryReductionOne2::findIvsLamRangeMin( } double ReflectometryReductionOne2::findIvsLamRangeMax( - MatrixWorkspace_sptr detectorWS, const std::vector &detectors, - const double lambda) { + const MatrixWorkspace_sptr &detectorWS, + const std::vector &detectors, const double lambda) { double projectedMax = 0.0; const size_t spIdx = findIvsLamRangeMaxDetector(detectors); @@ -928,9 +929,9 @@ double ReflectometryReductionOne2::findIvsLamRangeMax( * @param projectedMax [out] : the end of the resulting projected range */ void ReflectometryReductionOne2::findIvsLamRange( - MatrixWorkspace_sptr detectorWS, const std::vector &detectors, - const double lambdaMin, const double lambdaMax, double &projectedMin, - double &projectedMax) { + const MatrixWorkspace_sptr &detectorWS, + const std::vector &detectors, const double lambdaMin, + const double lambdaMax, double &projectedMin, double &projectedMax) { // Get the new max and min X values of the projected (virtual) lambda range projectedMin = findIvsLamRangeMin(detectorWS, detectors, lambdaMin); @@ -952,8 +953,8 @@ void ReflectometryReductionOne2::findIvsLamRange( * * @return : a 1D workspace where y values are all zero */ -MatrixWorkspace_sptr -ReflectometryReductionOne2::constructIvsLamWS(MatrixWorkspace_sptr detectorWS) { +MatrixWorkspace_sptr ReflectometryReductionOne2::constructIvsLamWS( + const MatrixWorkspace_sptr &detectorWS) { // There is one output spectrum for each detector group const size_t numGroups = detectorGroups().size(); @@ -1001,7 +1002,7 @@ ReflectometryReductionOne2::constructIvsLamWS(MatrixWorkspace_sptr detectorWS) { * @return :: the output workspace in wavelength */ MatrixWorkspace_sptr -ReflectometryReductionOne2::sumInQ(MatrixWorkspace_sptr detectorWS) { +ReflectometryReductionOne2::sumInQ(const MatrixWorkspace_sptr &detectorWS) { // Construct the output array in virtual lambda MatrixWorkspace_sptr IvsLam = constructIvsLamWS(detectorWS); @@ -1078,7 +1079,7 @@ void ReflectometryReductionOne2::sumInQProcessValue( const int inputIdx, const double twoTheta, const double bTwoTheta, const HistogramX &inputX, const HistogramY &inputY, const HistogramE &inputE, const std::vector &detectors, - const size_t outSpecIdx, MatrixWorkspace_sptr IvsLam, + const size_t outSpecIdx, const MatrixWorkspace_sptr &IvsLam, std::vector &outputE) { // Check whether there are any counts (if not, nothing to share) @@ -1097,7 +1098,7 @@ void ReflectometryReductionOne2::sumInQProcessValue( lambdaVMin, lambdaVMax); // Share the input counts into the output array sumInQShareCounts(inputCounts, inputE[inputIdx], bLambda, lambdaVMin, - lambdaVMax, outSpecIdx, IvsLam, outputE); + lambdaVMax, outSpecIdx, std::move(IvsLam), outputE); } /** @@ -1118,7 +1119,7 @@ void ReflectometryReductionOne2::sumInQProcessValue( void ReflectometryReductionOne2::sumInQShareCounts( const double inputCounts, const double inputErr, const double bLambda, const double lambdaMin, const double lambdaMax, const size_t outSpecIdx, - MatrixWorkspace_sptr IvsLam, std::vector &outputE) { + const MatrixWorkspace_sptr &IvsLam, std::vector &outputE) { // Check that we have histogram data const auto &outputX = IvsLam->dataX(outSpecIdx); auto &outputY = IvsLam->dataY(outSpecIdx); @@ -1239,7 +1240,8 @@ Check whether the spectra for the given workspaces are the same. exception. Otherwise a warning is generated. */ void ReflectometryReductionOne2::verifySpectrumMaps( - MatrixWorkspace_const_sptr ws1, MatrixWorkspace_const_sptr ws2) { + const MatrixWorkspace_const_sptr &ws1, + const MatrixWorkspace_const_sptr &ws2) { bool mismatch = false; // Check that the number of histograms is the same diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp index 2ee23048c2b4f470fe0e9364b375447c73537e0c..d9bfc3dae5c648098682c7c0ee5dc985e166668f 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp @@ -172,7 +172,7 @@ ReflectometryReductionOneAuto2::validateInputs() { } std::string ReflectometryReductionOneAuto2::getRunNumberForWorkspaceGroup( - WorkspaceGroup_const_sptr group) { + const WorkspaceGroup_const_sptr &group) { // Return the run number for the first child workspace if (!group) throw std::runtime_error("Invalid workspace group type"); @@ -495,8 +495,8 @@ void ReflectometryReductionOneAuto2::exec() { * @param inputWS :: the input workspace * @return :: the names of the detectors of interest */ -std::vector -ReflectometryReductionOneAuto2::getDetectorNames(MatrixWorkspace_sptr inputWS) { +std::vector ReflectometryReductionOneAuto2::getDetectorNames( + const MatrixWorkspace_sptr &inputWS) { std::vector wsIndices; boost::split(wsIndices, m_processingInstructionsWorkspaceIndex, @@ -572,8 +572,8 @@ MatrixWorkspace_sptr ReflectometryReductionOneAuto2::correctDetectorPositions( * @param inputWS :: the input workspace * @return :: the angle of the detector (only the first detector is considered) */ -double -ReflectometryReductionOneAuto2::calculateTheta(MatrixWorkspace_sptr inputWS) { +double ReflectometryReductionOneAuto2::calculateTheta( + const MatrixWorkspace_sptr &inputWS) { const auto detectorsOfInterest = getDetectorNames(inputWS); @@ -600,7 +600,7 @@ ReflectometryReductionOneAuto2::calculateTheta(MatrixWorkspace_sptr inputWS) { * @param instrument :: The instrument attached to the workspace */ void ReflectometryReductionOneAuto2::populateAlgorithmicCorrectionProperties( - IAlgorithm_sptr alg, Instrument_const_sptr instrument) { + const IAlgorithm_sptr &alg, const Instrument_const_sptr &instrument) { // With algorithmic corrections, monitors should not be integrated, see below @@ -664,7 +664,7 @@ void ReflectometryReductionOneAuto2::populateAlgorithmicCorrectionProperties( } auto ReflectometryReductionOneAuto2::getRebinParams( - MatrixWorkspace_sptr inputWS, const double theta) -> RebinParams { + const MatrixWorkspace_sptr &inputWS, const double theta) -> RebinParams { bool qMinIsDefault = true, qMaxIsDefault = true; auto const qMin = getPropertyOrDefault("MomentumTransferMin", inputWS->x(0).front(), qMinIsDefault); @@ -681,7 +681,7 @@ auto ReflectometryReductionOneAuto2::getRebinParams( * @return :: the rebin step in Q, or none if it could not be found */ boost::optional -ReflectometryReductionOneAuto2::getQStep(MatrixWorkspace_sptr inputWS, +ReflectometryReductionOneAuto2::getQStep(const MatrixWorkspace_sptr &inputWS, const double theta) { Property *qStepProp = getProperty("MomentumTransferStep"); double qstep; @@ -718,9 +718,8 @@ ReflectometryReductionOneAuto2::getQStep(MatrixWorkspace_sptr inputWS, * and max) * @return :: the output workspace */ -MatrixWorkspace_sptr -ReflectometryReductionOneAuto2::rebinAndScale(MatrixWorkspace_sptr inputWS, - RebinParams const ¶ms) { +MatrixWorkspace_sptr ReflectometryReductionOneAuto2::rebinAndScale( + const MatrixWorkspace_sptr &inputWS, RebinParams const ¶ms) { // Rebin IAlgorithm_sptr algRebin = createChildAlgorithm("Rebin"); algRebin->initialize(); @@ -747,7 +746,7 @@ ReflectometryReductionOneAuto2::rebinAndScale(MatrixWorkspace_sptr inputWS, } MatrixWorkspace_sptr -ReflectometryReductionOneAuto2::cropQ(MatrixWorkspace_sptr inputWS, +ReflectometryReductionOneAuto2::cropQ(const MatrixWorkspace_sptr &inputWS, RebinParams const ¶ms) { IAlgorithm_sptr algCrop = createChildAlgorithm("CropWorkspace"); algCrop->initialize(); diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp index c4c447f983dc160be2b04453d4ed6db827a3c1f6..365b8b41fa14cc318b3e3180b4fefaddd4e9bae0 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp @@ -163,7 +163,7 @@ ReflectometryReductionOneAuto3::validateInputs() { } std::string ReflectometryReductionOneAuto3::getRunNumberForWorkspaceGroup( - WorkspaceGroup_const_sptr group) { + const WorkspaceGroup_const_sptr &group) { // Return the run number for the first child workspace if (!group) throw std::runtime_error("Invalid workspace group type"); @@ -471,8 +471,8 @@ void ReflectometryReductionOneAuto3::exec() { * @param inputWS :: the input workspace * @return :: the names of the detectors of interest */ -std::vector -ReflectometryReductionOneAuto3::getDetectorNames(MatrixWorkspace_sptr inputWS) { +std::vector ReflectometryReductionOneAuto3::getDetectorNames( + const MatrixWorkspace_sptr &inputWS) { std::vector wsIndices; boost::split(wsIndices, m_processingInstructionsWorkspaceIndex, boost::is_any_of(":,-+")); @@ -546,8 +546,8 @@ MatrixWorkspace_sptr ReflectometryReductionOneAuto3::correctDetectorPositions( * @param inputWS :: the input workspace * @return :: the angle of the detector (only the first detector is considered) */ -double -ReflectometryReductionOneAuto3::calculateTheta(MatrixWorkspace_sptr inputWS) { +double ReflectometryReductionOneAuto3::calculateTheta( + const MatrixWorkspace_sptr &inputWS) { const auto detectorsOfInterest = getDetectorNames(inputWS); // Detectors of interest may be empty. This happens for instance when we input @@ -573,7 +573,7 @@ ReflectometryReductionOneAuto3::calculateTheta(MatrixWorkspace_sptr inputWS) { * @param instrument :: The instrument attached to the workspace */ void ReflectometryReductionOneAuto3::populateAlgorithmicCorrectionProperties( - IAlgorithm_sptr alg, Instrument_const_sptr instrument) { + const IAlgorithm_sptr &alg, const Instrument_const_sptr &instrument) { // With algorithmic corrections, monitors should not be integrated, see below const std::string correctionAlgorithm = getProperty("CorrectionAlgorithm"); @@ -635,7 +635,7 @@ void ReflectometryReductionOneAuto3::populateAlgorithmicCorrectionProperties( } auto ReflectometryReductionOneAuto3::getRebinParams( - MatrixWorkspace_sptr inputWS, const double theta) -> RebinParams { + const MatrixWorkspace_sptr &inputWS, const double theta) -> RebinParams { bool qMinIsDefault = true, qMaxIsDefault = true; auto const qMin = getPropertyOrDefault("MomentumTransferMin", inputWS->x(0).front(), qMinIsDefault); @@ -652,7 +652,7 @@ auto ReflectometryReductionOneAuto3::getRebinParams( * @return :: the rebin step in Q, or none if it could not be found */ boost::optional -ReflectometryReductionOneAuto3::getQStep(MatrixWorkspace_sptr inputWS, +ReflectometryReductionOneAuto3::getQStep(const MatrixWorkspace_sptr &inputWS, const double theta) { Property *qStepProp = getProperty("MomentumTransferStep"); double qstep; @@ -690,7 +690,7 @@ ReflectometryReductionOneAuto3::getQStep(MatrixWorkspace_sptr inputWS, * @return :: the output workspace */ MatrixWorkspace_sptr -ReflectometryReductionOneAuto3::rebin(MatrixWorkspace_sptr inputWS, +ReflectometryReductionOneAuto3::rebin(const MatrixWorkspace_sptr &inputWS, const RebinParams ¶ms) { IAlgorithm_sptr algRebin = createChildAlgorithm("Rebin"); algRebin->initialize(); diff --git a/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp b/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp index 5712e3db69121acccbe6441ea4f428bb8c7f18d9..7753d5f99c8b0175951189386e5665bf838978bb 100644 --- a/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp +++ b/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp @@ -4,9 +4,11 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidAlgorithms/ReflectometryWorkflowBase.h" +#include + #include "MantidAPI/BoostOptionalToAlgorithmProperty.h" #include "MantidAPI/WorkspaceUnitValidator.h" +#include "MantidAlgorithms/ReflectometryWorkflowBase.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/BoundedValidator.h" #include "MantidKernel/CompositeValidator.h" @@ -196,12 +198,12 @@ ReflectometryWorkflowBase::OptionalMinMax ReflectometryWorkflowBase::getOptionalMinMax( Mantid::API::Algorithm *const alg, const std::string &minProperty, const std::string &maxProperty, - Mantid::Geometry::Instrument_const_sptr inst, std::string minIdfName, - std::string maxIdfName) const { - const auto min = checkForOptionalInstrumentDefault(alg, minProperty, - inst, minIdfName); - const auto max = checkForOptionalInstrumentDefault(alg, maxProperty, - inst, maxIdfName); + const Mantid::Geometry::Instrument_const_sptr &inst, + const std::string &minIdfName, const std::string &maxIdfName) const { + const auto min = checkForOptionalInstrumentDefault( + alg, minProperty, inst, std::move(minIdfName)); + const auto max = checkForOptionalInstrumentDefault( + alg, maxProperty, inst, std::move(maxIdfName)); if (min.is_initialized() && max.is_initialized()) { MinMax result = getMinMax(minProperty, maxProperty); return OptionalMinMax(result); @@ -361,7 +363,7 @@ void ReflectometryWorkflowBase::getTransmissionRunInfo( * @return The cropped and corrected monitor workspace. */ MatrixWorkspace_sptr ReflectometryWorkflowBase::toLamMonitor( - const MatrixWorkspace_sptr &toConvert, const OptionalInteger monitorIndex, + const MatrixWorkspace_sptr &toConvert, const OptionalInteger &monitorIndex, const OptionalMinMax &backgroundMinMax) { // Convert Units. auto convertUnitsAlg = this->createChildAlgorithm("ConvertUnits"); @@ -473,9 +475,9 @@ ReflectometryWorkflowBase::makeUnityWorkspace(const HistogramX &x) { * @return Tuple of detector and monitor workspaces */ ReflectometryWorkflowBase::DetectorMonitorWorkspacePair -ReflectometryWorkflowBase::toLam(MatrixWorkspace_sptr toConvert, +ReflectometryWorkflowBase::toLam(const MatrixWorkspace_sptr &toConvert, const std::string &processingCommands, - const OptionalInteger monitorIndex, + const OptionalInteger &monitorIndex, const MinMax &wavelengthMinMax, const OptionalMinMax &backgroundMinMax) { // Detector Workspace Processing diff --git a/Framework/Algorithms/src/ReflectometryWorkflowBase2.cpp b/Framework/Algorithms/src/ReflectometryWorkflowBase2.cpp index a789763307e9991cfd728329c1ab7e159b56f082..5336598c54277c201e94de6cf533ae9ef8d06971 100644 --- a/Framework/Algorithms/src/ReflectometryWorkflowBase2.cpp +++ b/Framework/Algorithms/src/ReflectometryWorkflowBase2.cpp @@ -4,12 +4,14 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidAlgorithms/ReflectometryWorkflowBase2.h" +#include + #include "MantidAPI/Axis.h" #include "MantidAPI/BoostOptionalToAlgorithmProperty.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/Run.h" #include "MantidAPI/WorkspaceUnitValidator.h" +#include "MantidAlgorithms/ReflectometryWorkflowBase2.h" #include "MantidGeometry/Instrument.h" #include "MantidIndexing/IndexInfo.h" #include "MantidKernel/ArrayProperty.h" @@ -40,16 +42,15 @@ int convertStringNumToInt(const std::string &string) { } std::string convertToWorkspaceIndex(const std::string &spectrumNumber, - MatrixWorkspace_const_sptr ws) { + const MatrixWorkspace_const_sptr &ws) { auto specNum = convertStringNumToInt(spectrumNumber); std::string wsIdx = std::to_string( ws->getIndexFromSpectrumNumber(static_cast(specNum))); return wsIdx; } -std::string -convertProcessingInstructionsToWorkspaceIndices(const std::string &instructions, - MatrixWorkspace_const_sptr ws) { +std::string convertProcessingInstructionsToWorkspaceIndices( + const std::string &instructions, const MatrixWorkspace_const_sptr &ws) { std::string converted = ""; std::string currentNumber = ""; std::string ignoreThese = "-,:+"; @@ -79,7 +80,7 @@ convertProcessingInstructionsToWorkspaceIndices(const std::string &instructions, */ std::vector getProcessingInstructionsAsIndices(std::string const &instructions, - MatrixWorkspace_sptr workspace) { + const MatrixWorkspace_sptr &workspace) { auto instructionsInWSIndex = convertProcessingInstructionsToWorkspaceIndices(instructions, workspace); auto groups = @@ -517,8 +518,8 @@ ReflectometryWorkflowBase2::validateWavelengthRanges() const { * @param inputWS :: the workspace to convert * @return :: the workspace in wavelength */ -MatrixWorkspace_sptr -ReflectometryWorkflowBase2::convertToWavelength(MatrixWorkspace_sptr inputWS) { +MatrixWorkspace_sptr ReflectometryWorkflowBase2::convertToWavelength( + const MatrixWorkspace_sptr &inputWS) { auto convertUnitsAlg = createChildAlgorithm("ConvertUnits"); convertUnitsAlg->initialize(); @@ -541,8 +542,8 @@ ReflectometryWorkflowBase2::convertToWavelength(MatrixWorkspace_sptr inputWS) { * @return :: the cropped workspace */ MatrixWorkspace_sptr ReflectometryWorkflowBase2::cropWavelength( - MatrixWorkspace_sptr inputWS, const bool useArgs, const double argMin, - const double argMax) { + const MatrixWorkspace_sptr &inputWS, const bool useArgs, + const double argMin, const double argMax) { double wavelengthMin = 0.0; double wavelengthMax = 0.0; @@ -584,7 +585,7 @@ MatrixWorkspace_sptr ReflectometryWorkflowBase2::cropWavelength( MatrixWorkspace_sptr ReflectometryWorkflowBase2::makeDetectorWS(MatrixWorkspace_sptr inputWS, const bool convert, const bool sum) { - auto detectorWS = inputWS; + auto detectorWS = std::move(inputWS); if (sum) { // Use GroupDetectors to extract and sum the detectors of interest @@ -635,7 +636,7 @@ ReflectometryWorkflowBase2::makeDetectorWS(MatrixWorkspace_sptr inputWS, * @return :: the monitor workspace in wavelength */ MatrixWorkspace_sptr -ReflectometryWorkflowBase2::makeMonitorWS(MatrixWorkspace_sptr inputWS, +ReflectometryWorkflowBase2::makeMonitorWS(const MatrixWorkspace_sptr &inputWS, const bool integratedMonitors) { // Extract the monitor workspace @@ -697,7 +698,8 @@ ReflectometryWorkflowBase2::makeMonitorWS(MatrixWorkspace_sptr inputWS, * @return :: the rebinned detector workspace */ MatrixWorkspace_sptr ReflectometryWorkflowBase2::rebinDetectorsToMonitors( - MatrixWorkspace_sptr detectorWS, MatrixWorkspace_sptr monitorWS) { + const MatrixWorkspace_sptr &detectorWS, + const MatrixWorkspace_sptr &monitorWS) { auto rebin = createChildAlgorithm("RebinToWorkspace"); rebin->initialize(); @@ -715,7 +717,7 @@ MatrixWorkspace_sptr ReflectometryWorkflowBase2::rebinDetectorsToMonitors( * @param instrument :: the instrument attached to the workspace */ void ReflectometryWorkflowBase2::populateMonitorProperties( - IAlgorithm_sptr alg, Instrument_const_sptr instrument) { + const IAlgorithm_sptr &alg, const Instrument_const_sptr &instrument) { const auto startOverlap = checkForOptionalInstrumentDefault( this, "StartOverlap", instrument, "TransRunStartOverlap"); @@ -769,7 +771,8 @@ void ReflectometryWorkflowBase2::populateMonitorProperties( * @return :: processing instructions as a string */ std::string ReflectometryWorkflowBase2::findProcessingInstructions( - Instrument_const_sptr instrument, MatrixWorkspace_sptr inputWS) const { + const Instrument_const_sptr &instrument, + const MatrixWorkspace_sptr &inputWS) const { const std::string analysisMode = getProperty("AnalysisMode"); @@ -815,7 +818,7 @@ std::string ReflectometryWorkflowBase2::findProcessingInstructions( * @return Boolean, whether or not any transmission runs were found */ bool ReflectometryWorkflowBase2::populateTransmissionProperties( - IAlgorithm_sptr alg) const { + const IAlgorithm_sptr &alg) const { bool transRunsExist = false; @@ -845,9 +848,8 @@ bool ReflectometryWorkflowBase2::populateTransmissionProperties( * @return :: the value of theta found from the logs * @throw :: NotFoundError if the log value was not found */ -double -ReflectometryWorkflowBase2::getThetaFromLogs(MatrixWorkspace_sptr inputWs, - const std::string &logName) { +double ReflectometryWorkflowBase2::getThetaFromLogs( + const MatrixWorkspace_sptr &inputWs, const std::string &logName) { double theta = -1.; const Mantid::API::Run &run = inputWs->run(); Property *logData = run.getLogData(logName); @@ -884,7 +886,7 @@ ReflectometryWorkflowBase2::getRunNumber(MatrixWorkspace const &ws) const { std::string ReflectometryWorkflowBase2::convertProcessingInstructionsToSpectrumNumbers( const std::string &instructions, - Mantid::API::MatrixWorkspace_const_sptr ws) const { + const Mantid::API::MatrixWorkspace_const_sptr &ws) const { std::string converted = ""; std::string currentNumber = ""; std::string ignoreThese = "-,:+"; @@ -905,7 +907,7 @@ ReflectometryWorkflowBase2::convertProcessingInstructionsToSpectrumNumbers( } std::string ReflectometryWorkflowBase2::convertToSpectrumNumber( const std::string &workspaceIndex, - Mantid::API::MatrixWorkspace_const_sptr ws) const { + const Mantid::API::MatrixWorkspace_const_sptr &ws) const { auto wsIndx = convertStringNumToInt(workspaceIndex); std::string specId = std::to_string( static_cast(ws->indexInfo().spectrumNumber(wsIndx))); @@ -913,7 +915,8 @@ std::string ReflectometryWorkflowBase2::convertToSpectrumNumber( } void ReflectometryWorkflowBase2::convertProcessingInstructions( - Instrument_const_sptr instrument, MatrixWorkspace_sptr inputWS) { + const Instrument_const_sptr &instrument, + const MatrixWorkspace_sptr &inputWS) { m_processingInstructions = getPropertyValue("ProcessingInstructions"); if (!getPointerToProperty("ProcessingInstructions")->isDefault()) { m_processingInstructionsWorkspaceIndex = @@ -921,14 +924,14 @@ void ReflectometryWorkflowBase2::convertProcessingInstructions( m_processingInstructions, inputWS); } else { m_processingInstructionsWorkspaceIndex = - findProcessingInstructions(instrument, inputWS); + findProcessingInstructions(std::move(instrument), inputWS); m_processingInstructions = convertProcessingInstructionsToSpectrumNumbers( m_processingInstructionsWorkspaceIndex, inputWS); } } void ReflectometryWorkflowBase2::convertProcessingInstructions( - MatrixWorkspace_sptr inputWS) { + const MatrixWorkspace_sptr &inputWS) { m_processingInstructions = getPropertyValue("ProcessingInstructions"); m_processingInstructionsWorkspaceIndex = convertProcessingInstructionsToWorkspaceIndices(m_processingInstructions, @@ -938,7 +941,7 @@ void ReflectometryWorkflowBase2::convertProcessingInstructions( // Create an on-the-fly property to set an output workspace from a child // algorithm, if the child has that output value set void ReflectometryWorkflowBase2::setWorkspacePropertyFromChild( - Algorithm_sptr alg, std::string const &propertyName) { + const Algorithm_sptr &alg, std::string const &propertyName) { if (alg->isDefault(propertyName)) return; diff --git a/Framework/Algorithms/src/RemovePromptPulse.cpp b/Framework/Algorithms/src/RemovePromptPulse.cpp index 07e0a8bed958896ed2ad87e2f71b76f4250ce0c1..412802216b0d4e35c37ddf646ef60bf1ddcbf3cb 100644 --- a/Framework/Algorithms/src/RemovePromptPulse.cpp +++ b/Framework/Algorithms/src/RemovePromptPulse.cpp @@ -68,7 +68,8 @@ double getMedian(const API::Run &run, const std::string &name) { return stats.median; } -void getTofRange(MatrixWorkspace_const_sptr wksp, double &tmin, double &tmax) { +void getTofRange(const MatrixWorkspace_const_sptr &wksp, double &tmin, + double &tmax) { DataObjects::EventWorkspace_const_sptr eventWksp = boost::dynamic_pointer_cast(wksp); if (eventWksp == nullptr) { diff --git a/Framework/Algorithms/src/ResampleX.cpp b/Framework/Algorithms/src/ResampleX.cpp index ddd7344106f9ddbcfa802e56387c061f70768d93..4a686c0ec29a545a4594bfc0af26f4effb60f706 100644 --- a/Framework/Algorithms/src/ResampleX.cpp +++ b/Framework/Algorithms/src/ResampleX.cpp @@ -117,8 +117,8 @@ map ResampleX::validateInputs() { *everything * went according to plan. */ -string determineXMinMax(MatrixWorkspace_sptr inputWS, vector &xmins, - vector &xmaxs) { +string determineXMinMax(const MatrixWorkspace_sptr &inputWS, + vector &xmins, vector &xmaxs) { const size_t numSpectra = inputWS->getNumberHistograms(); // pad out the ranges by copying the first value to the rest that are needed diff --git a/Framework/Algorithms/src/ResetNegatives.cpp b/Framework/Algorithms/src/ResetNegatives.cpp index 430b9dc38702c6b2e490711cc4c98b430143469a..88f4fedbe3ded49e42ba201063a922ee2514a379 100644 --- a/Framework/Algorithms/src/ResetNegatives.cpp +++ b/Framework/Algorithms/src/ResetNegatives.cpp @@ -141,8 +141,9 @@ inline double fixZero(const double value) { * @param wksp The workspace to modify. * @param prog The progress. */ -void ResetNegatives::pushMinimum(MatrixWorkspace_const_sptr minWS, - MatrixWorkspace_sptr wksp, Progress &prog) { +void ResetNegatives::pushMinimum(const MatrixWorkspace_const_sptr &minWS, + const MatrixWorkspace_sptr &wksp, + Progress &prog) { int64_t nHist = minWS->getNumberHistograms(); PARALLEL_FOR_IF(Kernel::threadSafe(*wksp, *minWS)) for (int64_t i = 0; i < nHist; i++) { @@ -171,9 +172,9 @@ void ResetNegatives::pushMinimum(MatrixWorkspace_const_sptr minWS, * @param wksp The workspace to modify. * @param prog The progress. */ -void ResetNegatives::changeNegatives(MatrixWorkspace_const_sptr minWS, +void ResetNegatives::changeNegatives(const MatrixWorkspace_const_sptr &minWS, const double spectrumNegativeValues, - MatrixWorkspace_sptr wksp, + const MatrixWorkspace_sptr &wksp, Progress &prog) { int64_t nHist = wksp->getNumberHistograms(); PARALLEL_FOR_IF(Kernel::threadSafe(*minWS, *wksp)) diff --git a/Framework/Algorithms/src/RingProfile.cpp b/Framework/Algorithms/src/RingProfile.cpp index 83f078ed350f3833d6c3a794dad3df001e753c37..e7647dc7c8275448d1ea0d2e4e887390bbd722db 100644 --- a/Framework/Algorithms/src/RingProfile.cpp +++ b/Framework/Algorithms/src/RingProfile.cpp @@ -215,7 +215,7 @@ void RingProfile::exec() { * @param inputWS: the input workspace */ void RingProfile::checkInputsForSpectraWorkspace( - const API::MatrixWorkspace_sptr inputWS) { + const API::MatrixWorkspace_sptr &inputWS) { try { // finding the limits of the instrument const auto &spectrumInfo = inputWS->spectrumInfo(); @@ -325,7 +325,7 @@ void RingProfile::checkInputsForSpectraWorkspace( * @param inputWS: pointer to the input workspace */ void RingProfile::checkInputsForNumericWorkspace( - const API::MatrixWorkspace_sptr inputWS) { + const API::MatrixWorkspace_sptr &inputWS) { g_log.notice() << "CheckingInputs For Numeric Workspace\n"; // The Axis0 is defined by the values of readX inside the spectra of the @@ -396,7 +396,8 @@ void RingProfile::checkInputsForNumericWorkspace( *integration values */ void RingProfile::processInstrumentRingProfile( - const API::MatrixWorkspace_sptr inputWS, std::vector &output_bins) { + const API::MatrixWorkspace_sptr &inputWS, + std::vector &output_bins) { const auto &spectrumInfo = inputWS->spectrumInfo(); for (int i = 0; i < static_cast(inputWS->getNumberHistograms()); i++) { @@ -485,7 +486,8 @@ int RingProfile::getBinForPixel(const Kernel::V3D &position) { *integration values */ void RingProfile::processNumericImageRingProfile( - const API::MatrixWorkspace_sptr inputWS, std::vector &output_bins) { + const API::MatrixWorkspace_sptr &inputWS, + std::vector &output_bins) { // allocate the bin positions vector std::vector bin_n(inputWS->dataY(0).size(), -1); @@ -538,7 +540,7 @@ void RingProfile::processNumericImageRingProfile( * @param bins_pos: bin positions (for each column inside the spectrum, the *correspondent bin_pos) */ -void RingProfile::getBinForPixel(const API::MatrixWorkspace_sptr ws, +void RingProfile::getBinForPixel(const API::MatrixWorkspace_sptr &ws, int spectrum_index, std::vector &bins_pos) { diff --git a/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp b/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp index 493c2497f9938a291544b22a0fd79d46b63ae1a3..6bc22fdb6582ac73e4c9324f4d888d1c6531f1f1 100644 --- a/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp +++ b/Framework/Algorithms/src/RunCombinationHelpers/RunCombinationHelper.cpp @@ -59,7 +59,8 @@ RunCombinationHelper::unWrapGroups(const std::vector &inputs) { * to later check the compatibility of the others with the reference * @param ref : the reference workspace */ -void RunCombinationHelper::setReferenceProperties(MatrixWorkspace_sptr ref) { +void RunCombinationHelper::setReferenceProperties( + const MatrixWorkspace_sptr &ref) { m_numberSpectra = ref->getNumberHistograms(); m_numberDetectors = ref->detectorInfo().size(); m_xUnit = ref->getAxis(0)->unit()->unitID(); @@ -82,7 +83,7 @@ void RunCombinationHelper::setReferenceProperties(MatrixWorkspace_sptr ref) { * @return : empty if compatible, error message otherwises */ std::string -RunCombinationHelper::checkCompatibility(MatrixWorkspace_sptr ws, +RunCombinationHelper::checkCompatibility(const MatrixWorkspace_sptr &ws, bool checkNumberHistograms) { std::string errors; if (ws->getNumberHistograms() != m_numberSpectra && checkNumberHistograms) diff --git a/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp b/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp index 4115dbbff7378f60c99a307eb6cff523ad2aee5e..03a6bf849742076c03dbb30636c356afaaa3c0cd 100644 --- a/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp +++ b/Framework/Algorithms/src/RunCombinationHelpers/SampleLogsBehaviour.cpp @@ -91,7 +91,7 @@ const std::string SampleLogsBehaviour::SUM_DOC = * @param parName the parameter names which specify the sample log sames to * merge given be the IPF */ -SampleLogsBehaviour::SampleLogsBehaviour(MatrixWorkspace_sptr ws, +SampleLogsBehaviour::SampleLogsBehaviour(const MatrixWorkspace_sptr &ws, Logger &logger, const SampleLogNames &logEntries, const ParameterName &parName) @@ -416,8 +416,8 @@ bool SampleLogsBehaviour::setNumericValue(const std::string &item, * @param addeeWS the workspace being merged * @param outWS the workspace the others are merged into */ -void SampleLogsBehaviour::mergeSampleLogs(MatrixWorkspace_sptr addeeWS, - MatrixWorkspace_sptr outWS) { +void SampleLogsBehaviour::mergeSampleLogs(const MatrixWorkspace_sptr &addeeWS, + const MatrixWorkspace_sptr &outWS) { for (const auto &item : m_logMap) { const std::string &logName = item.first.first; @@ -625,7 +625,8 @@ bool SampleLogsBehaviour::stringPropertiesMatch( * * @param outWS the merged workspace */ -void SampleLogsBehaviour::setUpdatedSampleLogs(MatrixWorkspace_sptr outWS) { +void SampleLogsBehaviour::setUpdatedSampleLogs( + const MatrixWorkspace_sptr &outWS) { for (auto &item : m_logMap) { std::string propertyToReset = item.first.first; @@ -647,7 +648,7 @@ void SampleLogsBehaviour::setUpdatedSampleLogs(MatrixWorkspace_sptr outWS) { * @param addeeWS the workspace being merged */ void SampleLogsBehaviour::removeSampleLogsFromWorkspace( - MatrixWorkspace_sptr addeeWS) { + const MatrixWorkspace_sptr &addeeWS) { for (const auto &prop : m_addeeLogMap) { const auto &propName = prop->name(); addeeWS->mutableRun().removeProperty(propName); @@ -663,7 +664,7 @@ void SampleLogsBehaviour::removeSampleLogsFromWorkspace( * @param addeeWS the workspace being merged */ void SampleLogsBehaviour::readdSampleLogToWorkspace( - MatrixWorkspace_sptr addeeWS) { + const MatrixWorkspace_sptr &addeeWS) { for (const auto &item : m_addeeLogMap) { auto property = std::unique_ptr(item->clone()); addeeWS->mutableRun().addProperty(std::move(property)); @@ -676,7 +677,7 @@ void SampleLogsBehaviour::readdSampleLogToWorkspace( * * @param ws the merged workspace to reset the sample logs for */ -void SampleLogsBehaviour::resetSampleLogs(MatrixWorkspace_sptr ws) { +void SampleLogsBehaviour::resetSampleLogs(const MatrixWorkspace_sptr &ws) { for (auto const &item : m_logMap) { std::string const &propertyToReset = item.first.first; diff --git a/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp b/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp index 370940870bcce904641686be08bcb4bda0efaf4d..fdf2f1b04448db1c06ff293ef4b78330fddc0c3d 100644 --- a/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp +++ b/Framework/Algorithms/src/SANSCollimationLengthEstimator.cpp @@ -22,7 +22,7 @@ Mantid::Kernel::Logger g_log("SANSCollimationLengthEstimator"); * @param val: a value as a string * @returns true if it is convertible else false */ -bool checkForDouble(std::string val) { +bool checkForDouble(const std::string &val) { auto isDouble = false; try { boost::lexical_cast(val); @@ -45,7 +45,7 @@ using namespace API; * @returns the collimation length */ double SANSCollimationLengthEstimator::provideCollimationLength( - Mantid::API::MatrixWorkspace_sptr workspace) { + const Mantid::API::MatrixWorkspace_sptr &workspace) { // If the instrument does not have a correction specified then set the length // to 4 const double defaultLColim = 4.0; @@ -104,7 +104,7 @@ double SANSCollimationLengthEstimator::provideCollimationLength( * length */ double SANSCollimationLengthEstimator::getCollimationLengthWithGuides( - MatrixWorkspace_sptr inOutWS, const double L1, + const MatrixWorkspace_sptr &inOutWS, const double L1, const double collimationLengthCorrection) const { auto lCollim = L1 - collimationLengthCorrection; diff --git a/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp b/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp index 068b0e8ceb3ced189384c3cffbda5ec1660fdb48..41b007239b44cf0b732c44c1d2950b61eb512b7f 100644 --- a/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp +++ b/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp @@ -64,7 +64,7 @@ MCAbsorptionStrategy::MCAbsorptionStrategy( */ void MCAbsorptionStrategy::calculate( Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &finalPos, - Mantid::HistogramData::Points lambdas, double lambdaFixed, + const Mantid::HistogramData::Points &lambdas, double lambdaFixed, Mantid::API::ISpectrum &attenuationFactorsSpectrum) { const auto scatterBounds = m_scatterVol.getBoundingBox(); const auto nbins = static_cast(lambdas.size()); diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp index 68b04181ff44a1e9448746dd3b56ba360a8a3d35..8689b4a52377abd36d7604d4d483c4c0fbd34473 100644 --- a/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -685,7 +685,7 @@ void SmoothNeighbours::setupNewInstrument(MatrixWorkspace &outws) const { //-------------------------------------------------------------------------------------------- /** Spread the average over all the pixels */ -void SmoothNeighbours::spreadPixels(MatrixWorkspace_sptr outws) { +void SmoothNeighbours::spreadPixels(const MatrixWorkspace_sptr &outws) { // Get some stuff from the input workspace const size_t numberOfSpectra = inWS->getNumberHistograms(); diff --git a/Framework/Algorithms/src/SofQWPolygon.cpp b/Framework/Algorithms/src/SofQWPolygon.cpp index f0825ef817df61f3840884cbc3f03d078af2def5..2cbaed6f6286c7a34c6a1f7e5b2bf875b557fe3e 100644 --- a/Framework/Algorithms/src/SofQWPolygon.cpp +++ b/Framework/Algorithms/src/SofQWPolygon.cpp @@ -146,7 +146,8 @@ void SofQWPolygon::exec() { * Init variables caches * @param workspace :: Workspace pointer */ -void SofQWPolygon::initCachedValues(API::MatrixWorkspace_const_sptr workspace) { +void SofQWPolygon::initCachedValues( + const API::MatrixWorkspace_const_sptr &workspace) { m_EmodeProperties.initCachedValues(*workspace, this); // Index theta cache initThetaCache(*workspace); diff --git a/Framework/Algorithms/src/SortXAxis.cpp b/Framework/Algorithms/src/SortXAxis.cpp index 9838aba48e14f89d604ebbccf35aed3f163eab0f..e20d1ac5deb590e1c07943ecb1538b529fcd0ec4 100644 --- a/Framework/Algorithms/src/SortXAxis.cpp +++ b/Framework/Algorithms/src/SortXAxis.cpp @@ -118,7 +118,7 @@ void sortByXValue(std::vector &workspaceIndicies, } void SortXAxis::sortIndicesByX( - std::vector &workspaceIndicies, std::string order, + std::vector &workspaceIndicies, const std::string &order, const Mantid::API::MatrixWorkspace &inputWorkspace, unsigned int specNum) { if (order == "Ascending") { sortByXValue(workspaceIndicies, inputWorkspace, specNum, diff --git a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp index b8ccafe418699f0e3ac795e524bb5d48dba0c121..843e097cba6f8554f1af3e0ab1aa5881105a68e3 100644 --- a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp +++ b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp @@ -123,7 +123,7 @@ void SpecularReflectionAlgorithm::initCommonProperties() { */ Mantid::Geometry::IComponent_const_sptr SpecularReflectionAlgorithm::getSurfaceSampleComponent( - Mantid::Geometry::Instrument_const_sptr inst) const { + const Mantid::Geometry::Instrument_const_sptr &inst) const { std::string sampleComponent = "some-surface-holder"; if (!isPropertyDefault("SampleComponentName")) { sampleComponent = this->getPropertyValue("SampleComponentName"); @@ -148,7 +148,7 @@ SpecularReflectionAlgorithm::getSurfaceSampleComponent( */ boost::shared_ptr SpecularReflectionAlgorithm::getDetectorComponent( - MatrixWorkspace_sptr workspace, const bool isPointDetector) const { + const MatrixWorkspace_sptr &workspace, const bool isPointDetector) const { boost::shared_ptr searchResult; if (!isPropertyDefault("SpectrumNumbersOfDetectors")) { const std::vector spectrumNumbers = diff --git a/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp b/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp index 8af2c852b46011c6196f1926db323f7f192f85cb..5d0e86593514e0284e78222695d28b1a47dd6878 100644 --- a/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp +++ b/Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp @@ -138,8 +138,8 @@ void SpecularReflectionPositionCorrect::exec() { * @param detectorPosition: Actual detector or detector group position. */ void SpecularReflectionPositionCorrect::moveDetectors( - API::MatrixWorkspace_sptr toCorrect, IComponent_const_sptr detector, - IComponent_const_sptr sample, const double &upOffset, + const API::MatrixWorkspace_sptr &toCorrect, IComponent_const_sptr detector, + const IComponent_const_sptr &sample, const double &upOffset, const double &acrossOffset, const V3D &detectorPosition) { auto instrument = toCorrect->getInstrument(); const V3D samplePosition = sample->getPos(); @@ -203,8 +203,9 @@ void SpecularReflectionPositionCorrect::moveDetectors( * @param detector : Pointer to a given detector */ void SpecularReflectionPositionCorrect::correctPosition( - API::MatrixWorkspace_sptr toCorrect, const double &twoThetaInDeg, - IComponent_const_sptr sample, IComponent_const_sptr detector) { + const API::MatrixWorkspace_sptr &toCorrect, const double &twoThetaInDeg, + const IComponent_const_sptr &sample, + const IComponent_const_sptr &detector) { auto instrument = toCorrect->getInstrument(); diff --git a/Framework/Algorithms/src/Stitch1D.cpp b/Framework/Algorithms/src/Stitch1D.cpp index b0de3825d0bcdc20c302cf41875ee19e8cea8110..fc882cff79683705453c2c5e26a4fd5401192a86 100644 --- a/Framework/Algorithms/src/Stitch1D.cpp +++ b/Framework/Algorithms/src/Stitch1D.cpp @@ -644,7 +644,7 @@ void Stitch1D::exec() { /** Put special values back. * @param ws : MatrixWorkspace to resinsert special values into. */ -void Stitch1D::reinsertSpecialValues(MatrixWorkspace_sptr ws) { +void Stitch1D::reinsertSpecialValues(const MatrixWorkspace_sptr &ws) { auto histogramCount = static_cast(ws->getNumberHistograms()); PARALLEL_FOR_IF(Kernel::threadSafe(*ws)) for (int i = 0; i < histogramCount; ++i) { diff --git a/Framework/Algorithms/src/StripPeaks.cpp b/Framework/Algorithms/src/StripPeaks.cpp index 18b48d1042edfa4726f72e9fc3ed3a93438715c7..cc52ce60bd926761063fb5cca0b8051a2bc34188 100644 --- a/Framework/Algorithms/src/StripPeaks.cpp +++ b/Framework/Algorithms/src/StripPeaks.cpp @@ -107,7 +107,8 @@ void StripPeaks::exec() { * @param WS :: The workspace to search * @return list of found peaks */ -API::ITableWorkspace_sptr StripPeaks::findPeaks(API::MatrixWorkspace_sptr WS) { +API::ITableWorkspace_sptr +StripPeaks::findPeaks(const API::MatrixWorkspace_sptr &WS) { g_log.debug("Calling FindPeaks as a Child Algorithm"); // Read from properties @@ -172,8 +173,8 @@ API::ITableWorkspace_sptr StripPeaks::findPeaks(API::MatrixWorkspace_sptr WS) { * @return A workspace containing the peak-subtracted data */ API::MatrixWorkspace_sptr -StripPeaks::removePeaks(API::MatrixWorkspace_const_sptr input, - API::ITableWorkspace_sptr peakslist) { +StripPeaks::removePeaks(const API::MatrixWorkspace_const_sptr &input, + const API::ITableWorkspace_sptr &peakslist) { g_log.debug("Subtracting peaks"); // Create an output workspace - same size as input one MatrixWorkspace_sptr outputWS = WorkspaceFactory::Instance().create(input); diff --git a/Framework/Algorithms/src/SumEventsByLogValue.cpp b/Framework/Algorithms/src/SumEventsByLogValue.cpp index de12e5beec5bd804e43a4572ab6cf4f1a5bd7dde..a6f0eb8f8adcddf27422379d75870015519becc7 100644 --- a/Framework/Algorithms/src/SumEventsByLogValue.cpp +++ b/Framework/Algorithms/src/SumEventsByLogValue.cpp @@ -302,9 +302,9 @@ void SumEventsByLogValue::filterEventList( * @param minVal The minimum value of the log * @param maxVal The maximum value of the log */ -void SumEventsByLogValue::addMonitorCounts(ITableWorkspace_sptr outputWorkspace, - const TimeSeriesProperty *log, - const int minVal, const int maxVal) { +void SumEventsByLogValue::addMonitorCounts( + const ITableWorkspace_sptr &outputWorkspace, + const TimeSeriesProperty *log, const int minVal, const int maxVal) { DataObjects::EventWorkspace_const_sptr monitorWorkspace = getProperty("MonitorWorkspace"); // If no monitor workspace was given, there's nothing to do diff --git a/Framework/Algorithms/src/SumSpectra.cpp b/Framework/Algorithms/src/SumSpectra.cpp index c08a7a0891a4dfae28920bb020ea9faf3da8e0dc..4b0e1b3edfbebb8fd0284e18bb213d8f57d7c665 100644 --- a/Framework/Algorithms/src/SumSpectra.cpp +++ b/Framework/Algorithms/src/SumSpectra.cpp @@ -324,7 +324,7 @@ void SumSpectra::determineIndices(const size_t numberOfSpectra) { * @return The minimum spectrum No for all the spectra being summed. */ specnum_t -SumSpectra::getOutputSpecNo(MatrixWorkspace_const_sptr localworkspace) { +SumSpectra::getOutputSpecNo(const MatrixWorkspace_const_sptr &localworkspace) { // initial value - any included spectrum will do specnum_t specId = localworkspace->getSpectrum(*(m_indices.begin())).getSpectrumNo(); @@ -435,7 +435,7 @@ bool useSpectrum(const SpectrumInfo &spectrumInfo, const size_t wsIndex, * @param numZeros The number of zero bins in histogram workspace or empty * spectra for event workspace. */ -void SumSpectra::doSimpleSum(MatrixWorkspace_sptr outputWorkspace, +void SumSpectra::doSimpleSum(const MatrixWorkspace_sptr &outputWorkspace, Progress &progress, size_t &numSpectra, size_t &numMasked, size_t &numZeros) { // Clean workspace of any NANs or Inf values @@ -510,7 +510,7 @@ void SumSpectra::doSimpleSum(MatrixWorkspace_sptr outputWorkspace, * @param numZeros The number of zero bins in histogram workspace or empty * spectra for event workspace. */ -void SumSpectra::doFractionalSum(MatrixWorkspace_sptr outputWorkspace, +void SumSpectra::doFractionalSum(const MatrixWorkspace_sptr &outputWorkspace, Progress &progress, size_t &numSpectra, size_t &numMasked, size_t &numZeros) { // First, we need to clean the input workspace for nan's and inf's in order @@ -608,7 +608,7 @@ void SumSpectra::doFractionalSum(MatrixWorkspace_sptr outputWorkspace, * @param numZeros The number of zero bins in histogram workspace or empty * spectra for event workspace. */ -void SumSpectra::execEvent(MatrixWorkspace_sptr outputWorkspace, +void SumSpectra::execEvent(const MatrixWorkspace_sptr &outputWorkspace, Progress &progress, size_t &numSpectra, size_t &numMasked, size_t &numZeros) { MatrixWorkspace_const_sptr localworkspace = getProperty("InputWorkspace"); diff --git a/Framework/Algorithms/src/TOFSANSResolutionByPixel.cpp b/Framework/Algorithms/src/TOFSANSResolutionByPixel.cpp index 92327c6020d2bd5e56b9fcd4d5912491445450be..a5862b2866bf8cbe9625b432190474a028c3d686 100644 --- a/Framework/Algorithms/src/TOFSANSResolutionByPixel.cpp +++ b/Framework/Algorithms/src/TOFSANSResolutionByPixel.cpp @@ -209,7 +209,7 @@ void TOFSANSResolutionByPixel::exec() { * @returns a copy of the input workspace */ MatrixWorkspace_sptr TOFSANSResolutionByPixel::setupOutputWorkspace( - MatrixWorkspace_sptr inputWorkspace) { + const MatrixWorkspace_sptr &inputWorkspace) { IAlgorithm_sptr duplicate = createChildAlgorithm("CloneWorkspace"); duplicate->initialize(); duplicate->setProperty("InputWorkspace", inputWorkspace); @@ -224,7 +224,7 @@ MatrixWorkspace_sptr TOFSANSResolutionByPixel::setupOutputWorkspace( * @returns the moderator workspace wiht the correct wavelength binning */ MatrixWorkspace_sptr TOFSANSResolutionByPixel::getModeratorWorkspace( - Mantid::API::MatrixWorkspace_sptr inputWorkspace) { + const Mantid::API::MatrixWorkspace_sptr &inputWorkspace) { MatrixWorkspace_sptr sigmaModerator = getProperty("SigmaModerator"); IAlgorithm_sptr rebinned = createChildAlgorithm("RebinToWorkspace"); @@ -242,7 +242,7 @@ MatrixWorkspace_sptr TOFSANSResolutionByPixel::getModeratorWorkspace( * @param inWS: the input workspace */ void TOFSANSResolutionByPixel::checkInput( - Mantid::API::MatrixWorkspace_sptr inWS) { + const Mantid::API::MatrixWorkspace_sptr &inWS) { // Make sure that input workspace has an instrument as we rely heavily on // thisa auto inst = inWS->getInstrument(); diff --git a/Framework/Algorithms/src/TimeAtSampleStrategyDirect.cpp b/Framework/Algorithms/src/TimeAtSampleStrategyDirect.cpp index 028f495e81e425191f517c7f67ab0a3f7ce9e9d2..e40755b92c351ce3e5db4d154d7e11255486f069 100644 --- a/Framework/Algorithms/src/TimeAtSampleStrategyDirect.cpp +++ b/Framework/Algorithms/src/TimeAtSampleStrategyDirect.cpp @@ -27,7 +27,7 @@ namespace Algorithms { /** Constructor */ TimeAtSampleStrategyDirect::TimeAtSampleStrategyDirect( - MatrixWorkspace_const_sptr ws, double ei) + const MatrixWorkspace_const_sptr &ws, double ei) : m_constShift(0) { // A constant among all spectra diff --git a/Framework/Algorithms/src/TimeAtSampleStrategyElastic.cpp b/Framework/Algorithms/src/TimeAtSampleStrategyElastic.cpp index 46ecee6753c3f74004984b483345e1b376684933..d8ba32fbadaee01dcd130590ad7f8a69c6ed94ef 100644 --- a/Framework/Algorithms/src/TimeAtSampleStrategyElastic.cpp +++ b/Framework/Algorithms/src/TimeAtSampleStrategyElastic.cpp @@ -4,9 +4,11 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidAlgorithms/TimeAtSampleStrategyElastic.h" +#include + #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/SpectrumInfo.h" +#include "MantidAlgorithms/TimeAtSampleStrategyElastic.h" #include "MantidGeometry/IComponent.h" #include "MantidGeometry/Instrument.h" #include "MantidGeometry/Instrument/ReferenceFrame.h" @@ -22,7 +24,7 @@ namespace Algorithms { */ TimeAtSampleStrategyElastic::TimeAtSampleStrategyElastic( Mantid::API::MatrixWorkspace_const_sptr ws) - : m_ws(ws), m_spectrumInfo(m_ws->spectrumInfo()), + : m_ws(std::move(ws)), m_spectrumInfo(m_ws->spectrumInfo()), m_beamDir( m_ws->getInstrument()->getReferenceFrame()->vecPointingAlongBeam()) {} diff --git a/Framework/Algorithms/src/TimeAtSampleStrategyIndirect.cpp b/Framework/Algorithms/src/TimeAtSampleStrategyIndirect.cpp index e173a5e3568f272e35b2f38f55c7eebab3ac7a2a..1084de35630bd11f226445f06e5360f189680cab 100644 --- a/Framework/Algorithms/src/TimeAtSampleStrategyIndirect.cpp +++ b/Framework/Algorithms/src/TimeAtSampleStrategyIndirect.cpp @@ -18,6 +18,7 @@ #include #include #include +#include using namespace Mantid::Kernel; using namespace Mantid::Geometry; @@ -30,7 +31,7 @@ namespace Algorithms { */ TimeAtSampleStrategyIndirect::TimeAtSampleStrategyIndirect( MatrixWorkspace_const_sptr ws) - : m_ws(ws), m_spectrumInfo(m_ws->spectrumInfo()) {} + : m_ws(std::move(ws)), m_spectrumInfo(m_ws->spectrumInfo()) {} Correction TimeAtSampleStrategyIndirect::calculate(const size_t &workspace_index) const { diff --git a/Framework/Algorithms/src/Transpose.cpp b/Framework/Algorithms/src/Transpose.cpp index edf886f726a8df8c98cff4202b06e60dfcab2ff5..ac7f1807bb9f779a8513cf16944f97e1107261fd 100644 --- a/Framework/Algorithms/src/Transpose.cpp +++ b/Framework/Algorithms/src/Transpose.cpp @@ -98,7 +98,7 @@ void Transpose::exec() { * @return A pointer to the output workspace. */ API::MatrixWorkspace_sptr Transpose::createOutputWorkspace( - API::MatrixWorkspace_const_sptr inputWorkspace) { + const API::MatrixWorkspace_const_sptr &inputWorkspace) { Mantid::API::Axis *yAxis = getVerticalAxis(inputWorkspace); const size_t oldNhist = inputWorkspace->getNumberHistograms(); const auto &inX = inputWorkspace->x(0); @@ -138,8 +138,8 @@ API::MatrixWorkspace_sptr Transpose::createOutputWorkspace( * @param workspace :: A pointer to a workspace * @return An axis pointer for the vertical axis of the input workspace */ -API::Axis * -Transpose::getVerticalAxis(API::MatrixWorkspace_const_sptr workspace) const { +API::Axis *Transpose::getVerticalAxis( + const API::MatrixWorkspace_const_sptr &workspace) const { API::Axis *yAxis; try { yAxis = workspace->getAxis(1); diff --git a/Framework/Algorithms/src/WienerSmooth.cpp b/Framework/Algorithms/src/WienerSmooth.cpp index 3b28573c8696ebc7e067d20eeb5f8bbca21065ab..a2c56911f3b3cbb784669301468ac6abaf7b3f93 100644 --- a/Framework/Algorithms/src/WienerSmooth.cpp +++ b/Framework/Algorithms/src/WienerSmooth.cpp @@ -420,7 +420,8 @@ WienerSmooth::getStartEnd(const Mantid::HistogramData::HistogramX &X, * @return :: Workspace with the copied spectrum. */ API::MatrixWorkspace_sptr -WienerSmooth::copyInput(API::MatrixWorkspace_sptr inputWS, size_t wsIndex) { +WienerSmooth::copyInput(const API::MatrixWorkspace_sptr &inputWS, + size_t wsIndex) { auto alg = createChildAlgorithm("ExtractSingleSpectrum"); alg->initialize(); alg->setProperty("InputWorkspace", inputWS); diff --git a/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp b/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp index 5cad33ea450c240aa7224eb0f8d19e5b1f9ae399..4262dd66ef98633aad357f1077bcb83eaa302e70 100644 --- a/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp +++ b/Framework/Algorithms/src/WorkflowAlgorithmRunner.cpp @@ -59,7 +59,8 @@ std::string tidyWorkspaceName(const std::string &s) { * @throw std::runtime_error in case of errorneous entries in `table` */ template -void cleanPropertyTable(ITableWorkspace_sptr table, const MAP &ioMapping) { +void cleanPropertyTable(const ITableWorkspace_sptr &table, + const MAP &ioMapping) { // Some output columns may be processed several times, but this should // not be a serious performance hit. for (const auto &ioPair : ioMapping) { diff --git a/Framework/Algorithms/src/XDataConverter.cpp b/Framework/Algorithms/src/XDataConverter.cpp index 54aacafa83cab9047cde3e17af6fa4b2dc769214..b656ca879a0962a0227f56ddbd8b16931e384341 100644 --- a/Framework/Algorithms/src/XDataConverter.cpp +++ b/Framework/Algorithms/src/XDataConverter.cpp @@ -90,7 +90,7 @@ void XDataConverter::exec() { } std::size_t -XDataConverter::getNewYSize(const API::MatrixWorkspace_sptr inputWS) { +XDataConverter::getNewYSize(const API::MatrixWorkspace_sptr &inputWS) { // this is the old behavior of MatrixWorkspace::blocksize() return inputWS->y(0).size(); } @@ -101,8 +101,8 @@ XDataConverter::getNewYSize(const API::MatrixWorkspace_sptr inputWS) { * @param inputWS :: The input workspace * @param index :: The index */ -void XDataConverter::setXData(API::MatrixWorkspace_sptr outputWS, - const API::MatrixWorkspace_sptr inputWS, +void XDataConverter::setXData(const API::MatrixWorkspace_sptr &outputWS, + const API::MatrixWorkspace_sptr &inputWS, const int index) { if (m_sharedX) { PARALLEL_CRITICAL(XDataConverter_para) { diff --git a/Framework/Algorithms/test/AddNoteTest.h b/Framework/Algorithms/test/AddNoteTest.h index 547493876e9581ef288c90c274550ad9753af0e2..57338460fd0bfd680e407c6f0869fd5290df74de 100644 --- a/Framework/Algorithms/test/AddNoteTest.h +++ b/Framework/Algorithms/test/AddNoteTest.h @@ -88,9 +88,9 @@ public: } private: - void executeAlgorithm(Mantid::API::MatrixWorkspace_sptr testWS, + void executeAlgorithm(const Mantid::API::MatrixWorkspace_sptr &testWS, const std::string &logName, const std::string &logTime, - const std::string logValue, + const std::string &logValue, const UpdateType update = Update) { Mantid::Algorithms::AddNote alg; @@ -110,11 +110,11 @@ private: } template - void checkLogWithEntryExists(Mantid::API::MatrixWorkspace_sptr testWS, + void checkLogWithEntryExists(const Mantid::API::MatrixWorkspace_sptr &testWS, const std::string &logName, const std::string &logStartTime, const int &logEndTime, - const std::string logValue, + const std::string &logValue, const size_t position) { using Mantid::Kernel::TimeSeriesProperty; using Mantid::Types::Core::DateAndTime; diff --git a/Framework/Algorithms/test/AddSampleLogTest.h b/Framework/Algorithms/test/AddSampleLogTest.h index f929806e824ced1e1f076b7b1fb3fddb2b560e55..45d9bec83ff41af98f380b695ccc88368ed91ac5 100644 --- a/Framework/Algorithms/test/AddSampleLogTest.h +++ b/Framework/Algorithms/test/AddSampleLogTest.h @@ -170,11 +170,12 @@ public: } template - void - ExecuteAlgorithm(MatrixWorkspace_sptr testWS, std::string LogName, - std::string LogType, std::string LogText, T expectedValue, - bool fails = false, std::string LogUnit = "", - std::string NumberType = "AutoDetect", bool throws = false) { + void ExecuteAlgorithm(const MatrixWorkspace_sptr &testWS, + const std::string &LogName, const std::string &LogType, + const std::string &LogText, T expectedValue, + bool fails = false, const std::string &LogUnit = "", + const std::string &NumberType = "AutoDetect", + bool throws = false) { // add the workspace to the ADS AnalysisDataService::Instance().addOrReplace("AddSampleLogTest_Temporary", testWS); diff --git a/Framework/Algorithms/test/AddTimeSeriesLogTest.h b/Framework/Algorithms/test/AddTimeSeriesLogTest.h index 8811ed1163c8c8e5f73751e88e6f93b964a96bdb..7a7fb480e888134123079dab752fa71926faf422 100644 --- a/Framework/Algorithms/test/AddTimeSeriesLogTest.h +++ b/Framework/Algorithms/test/AddTimeSeriesLogTest.h @@ -134,7 +134,7 @@ public: } private: - void executeAlgorithm(Mantid::API::MatrixWorkspace_sptr testWS, + void executeAlgorithm(const Mantid::API::MatrixWorkspace_sptr &testWS, const std::string &logName, const std::string &logTime, const double logValue, const LogType type = Double, const UpdateType update = Update) { @@ -157,7 +157,7 @@ private: } template - void checkLogWithEntryExists(Mantid::API::MatrixWorkspace_sptr testWS, + void checkLogWithEntryExists(const Mantid::API::MatrixWorkspace_sptr &testWS, const std::string &logName, const std::string &logTime, const T logValue, const size_t position) { diff --git a/Framework/Algorithms/test/AppendSpectraTest.h b/Framework/Algorithms/test/AppendSpectraTest.h index 1e584609848c81afcbce6a83c4d7252a3a28c15a..261eb100c1fb797034f42f05e8cd230c4d29ef16 100644 --- a/Framework/Algorithms/test/AppendSpectraTest.h +++ b/Framework/Algorithms/test/AppendSpectraTest.h @@ -432,9 +432,9 @@ private: } /** Creates a 2D workspace with 5 histograms */ - void createWorkspaceWithAxisAndLabel(const std::string outputName, + void createWorkspaceWithAxisAndLabel(const std::string &outputName, const std::string &axisType, - const std::string axisValue) { + const std::string &axisValue) { int nspec = 5; std::vector YVals; std::vector dataX; diff --git a/Framework/Algorithms/test/ApplyFloodWorkspaceTest.h b/Framework/Algorithms/test/ApplyFloodWorkspaceTest.h index aa6663deaabd64a8eda53875a22e14d0f6f1d5ff..513fa13adac8800cf9c17631ce33d53889596373 100644 --- a/Framework/Algorithms/test/ApplyFloodWorkspaceTest.h +++ b/Framework/Algorithms/test/ApplyFloodWorkspaceTest.h @@ -65,9 +65,9 @@ public: } private: - MatrixWorkspace_sptr - createFloodWorkspace(Mantid::Geometry::Instrument_const_sptr instrument, - std::string const &xUnit = "TOF") { + MatrixWorkspace_sptr createFloodWorkspace( + const Mantid::Geometry::Instrument_const_sptr &instrument, + std::string const &xUnit = "TOF") { MatrixWorkspace_sptr flood = create2DWorkspace(4, 1); flood->mutableY(0)[0] = 0.7; flood->mutableY(1)[0] = 1.0; diff --git a/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h b/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h index bcfff101bcac39ab2c05ed39c09d991278619a8a..d3e34e2f6d227f8fee16fb107e51dfd768b65b43 100644 --- a/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h +++ b/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h @@ -284,7 +284,7 @@ private: } // creates test file with bins description - void createBinFile(std::string fname) { + void createBinFile(const std::string &fname) { std::ofstream binfile; binfile.open(fname); binfile << "#dp_min #dp_max\n"; diff --git a/Framework/Algorithms/test/BinaryOperationTest.h b/Framework/Algorithms/test/BinaryOperationTest.h index b7fc31ca5216eb8cf84fb994f3a38107f23e78e0..fb694bd5b81f19abc45df13f9f5faa9cead4496f 100644 --- a/Framework/Algorithms/test/BinaryOperationTest.h +++ b/Framework/Algorithms/test/BinaryOperationTest.h @@ -7,6 +7,8 @@ #pragma once #include +#include + #include #include "MantidAPI/AnalysisDataService.h" @@ -42,8 +44,8 @@ public: /// is provided. const std::string summary() const override { return "Summary of this test."; } - std::string checkSizeCompatibility(const MatrixWorkspace_const_sptr ws1, - const MatrixWorkspace_const_sptr ws2) { + std::string checkSizeCompatibility(const MatrixWorkspace_const_sptr &ws1, + const MatrixWorkspace_const_sptr &ws2) { m_lhs = ws1; m_rhs = ws2; m_lhsBlocksize = ws1->blocksize(); @@ -297,9 +299,11 @@ public: std::vector> rhs, bool expect_throw = false) { EventWorkspace_sptr lhsWS = - WorkspaceCreationHelper::createGroupedEventWorkspace(lhs, 50, 1.0); + WorkspaceCreationHelper::createGroupedEventWorkspace(std::move(lhs), 50, + 1.0); EventWorkspace_sptr rhsWS = - WorkspaceCreationHelper::createGroupedEventWorkspace(rhs, 50, 1.0); + WorkspaceCreationHelper::createGroupedEventWorkspace(std::move(rhs), 50, + 1.0); BinaryOperation::BinaryOperationTable_sptr table; Mantid::Kernel::Timer timer1; if (expect_throw) { diff --git a/Framework/Algorithms/test/CalculateDIFCTest.h b/Framework/Algorithms/test/CalculateDIFCTest.h index 8e15a35d9c4c45f260f61cd7f2512d7d2236c908..509a4925d6572ffec033bd3d26fe837dd4b25ad5 100644 --- a/Framework/Algorithms/test/CalculateDIFCTest.h +++ b/Framework/Algorithms/test/CalculateDIFCTest.h @@ -39,8 +39,8 @@ public: TS_ASSERT(alg.isInitialized()) } - void runTest(Workspace2D_sptr inputWS, OffsetsWorkspace_sptr offsetsWS, - std::string &outWSName) { + void runTest(const Workspace2D_sptr &inputWS, + const OffsetsWorkspace_sptr &offsetsWS, std::string &outWSName) { CalculateDIFC alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) diff --git a/Framework/Algorithms/test/CalculateFlatBackgroundTest.h b/Framework/Algorithms/test/CalculateFlatBackgroundTest.h index 8fb91e7509e52aa4b8aba7f6d6ac67b0763800d7..4ef353d997bd4a53e3e0ca39f11c85ec201cff59 100644 --- a/Framework/Algorithms/test/CalculateFlatBackgroundTest.h +++ b/Framework/Algorithms/test/CalculateFlatBackgroundTest.h @@ -839,7 +839,8 @@ private: } void compareSubtractedAndBackgroundWorkspaces( - MatrixWorkspace_sptr originalWS, const std::string &subtractedWSName, + const MatrixWorkspace_sptr &originalWS, + const std::string &subtractedWSName, const std::string &backgroundWSName) { const std::string minusWSName("minused"); MatrixWorkspace_sptr backgroundWS = diff --git a/Framework/Algorithms/test/CalculateIqtTest.h b/Framework/Algorithms/test/CalculateIqtTest.h index 132ac4c142c5e48ec4ea3647cc8bbaebd16b507b..c0eb3d2d8f9a70a7a80eabceb64ea2087246192d 100644 --- a/Framework/Algorithms/test/CalculateIqtTest.h +++ b/Framework/Algorithms/test/CalculateIqtTest.h @@ -54,8 +54,8 @@ Mantid::API::MatrixWorkspace_sptr setUpResolutionWorkspace() { return createWorkspace->getProperty("OutputWorkspace"); } -IAlgorithm_sptr calculateIqtAlgorithm(MatrixWorkspace_sptr sample, - MatrixWorkspace_sptr resolution, +IAlgorithm_sptr calculateIqtAlgorithm(const MatrixWorkspace_sptr &sample, + const MatrixWorkspace_sptr &resolution, const double EnergyMin = -0.5, const double EnergyMax = 0.5, const double EnergyWidth = 0.1, diff --git a/Framework/Algorithms/test/ChainedOperatorTest.h b/Framework/Algorithms/test/ChainedOperatorTest.h index 4e51d242ecd5ef003050e00557b4f18972fa94b5..36ecc1c4749602673c2a75bb540d91fd1b61221a 100644 --- a/Framework/Algorithms/test/ChainedOperatorTest.h +++ b/Framework/Algorithms/test/ChainedOperatorTest.h @@ -70,8 +70,8 @@ public: performTest(work_in1, work_in2); } - void performTest(MatrixWorkspace_sptr work_in1, - MatrixWorkspace_sptr work_in2) { + void performTest(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2) { ComplexOpTest alg; std::string wsNameIn1 = "testChainedOperator_in21"; @@ -98,9 +98,9 @@ public: } private: - void checkData(const MatrixWorkspace_sptr work_in1, - const MatrixWorkspace_sptr work_in2, - const MatrixWorkspace_sptr work_out1) { + void checkData(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1) { size_t ws2LoopCount = 0; if (work_in2->size() > 0) { ws2LoopCount = work_in1->size() / work_in2->size(); @@ -112,9 +112,9 @@ private: } } - void checkDataItem(const MatrixWorkspace_sptr work_in1, - const MatrixWorkspace_sptr work_in2, - const MatrixWorkspace_sptr work_out1, size_t i, + void checkDataItem(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1, size_t i, size_t ws2Index) { double sig1 = work_in1->readY(i / work_in1->blocksize())[i % work_in1->blocksize()]; diff --git a/Framework/Algorithms/test/ChangeLogTimeTest.h b/Framework/Algorithms/test/ChangeLogTimeTest.h index b923e8da0f2c16989e6c56be133342f48bf1b872..e7007c0f3046126c0a3ecda4ba5ae8e8dd062fd4 100644 --- a/Framework/Algorithms/test/ChangeLogTimeTest.h +++ b/Framework/Algorithms/test/ChangeLogTimeTest.h @@ -52,7 +52,7 @@ private: * @param in_name Name of the input workspace. * @param out_name Name of the output workspace. */ - void verify(const std::string in_name, const std::string out_name) { + void verify(const std::string &in_name, const std::string &out_name) { DateAndTime start(start_str); // create a workspace to mess with diff --git a/Framework/Algorithms/test/ChangePulsetime2Test.h b/Framework/Algorithms/test/ChangePulsetime2Test.h index 383501bfa2a87b3f9a8be3077cc06aeff3e694b8..5e39d09bfcf7ca0597d0872b2ca4efc58e9f8287 100644 --- a/Framework/Algorithms/test/ChangePulsetime2Test.h +++ b/Framework/Algorithms/test/ChangePulsetime2Test.h @@ -22,8 +22,9 @@ using Mantid::Types::Core::DateAndTime; namespace { EventWorkspace_sptr -execute_change_of_pulse_times(EventWorkspace_sptr in_ws, std::string timeOffset, - std::string workspaceIndexList) { +execute_change_of_pulse_times(const EventWorkspace_sptr &in_ws, + const std::string &timeOffset, + const std::string &workspaceIndexList) { // Create and run the algorithm ChangePulsetime2 alg; alg.initialize(); @@ -53,8 +54,8 @@ public: TS_ASSERT(alg.isInitialized()) } - void do_test(std::string in_ws_name, std::string out_ws_name, - std::string WorkspaceIndexList) { + void do_test(const std::string &in_ws_name, const std::string &out_ws_name, + const std::string &WorkspaceIndexList) { ChangePulsetime2 alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) TS_ASSERT(alg.isInitialized()) diff --git a/Framework/Algorithms/test/ChangePulsetimeTest.h b/Framework/Algorithms/test/ChangePulsetimeTest.h index 6ecb5b9e5a450506fba46043b54dacadaf22fd29..22500e9fc344b6056fee0d93165acbdaf3fa5a11 100644 --- a/Framework/Algorithms/test/ChangePulsetimeTest.h +++ b/Framework/Algorithms/test/ChangePulsetimeTest.h @@ -21,8 +21,9 @@ using Mantid::Types::Core::DateAndTime; namespace { EventWorkspace_sptr -execute_change_of_pulse_times(EventWorkspace_sptr in_ws, std::string timeOffset, - std::string workspaceIndexList) { +execute_change_of_pulse_times(const EventWorkspace_sptr &in_ws, + const std::string &timeOffset, + const std::string &workspaceIndexList) { // Create and run the algorithm ChangePulsetime alg; alg.initialize(); @@ -51,8 +52,8 @@ public: TS_ASSERT(alg.isInitialized()) } - void do_test(std::string in_ws_name, std::string out_ws_name, - std::string WorkspaceIndexList) { + void do_test(const std::string &in_ws_name, const std::string &out_ws_name, + const std::string &WorkspaceIndexList) { ChangePulsetime alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) TS_ASSERT(alg.isInitialized()) diff --git a/Framework/Algorithms/test/ChangeTimeZeroTest.h b/Framework/Algorithms/test/ChangeTimeZeroTest.h index 81e7d68a053f390bbe759cb448424f0cff504930..8c69978f19eb48a2887e3dcf4bc861c1e1604fe1 100644 --- a/Framework/Algorithms/test/ChangeTimeZeroTest.h +++ b/Framework/Algorithms/test/ChangeTimeZeroTest.h @@ -9,6 +9,8 @@ #include "MantidKernel/Timer.h" #include +#include + #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ScopedWorkspace.h" #include "MantidAPI/WorkspaceGroup.h" @@ -36,8 +38,8 @@ DateAndTime stringPropertyTime("2010-01-01T00:10:00"); enum LogType { STANDARD, NOPROTONCHARGE }; template -void addTimeSeriesLogToWorkspace(Mantid::API::MatrixWorkspace_sptr ws, - std::string id, DateAndTime startTime, +void addTimeSeriesLogToWorkspace(const Mantid::API::MatrixWorkspace_sptr &ws, + const std::string &id, DateAndTime startTime, T defaultValue, int length) { auto timeSeries = new TimeSeriesProperty(id); timeSeries->setUnits("mm"); @@ -48,15 +50,15 @@ void addTimeSeriesLogToWorkspace(Mantid::API::MatrixWorkspace_sptr ws, } template -void addProperyWithValueToWorkspace(Mantid::API::MatrixWorkspace_sptr ws, - std::string id, T value) { +void addProperyWithValueToWorkspace(const Mantid::API::MatrixWorkspace_sptr &ws, + const std::string &id, T value) { auto propWithVal = new PropertyWithValue(id, value); propWithVal->setUnits("mm"); ws->mutableRun().addProperty(propWithVal, true); } // Provide the logs for matrix workspaces -void provideLogs(LogType logType, Mantid::API::MatrixWorkspace_sptr ws, +void provideLogs(LogType logType, const Mantid::API::MatrixWorkspace_sptr &ws, DateAndTime startTime, int length) { switch (logType) { case (STANDARD): @@ -96,7 +98,7 @@ void provideLogs(LogType logType, Mantid::API::MatrixWorkspace_sptr ws, // Provides a 2D workspace with a log Mantid::API::MatrixWorkspace_sptr provideWorkspace2D(LogType logType, - std::string wsName, + const std::string &wsName, DateAndTime startTime, int length) { Workspace2D_sptr ws(new Workspace2D); @@ -140,9 +142,9 @@ provideEventWorkspace(LogType logType, DateAndTime startTime, int length) { return provideEventWorkspaceCustom(logType, startTime, length, 100, 100, 100); } -MatrixWorkspace_sptr execute_change_time(MatrixWorkspace_sptr in_ws, +MatrixWorkspace_sptr execute_change_time(const MatrixWorkspace_sptr &in_ws, double relativeTimeOffset, - std::string absolutTimeOffset) { + const std::string &absolutTimeOffset) { // Create and run the algorithm ChangeTimeZero alg; alg.initialize(); @@ -441,8 +443,9 @@ private: int m_length; // act and assert - void act_and_assert(double relativeTimeShift, std::string absoluteTimeShift, - MatrixWorkspace_sptr in_ws, + void act_and_assert(double relativeTimeShift, + const std::string &absoluteTimeShift, + const MatrixWorkspace_sptr &in_ws, bool inputEqualsOutputWorkspace) { // Create a duplicate workspace EventWorkspace_sptr duplicate_ws; @@ -484,8 +487,8 @@ private: } // perform the verification - void do_test_shift(MatrixWorkspace_sptr ws, const double timeShift, - MatrixWorkspace_sptr duplicate) const { + void do_test_shift(const MatrixWorkspace_sptr &ws, const double timeShift, + const MatrixWorkspace_sptr &duplicate) const { // Check the logs TS_ASSERT(ws); @@ -501,7 +504,7 @@ private: // Check the neutrons if (auto outWs = boost::dynamic_pointer_cast(ws)) { - do_check_workspace(outWs, timeShift, duplicate); + do_check_workspace(outWs, timeShift, std::move(duplicate)); } } @@ -536,8 +539,8 @@ private: } // Check contents of an event workspace. We compare the time stamps to the // time stamps of the duplicate workspace - void do_check_workspace(EventWorkspace_sptr ws, double timeShift, - MatrixWorkspace_sptr duplicate) const { + void do_check_workspace(const EventWorkspace_sptr &ws, double timeShift, + const MatrixWorkspace_sptr &duplicate) const { // Get the duplicate input workspace for comparison reasons auto duplicateWs = boost::dynamic_pointer_cast(duplicate); @@ -562,7 +565,7 @@ private: // Create comparison workspace EventWorkspace_sptr - createComparisonWorkspace(EventWorkspace_sptr inputWorkspace) { + createComparisonWorkspace(const EventWorkspace_sptr &inputWorkspace) { CloneWorkspace alg; alg.setChild(true); TS_ASSERT_THROWS_NOTHING(alg.initialize()) diff --git a/Framework/Algorithms/test/CheckWorkspacesMatchTest.h b/Framework/Algorithms/test/CheckWorkspacesMatchTest.h index 716105ed1a88be94a9142d4283e9ee6966f264c4..87630794e631474e0411e9ac6b5c6c09d79a696d 100644 --- a/Framework/Algorithms/test/CheckWorkspacesMatchTest.h +++ b/Framework/Algorithms/test/CheckWorkspacesMatchTest.h @@ -1140,7 +1140,7 @@ private: TS_ASSERT_EQUALS(matcher.getPropertyValue("Result"), expectedResult); } - void cleanupGroup(const WorkspaceGroup_sptr group) { + void cleanupGroup(const WorkspaceGroup_sptr &group) { // group->deepRemoveAll(); const std::string name = group->getName(); Mantid::API::AnalysisDataService::Instance().deepRemoveGroup(name); diff --git a/Framework/Algorithms/test/ClearCacheTest.h b/Framework/Algorithms/test/ClearCacheTest.h index 73069ee0a44b853209439068ea8668614a494a63..d6f1a2a7a2a41f1d1ea6ca178d005513dc60cff8 100644 --- a/Framework/Algorithms/test/ClearCacheTest.h +++ b/Framework/Algorithms/test/ClearCacheTest.h @@ -49,7 +49,7 @@ public: createDirectory(GeomPath); } - void createDirectory(Poco::Path path) { + void createDirectory(const Poco::Path &path) { Poco::File file(path); if (file.createDirectory()) { m_directoriesToRemove.emplace_back(file); diff --git a/Framework/Algorithms/test/ClearInstrumentParametersTest.h b/Framework/Algorithms/test/ClearInstrumentParametersTest.h index cd866bdc40acc55cf06b4e1e9da0f4c2baf688da..2e8d40202a598a925faf87f32b48d9824fab1852 100644 --- a/Framework/Algorithms/test/ClearInstrumentParametersTest.h +++ b/Framework/Algorithms/test/ClearInstrumentParametersTest.h @@ -47,21 +47,23 @@ public: TS_ASSERT_EQUALS(oldPos, m_ws->detectorInfo().position(0)); } - void setParam(std::string cName, std::string pName, std::string value) { + void setParam(const std::string &cName, const std::string &pName, + const std::string &value) { Instrument_const_sptr inst = m_ws->getInstrument(); ParameterMap ¶mMap = m_ws->instrumentParameters(); boost::shared_ptr comp = inst->getComponentByName(cName); paramMap.addString(comp->getComponentID(), pName, value); } - void setParam(std::string cName, std::string pName, double value) { + void setParam(const std::string &cName, const std::string &pName, + double value) { Instrument_const_sptr inst = m_ws->getInstrument(); ParameterMap ¶mMap = m_ws->instrumentParameters(); boost::shared_ptr comp = inst->getComponentByName(cName); paramMap.addDouble(comp->getComponentID(), pName, value); } - void checkEmpty(std::string cName, std::string pName) { + void checkEmpty(const std::string &cName, const std::string &pName) { Instrument_const_sptr inst = m_ws->getInstrument(); ParameterMap ¶mMap = m_ws->instrumentParameters(); boost::shared_ptr comp = inst->getComponentByName(cName); diff --git a/Framework/Algorithms/test/CommutativeBinaryOperationTest.h b/Framework/Algorithms/test/CommutativeBinaryOperationTest.h index 24eb4aaa6fff32a55c8f6988f04af2ca5253a003..a7c834710b1fa98356809efef6257143045949fc 100644 --- a/Framework/Algorithms/test/CommutativeBinaryOperationTest.h +++ b/Framework/Algorithms/test/CommutativeBinaryOperationTest.h @@ -33,8 +33,8 @@ public: return "Commutative binary operation helper."; } - std::string checkSizeCompatibility(const MatrixWorkspace_const_sptr ws1, - const MatrixWorkspace_const_sptr ws2) { + std::string checkSizeCompatibility(const MatrixWorkspace_const_sptr &ws1, + const MatrixWorkspace_const_sptr &ws2) { m_lhs = ws1; m_rhs = ws2; m_lhsBlocksize = ws1->blocksize(); diff --git a/Framework/Algorithms/test/CompareWorkspacesTest.h b/Framework/Algorithms/test/CompareWorkspacesTest.h index fe15a2ed1e00a56af6781180ca8ed86131ba5669..a2d907d86fa79e55636705aa119eea1e125c192a 100644 --- a/Framework/Algorithms/test/CompareWorkspacesTest.h +++ b/Framework/Algorithms/test/CompareWorkspacesTest.h @@ -1351,7 +1351,7 @@ private: } } - void cleanupGroup(const WorkspaceGroup_sptr group) { + void cleanupGroup(const WorkspaceGroup_sptr &group) { // group->deepRemoveAll(); const std::string name = group->getName(); Mantid::API::AnalysisDataService::Instance().deepRemoveGroup(name); diff --git a/Framework/Algorithms/test/ConjoinWorkspacesTest.h b/Framework/Algorithms/test/ConjoinWorkspacesTest.h index 27d90dde12a1a75d31f0f48672e319be6f7d16fd..2485feebb729076714020c5f41df507c15974e38 100644 --- a/Framework/Algorithms/test/ConjoinWorkspacesTest.h +++ b/Framework/Algorithms/test/ConjoinWorkspacesTest.h @@ -37,7 +37,7 @@ public: : ws1Name("ConjoinWorkspacesTest_grp1"), ws2Name("ConjoinWorkspacesTest_grp2") {} - MatrixWorkspace_sptr getWSFromADS(std::string wsName) { + MatrixWorkspace_sptr getWSFromADS(const std::string &wsName) { auto out = boost::dynamic_pointer_cast( AnalysisDataService::Instance().retrieve(wsName)); TS_ASSERT(out); diff --git a/Framework/Algorithms/test/ConvertAxesToRealSpaceTest.h b/Framework/Algorithms/test/ConvertAxesToRealSpaceTest.h index 3fad5cfc7c86596740a815439162c61369d4e984..56ae17def050ad508e455c8b1b11db6116f4f23d 100644 --- a/Framework/Algorithms/test/ConvertAxesToRealSpaceTest.h +++ b/Framework/Algorithms/test/ConvertAxesToRealSpaceTest.h @@ -55,10 +55,10 @@ public: do_algorithm_run(baseWSName, "phi", "signed2theta", 100, 200); } - MatrixWorkspace_sptr do_algorithm_run(std::string baseWSName, - std::string verticalAxis, - std::string horizontalAxis, int nHBins, - int nVBins) { + MatrixWorkspace_sptr do_algorithm_run(const std::string &baseWSName, + const std::string &verticalAxis, + const std::string &horizontalAxis, + int nHBins, int nVBins) { std::string inWSName(baseWSName + "_InputWS"); std::string outWSName(baseWSName + "_OutputWS"); diff --git a/Framework/Algorithms/test/ConvertAxisByFormulaTest.h b/Framework/Algorithms/test/ConvertAxisByFormulaTest.h index df3e41b59caffe07ff3707835435d78877116be6..6b55ecffeb14beef33741b690ca9bb8ef7543442 100644 --- a/Framework/Algorithms/test/ConvertAxisByFormulaTest.h +++ b/Framework/Algorithms/test/ConvertAxisByFormulaTest.h @@ -197,8 +197,9 @@ public: cleanupWorkspaces(std::vector{inputWs}); } - bool runConvertAxisByFormula(std::string testName, std::string formula, - std::string axis, std::string &inputWs, + bool runConvertAxisByFormula(const std::string &testName, + const std::string &formula, + const std::string &axis, std::string &inputWs, std::string &resultWs) { Mantid::Algorithms::ConvertAxisByFormula alg; alg.initialize(); diff --git a/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h b/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h index 595e8c4b8f5d926a29955aaab0503fb764ce0bcc..78f9b1605ab800b91551c52857cc2d310665b88d 100644 --- a/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h +++ b/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h @@ -23,8 +23,8 @@ using namespace Mantid::HistogramData::detail; class ConvertSpectrumAxis2Test : public CxxTest::TestSuite { private: - void do_algorithm_run(std::string target, std::string inputWS, - std::string outputWS, bool startYNegative = true, + void do_algorithm_run(const std::string &target, const std::string &inputWS, + const std::string &outputWS, bool startYNegative = true, bool isHistogram = true) { auto testWS = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument( 3, 1, false, startYNegative, isHistogram); @@ -45,7 +45,7 @@ private: } void check_output_values_for_signed_theta_conversion( - std::string outputWSSignedTheta) { + const std::string &outputWSSignedTheta) { MatrixWorkspace_const_sptr outputSignedTheta; TS_ASSERT_THROWS_NOTHING( outputSignedTheta = @@ -69,8 +69,9 @@ private: TS_ASSERT_DELTA((*thetaAxis)(2), 1.1458, 0.0001); } - void check_output_values_for_theta_conversion(std::string inputWSTheta, - std::string outputWSTheta) { + void + check_output_values_for_theta_conversion(const std::string &inputWSTheta, + const std::string &outputWSTheta) { MatrixWorkspace_const_sptr input, output; TS_ASSERT_THROWS_NOTHING( input = AnalysisDataService::Instance().retrieveWS( @@ -101,8 +102,8 @@ private: const Mantid::Kernel::Exception::IndexError &); } - void clean_up_workspaces(const std::string inputWS, - const std::string outputWS) { + void clean_up_workspaces(const std::string &inputWS, + const std::string &outputWS) { AnalysisDataService::Instance().remove(inputWS); AnalysisDataService::Instance().remove(outputWS); } diff --git a/Framework/Algorithms/test/ConvertSpectrumAxisTest.h b/Framework/Algorithms/test/ConvertSpectrumAxisTest.h index 46c3ebe3539433e909e34d82020fc160d8f0f676..fcab91851b1cd6322fa37ee7400e873442b0c2f6 100644 --- a/Framework/Algorithms/test/ConvertSpectrumAxisTest.h +++ b/Framework/Algorithms/test/ConvertSpectrumAxisTest.h @@ -19,8 +19,8 @@ using namespace Mantid::HistogramData::detail; class ConvertSpectrumAxisTest : public CxxTest::TestSuite { private: - void do_algorithm_run(std::string target, std::string inputWS, - std::string outputWS) { + void do_algorithm_run(const std::string &target, const std::string &inputWS, + const std::string &outputWS) { Mantid::Algorithms::ConvertSpectrumAxis conv; conv.initialize(); diff --git a/Framework/Algorithms/test/ConvertToConstantL2Test.h b/Framework/Algorithms/test/ConvertToConstantL2Test.h index e224874b82f18d43a5cac7c59cc2346da938eacd..4937686131866414685542e4d665e7585869d3f6 100644 --- a/Framework/Algorithms/test/ConvertToConstantL2Test.h +++ b/Framework/Algorithms/test/ConvertToConstantL2Test.h @@ -58,7 +58,7 @@ public: do_test_move(inputWS); } - void do_test_move(MatrixWorkspace_sptr inputWS) { + void do_test_move(const MatrixWorkspace_sptr &inputWS) { // BEFORE - check the L2 values differ const auto &spectrumInfoInput = inputWS->spectrumInfo(); for (size_t i = 0; i < inputWS->getNumberHistograms(); i++) { @@ -169,7 +169,7 @@ private: return inputWS; } - void addSampleLogs(MatrixWorkspace_sptr inputWS) { + void addSampleLogs(const MatrixWorkspace_sptr &inputWS) { inputWS->mutableRun().addProperty( "wavelength", boost::lexical_cast(m_wavelength)); diff --git a/Framework/Algorithms/test/ConvertToHistogramTest.h b/Framework/Algorithms/test/ConvertToHistogramTest.h index d6696e74329a7ec92fb1c4cdfd3ec74cd76b4820..a693111185bbc58238bd5aa1e6513a66e560eb30 100644 --- a/Framework/Algorithms/test/ConvertToHistogramTest.h +++ b/Framework/Algorithms/test/ConvertToHistogramTest.h @@ -110,7 +110,7 @@ public: } private: - MatrixWorkspace_sptr runAlgorithm(Workspace2D_sptr inputWS) { + MatrixWorkspace_sptr runAlgorithm(const Workspace2D_sptr &inputWS) { IAlgorithm_sptr alg(new ConvertToHistogram()); alg->initialize(); alg->setRethrows(true); diff --git a/Framework/Algorithms/test/ConvertToPointDataTest.h b/Framework/Algorithms/test/ConvertToPointDataTest.h index 6fe2a97daca71de1b9839624ebf1ed2996ca8726..10b4868b4d2bb28179ec4cdba88aee189d2e83f2 100644 --- a/Framework/Algorithms/test/ConvertToPointDataTest.h +++ b/Framework/Algorithms/test/ConvertToPointDataTest.h @@ -171,7 +171,7 @@ public: } private: - MatrixWorkspace_sptr runAlgorithm(Workspace2D_sptr inputWS) { + MatrixWorkspace_sptr runAlgorithm(const Workspace2D_sptr &inputWS) { IAlgorithm_sptr alg(new ConvertToPointData()); alg->initialize(); alg->setRethrows(true); diff --git a/Framework/Algorithms/test/ConvertUnitsTest.h b/Framework/Algorithms/test/ConvertUnitsTest.h index c8fbf020f81aa98f95131de76be56b91f662f133..ca345e3cb59181f7c47f22c8156c30b648183ecc 100644 --- a/Framework/Algorithms/test/ConvertUnitsTest.h +++ b/Framework/Algorithms/test/ConvertUnitsTest.h @@ -713,7 +713,7 @@ public: * sorting flips the direction */ void do_testExecEvent_RemainsSorted(EventSortType sortType, - std::string targetUnit) { + const std::string &targetUnit) { EventWorkspace_sptr ws = WorkspaceCreationHelper::createEventWorkspaceWithFullInstrument(1, 10, false); diff --git a/Framework/Algorithms/test/CopyDataRangeTest.h b/Framework/Algorithms/test/CopyDataRangeTest.h index b0dbf373b55819704e0977a934c3742cfbc5109d..da41285003b3912b140abe268fcc32dea7a4c98b 100644 --- a/Framework/Algorithms/test/CopyDataRangeTest.h +++ b/Framework/Algorithms/test/CopyDataRangeTest.h @@ -37,8 +37,8 @@ MatrixWorkspace_sptr getADSMatrixWorkspace(std::string const &workspaceName) { workspaceName); } -IAlgorithm_sptr setUpAlgorithm(MatrixWorkspace_sptr inputWorkspace, - MatrixWorkspace_sptr destWorkspace, +IAlgorithm_sptr setUpAlgorithm(const MatrixWorkspace_sptr &inputWorkspace, + const MatrixWorkspace_sptr &destWorkspace, int const &specMin, int const &specMax, double const &xMin, double const &xMax, int const &yInsertionIndex, @@ -68,7 +68,7 @@ IAlgorithm_sptr setUpAlgorithm(std::string const &inputName, xMax, yInsertionIndex, xInsertionIndex, outputName); } -void populateSpectrum(MatrixWorkspace_sptr workspace, +void populateSpectrum(const MatrixWorkspace_sptr &workspace, std::size_t const &spectrum, std::vector const &yData, std::vector const &xData, @@ -78,7 +78,7 @@ void populateSpectrum(MatrixWorkspace_sptr workspace, workspace->mutableE(spectrum) = HistogramE(eData); } -void populateWorkspace(MatrixWorkspace_sptr workspace, +void populateWorkspace(const MatrixWorkspace_sptr &workspace, std::vector const &yData, std::vector const &xData, std::vector const &eData) { @@ -94,7 +94,7 @@ constructHistogramData(Mantid::MantidVec::const_iterator fromIterator, return histogram; } -void populateOutputWorkspace(MatrixWorkspace_sptr workspace, +void populateOutputWorkspace(const MatrixWorkspace_sptr &workspace, std::vector const &yData, std::vector const &eData) { std::vector const xData = {2.1, 2.2, 2.3, 2.4, 2.5, 2.6}; @@ -111,8 +111,8 @@ void populateOutputWorkspace(MatrixWorkspace_sptr workspace, } } -ITableWorkspace_sptr compareWorkspaces(MatrixWorkspace_sptr workspace1, - MatrixWorkspace_sptr workspace2, +ITableWorkspace_sptr compareWorkspaces(const MatrixWorkspace_sptr &workspace1, + const MatrixWorkspace_sptr &workspace2, double tolerance = 0.000001) { auto compareAlg = AlgorithmManager::Instance().create("CompareWorkspaces"); compareAlg->setProperty("Workspace1", workspace1); diff --git a/Framework/Algorithms/test/CopyLogsTest.h b/Framework/Algorithms/test/CopyLogsTest.h index 0f2292f8ea65a4550fa19fc91d9199faae4a561a..c67a5903e17e7c01ee5d680e085aeac88ca9dec7 100644 --- a/Framework/Algorithms/test/CopyLogsTest.h +++ b/Framework/Algorithms/test/CopyLogsTest.h @@ -136,7 +136,7 @@ public: } // Run the Copy Logs algorithm - void runAlg(MatrixWorkspace_sptr in, MatrixWorkspace_sptr out, + void runAlg(const MatrixWorkspace_sptr &in, const MatrixWorkspace_sptr &out, const std::string &mode) { CopyLogs alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) @@ -149,14 +149,14 @@ public: } // Add a string sample log to the workspace - void addSampleLog(MatrixWorkspace_sptr ws, const std::string &name, + void addSampleLog(const MatrixWorkspace_sptr &ws, const std::string &name, const std::string &value) { Run &run = ws->mutableRun(); run.addLogData(new PropertyWithValue(name, value)); } // Add a double sample log to the workspace - void addSampleLog(MatrixWorkspace_sptr ws, const std::string &name, + void addSampleLog(const MatrixWorkspace_sptr &ws, const std::string &name, const double value) { Run &run = ws->mutableRun(); run.addLogData(new PropertyWithValue(name, value)); diff --git a/Framework/Algorithms/test/CorrectTOFAxisTest.h b/Framework/Algorithms/test/CorrectTOFAxisTest.h index 23ccaedf78dd4c952284c8ca0065cc05b66b3322..6f376bda675306b70e982f85493ffcea34da9383 100644 --- a/Framework/Algorithms/test/CorrectTOFAxisTest.h +++ b/Framework/Algorithms/test/CorrectTOFAxisTest.h @@ -323,7 +323,7 @@ public: } private: - static void addSampleLogs(MatrixWorkspace_sptr ws, const double TOF) { + static void addSampleLogs(const MatrixWorkspace_sptr &ws, const double TOF) { const double length = flightLengthIN4(ws); const double Ei = incidentEnergy(TOF, length); ws->mutableRun().addProperty("EI", Ei); @@ -331,8 +331,8 @@ private: ws->mutableRun().addProperty("wavelength", lambda); } - static void assertTOFShift(MatrixWorkspace_sptr shiftedWs, - MatrixWorkspace_sptr ws, const double ei, + static void assertTOFShift(const MatrixWorkspace_sptr &shiftedWs, + const MatrixWorkspace_sptr &ws, const double ei, const double wavelength, const double shift) { TS_ASSERT(shiftedWs); TS_ASSERT_EQUALS(shiftedWs->run().getPropertyAsSingleValue("EI"), ei); @@ -412,7 +412,7 @@ private: } } - static double flightLengthIN4(MatrixWorkspace_const_sptr ws) { + static double flightLengthIN4(const MatrixWorkspace_const_sptr &ws) { const double l1 = ws->spectrumInfo().l1(); const double l2 = ws->spectrumInfo().l2(1); return l1 + l2; diff --git a/Framework/Algorithms/test/CorrectToFileTest.h b/Framework/Algorithms/test/CorrectToFileTest.h index 6d052370c9b4029d540de06090e9fa4f4f4e2de4..532a0c8fdeb8f7948ed9db9e65e1a4899d01174e 100644 --- a/Framework/Algorithms/test/CorrectToFileTest.h +++ b/Framework/Algorithms/test/CorrectToFileTest.h @@ -142,7 +142,7 @@ public: AnalysisDataService::Instance().remove(data->getName()); } - MatrixWorkspace_sptr executeAlgorithm(MatrixWorkspace_sptr testInput, + MatrixWorkspace_sptr executeAlgorithm(const MatrixWorkspace_sptr &testInput, const std::string &unit, const std::string &operation, bool newWksp = true) { diff --git a/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h b/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h index 0dc96dc50c0922f2845b12e4aa7b1829dea98d73..79cd24af8cb0243ba5620f5d8da59a1ce06b1c4d 100644 --- a/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h +++ b/Framework/Algorithms/test/CreateGroupingWorkspaceTest.h @@ -25,7 +25,7 @@ public: TS_ASSERT(alg.isInitialized()) } - void doTest(std::string outWSName) { + void doTest(const std::string &outWSName) { // Retrieve the workspace from data service. GroupingWorkspace_sptr ws; TS_ASSERT_THROWS_NOTHING( diff --git a/Framework/Algorithms/test/CreateLogPropertyTableTest.h b/Framework/Algorithms/test/CreateLogPropertyTableTest.h index 269b7bea7fd313442ded0a408620dfb70bf2d1c8..5f3639ce2f1e41e8fc02c09235e21865c7f3633c 100644 --- a/Framework/Algorithms/test/CreateLogPropertyTableTest.h +++ b/Framework/Algorithms/test/CreateLogPropertyTableTest.h @@ -110,7 +110,7 @@ public: private: void createSampleWorkspace( - std::string wsName = "__CreateLogPropertyTable__TestWorkspace", + const std::string &wsName = "__CreateLogPropertyTable__TestWorkspace", int runNumber = 12345, int64_t runStart = 3000000000) { using namespace WorkspaceCreationHelper; diff --git a/Framework/Algorithms/test/CreateSampleWorkspaceTest.h b/Framework/Algorithms/test/CreateSampleWorkspaceTest.h index 73fcede99c031b32a7a12ab8bebf97eee20c5841..3e0e5f37ba44b75122a2e3fe6972f9a8faafd78a 100644 --- a/Framework/Algorithms/test/CreateSampleWorkspaceTest.h +++ b/Framework/Algorithms/test/CreateSampleWorkspaceTest.h @@ -46,9 +46,10 @@ public: } MatrixWorkspace_sptr createSampleWorkspace( - std::string outWSName, std::string wsType = "", std::string function = "", - std::string userFunction = "", int numBanks = 2, int bankPixelWidth = 10, - int numEvents = 1000, bool isRandom = false, std::string xUnit = "TOF", + const std::string &outWSName, const std::string &wsType = "", + const std::string &function = "", const std::string &userFunction = "", + int numBanks = 2, int bankPixelWidth = 10, int numEvents = 1000, + bool isRandom = false, const std::string &xUnit = "TOF", double xMin = 0.0, double xMax = 20000.0, double binWidth = 200.0, int numScanPoints = 1) { diff --git a/Framework/Algorithms/test/CreateTransmissionWorkspace2Test.h b/Framework/Algorithms/test/CreateTransmissionWorkspace2Test.h index bde02a3160fca645785343c636d6bd255a0778b5..cda64d11d6f629869c034d9c72c01daea3ed837c 100644 --- a/Framework/Algorithms/test/CreateTransmissionWorkspace2Test.h +++ b/Framework/Algorithms/test/CreateTransmissionWorkspace2Test.h @@ -617,7 +617,7 @@ private: } } - void check_lambda_workspace(MatrixWorkspace_sptr ws) { + void check_lambda_workspace(const MatrixWorkspace_sptr &ws) { TS_ASSERT(ws); if (!ws) return; diff --git a/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h b/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h index e5f4c4b2f2f4d5a943197fb23b43e3b5df04a162..aa502c2dd8662e258191ce336b324b4b0431ade5 100644 --- a/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h +++ b/Framework/Algorithms/test/CreateUserDefinedBackgroundTest.h @@ -330,8 +330,8 @@ private: } /// Compare workspaces - bool workspacesEqual(const MatrixWorkspace_sptr lhs, - const MatrixWorkspace_sptr rhs, double tolerance, + bool workspacesEqual(const MatrixWorkspace_sptr &lhs, + const MatrixWorkspace_sptr &rhs, double tolerance, bool relativeError = false) { auto alg = Mantid::API::AlgorithmFactory::Instance().create( "CompareWorkspaces", 1); diff --git a/Framework/Algorithms/test/CropToComponentTest.h b/Framework/Algorithms/test/CropToComponentTest.h index 731380ea725ef564bb736526fe0e0a44cbf01045..1a6ae411b1fc2d86ae8ba2e44cf96141d234ff0e 100644 --- a/Framework/Algorithms/test/CropToComponentTest.h +++ b/Framework/Algorithms/test/CropToComponentTest.h @@ -242,7 +242,7 @@ private: numberOfBanks, numbersOfPixelPerBank, 2); } - void doAsssert(Mantid::API::MatrixWorkspace_sptr workspace, + void doAsssert(const Mantid::API::MatrixWorkspace_sptr &workspace, std::vector &expectedIDs, size_t expectedNumberOfHistograms) { // Assert diff --git a/Framework/Algorithms/test/CropWorkspaceTest.h b/Framework/Algorithms/test/CropWorkspaceTest.h index 3fa04b6059029bbfa72a96f7ccd70d97fa1f0e1c..f5ab1f14d02305118681d59f17f93d4507e97503 100644 --- a/Framework/Algorithms/test/CropWorkspaceTest.h +++ b/Framework/Algorithms/test/CropWorkspaceTest.h @@ -103,7 +103,7 @@ public: TS_ASSERT(!crop.isExecuted()); } - void makeFakeEventWorkspace(std::string wsName) { + void makeFakeEventWorkspace(const std::string &wsName) { // Make an event workspace with 2 events in each bin. EventWorkspace_sptr test_in = WorkspaceCreationHelper::createEventWorkspace(36, 50, 50, 0.0, 2., 2); diff --git a/Framework/Algorithms/test/CrossCorrelateTest.h b/Framework/Algorithms/test/CrossCorrelateTest.h index 4904a2f1f60319aa6d7f590d7d635b6c40eb91c3..8b60401adffd881de42f2f09cbe373a713cef12e 100644 --- a/Framework/Algorithms/test/CrossCorrelateTest.h +++ b/Framework/Algorithms/test/CrossCorrelateTest.h @@ -161,7 +161,7 @@ private: // Run the algorithm and do some basic checks. Returns the output workspace. MatrixWorkspace_const_sptr - runAlgorithm(CrossCorrelate &alg, const MatrixWorkspace_const_sptr inWS) { + runAlgorithm(CrossCorrelate &alg, const MatrixWorkspace_const_sptr &inWS) { // run the algorithm TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT(alg.isExecuted()); diff --git a/Framework/Algorithms/test/CylinderAbsorptionTest.h b/Framework/Algorithms/test/CylinderAbsorptionTest.h index 0950fb2082923018c5a55e466e429fb2118b6d83..ec2b9109b2c57695a387a7f0c534b0054f3b596d 100644 --- a/Framework/Algorithms/test/CylinderAbsorptionTest.h +++ b/Framework/Algorithms/test/CylinderAbsorptionTest.h @@ -305,9 +305,9 @@ private: void configureAbsCommon(Mantid::Algorithms::CylinderAbsorption &alg, MatrixWorkspace_sptr &inputWS, const std::string &outputWSname, - std::string numberOfSlices = "2", - std::string numberOfAnnuli = "2", - std::string cylinderAxis = "0,1,0") { + const std::string &numberOfSlices = "2", + const std::string &numberOfAnnuli = "2", + const std::string &cylinderAxis = "0,1,0") { if (!alg.isInitialized()) alg.initialize(); diff --git a/Framework/Algorithms/test/DeleteWorkspacesTest.h b/Framework/Algorithms/test/DeleteWorkspacesTest.h index 70fc055b60afd4dc8962e9b449d5e9686cac1d12..99d0d42a5931169cb5a6e27fe9246e2713313696 100644 --- a/Framework/Algorithms/test/DeleteWorkspacesTest.h +++ b/Framework/Algorithms/test/DeleteWorkspacesTest.h @@ -118,7 +118,7 @@ public: TS_ASSERT_EQUALS(dataStore.size(), storeSizeAtStart); } - void createAndStoreWorkspace(std::string name, int ylength = 10) { + void createAndStoreWorkspace(const std::string &name, int ylength = 10) { using namespace Mantid::API; using namespace Mantid::DataObjects; diff --git a/Framework/Algorithms/test/EditInstrumentGeometryTest.h b/Framework/Algorithms/test/EditInstrumentGeometryTest.h index 0ec972211148c925a94ff9e235af63b3532334c9..25b3d79ee97257da2ed47da555a25ea43221442f 100644 --- a/Framework/Algorithms/test/EditInstrumentGeometryTest.h +++ b/Framework/Algorithms/test/EditInstrumentGeometryTest.h @@ -158,7 +158,7 @@ public: //---------------------------------------------------------------------------------------------- /** Check detector parameter */ - void checkDetectorParameters(API::MatrixWorkspace_sptr workspace, + void checkDetectorParameters(const API::MatrixWorkspace_sptr &workspace, size_t wsindex, double realr, double realtth, double realphi) { @@ -175,8 +175,8 @@ public: //---------------------------------------------------------------------------------------------- /** Check detector parameter */ - void checkDetectorID(API::MatrixWorkspace_sptr workspace, size_t wsindex, - detid_t detid) { + void checkDetectorID(const API::MatrixWorkspace_sptr &workspace, + size_t wsindex, detid_t detid) { const auto &spectrumInfo = workspace->spectrumInfo(); TS_ASSERT_EQUALS(spectrumInfo.hasUniqueDetector(wsindex), true); diff --git a/Framework/Algorithms/test/ElasticWindowTest.h b/Framework/Algorithms/test/ElasticWindowTest.h index e00979fc42d7861c6d92134c08d8502ad1aaf27a..65328ac0a40b6cb25a8b9e1d9a197392bb4ce04b 100644 --- a/Framework/Algorithms/test/ElasticWindowTest.h +++ b/Framework/Algorithms/test/ElasticWindowTest.h @@ -201,7 +201,7 @@ private: * * @param ws Workspace to test */ - void verifyQworkspace(MatrixWorkspace_sptr ws) { + void verifyQworkspace(const MatrixWorkspace_sptr &ws) { std::string unitID = ws->getAxis(0)->unit()->unitID(); TS_ASSERT_EQUALS(unitID, "MomentumTransfer"); } @@ -211,7 +211,7 @@ private: * * @param ws Workspace to test */ - void verifyQ2workspace(MatrixWorkspace_sptr ws) { + void verifyQ2workspace(const MatrixWorkspace_sptr &ws) { std::string unitID = ws->getAxis(0)->unit()->unitID(); TS_ASSERT_EQUALS(unitID, "QSquared"); } diff --git a/Framework/Algorithms/test/ExponentialTest.h b/Framework/Algorithms/test/ExponentialTest.h index 9a682293ff8893c691aa691d11eccd5acc36e48b..28eec221b8561c92bbecb9741f7882f4e5cbb823 100644 --- a/Framework/Algorithms/test/ExponentialTest.h +++ b/Framework/Algorithms/test/ExponentialTest.h @@ -98,8 +98,8 @@ public: private: // loopOrientation 0=Horizontal, 1=Vertical - void checkData(MatrixWorkspace_sptr work_in1, - MatrixWorkspace_sptr work_out1) { + void checkData(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_out1) { for (size_t i = 0; i < work_out1->size(); i++) { double sig1 = @@ -123,7 +123,7 @@ private: } } // loopOrientation 0=Horizontal, 1=Vertical - void setError(MatrixWorkspace_sptr work_in1) { + void setError(const MatrixWorkspace_sptr &work_in1) { for (size_t i = 0; i < work_in1->size(); i++) { double sig1 = diff --git a/Framework/Algorithms/test/ExtractMaskTest.h b/Framework/Algorithms/test/ExtractMaskTest.h index 638cd418e87d327e90e73938d44d6c21bb532821..33bf6460081c9f3b2e38e6fa144954add847f140 100644 --- a/Framework/Algorithms/test/ExtractMaskTest.h +++ b/Framework/Algorithms/test/ExtractMaskTest.h @@ -163,8 +163,8 @@ private: return detectorList; } - void doTest(MatrixWorkspace_const_sptr inputWS, - MaskWorkspace_const_sptr outputWS) { + void doTest(const MatrixWorkspace_const_sptr &inputWS, + const MaskWorkspace_const_sptr &outputWS) { TS_ASSERT_EQUALS(outputWS->blocksize(), 1); size_t nOutputHists(outputWS->getNumberHistograms()); TS_ASSERT_EQUALS(nOutputHists, inputWS->getNumberHistograms()); diff --git a/Framework/Algorithms/test/ExtractSingleSpectrumTest.h b/Framework/Algorithms/test/ExtractSingleSpectrumTest.h index 70c11883dcc5d1bd529baf941cb5a76839945b85..467ff4a4f5952ec7afc7dfbd460ce60be7217241 100644 --- a/Framework/Algorithms/test/ExtractSingleSpectrumTest.h +++ b/Framework/Algorithms/test/ExtractSingleSpectrumTest.h @@ -88,7 +88,7 @@ public: } private: - MatrixWorkspace_sptr runAlgorithm(MatrixWorkspace_sptr inputWS, + MatrixWorkspace_sptr runAlgorithm(const MatrixWorkspace_sptr &inputWS, const int index) { ExtractSingleSpectrum extractor; extractor.initialize(); @@ -106,8 +106,8 @@ private: return extractor.getProperty("OutputWorkspace"); } - void do_Spectrum_Tests(MatrixWorkspace_sptr outputWS, const specnum_t specID, - const detid_t detID) { + void do_Spectrum_Tests(const MatrixWorkspace_sptr &outputWS, + const specnum_t specID, const detid_t detID) { TS_ASSERT_EQUALS(outputWS->getNumberHistograms(), 1); TS_ASSERT_THROWS_NOTHING(outputWS->getSpectrum(0)); const auto &spectrum = outputWS->getSpectrum(0); diff --git a/Framework/Algorithms/test/ExtractSpectraTest.h b/Framework/Algorithms/test/ExtractSpectraTest.h index daf981ab6c9860e5505fc25857797e4a74e73775..25c661dcaea660bd067781f9f0dfbbe62e892cb0 100644 --- a/Framework/Algorithms/test/ExtractSpectraTest.h +++ b/Framework/Algorithms/test/ExtractSpectraTest.h @@ -544,7 +544,7 @@ private: } MatrixWorkspace_sptr - createInputWithDetectors(std::string workspaceType) const { + createInputWithDetectors(const std::string &workspaceType) const { MatrixWorkspace_sptr ws; // Set the type of underlying workspace diff --git a/Framework/Algorithms/test/ExtractUnmaskedSpectraTest.h b/Framework/Algorithms/test/ExtractUnmaskedSpectraTest.h index 74486994886c34ee3446c2ea31ded0f57a72d1e1..769c8d1fef74d18c71e0a4720a9e3ff48f49ff0a 100644 --- a/Framework/Algorithms/test/ExtractUnmaskedSpectraTest.h +++ b/Framework/Algorithms/test/ExtractUnmaskedSpectraTest.h @@ -133,7 +133,7 @@ private: } Mantid::API::MatrixWorkspace_sptr - createMask(Mantid::API::MatrixWorkspace_sptr inputWS) { + createMask(const Mantid::API::MatrixWorkspace_sptr &inputWS) { auto maskWS = Mantid::DataObjects::MaskWorkspace_sptr( new Mantid::DataObjects::MaskWorkspace(inputWS)); size_t n = inputWS->getNumberHistograms(); @@ -146,8 +146,8 @@ private: } Mantid::API::MatrixWorkspace_sptr - runAlgorithm(Mantid::API::MatrixWorkspace_sptr inputWS, - Mantid::API::MatrixWorkspace_sptr maskedWS = + runAlgorithm(const Mantid::API::MatrixWorkspace_sptr &inputWS, + const Mantid::API::MatrixWorkspace_sptr &maskedWS = Mantid::API::MatrixWorkspace_sptr()) { ExtractUnmaskedSpectra alg; alg.setChild(true); diff --git a/Framework/Algorithms/test/FFTSmooth2Test.h b/Framework/Algorithms/test/FFTSmooth2Test.h index 8f3ad38eead8f38cc21bc03134472c3b3628b30a..a0a85cac67090cdd44900be723a63b2832ea2104 100644 --- a/Framework/Algorithms/test/FFTSmooth2Test.h +++ b/Framework/Algorithms/test/FFTSmooth2Test.h @@ -169,8 +169,9 @@ public: } //------------------------------------------------------------------------------------------------- - void performTest(bool event, std::string filter, std::string params, - bool AllSpectra, int WorkspaceIndex, bool inPlace = false) { + void performTest(bool event, const std::string &filter, + const std::string ¶ms, bool AllSpectra, + int WorkspaceIndex, bool inPlace = false) { MatrixWorkspace_sptr ws1, out; int numPixels = 10; int numBins = 20; diff --git a/Framework/Algorithms/test/FFTTest.h b/Framework/Algorithms/test/FFTTest.h index a439134be667a11608f1b5a5012cf404b690708e..904716b6be11c5c0dbe7fe5c09f5e9b75ca2a8f6 100644 --- a/Framework/Algorithms/test/FFTTest.h +++ b/Framework/Algorithms/test/FFTTest.h @@ -717,7 +717,7 @@ public: } private: - MatrixWorkspace_sptr doRebin(MatrixWorkspace_sptr inputWS, + MatrixWorkspace_sptr doRebin(const MatrixWorkspace_sptr &inputWS, const std::string ¶ms) { auto rebin = FrameworkManager::Instance().createAlgorithm("Rebin"); rebin->initialize(); @@ -729,8 +729,8 @@ private: return rebin->getProperty("OutputWorkspace"); } - MatrixWorkspace_sptr doFFT(MatrixWorkspace_sptr inputWS, const bool complex, - const bool phaseShift) { + MatrixWorkspace_sptr doFFT(const MatrixWorkspace_sptr &inputWS, + const bool complex, const bool phaseShift) { auto fft = FrameworkManager::Instance().createAlgorithm("FFT"); fft->initialize(); fft->setChild(true); @@ -747,7 +747,7 @@ private: return fft->getProperty("OutputWorkspace"); } - void doPhaseTest(MatrixWorkspace_sptr inputWS, bool complex) { + void doPhaseTest(const MatrixWorkspace_sptr &inputWS, bool complex) { // Offset the input workspace const auto offsetWS = offsetWorkspace(inputWS); @@ -803,7 +803,7 @@ private: return ws; } - MatrixWorkspace_sptr offsetWorkspace(MatrixWorkspace_sptr workspace) { + MatrixWorkspace_sptr offsetWorkspace(const MatrixWorkspace_sptr &workspace) { auto scaleX = FrameworkManager::Instance().createAlgorithm("ScaleX"); scaleX->initialize(); scaleX->setChild(true); @@ -936,7 +936,7 @@ private: return create->getProperty("OutputWorkspace"); } - MatrixWorkspace_sptr doCrop(MatrixWorkspace_sptr inputWS, double lower, + MatrixWorkspace_sptr doCrop(const MatrixWorkspace_sptr &inputWS, double lower, double higher) { auto crop = FrameworkManager::Instance().createAlgorithm("CropWorkspace"); crop->initialize(); diff --git a/Framework/Algorithms/test/FilterByLogValueTest.h b/Framework/Algorithms/test/FilterByLogValueTest.h index 19b20c56e69f2652dfaa8cd9a968737a4de97dc8..25b241d1021ec87d7bdea75383c9eb30de7dbafd 100644 --- a/Framework/Algorithms/test/FilterByLogValueTest.h +++ b/Framework/Algorithms/test/FilterByLogValueTest.h @@ -174,7 +174,7 @@ public: * @param do_in_place * @param PulseFilter :: PulseFilter parameter */ - void do_test_fake(std::string log_name, double min, double max, + void do_test_fake(const std::string &log_name, double min, double max, int seconds_kept, bool add_proton_charge = true, bool do_in_place = false, bool PulseFilter = false) { EventWorkspace_sptr ew = createInputWS(add_proton_charge); diff --git a/Framework/Algorithms/test/FilterEventsTest.h b/Framework/Algorithms/test/FilterEventsTest.h index 62120ef732583da28d48689c166db0fad142f620..b657f88b3d53ff936be937a54499a7fd232a71d4 100644 --- a/Framework/Algorithms/test/FilterEventsTest.h +++ b/Framework/Algorithms/test/FilterEventsTest.h @@ -1753,7 +1753,8 @@ public: //---------------------------------------------------------------------------------------------- /** Create the time correction table */ - TableWorkspace_sptr createTimeCorrectionTable(MatrixWorkspace_sptr inpws) { + TableWorkspace_sptr + createTimeCorrectionTable(const MatrixWorkspace_sptr &inpws) { // 1. Generate an empty table auto corrtable = boost::make_shared(); corrtable->addColumn("int", "DetectorID"); diff --git a/Framework/Algorithms/test/FindEPPTest.h b/Framework/Algorithms/test/FindEPPTest.h index 3f9ef8197a23a46a67fa892fbdd385c2ae5fdae1..a84315c99f436a8c8650e61e64b3ee1b58265c3f 100644 --- a/Framework/Algorithms/test/FindEPPTest.h +++ b/Framework/Algorithms/test/FindEPPTest.h @@ -223,7 +223,7 @@ public: } private: - void _check_table(ITableWorkspace_sptr ws, size_t nSpectra) { + void _check_table(const ITableWorkspace_sptr &ws, size_t nSpectra) { TS_ASSERT_EQUALS(ws->rowCount(), nSpectra); TS_ASSERT_EQUALS(ws->columnCount(), 9); TS_ASSERT_EQUALS(ws->getColumnNames(), m_columnNames); diff --git a/Framework/Algorithms/test/FindPeaksTest.h b/Framework/Algorithms/test/FindPeaksTest.h index 104ea75cf06eb28e2dbee683837e64cbb4d78266..eef5f327f104d5963b1e018ecfaf27eaf46aca58 100644 --- a/Framework/Algorithms/test/FindPeaksTest.h +++ b/Framework/Algorithms/test/FindPeaksTest.h @@ -190,7 +190,7 @@ public: /** Parse a row in output parameter tableworkspace to a string/double * parameter name/value map */ - void getParameterMap(TableWorkspace_sptr tablews, size_t rowindex, + void getParameterMap(const TableWorkspace_sptr &tablews, size_t rowindex, map ¶mmap) { parammap.clear(); diff --git a/Framework/Algorithms/test/FixGSASInstrumentFileTest.h b/Framework/Algorithms/test/FixGSASInstrumentFileTest.h index 7ff6c56f089602cdbe2cd1905fc074605885e54e..7d5a650d5d2f4e34eb5b4b195c538fba408f2685 100644 --- a/Framework/Algorithms/test/FixGSASInstrumentFileTest.h +++ b/Framework/Algorithms/test/FixGSASInstrumentFileTest.h @@ -67,7 +67,7 @@ public: file.remove(); } - void createFaultFile(std::string prmfilename) { + void createFaultFile(const std::string &prmfilename) { ofstream ofile; ofile.open(prmfilename.c_str(), ios::out); ofile << " " diff --git a/Framework/Algorithms/test/GenerateEventsFilterTest.h b/Framework/Algorithms/test/GenerateEventsFilterTest.h index bd5c7d8a22c74e9ad4c7342da233926ce52387da..8c6cdc750d876bed66921e027a01c3dd8e2e1e50 100644 --- a/Framework/Algorithms/test/GenerateEventsFilterTest.h +++ b/Framework/Algorithms/test/GenerateEventsFilterTest.h @@ -1145,7 +1145,7 @@ public: * SplittingInterval objects */ size_t convertMatrixSplitterToSplitters( - API::MatrixWorkspace_const_sptr matrixws, + const API::MatrixWorkspace_const_sptr &matrixws, std::vector &splitters) { splitters.clear(); size_t numsplitters = 0; diff --git a/Framework/Algorithms/test/GetDetOffsetsMultiPeaksTest.h b/Framework/Algorithms/test/GetDetOffsetsMultiPeaksTest.h index 6adbaedc2a78560469809db114c046e1902173e8..97c55f0ee4135394c0f9808dc7689e8c789d5dfc 100644 --- a/Framework/Algorithms/test/GetDetOffsetsMultiPeaksTest.h +++ b/Framework/Algorithms/test/GetDetOffsetsMultiPeaksTest.h @@ -430,7 +430,7 @@ public: //---------------------------------------------------------------------------------------------- /** Generate noisy data in a workspace */ - void generateNoisyData(MatrixWorkspace_sptr WS) { + void generateNoisyData(const MatrixWorkspace_sptr &WS) { auto &Y = WS->mutableY(0); Y.assign(Y.size(), static_cast(rand() % 5)); diff --git a/Framework/Algorithms/test/GetEiMonDet3Test.h b/Framework/Algorithms/test/GetEiMonDet3Test.h index c5cf0ac1f5cb090ca8c5f0d351d15987ffb1b430..111ea70a6a4ae3f542210aca8e1260339f611469 100644 --- a/Framework/Algorithms/test/GetEiMonDet3Test.h +++ b/Framework/Algorithms/test/GetEiMonDet3Test.h @@ -8,6 +8,8 @@ #include +#include + #include "MantidAPI/Axis.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAlgorithms/ExtractSpectra2.h" @@ -157,7 +159,7 @@ public: } private: - static void attachInstrument(MatrixWorkspace_sptr targetWs) { + static void attachInstrument(const MatrixWorkspace_sptr &targetWs) { // The reference frame used by createInstrumentForWorkspaceWithDistances // is left handed with y pointing up, x along beam. @@ -170,8 +172,8 @@ private: detectorRs.emplace_back(-MONITOR_DISTANCE, 0., 0.); // Add more detectors --- these should be treated as the real ones. detectorRs.emplace_back(0., 0., DETECTOR_DISTANCE); - createInstrumentForWorkspaceWithDistances(targetWs, sampleR, sourceR, - detectorRs); + createInstrumentForWorkspaceWithDistances(std::move(targetWs), sampleR, + sourceR, detectorRs); } static MatrixWorkspace_sptr @@ -215,7 +217,8 @@ private: } // Mininum setup for GetEiMonDet3. - static void setupSimple(MatrixWorkspace_sptr ws, GetEiMonDet3 &algorithm) { + static void setupSimple(const MatrixWorkspace_sptr &ws, + GetEiMonDet3 &algorithm) { algorithm.setRethrows(true); TS_ASSERT_THROWS_NOTHING(algorithm.initialize()) TS_ASSERT(algorithm.isInitialized()) diff --git a/Framework/Algorithms/test/He3TubeEfficiencyTest.h b/Framework/Algorithms/test/He3TubeEfficiencyTest.h index 8488bb39b1e99a50be2c7b2735044cf54427e3b3..6db24d8af3fc433346fc81a4095b1ec9cd903c1a 100644 --- a/Framework/Algorithms/test/He3TubeEfficiencyTest.h +++ b/Framework/Algorithms/test/He3TubeEfficiencyTest.h @@ -30,7 +30,7 @@ using Mantid::HistogramData::Counts; using Mantid::HistogramData::CountStandardDeviations; namespace He3TubeEffeciencyHelper { -void createWorkspace2DInADS(const std::string inputWS) { +void createWorkspace2DInADS(const std::string &inputWS) { const int nspecs(4); const int nbins(5); @@ -58,7 +58,7 @@ void createWorkspace2DInADS(const std::string inputWS) { loader.execute(); } -void createEventWorkspaceInADS(const std::string inputEvWS) { +void createEventWorkspaceInADS(const std::string &inputEvWS) { EventWorkspace_sptr event = WorkspaceCreationHelper::createEventWorkspace(4, 5, 5, 0, 0.9, 3, 0); event->getAxis(0)->unit() = UnitFactory::Instance().create("Wavelength"); diff --git a/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h b/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h index a3037f1d0cecc51eecb35969c0df925a0bfb4d08..d4fc9f315599719e67e44dbdb1c9c3f21eb6eb22 100644 --- a/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h +++ b/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h @@ -24,7 +24,7 @@ std::vector getTextAxisLabels() { std::vector getNumericAxisLabels() { return {2.2, 3.3, 4.4}; } void storeWorkspaceInADS(std::string const &workspaceName, - MatrixWorkspace_sptr workspace) { + const MatrixWorkspace_sptr &workspace) { SetUpADSWithWorkspace ads(workspaceName, workspace); } diff --git a/Framework/Algorithms/test/IntegrateByComponentTest.h b/Framework/Algorithms/test/IntegrateByComponentTest.h index 83f579d6e567645a282d253832e80631b6405c0b..efb8aa33fce4686639b6525cee86823dcecce109 100644 --- a/Framework/Algorithms/test/IntegrateByComponentTest.h +++ b/Framework/Algorithms/test/IntegrateByComponentTest.h @@ -240,7 +240,7 @@ public: } private: - void ABCtestWorkspace(std::string inputWSname, bool mask) { + void ABCtestWorkspace(const std::string &inputWSname, bool mask) { int nSpectra(12); Workspace2D_sptr ws2D = WorkspaceCreationHelper::create2DWorkspaceWhereYIsWorkspaceIndex( diff --git a/Framework/Algorithms/test/IntegrationTest.h b/Framework/Algorithms/test/IntegrationTest.h index 9fa007b15c79c6de1e00059657d1091bae155cad..e99316d0e09a15906a1f0558b9652a4745136661 100644 --- a/Framework/Algorithms/test/IntegrationTest.h +++ b/Framework/Algorithms/test/IntegrationTest.h @@ -166,7 +166,7 @@ public: assertRangeWithPartialBins(input); } - void doTestEvent(std::string inName, std::string outName, + void doTestEvent(const std::string &inName, const std::string &outName, int StartWorkspaceIndex, int EndWorkspaceIndex) { int numPixels = 100; int numBins = 50; @@ -229,8 +229,8 @@ public: doTestEvent("inWS", "inWS", 10, 29); } - void doTestRebinned(const std::string RangeLower, - const std::string RangeUpper, + void doTestRebinned(const std::string &RangeLower, + const std::string &RangeUpper, const int StartWorkspaceIndex, const int EndWorkspaceIndex, const bool IncludePartialBins, const int expectedNumHists, @@ -290,7 +290,7 @@ public: doTestRebinned("-1.5", "1.75", 0, 3, true, 4, truth); } - void makeRealBinBoundariesWorkspace(const std::string inWsName) { + void makeRealBinBoundariesWorkspace(const std::string &inWsName) { const unsigned int lenX = 11, lenY = 10, lenE = lenY; Workspace_sptr wsAsWs = @@ -326,9 +326,9 @@ public: AnalysisDataService::Instance().add(inWsName, ws); } - void doTestRealBinBoundaries(const std::string inWsName, - const std::string rangeLower, - const std::string rangeUpper, + void doTestRealBinBoundaries(const std::string &inWsName, + const std::string &rangeLower, + const std::string &rangeUpper, const double expectedVal, const bool checkRanges = false, const bool IncPartialBins = false) { @@ -707,7 +707,7 @@ public: } template - void wsBoundsTest(std::string workspace, int startIndex, int endIndex, + void wsBoundsTest(const std::string &workspace, int startIndex, int endIndex, F boundsAssert) { MatrixWorkspace_sptr input; TS_ASSERT_THROWS_NOTHING( @@ -732,8 +732,9 @@ public: } void testStartWsIndexOutOfBounds() { - auto boundsAssert = [](MatrixWorkspace_sptr, MatrixWorkspace_sptr output, - int, int endIndex) { + auto boundsAssert = [](const MatrixWorkspace_sptr &, + const MatrixWorkspace_sptr &output, int, + int endIndex) { TS_ASSERT_EQUALS(output->getNumberHistograms(), endIndex + 1); }; @@ -741,8 +742,9 @@ public: } void testStartWSIndexGreaterThanEnd() { - auto boundsAssert = [](MatrixWorkspace_sptr input, - MatrixWorkspace_sptr output, int startIndex, int) { + auto boundsAssert = [](const MatrixWorkspace_sptr &input, + const MatrixWorkspace_sptr &output, int startIndex, + int) { TS_ASSERT_EQUALS(output->getNumberHistograms(), input->getNumberHistograms() - startIndex); }; @@ -751,8 +753,8 @@ public: } void testStartWSIndexEqualsEnd() { - auto boundsAssert = [](MatrixWorkspace_sptr, MatrixWorkspace_sptr output, - int, int) { + auto boundsAssert = [](const MatrixWorkspace_sptr &, + const MatrixWorkspace_sptr &output, int, int) { TS_ASSERT_EQUALS(output->getNumberHistograms(), 1); }; @@ -780,7 +782,7 @@ public: } private: - void assertRangeWithPartialBins(Workspace_sptr input) { + void assertRangeWithPartialBins(const Workspace_sptr &input) { Integration alg; alg.setRethrows(false); TS_ASSERT_THROWS_NOTHING(alg.initialize()); diff --git a/Framework/Algorithms/test/LineProfileTest.h b/Framework/Algorithms/test/LineProfileTest.h index 1ceace8fe27a54997b72cf366a13598b8f35d3ac..ec4e372c533d4adffb45670f906476d1c70ab5ec 100644 --- a/Framework/Algorithms/test/LineProfileTest.h +++ b/Framework/Algorithms/test/LineProfileTest.h @@ -584,9 +584,9 @@ public: } private: - MatrixWorkspace_sptr profileOverTwoSpectra(MatrixWorkspace_sptr inputWS, - const int start, const int end, - const std::string &mode) { + MatrixWorkspace_sptr + profileOverTwoSpectra(const MatrixWorkspace_sptr &inputWS, const int start, + const int end, const std::string &mode) { LineProfile alg; // Don't put output in ADS by default alg.setChild(true); diff --git a/Framework/Algorithms/test/MCInteractionVolumeTest.h b/Framework/Algorithms/test/MCInteractionVolumeTest.h index cb97ba7658a2c1f63234047ac78edecc8136d8a9..199fa0f9c2716b3dae098704a14c84b6a8569e32 100644 --- a/Framework/Algorithms/test/MCInteractionVolumeTest.h +++ b/Framework/Algorithms/test/MCInteractionVolumeTest.h @@ -358,7 +358,8 @@ private: Mantid::Kernel::Logger g_log{"MCInteractionVolumeTest"}; void TestGeneratedTracks(const V3D startPos, const V3D endPos, - const Track beforeScatter, const Track afterScatter, + const Track &beforeScatter, + const Track &afterScatter, const Mantid::Geometry::IObject &shape) { // check the generated tracks share the same start point (the scatter point) TS_ASSERT_EQUALS(beforeScatter.startPoint(), afterScatter.startPoint()); diff --git a/Framework/Algorithms/test/MagFormFactorCorrectionTest.h b/Framework/Algorithms/test/MagFormFactorCorrectionTest.h index 8f2cdb2d61f76124f2ce91633708e3c5b59f1871..2ec64fbbb6c507956aa771f2d5ee42746d238fc1 100644 --- a/Framework/Algorithms/test/MagFormFactorCorrectionTest.h +++ b/Framework/Algorithms/test/MagFormFactorCorrectionTest.h @@ -91,7 +91,7 @@ private: std::string formFactorWSname; // Creates a fake workspace - void createWorkspaceMag(bool isHistogram, std::string wsname) { + void createWorkspaceMag(bool isHistogram, const std::string &wsname) { const int nspecs(10); const int nbins(50); const double invfourPiSqr = 1. / (16. * M_PI * M_PI); @@ -116,8 +116,9 @@ private: } // Checks that all the workspaces are consistent (in = out*ff) - double checkWorkspaces(MatrixWorkspace_sptr in, MatrixWorkspace_sptr out, - MatrixWorkspace_sptr ff) { + double checkWorkspaces(const MatrixWorkspace_sptr &in, + const MatrixWorkspace_sptr &out, + const MatrixWorkspace_sptr &ff) { const int64_t nbins = in->blocksize(); const int64_t nspecs = in->getNumberHistograms(); double df2 = 0., df; diff --git a/Framework/Algorithms/test/MergeLogsTest.h b/Framework/Algorithms/test/MergeLogsTest.h index 535868d98a41d1bc49bb761b4aacdda2e66da9d9..624b44238ef28a8358c067a6405b66ed5853a5f1 100644 --- a/Framework/Algorithms/test/MergeLogsTest.h +++ b/Framework/Algorithms/test/MergeLogsTest.h @@ -116,7 +116,7 @@ public: return log; } - void testLogValues(MatrixWorkspace_sptr ws, const std::string &name, + void testLogValues(const MatrixWorkspace_sptr &ws, const std::string &name, const int msize, double value) { TimeSeriesProperty *log = ws->run().getTimeSeriesProperty(name); @@ -131,7 +131,7 @@ public: } // msize1 < msize2! - void testLogValues(MatrixWorkspace_sptr ws, const std::string &name, + void testLogValues(const MatrixWorkspace_sptr &ws, const std::string &name, const int msize1, const int msize2, const double v1, const double v2) { TimeSeriesProperty *log = diff --git a/Framework/Algorithms/test/MergeRunsTest.h b/Framework/Algorithms/test/MergeRunsTest.h index a5e92fe227bdf676e322430c3e4f8ff5f308b814..3e696152726b57bee9bf44ce6083dfaca4cbfe99 100644 --- a/Framework/Algorithms/test/MergeRunsTest.h +++ b/Framework/Algorithms/test/MergeRunsTest.h @@ -40,8 +40,8 @@ private: MergeRuns merge; /// Helper method to add an 'nperiods' log value to each workspace in a group. - void add_periods_logs(WorkspaceGroup_sptr ws, bool calculateNPeriods = true, - int nperiods = -1) { + void add_periods_logs(const WorkspaceGroup_sptr &ws, + bool calculateNPeriods = true, int nperiods = -1) { if (calculateNPeriods) { nperiods = static_cast(ws->size()); } @@ -268,7 +268,7 @@ private: return c; } - void do_test_treat_as_non_period_groups(WorkspaceGroup_sptr input) { + void do_test_treat_as_non_period_groups(const WorkspaceGroup_sptr &input) { MatrixWorkspace_sptr sampleInputWorkspace = boost::dynamic_pointer_cast(input->getItem(0)); const double uniformSignal = sampleInputWorkspace->y(0)[0]; @@ -320,7 +320,7 @@ public: "in6", WorkspaceCreationHelper::create2DWorkspaceBinned(3, 3, 2., 2.)); } - void checkOutput(std::string wsname) { + void checkOutput(const std::string &wsname) { EventWorkspace_sptr output; TimeSeriesProperty *log; int log1, log2, logTot; @@ -874,7 +874,8 @@ public: AnalysisDataService::Instance().remove("outer"); } - void do_test_validation_throws(WorkspaceGroup_sptr a, WorkspaceGroup_sptr b) { + void do_test_validation_throws(const WorkspaceGroup_sptr &a, + const WorkspaceGroup_sptr &b) { MergeRuns alg; alg.setRethrows(true); alg.initialize(); @@ -911,7 +912,7 @@ public: do_test_validation_throws(aCorrupted, a); } - void do_test_with_multiperiod_data(WorkspaceGroup_sptr input) { + void do_test_with_multiperiod_data(const WorkspaceGroup_sptr &input) { // Extract some internal information from the nested workspaces in order to // run test asserts later. const size_t expectedNumHistograms = @@ -1356,8 +1357,8 @@ public: 3); } - void do_test_merge_two_workspaces_then_third(std::string mergeType, - std::string result) { + void do_test_merge_two_workspaces_then_third(const std::string &mergeType, + const std::string &result) { auto ws = create_group_workspace_with_sample_logs( mergeType, "prop1", 1.0, 2.0, 3.0, 4.0); @@ -1391,8 +1392,8 @@ public: "1, 2, 5"); } - void do_test_merging_two_workspaces_both_already_merged(std::string mergeType, - std::string result) { + void do_test_merging_two_workspaces_both_already_merged( + const std::string &mergeType, const std::string &result) { auto ws = create_group_workspace_with_sample_logs( mergeType, "prop1", 1.0, 2.0, 3.0, 4.0); diff --git a/Framework/Algorithms/test/ModeratorTzeroLinearTest.h b/Framework/Algorithms/test/ModeratorTzeroLinearTest.h index 011ea38cf3b000aee198a45936230aaf07498a09..5c07a2aba506181fe25d027cb156f6386d5f147b 100644 --- a/Framework/Algorithms/test/ModeratorTzeroLinearTest.h +++ b/Framework/Algorithms/test/ModeratorTzeroLinearTest.h @@ -26,7 +26,7 @@ using Mantid::HistogramData::LinearGenerator; using Mantid::Types::Event::TofEvent; namespace { -void addToInstrument(MatrixWorkspace_sptr testWS, +void addToInstrument(const MatrixWorkspace_sptr &testWS, const bool &add_deltaE_mode = false, const bool &add_t0_formula = false) { const double evalue(2.082); // energy corresponding to the first order Bragg diff --git a/Framework/Algorithms/test/MonteCarloAbsorptionTest.h b/Framework/Algorithms/test/MonteCarloAbsorptionTest.h index e9dde8bff9bacee37b7b2f7fd5e4364d9c128d2c..2754ce990002e6de98d665405ce6ff4b98f748e4 100644 --- a/Framework/Algorithms/test/MonteCarloAbsorptionTest.h +++ b/Framework/Algorithms/test/MonteCarloAbsorptionTest.h @@ -40,7 +40,7 @@ struct TestWorkspaceDescriptor { double beamHeight; }; -void addSample(Mantid::API::MatrixWorkspace_sptr ws, +void addSample(const Mantid::API::MatrixWorkspace_sptr &ws, const Environment environment, double beamWidth = 0., double beamHeight = 0.) { using namespace Mantid::API; @@ -403,7 +403,7 @@ private: } Mantid::API::MatrixWorkspace_const_sptr - getOutputWorkspace(Mantid::API::IAlgorithm_sptr alg) { + getOutputWorkspace(const Mantid::API::IAlgorithm_sptr &alg) { using Mantid::API::MatrixWorkspace_sptr; MatrixWorkspace_sptr output = alg->getProperty("OutputWorkspace"); TS_ASSERT(output); @@ -412,8 +412,9 @@ private: return output; } - void verifyDimensions(TestWorkspaceDescriptor wsProps, - Mantid::API::MatrixWorkspace_const_sptr outputWS) { + void + verifyDimensions(TestWorkspaceDescriptor wsProps, + const Mantid::API::MatrixWorkspace_const_sptr &outputWS) { TS_ASSERT_EQUALS(wsProps.nspectra, outputWS->getNumberHistograms()); TS_ASSERT_EQUALS(wsProps.nbins, outputWS->blocksize()); } diff --git a/Framework/Algorithms/test/NormaliseByCurrentTest.h b/Framework/Algorithms/test/NormaliseByCurrentTest.h index 766db44fb1bfee8f2ec4efdc248cf14992fa73a9..6b3ca7a62904d41fa37a06cb7efc23367d82791f 100644 --- a/Framework/Algorithms/test/NormaliseByCurrentTest.h +++ b/Framework/Algorithms/test/NormaliseByCurrentTest.h @@ -9,6 +9,8 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include +#include + #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/Axis.h" #include "MantidAPI/WorkspaceGroup.h" @@ -25,9 +27,10 @@ using namespace Mantid::Algorithms; using namespace Mantid::DataObjects; namespace { -MatrixWorkspace_const_sptr doTest(MatrixWorkspace_sptr inWS, - std::string wsNameOut, double expectedY, - double expectedE, bool calcPcharge = false, +MatrixWorkspace_const_sptr doTest(const MatrixWorkspace_sptr &inWS, + const std::string &wsNameOut, + double expectedY, double expectedE, + bool calcPcharge = false, bool performance = false) { NormaliseByCurrent norm1; if (!norm1.isInitialized()) @@ -87,7 +90,8 @@ MatrixWorkspace_const_sptr doTest(MatrixWorkspace_sptr inWS, return output; } -MatrixWorkspace_const_sptr doTest(std::string wsNameIn, std::string wsNameOut, +MatrixWorkspace_const_sptr doTest(const std::string &wsNameIn, + const std::string &wsNameOut, const double pCharge, double expectedY, double expectedE, bool performance = false) { MatrixWorkspace_sptr inWS = @@ -99,13 +103,14 @@ MatrixWorkspace_const_sptr doTest(std::string wsNameIn, std::string wsNameOut, Mantid::Kernel::UnitFactory::Instance().create("TOF"); inWS->setYUnit("Counts"); - return doTest(inWS, wsNameOut, expectedY, expectedE, true, performance); + return doTest(inWS, std::move(wsNameOut), expectedY, expectedE, true, + performance); } /// Helper method to add necessary log values to simulate multi-period data. /// The algorithm uses these logs to determien how to normalise by the /// current. -void addMultiPeriodLogsTo(MatrixWorkspace_sptr ws, int period, +void addMultiPeriodLogsTo(const MatrixWorkspace_sptr &ws, int period, const std::string &protonCharges) { ArrayProperty *chargeProp = new ArrayProperty("proton_charge_by_period", protonCharges); @@ -119,7 +124,8 @@ void addMultiPeriodLogsTo(MatrixWorkspace_sptr ws, int period, ws->mutableRun().addLogData(currentPeriodProp); } -void addPChargeLogTo(MatrixWorkspace_sptr ws, const double pChargeAccum) { +void addPChargeLogTo(const MatrixWorkspace_sptr &ws, + const double pChargeAccum) { auto pchargeLog = std::make_unique>("proton_charge"); diff --git a/Framework/Algorithms/test/NormaliseByDetectorTest.h b/Framework/Algorithms/test/NormaliseByDetectorTest.h index feb1b287d0433233d2b485d710807ad93c9874f9..8aa3652fe166a4dcad79c6de4af4b7cd9631f280 100644 --- a/Framework/Algorithms/test/NormaliseByDetectorTest.h +++ b/Framework/Algorithms/test/NormaliseByDetectorTest.h @@ -28,8 +28,8 @@ using ScopedFileHelper::ScopedFile; Helper function. Runs LoadParameterAlg, to get an instrument parameter definition from a file onto a workspace. */ -void apply_instrument_parameter_file_to_workspace(MatrixWorkspace_sptr ws, - const ScopedFile &file) { +void apply_instrument_parameter_file_to_workspace( + const MatrixWorkspace_sptr &ws, const ScopedFile &file) { // Load the Instrument Parameter file over the existing test workspace + // instrument. using DataHandling::LoadParameterFile; @@ -46,7 +46,7 @@ Helper method for running the algorithm and simply verifying that it runs without exception producing an output workspace.. */ MatrixWorkspace_sptr -do_test_doesnt_throw_on_execution(MatrixWorkspace_sptr inputWS, +do_test_doesnt_throw_on_execution(const MatrixWorkspace_sptr &inputWS, bool parallel = true) { NormaliseByDetector alg(parallel); alg.setRethrows(true); @@ -102,7 +102,7 @@ private: The fit function is set at the instrument level. */ MatrixWorkspace_sptr create_workspace_with_fitting_functions( - const std::string result_unit = "Wavelength") { + const std::string &result_unit = "Wavelength") { // Create a default workspace with no-fitting functions. MatrixWorkspace_sptr ws = create_workspace_with_no_fitting_functions(); const std::string instrumentName = ws->getInstrument()->getName(); @@ -228,7 +228,8 @@ private: */ MatrixWorkspace_sptr create_workspace_with_incomplete_detector_level_only_fit_functions( - MatrixWorkspace_sptr original = boost::shared_ptr()) { + const MatrixWorkspace_sptr &original = + boost::shared_ptr()) { MatrixWorkspace_sptr ws = original; if (original == nullptr) { // Create a default workspace with no-fitting functions. @@ -274,9 +275,8 @@ private: Helper method for running the algorithm and testing for invalid argument on execution. */ - void - do_test_throws_invalid_argument_on_execution(MatrixWorkspace_sptr inputWS, - bool parallel = false) { + void do_test_throws_invalid_argument_on_execution( + const MatrixWorkspace_sptr &inputWS, bool parallel = false) { NormaliseByDetector alg(parallel); alg.setRethrows(true); alg.initialize(); @@ -651,7 +651,7 @@ public: private: /// Helper method to run common sanity checks. - void do_basic_checks(MatrixWorkspace_sptr normalisedWS) { + void do_basic_checks(const MatrixWorkspace_sptr &normalisedWS) { TS_ASSERT(normalisedWS != nullptr); TS_ASSERT(ws->getNumberHistograms() == normalisedWS->getNumberHistograms()); TS_ASSERT(ws->x(0).size() == normalisedWS->x(0).size()); diff --git a/Framework/Algorithms/test/PDDetermineCharacterizationsTest.h b/Framework/Algorithms/test/PDDetermineCharacterizationsTest.h index 0f2fea3fef97ed0e109a6a0fd3395f5daa686171..f79748f75c1c2c86c4d1805a37c5486881ffd000 100644 --- a/Framework/Algorithms/test/PDDetermineCharacterizationsTest.h +++ b/Framework/Algorithms/test/PDDetermineCharacterizationsTest.h @@ -82,8 +82,8 @@ public: } } - void addRow(ITableWorkspace_sptr wksp, const double freq, const double wl, - const int bank, const std::string &van, + void addRow(const ITableWorkspace_sptr &wksp, const double freq, + const double wl, const int bank, const std::string &van, const std::string &van_back, const std::string &can, const std::string &empty_env, const std::string &empty_inst, const std::string &dmin, const std::string &dmax, @@ -209,8 +209,8 @@ public: return expectedInfo; } - void compareResult(PropertyManager_sptr expected, - PropertyManager_sptr observed) { + void compareResult(const PropertyManager_sptr &expected, + const PropertyManager_sptr &observed) { TS_ASSERT_EQUALS(expected->propertyCount(), observed->propertyCount()); const std::vector &expectedProps = expected->getProperties(); diff --git a/Framework/Algorithms/test/PDFFourierTransformTest.h b/Framework/Algorithms/test/PDFFourierTransformTest.h index ecf820a006954bfef77e04e55e4d2cb69fa53d60..8b39d78f74853f5ff1bdf57d557305490824ba06 100644 --- a/Framework/Algorithms/test/PDFFourierTransformTest.h +++ b/Framework/Algorithms/test/PDFFourierTransformTest.h @@ -32,7 +32,7 @@ namespace { */ Mantid::API::MatrixWorkspace_sptr createWS(size_t n, double dx, const std::string &name, - const std::string unitlabel, + const std::string &unitlabel, const bool withBadValues = false) { Mantid::API::FrameworkManager::Instance(); diff --git a/Framework/Algorithms/test/ParallaxCorrectionTest.h b/Framework/Algorithms/test/ParallaxCorrectionTest.h index b6cdeb9e46e834df0385ccc3701e2cc70cdc3869..36b63cf846c3c0e61a2ce17f3353c72927beb801 100644 --- a/Framework/Algorithms/test/ParallaxCorrectionTest.h +++ b/Framework/Algorithms/test/ParallaxCorrectionTest.h @@ -27,7 +27,7 @@ using Mantid::Geometry::DetectorInfo; using Mantid::Kernel::V3D; namespace { -bool compare(MatrixWorkspace_sptr w1, MatrixWorkspace_sptr w2) { +bool compare(const MatrixWorkspace_sptr &w1, const MatrixWorkspace_sptr &w2) { CompareWorkspaces comparator; comparator.initialize(); comparator.setChild(true); diff --git a/Framework/Algorithms/test/PerformIndexOperationsTest.h b/Framework/Algorithms/test/PerformIndexOperationsTest.h index 1502a093f78138e316fc1f1012e632863c8300d6..0a0a02992723e10d9f71b4b2a3170a44fa09a214 100644 --- a/Framework/Algorithms/test/PerformIndexOperationsTest.h +++ b/Framework/Algorithms/test/PerformIndexOperationsTest.h @@ -16,7 +16,7 @@ using Mantid::Algorithms::PerformIndexOperations; using namespace Mantid::API; MatrixWorkspace_const_sptr -doExecute(MatrixWorkspace_sptr inWS, +doExecute(const MatrixWorkspace_sptr &inWS, const std::string &processingInstructions) { // Name of the output workspace. std::string outWSName("PerformIndexOperationsTest_OutputWS"); diff --git a/Framework/Algorithms/test/PoissonErrorsTest.h b/Framework/Algorithms/test/PoissonErrorsTest.h index 4967c3533d84b1d3808330cb9eaa9c0b8904cdfb..1651bc0bdefa202e1839498487218acfb80a3b73 100644 --- a/Framework/Algorithms/test/PoissonErrorsTest.h +++ b/Framework/Algorithms/test/PoissonErrorsTest.h @@ -7,6 +7,8 @@ #pragma once #include +#include + #include #include "MantidAPI/AnalysisDataService.h" @@ -238,15 +240,18 @@ public: } private: - void checkData(MatrixWorkspace_sptr work_in1, MatrixWorkspace_sptr work_in2, - MatrixWorkspace_sptr work_out1) { + void checkData(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1) { // default to a horizontal loop orientation - checkData(work_in1, work_in2, work_out1, 0); + checkData(std::move(work_in1), std::move(work_in2), std::move(work_out1), + 0); } // loopOrientation 0=Horizontal, 1=Vertical - void checkData(MatrixWorkspace_sptr work_in1, MatrixWorkspace_sptr work_in2, - MatrixWorkspace_sptr work_out1, int loopOrientation) { + void checkData(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1, int loopOrientation) { size_t ws2LoopCount = 0; if (work_in2->size() > 0) { ws2LoopCount = work_in1->size() / work_in2->size(); @@ -267,9 +272,9 @@ private: } } - void checkDataItem(MatrixWorkspace_sptr work_in1, - MatrixWorkspace_sptr work_in2, - MatrixWorkspace_sptr work_out1, size_t i, + void checkDataItem(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1, size_t i, size_t ws2Index) { // printf("I=%d\tws2Index=%d\n",i,ws2Index); double sig1 = diff --git a/Framework/Algorithms/test/PolarizationCorrectionFredrikzeTest.h b/Framework/Algorithms/test/PolarizationCorrectionFredrikzeTest.h index 4af539c20c9306d9e1ad7026f6169140b769b3c0..b558ac16662702b1aa0773d8f2bd80026b7b2376 100644 --- a/Framework/Algorithms/test/PolarizationCorrectionFredrikzeTest.h +++ b/Framework/Algorithms/test/PolarizationCorrectionFredrikzeTest.h @@ -79,7 +79,7 @@ public: return group; } - MatrixWorkspace_sptr makeEfficiencies(Workspace_sptr inWS, + MatrixWorkspace_sptr makeEfficiencies(const Workspace_sptr &inWS, const std::string &rho, const std::string &pp, const std::string &alpha = "", @@ -214,7 +214,8 @@ public: } } - void setInstrument(Workspace_sptr ws, const std::string &instrument_name) { + void setInstrument(const Workspace_sptr &ws, + const std::string &instrument_name) { auto alg = AlgorithmManager::Instance().createUnmanaged("LoadInstrument"); AnalysisDataService::Instance().addOrReplace("dummy", ws); alg->initialize(); diff --git a/Framework/Algorithms/test/Rebin2DTest.h b/Framework/Algorithms/test/Rebin2DTest.h index 3d458558e089b177118982efacd355e7f27a64e7..3326dbccec4812e03c241097a00ba6701fd0b064 100644 --- a/Framework/Algorithms/test/Rebin2DTest.h +++ b/Framework/Algorithms/test/Rebin2DTest.h @@ -76,7 +76,7 @@ MatrixWorkspace_sptr makeInputWS(const bool distribution, return ws; } -MatrixWorkspace_sptr runAlgorithm(MatrixWorkspace_sptr inputWS, +MatrixWorkspace_sptr runAlgorithm(const MatrixWorkspace_sptr &inputWS, const std::string &axis1Params, const std::string &axis2Params, const bool UseFractionalArea = false) { @@ -273,9 +273,9 @@ public: } private: - void checkData(MatrixWorkspace_const_sptr outputWS, const size_t nxvalues, - const size_t nhist, const bool dist, const bool onAxis1, - const bool small_bins = false) { + void checkData(const MatrixWorkspace_const_sptr &outputWS, + const size_t nxvalues, const size_t nhist, const bool dist, + const bool onAxis1, const bool small_bins = false) { TS_ASSERT_EQUALS(outputWS->getNumberHistograms(), nhist); TS_ASSERT_EQUALS(outputWS->isDistribution(), dist); // Axis sizes diff --git a/Framework/Algorithms/test/ReflectometryMomentumTransferTest.h b/Framework/Algorithms/test/ReflectometryMomentumTransferTest.h index f3e8e41787b8a1f06e7941a0a9e9cb33488cab64..d4c076943fbff006e40ab3464168ea7efd551247 100644 --- a/Framework/Algorithms/test/ReflectometryMomentumTransferTest.h +++ b/Framework/Algorithms/test/ReflectometryMomentumTransferTest.h @@ -283,7 +283,7 @@ private: TS_ASSERT(!alg->isExecuted()) } - static API::Algorithm_sptr make_alg(API::MatrixWorkspace_sptr inputWS, + static API::Algorithm_sptr make_alg(const API::MatrixWorkspace_sptr &inputWS, const std::string &sumType, const std::vector &foreground) { auto alg = boost::make_shared(); diff --git a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h index 382dec5feae141945268d8d4082af78b40841948..e0d381d65367af75e6305dc47df6a211c8580508 100644 --- a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h +++ b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h @@ -964,7 +964,7 @@ private: const double wavelengthMin, const double wavelengthMax, const std::string &procInstr, - MatrixWorkspace_sptr transWS, + const MatrixWorkspace_sptr &transWS, const bool multiple_runs) { setupAlgorithm(alg, wavelengthMin, wavelengthMax, procInstr); alg.setProperty("FirstTransmissionRun", transWS); @@ -981,7 +981,7 @@ private: const double wavelengthMin, const double wavelengthMax, const std::string &procInstr, - MatrixWorkspace_sptr inputWS, + const MatrixWorkspace_sptr &inputWS, const bool integrate) { setupAlgorithm(alg, wavelengthMin, wavelengthMax, procInstr); alg.setProperty("InputWorkspace", inputWS); @@ -997,8 +997,9 @@ private: } } - void setupAlgorithmForBackgroundSubtraction(ReflectometryReductionOne2 &alg, - MatrixWorkspace_sptr inputWS) { + void + setupAlgorithmForBackgroundSubtraction(ReflectometryReductionOne2 &alg, + const MatrixWorkspace_sptr &inputWS) { setupAlgorithm(alg, 0, 5, "3"); alg.setChild(false); // required to get history alg.setProperty("InputWorkspace", inputWS); @@ -1105,7 +1106,7 @@ private: return ws; } - void checkWorkspaceHistory(MatrixWorkspace_sptr ws, + void checkWorkspaceHistory(const MatrixWorkspace_sptr &ws, std::vector const &expected, bool const unroll = true) { auto wsHistory = ws->getHistory(); @@ -1116,19 +1117,20 @@ private: auto childHistories = lastAlgHistory->getChildHistories(); std::transform(childHistories.cbegin(), childHistories.cend(), std::back_inserter(algNames), - [](AlgorithmHistory_const_sptr childAlg) { + [](const AlgorithmHistory_const_sptr &childAlg) { return childAlg->name(); }); } else if (!unroll) { - std::transform(algHistories.cbegin(), algHistories.cend(), - std::back_inserter(algNames), - [](AlgorithmHistory_sptr alg) { return alg->name(); }); + std::transform( + algHistories.cbegin(), algHistories.cend(), + std::back_inserter(algNames), + [](const AlgorithmHistory_sptr &alg) { return alg->name(); }); } TS_ASSERT_EQUALS(algNames, expected); } void checkHistoryAlgorithmProperties( - MatrixWorkspace_sptr ws, size_t toplevelIdx, size_t childIdx, + const MatrixWorkspace_sptr &ws, size_t toplevelIdx, size_t childIdx, std::map const &expected) { auto parentHist = ws->getHistory().getAlgorithmHistory(toplevelIdx); auto childHistories = parentHist->getChildHistories(); diff --git a/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h b/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h index 7c41d3fbc7bf35b28ba83de2c06a4692398423e5..38595e0e82eb20039485c8cbfea9e3543f023e0f 100644 --- a/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h +++ b/Framework/Algorithms/test/ReflectometryReductionOneAuto2Test.h @@ -1680,9 +1680,8 @@ public: } private: - MatrixWorkspace_sptr - createFloodWorkspace(Mantid::Geometry::Instrument_const_sptr instrument, - size_t n = 4) { + MatrixWorkspace_sptr createFloodWorkspace( + const Mantid::Geometry::Instrument_const_sptr &instrument, size_t n = 4) { size_t detid = 1; auto flood = create2DWorkspace(int(n), 1); if (n == 4) { diff --git a/Framework/Algorithms/test/ReflectometryReductionOneAuto3Test.h b/Framework/Algorithms/test/ReflectometryReductionOneAuto3Test.h index 23b0201f6bf53bd95e3131456b2c1b2de82eb581..2041bcb2bf2b65226eecb16d0747376d0f861f87 100644 --- a/Framework/Algorithms/test/ReflectometryReductionOneAuto3Test.h +++ b/Framework/Algorithms/test/ReflectometryReductionOneAuto3Test.h @@ -1594,9 +1594,8 @@ public: } private: - MatrixWorkspace_sptr - createFloodWorkspace(Mantid::Geometry::Instrument_const_sptr instrument, - size_t n = 4) { + MatrixWorkspace_sptr createFloodWorkspace( + const Mantid::Geometry::Instrument_const_sptr &instrument, size_t n = 4) { size_t detid = 1; auto flood = create2DWorkspace(int(n), 1); if (n == 4) { diff --git a/Framework/Algorithms/test/ReflectometrySumInQTest.h b/Framework/Algorithms/test/ReflectometrySumInQTest.h index 0dd4fdcb4d0253625e75efdece79c551ff88b4c8..08f40af60478f3ca42e6dd8387a404ba060a8bff 100644 --- a/Framework/Algorithms/test/ReflectometrySumInQTest.h +++ b/Framework/Algorithms/test/ReflectometrySumInQTest.h @@ -29,7 +29,7 @@ public: static void destroySuite(ReflectometrySumInQTest *suite) { delete suite; } static Mantid::API::MatrixWorkspace_sptr - convertToWavelength(Mantid::API::MatrixWorkspace_sptr ws) { + convertToWavelength(const Mantid::API::MatrixWorkspace_sptr &ws) { using namespace Mantid; auto toWavelength = API::AlgorithmManager::Instance().createUnmanaged("ConvertUnits"); @@ -44,7 +44,7 @@ public: } static Mantid::API::MatrixWorkspace_sptr - detectorsOnly(Mantid::API::MatrixWorkspace_sptr ws) { + detectorsOnly(const Mantid::API::MatrixWorkspace_sptr &ws) { using namespace Mantid; auto &specturmInfo = ws->spectrumInfo(); std::vector detectorIndices; diff --git a/Framework/Algorithms/test/RemoveLowResTOFTest.h b/Framework/Algorithms/test/RemoveLowResTOFTest.h index 5e7b3aab3fd83f01cb5446c035acc2d0dedad20c..d332578bed373a603676f13a03bbd1c1946f3f69 100644 --- a/Framework/Algorithms/test/RemoveLowResTOFTest.h +++ b/Framework/Algorithms/test/RemoveLowResTOFTest.h @@ -31,7 +31,7 @@ private: int NUMPIXELS; int NUMBINS; - void makeFakeEventWorkspace(std::string wsName) { + void makeFakeEventWorkspace(const std::string &wsName) { // Make an event workspace with 2 events in each bin. EventWorkspace_sptr test_in = WorkspaceCreationHelper::createEventWorkspace( NUMPIXELS, NUMBINS, NUMBINS, 0.0, BIN_DELTA, 2); diff --git a/Framework/Algorithms/test/RemoveMaskedSpectraTest.h b/Framework/Algorithms/test/RemoveMaskedSpectraTest.h index 9bda9c5894ae54cb149bd2d2418b1eced31a5a00..8d182e7a87aca95db1efb99421d37029b032bbf1 100644 --- a/Framework/Algorithms/test/RemoveMaskedSpectraTest.h +++ b/Framework/Algorithms/test/RemoveMaskedSpectraTest.h @@ -106,7 +106,7 @@ private: return space; } - void maskWorkspace(MatrixWorkspace_sptr ws) { + void maskWorkspace(const MatrixWorkspace_sptr &ws) { std::vector spectra(3); spectra[0] = 1; spectra[1] = 3; @@ -119,8 +119,8 @@ private: } MatrixWorkspace_sptr - runAlgorithm(MatrixWorkspace_sptr inputWS, - MatrixWorkspace_sptr maskedWS = MatrixWorkspace_sptr()) { + runAlgorithm(const MatrixWorkspace_sptr &inputWS, + const MatrixWorkspace_sptr &maskedWS = MatrixWorkspace_sptr()) { // Name of the output workspace. std::string outWSName("RemoveMaskedSpectraTest_OutputWS"); diff --git a/Framework/Algorithms/test/RemovePromptPulseTest.h b/Framework/Algorithms/test/RemovePromptPulseTest.h index 83f907853a6762b4d301a83da0d8652530c1f243..e21a5651c8c481332d79589bc8c4b8b70a93e06b 100644 --- a/Framework/Algorithms/test/RemovePromptPulseTest.h +++ b/Framework/Algorithms/test/RemovePromptPulseTest.h @@ -32,7 +32,7 @@ private: std::string inWSName; std::string outWSName; - void makeFakeEventWorkspace(std::string wsName) { + void makeFakeEventWorkspace(const std::string &wsName) { // Make an event workspace with 2 events in each bin. EventWorkspace_sptr test_in = WorkspaceCreationHelper::createEventWorkspace( NUMPIXELS, NUMBINS, NUMEVENTS, 1000., BIN_DELTA, 2); diff --git a/Framework/Algorithms/test/RemoveWorkspaceHistoryTest.h b/Framework/Algorithms/test/RemoveWorkspaceHistoryTest.h index 7ca2bdcfd94cea892ce1673b944c19657b08f885..81ff558e5e32928516f89fbb1e7f8ac6df267579 100644 --- a/Framework/Algorithms/test/RemoveWorkspaceHistoryTest.h +++ b/Framework/Algorithms/test/RemoveWorkspaceHistoryTest.h @@ -64,7 +64,7 @@ private: } }; - void createWorkspace(std::string wsName) { + void createWorkspace(const std::string &wsName) { // create a fake workspace for testing boost::shared_ptr input = boost::make_shared(); diff --git a/Framework/Algorithms/test/ReplaceSpecialValuesTest.h b/Framework/Algorithms/test/ReplaceSpecialValuesTest.h index 322e88fbf98e476ddbeb2af118a1b5d7178174f8..ff1ef4fe38df6dde1db5ca7edd60c9a1fda377fd 100644 --- a/Framework/Algorithms/test/ReplaceSpecialValuesTest.h +++ b/Framework/Algorithms/test/ReplaceSpecialValuesTest.h @@ -247,8 +247,9 @@ public: AnalysisDataService::Instance().remove("InputWS"); } - void checkValues(MatrixWorkspace_sptr inputWS, MatrixWorkspace_sptr result, - bool naNCheck, bool infCheck) { + void checkValues(const MatrixWorkspace_sptr &inputWS, + const MatrixWorkspace_sptr &result, bool naNCheck, + bool infCheck) { for (size_t i = 0; i < result->getNumberHistograms(); ++i) { for (int j = 1; j < 5; ++j) { diff --git a/Framework/Algorithms/test/RingProfileTest.h b/Framework/Algorithms/test/RingProfileTest.h index 725ed7fbb384b73fa7518e28af1960f9f2493edc..5eef8b18169bbb410979341208ed6fe74e542885 100644 --- a/Framework/Algorithms/test/RingProfileTest.h +++ b/Framework/Algorithms/test/RingProfileTest.h @@ -148,8 +148,9 @@ public: return goodWS; } - void configure_ring_profile(RingProfile &alg, MatrixWorkspace_sptr inws, - std::vector centre, int num_bins, + void configure_ring_profile(RingProfile &alg, + const MatrixWorkspace_sptr &inws, + const std::vector ¢re, int num_bins, double start_angle = 0, double min_radius = 0, double max_radius = 1000, bool anticlock = true) { TS_ASSERT_THROWS_NOTHING(alg.initialize()); diff --git a/Framework/Algorithms/test/RunCombinationHelperTest.h b/Framework/Algorithms/test/RunCombinationHelperTest.h index f969377a6ea794d3b75619e10ec31f72c9412c8d..e2319d0eefe4615a7ed86f452a11d99cc47e104f 100644 --- a/Framework/Algorithms/test/RunCombinationHelperTest.h +++ b/Framework/Algorithms/test/RunCombinationHelperTest.h @@ -187,7 +187,7 @@ public: } private: - void setUnits(MatrixWorkspace_sptr ws) { + void setUnits(const MatrixWorkspace_sptr &ws) { ws->getAxis(0)->unit() = UnitFactory::Instance().create("TOF"); ws->getAxis(1)->unit() = UnitFactory::Instance().create("Momentum"); ws->setYUnit("Counts"); diff --git a/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h b/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h index a950bb69a8582eda616f6f203e5ea70c109c5748..8ee9edd6fa851d536185c2a73151e19067b511e8 100644 --- a/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h +++ b/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h @@ -9,6 +9,8 @@ #include "MantidAlgorithms/SANSCollimationLengthEstimator.h" #include +#include + #include "MantidGeometry/Instrument.h" #include "MantidGeometry/Instrument/Detector.h" #include "MantidGeometry/Objects/CSGObject.h" @@ -71,8 +73,8 @@ createTestInstrument(const Mantid::detid_t id, * Set the instrument parameters */ void setInstrumentParametersForTOFSANS( - const Mantid::API::MatrixWorkspace_sptr ws, std::string methodType = "", - double collimationLengthCorrection = 20, + const Mantid::API::MatrixWorkspace_sptr &ws, + const std::string &methodType = "", double collimationLengthCorrection = 20, double collimationLengthIncrement = 2, double guideCutoff = 130, double numberOfGuides = 5) { auto &pmap = ws->instrumentParameters(); @@ -106,8 +108,8 @@ void setInstrumentParametersForTOFSANS( /* * Add a timer series sample log */ -void addSampleLog(Mantid::API::MatrixWorkspace_sptr workspace, - std::string sampleLogName, double value, +void addSampleLog(const Mantid::API::MatrixWorkspace_sptr &workspace, + const std::string &sampleLogName, double value, unsigned int length) { auto timeSeries = new Mantid::Kernel::TimeSeriesProperty(sampleLogName); @@ -124,7 +126,7 @@ void addSampleLog(Mantid::API::MatrixWorkspace_sptr workspace, */ Mantid::API::MatrixWorkspace_sptr createTestWorkspace( const size_t nhist, const double x0, const double x1, const double dx, - std::string methodType = "", double collimationLengthCorrection = 20, + const std::string &methodType = "", double collimationLengthCorrection = 20, double collimationLengthIncrement = 2, double guideCutoff = 130, double numberOfGuides = 5, V3D sourcePosition = V3D(0.0, 0.0, -25.0), V3D samplePosition = V3D(0.0, 0.0, 0.0), @@ -142,8 +144,8 @@ Mantid::API::MatrixWorkspace_sptr createTestWorkspace( // Set the instrument parameters setInstrumentParametersForTOFSANS( - ws2d, methodType, collimationLengthCorrection, collimationLengthIncrement, - guideCutoff, numberOfGuides); + ws2d, std::move(methodType), collimationLengthCorrection, + collimationLengthIncrement, guideCutoff, numberOfGuides); // Add sample log details if (!guideLogDetails.empty()) { diff --git a/Framework/Algorithms/test/SampleLogsBehaviourTest.h b/Framework/Algorithms/test/SampleLogsBehaviourTest.h index 6feaafde477818b56b4ca77f6af31d1fe579a142..3cc82415ad85894cd16e19cfb99b924ee337d026 100644 --- a/Framework/Algorithms/test/SampleLogsBehaviourTest.h +++ b/Framework/Algorithms/test/SampleLogsBehaviourTest.h @@ -221,7 +221,7 @@ public: return ws; } - void testLogUnits(MatrixWorkspace_sptr ws) { + void testLogUnits(const MatrixWorkspace_sptr &ws) { // All units must not have changed: TS_ASSERT_EQUALS(ws->getLog("A")->units(), "A_unit") TS_ASSERT_EQUALS(ws->getLog("B")->units(), "B_unit") diff --git a/Framework/Algorithms/test/ScaleTest.h b/Framework/Algorithms/test/ScaleTest.h index 08df28cbaef79bdc53831ab0ee166814e9da4da9..973f48ebc645eca819f5c1a5bb9843aa42906f0e 100644 --- a/Framework/Algorithms/test/ScaleTest.h +++ b/Framework/Algorithms/test/ScaleTest.h @@ -127,7 +127,7 @@ private: } } - void doTestScaleWithDx(std::string type, bool outIsIn = false) { + void doTestScaleWithDx(const std::string &type, bool outIsIn = false) { // Arrange const double xValue = 1.222; const double value = 5; diff --git a/Framework/Algorithms/test/SetInstrumentParameterTest.h b/Framework/Algorithms/test/SetInstrumentParameterTest.h index b718fba691a09e3d44024824a3e4101b07720310..7da3ec3c0c43653401003b55f3346ae955e678ca 100644 --- a/Framework/Algorithms/test/SetInstrumentParameterTest.h +++ b/Framework/Algorithms/test/SetInstrumentParameterTest.h @@ -173,10 +173,10 @@ public: } MatrixWorkspace_sptr - ExecuteAlgorithm(MatrixWorkspace_sptr testWS, std::string cmptName, - std::string detList, std::string paramName, - std::string paramValue, std::string paramType = "", - bool fails = false) { + ExecuteAlgorithm(MatrixWorkspace_sptr testWS, const std::string &cmptName, + const std::string &detList, const std::string ¶mName, + const std::string ¶mValue, + const std::string ¶mType = "", bool fails = false) { // add the workspace to the ADS AnalysisDataService::Instance().addOrReplace( "SetInstrumentParameter_Temporary", testWS); diff --git a/Framework/Algorithms/test/ShiftLogTimeTest.h b/Framework/Algorithms/test/ShiftLogTimeTest.h index b827da4744f2ff01b52a3b9a42ca2cfdd32b1043..64a2111fe9bc2436c6c01a0e780e7fbea9b3640c 100644 --- a/Framework/Algorithms/test/ShiftLogTimeTest.h +++ b/Framework/Algorithms/test/ShiftLogTimeTest.h @@ -61,7 +61,7 @@ private: * @param in_name Name of the input workspace. * @param out_name Name of the output workspace. */ - void verify(const std::string in_name, const std::string out_name, + void verify(const std::string &in_name, const std::string &out_name, const int shift) { DateAndTime start(start_str); diff --git a/Framework/Algorithms/test/SmoothNeighboursTest.h b/Framework/Algorithms/test/SmoothNeighboursTest.h index 317f8eb0442d7068020e2601ba1408d2cad2eca8..39ede25745d951215e9a66babd91ad89e57189ea 100644 --- a/Framework/Algorithms/test/SmoothNeighboursTest.h +++ b/Framework/Algorithms/test/SmoothNeighboursTest.h @@ -21,7 +21,7 @@ using namespace Mantid::Algorithms; class SmoothNeighboursTest : public CxxTest::TestSuite { public: - void doTestWithNumberOfNeighbours(std::string WeightedSum = "Flat") { + void doTestWithNumberOfNeighbours(const std::string &WeightedSum = "Flat") { MatrixWorkspace_sptr inWS = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument(100, 10); @@ -75,7 +75,7 @@ public: } void do_test_non_uniform(EventType type, double *expectedY, - std::string WeightedSum = "Parabolic", + const std::string &WeightedSum = "Parabolic", bool PreserveEvents = true, double Radius = 0.001, bool ConvertTo2D = false, int numberOfNeighbours = 8) { @@ -158,7 +158,7 @@ public: } void do_test_rectangular(EventType type, double *expectedY, - std::string WeightedSum = "Parabolic", + const std::string &WeightedSum = "Parabolic", bool PreserveEvents = true, bool ConvertTo2D = false) { // Pixels will be spaced 0.008 apart. diff --git a/Framework/Algorithms/test/SofQCommonTest.h b/Framework/Algorithms/test/SofQCommonTest.h index 46ee0e873b8545b8f652aebfcd97ef34ee11c6be..d2aae6161915092f9bd60b6a3703590489e4ae7a 100644 --- a/Framework/Algorithms/test/SofQCommonTest.h +++ b/Framework/Algorithms/test/SofQCommonTest.h @@ -257,7 +257,7 @@ private: return std::sqrt(ki * ki + kf * kf - 2. * ki * kf * std::cos(twoTheta)); } - static void setEFixed(Mantid::API::MatrixWorkspace_sptr ws, + static void setEFixed(const Mantid::API::MatrixWorkspace_sptr &ws, const std::string &component, const double eFixed) { using namespace Mantid; auto alg = API::AlgorithmManager::Instance().createUnmanaged( diff --git a/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h b/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h index eaa457965e3c10e72098c8f847b74959a5f1bb4f..9e9ca636f2815ec47f28fcfb99b7d010622ee124 100644 --- a/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h +++ b/Framework/Algorithms/test/SofQWNormalisedPolygonTest.h @@ -364,9 +364,10 @@ public: * @param twoThetaRanges input table workspace * @return the algorithm object */ - IAlgorithm_sptr setUpAlg( - Mantid::API::MatrixWorkspace_sptr const inputWS, - boost::shared_ptr twoThetaRanges) { + IAlgorithm_sptr + setUpAlg(Mantid::API::MatrixWorkspace_sptr const &inputWS, + const boost::shared_ptr + &twoThetaRanges) { const std::vector qBinParams{0.023}; IAlgorithm_sptr alg = AlgorithmManager::Instance().create("SofQWNormalisedPolygon"); @@ -384,7 +385,7 @@ public: * @return A pointer to the table workspace */ boost::shared_ptr - createTableWorkspace(const std::vector dataTypes, + createTableWorkspace(const std::vector &dataTypes, const int rowCount) { auto twoThetaRanges = boost::make_shared(); std::vector names = {"Detector ID", "Max two theta", diff --git a/Framework/Algorithms/test/SpecularReflectionAlgorithmTest.h b/Framework/Algorithms/test/SpecularReflectionAlgorithmTest.h index 740e27ac27c6ba60f10dd80db5d9db26e40bf103..45e7009a10f72edace3376620e0d9c15e88fc0a8 100644 --- a/Framework/Algorithms/test/SpecularReflectionAlgorithmTest.h +++ b/Framework/Algorithms/test/SpecularReflectionAlgorithmTest.h @@ -68,7 +68,8 @@ protected: } VerticalHorizontalOffsetType determine_vertical_and_horizontal_offsets( - MatrixWorkspace_sptr ws, std::string detectorName = "point-detector") { + const MatrixWorkspace_sptr &ws, + const std::string &detectorName = "point-detector") { auto instrument = ws->getInstrument(); const V3D pointDetector = instrument->getComponentByName(detectorName)->getPos(); diff --git a/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h b/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h index d2d7c5edc44f58dd61f37000c13a13d701a4b149..3f91a26dd6d820dc23b0d9a1250ef29b080285d3 100644 --- a/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h +++ b/Framework/Algorithms/test/SpecularReflectionPositionCorrectTest.h @@ -15,6 +15,7 @@ #include "MantidKernel/V3D.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include +#include using Mantid::Algorithms::SpecularReflectionPositionCorrect; using namespace Mantid::API; @@ -181,9 +182,9 @@ public: sampleToDetectorBeamOffset, 1e-6); } - void - do_test_correct_point_detector_position(std::string detectorFindProperty = "", - std::string stringValue = "") { + void do_test_correct_point_detector_position( + const std::string &detectorFindProperty = "", + const std::string &stringValue = "") { MatrixWorkspace_sptr toConvert = pointDetectorWS; const double thetaInDegrees = 10.0; // Desired theta in degrees. @@ -240,8 +241,8 @@ public: } double do_test_correct_line_detector_position( - std::vector specNumbers, double thetaInDegrees, - std::string detectorName = "lineardetector", + const std::vector &specNumbers, double thetaInDegrees, + const std::string &detectorName = "lineardetector", bool strictSpectrumCheck = true) { auto toConvert = this->linearDetectorWS; @@ -258,7 +259,7 @@ public: VerticalHorizontalOffsetType offsetTupleCorrected = determine_vertical_and_horizontal_offsets( - corrected, detectorName); // Positions after correction + corrected, std::move(detectorName)); // Positions after correction const double sampleToDetectorVerticalOffsetCorrected = offsetTupleCorrected.get<0>(); diff --git a/Framework/Algorithms/test/Stitch1DManyTest.h b/Framework/Algorithms/test/Stitch1DManyTest.h index 5b0252dabdc76cf51ec4aa39efc128ab8e216507..bacff25f1164adbcd032ea793de476dd7b8626e7 100644 --- a/Framework/Algorithms/test/Stitch1DManyTest.h +++ b/Framework/Algorithms/test/Stitch1DManyTest.h @@ -45,7 +45,7 @@ private: * @param outWSName :: output workspace name used if running CreateWorkspace */ void createUniformWorkspace(double xstart, double deltax, double value1, - double value2, std::string outWSName, + double value2, const std::string &outWSName, bool runAlg = false) { const int nbins = 10; @@ -108,7 +108,8 @@ private: * @param inputWSNames :: input workspaces names * @param outputWSName :: output workspace name */ - void doGroupWorkspaces(std::string inputWSNames, std::string outWSName) { + void doGroupWorkspaces(const std::string &inputWSNames, + const std::string &outWSName) { GroupWorkspaces gw; gw.initialize(); gw.setProperty("InputWorkspaces", inputWSNames); @@ -123,7 +124,7 @@ private: * @param inputWS :: the input workspace * @return vector of names of algorithm histories */ - std::vector getHistory(MatrixWorkspace_sptr inputWS) { + std::vector getHistory(const MatrixWorkspace_sptr &inputWS) { std::vector histNames; auto histories = inputWS->history().getAlgorithmHistories(); for (auto &hist : histories) { diff --git a/Framework/Algorithms/test/SumOverlappingTubesTest.h b/Framework/Algorithms/test/SumOverlappingTubesTest.h index f64ce4b756266372c56920e08cf77be489884c9a..191555ab6fac3c436eefbf23cb666b10d151c0d3 100644 --- a/Framework/Algorithms/test/SumOverlappingTubesTest.h +++ b/Framework/Algorithms/test/SumOverlappingTubesTest.h @@ -34,8 +34,8 @@ using namespace Mantid::Types::Core; namespace { MatrixWorkspace_sptr createTestScanningWS(size_t nTubes, size_t nPixelsPerTube, - std::vector rotations, - std::string name = "testWS") { + const std::vector &rotations, + const std::string &name = "testWS") { const auto instrument = ComponentCreationHelper::createInstrumentWithPSDTubes( nTubes, nPixelsPerTube, true); size_t nTimeIndexes = rotations.size(); @@ -131,7 +131,7 @@ public: TS_ASSERT_DELTA(yAxis->getValue(i), 0.003 * double(i), 1e-6) } - void verifySpectraHaveSameCounts(MatrixWorkspace_sptr outWS, + void verifySpectraHaveSameCounts(const MatrixWorkspace_sptr &outWS, double expectedCounts = 2.0, double expectedErrors = sqrt(2.0), bool checkErrors = true) { @@ -143,7 +143,7 @@ public: } } - void verifySpectraCountsForScan(MatrixWorkspace_sptr outWS) { + void verifySpectraCountsForScan(const MatrixWorkspace_sptr &outWS) { size_t bin = 0; for (size_t j = 0; j < N_PIXELS_PER_TUBE; ++j) { TS_ASSERT_DELTA(outWS->getSpectrum(j).y()[bin], 2.0, 1e-6) diff --git a/Framework/Algorithms/test/SumSpectraTest.h b/Framework/Algorithms/test/SumSpectraTest.h index 1e8066de1e9149e9ea58bad086a83d883806c6cc..ebbbb6cffb67c155072490e9fa7906c040a3d154 100644 --- a/Framework/Algorithms/test/SumSpectraTest.h +++ b/Framework/Algorithms/test/SumSpectraTest.h @@ -277,8 +277,8 @@ public: const std::runtime_error &); } - void dotestExecEvent(std::string inName, std::string outName, - std::string indices_list) { + void dotestExecEvent(const std::string &inName, const std::string &outName, + const std::string &indices_list) { int numPixels = 100; int numBins = 20; int numEvents = 20; diff --git a/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h b/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h index 5c5c039c30cfa9378ed5f391d20dccafa24a5f1e..38dee4681567ffd99cd9f40ca7186b98cd16e888 100644 --- a/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h +++ b/Framework/Algorithms/test/TOFSANSResolutionByPixelTest.h @@ -22,6 +22,7 @@ #include "boost/shared_ptr.hpp" #include +#include using namespace Mantid::Algorithms; using Mantid::Kernel::V3D; @@ -82,8 +83,8 @@ createTestInstrument(const Mantid::detid_t id, * Set the instrument parameters */ void setInstrumentParametersForTOFSANS( - const Mantid::API::MatrixWorkspace_sptr ws, std::string methodType = "", - double collimationLengthCorrection = 20, + const Mantid::API::MatrixWorkspace_sptr &ws, + const std::string &methodType = "", double collimationLengthCorrection = 20, double collimationLengthIncrement = 2, double guideCutoff = 130, double numberOfGuides = 5) { auto &pmap = ws->instrumentParameters(); @@ -117,8 +118,8 @@ void setInstrumentParametersForTOFSANS( /* * Add a timer series sample log */ -void addSampleLog(Mantid::API::MatrixWorkspace_sptr workspace, - std::string sampleLogName, double value, +void addSampleLog(const Mantid::API::MatrixWorkspace_sptr &workspace, + const std::string &sampleLogName, double value, unsigned int length) { auto timeSeries = new Mantid::Kernel::TimeSeriesProperty(sampleLogName); @@ -135,7 +136,7 @@ void addSampleLog(Mantid::API::MatrixWorkspace_sptr workspace, */ Mantid::API::MatrixWorkspace_sptr createTestWorkspace( const size_t nhist, const double x0, const double x1, const double dx, - std::string methodType = "", bool isModerator = false, + const std::string &methodType = "", bool isModerator = false, double collimationLengthCorrection = 20, double collimationLengthIncrement = 2, double guideCutoff = 130, double numberOfGuides = 5, V3D sourcePosition = V3D(0.0, 0.0, -25.0), @@ -163,8 +164,8 @@ Mantid::API::MatrixWorkspace_sptr createTestWorkspace( // Set the instrument parameters setInstrumentParametersForTOFSANS( - ws2d, methodType, collimationLengthCorrection, collimationLengthIncrement, - guideCutoff, numberOfGuides); + ws2d, std::move(methodType), collimationLengthCorrection, + collimationLengthIncrement, guideCutoff, numberOfGuides); // Add sample log details if (!guideLogDetails.empty()) { diff --git a/Framework/Algorithms/test/UnwrapMonitorTest.h b/Framework/Algorithms/test/UnwrapMonitorTest.h index 009a150a6b0960ad2fcb165fb30ebe8ea1ccd6c0..dd1193aae0da8bc5e38e149f241df72fae125dbb 100644 --- a/Framework/Algorithms/test/UnwrapMonitorTest.h +++ b/Framework/Algorithms/test/UnwrapMonitorTest.h @@ -175,7 +175,7 @@ private: // Run the algorithm and do some basic checks. Returns the output workspace. MatrixWorkspace_const_sptr - runAlgorithm(UnwrapMonitor &algo, const MatrixWorkspace_const_sptr inWS) { + runAlgorithm(UnwrapMonitor &algo, const MatrixWorkspace_const_sptr &inWS) { // run the algorithm TS_ASSERT(algo.execute()); TS_ASSERT(algo.isExecuted()); diff --git a/Framework/Algorithms/test/UnwrapSNSTest.h b/Framework/Algorithms/test/UnwrapSNSTest.h index 9afb0ca1ecf5fff37d41f6de90f77fb7af97a29b..15838fe963cf43899a1deaf80e9bc02ee88e5912 100644 --- a/Framework/Algorithms/test/UnwrapSNSTest.h +++ b/Framework/Algorithms/test/UnwrapSNSTest.h @@ -29,7 +29,7 @@ private: int NUMPIXELS; int NUMBINS; - void makeFakeEventWorkspace(std::string wsName) { + void makeFakeEventWorkspace(const std::string &wsName) { // Make an event workspace with 2 events in each bin. EventWorkspace_sptr test_in = WorkspaceCreationHelper::createEventWorkspace( NUMPIXELS, NUMBINS, NUMBINS, 0.0, BIN_DELTA, 2); diff --git a/Framework/Algorithms/test/VesuvioL1ThetaResolutionTest.h b/Framework/Algorithms/test/VesuvioL1ThetaResolutionTest.h index f0c1650de4afdf1bc4e58dfb7727455658047e7a..df7d1c9d9030d020c1cb70d4eacf8a0a0dc6fef6 100644 --- a/Framework/Algorithms/test/VesuvioL1ThetaResolutionTest.h +++ b/Framework/Algorithms/test/VesuvioL1ThetaResolutionTest.h @@ -159,7 +159,7 @@ public: } private: - void validateFullResolutionWorkspace(MatrixWorkspace_sptr ws) { + void validateFullResolutionWorkspace(const MatrixWorkspace_sptr &ws) { NumericAxis *xAxis = dynamic_cast(ws->getAxis(0)); TS_ASSERT(xAxis); if (xAxis) { @@ -177,7 +177,7 @@ private: } } - void validateFullDistributionWorkspace(MatrixWorkspace_sptr ws, + void validateFullDistributionWorkspace(const MatrixWorkspace_sptr &ws, const std::string &label) { NumericAxis *xAxis = dynamic_cast(ws->getAxis(0)); TS_ASSERT(xAxis); diff --git a/Framework/Algorithms/test/WienerSmoothTest.h b/Framework/Algorithms/test/WienerSmoothTest.h index ceea1b67bf7015cb1ca60b06636c4a474769e37d..621d07e59b06ab0b71d6efe333887ba9a080a2cd 100644 --- a/Framework/Algorithms/test/WienerSmoothTest.h +++ b/Framework/Algorithms/test/WienerSmoothTest.h @@ -580,7 +580,7 @@ private: } } - MatrixWorkspace_sptr runWienerSmooth(MatrixWorkspace_sptr inputWS, + MatrixWorkspace_sptr runWienerSmooth(const MatrixWorkspace_sptr &inputWS, const std::vector &wsIndexList) { // Name of the output workspace. std::string outWSName("WienerSmoothTest_OutputWS"); diff --git a/Framework/Algorithms/test/WorkspaceGroupTest.h b/Framework/Algorithms/test/WorkspaceGroupTest.h index 6842062876a001a1814bab43f0c0e1c6534db808..f37adda4f3efba15d618576c4b4d94d0e6352597 100644 --- a/Framework/Algorithms/test/WorkspaceGroupTest.h +++ b/Framework/Algorithms/test/WorkspaceGroupTest.h @@ -19,6 +19,7 @@ #include #include +#include using namespace Mantid::API; using namespace Mantid::Kernel; @@ -30,15 +31,18 @@ using Mantid::HistogramData::CountStandardDeviations; class WorkspaceGroupTest : public CxxTest::TestSuite { private: - void checkData(MatrixWorkspace_sptr work_in1, MatrixWorkspace_sptr work_in2, - MatrixWorkspace_sptr work_out1) { + void checkData(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1) { // default to a horizontal loop orientation - checkData(work_in1, work_in2, work_out1, 0); + checkData(std::move(work_in1), std::move(work_in2), std::move(work_out1), + 0); } // loopOrientation 0=Horizontal, 1=Vertical - void checkData(MatrixWorkspace_sptr work_in1, MatrixWorkspace_sptr work_in2, - MatrixWorkspace_sptr work_out1, int loopOrientation) { + void checkData(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1, int loopOrientation) { if (!work_in1 || !work_in2 || !work_out1) { TSM_ASSERT("One or more empty workspace pointers.", 0); return; @@ -63,9 +67,9 @@ private: } } - void checkDataItem(MatrixWorkspace_sptr work_in1, - MatrixWorkspace_sptr work_in2, - MatrixWorkspace_sptr work_out1, size_t i, + void checkDataItem(const MatrixWorkspace_sptr &work_in1, + const MatrixWorkspace_sptr &work_in2, + const MatrixWorkspace_sptr &work_out1, size_t i, size_t ws2Index) { double sig1 = work_in1->dataY(i / work_in1->blocksize())[i % work_in1->blocksize()]; diff --git a/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h b/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h index c886831e0ab3ac5551d4e56ebd88ede851ed4dd8..a2bf815d0ddf5a5bedbe2d2e1052190f971f1dc7 100644 --- a/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h +++ b/Framework/Crystal/inc/MantidCrystal/AnvredCorrection.h @@ -112,11 +112,11 @@ private: void BuildLamdaWeights(); double absor_sphere(double &twoth, double &wl); void scale_init(const Geometry::IDetector &det, - Geometry::Instrument_const_sptr inst, double &L2, + const Geometry::Instrument_const_sptr &inst, double &L2, double &depth, double &pathlength, std::string &bankName); void scale_exec(std::string &bankName, double &lambda, double &depth, - Geometry::Instrument_const_sptr inst, double &pathlength, - double &value); + const Geometry::Instrument_const_sptr &inst, + double &pathlength, double &value); double m_smu; ///< linear scattering coefficient in 1/cm double m_amu; ///< linear absoprtion coefficient in 1/cm diff --git a/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h b/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h index 8aef4a4dbb9a36d1cbea07aa867b4ab33066dc5c..8743887900901e9cab780c0c3e319661a67dcab5 100644 --- a/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h +++ b/Framework/Crystal/inc/MantidCrystal/CentroidPeaks.h @@ -45,7 +45,7 @@ private: void exec() override; void integrate(); void integrateEvent(); - int findPixelID(std::string bankName, int col, int row); + int findPixelID(const std::string &bankName, int col, int row); void removeEdgePeaks(Mantid::DataObjects::PeaksWorkspace &peakWS); void sizeBanks(const std::string &bankName, int &nCols, int &nRows); Geometry::Instrument_const_sptr inst; diff --git a/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h b/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h index 4a8becae3d7f5f26e4b21a8f487da3b61af3db8f..f1eca3a25e337651c35edb51d7fb312974dcb2ac 100644 --- a/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h +++ b/Framework/Crystal/inc/MantidCrystal/ConnectedComponentLabeling.h @@ -49,8 +49,9 @@ class MANTID_CRYSTAL_DLL ConnectedComponentLabeling { public: /// Constructor - ConnectedComponentLabeling(const size_t &startId = 1, - const boost::optional nThreads = boost::none); + ConnectedComponentLabeling( + const size_t &startId = 1, + const boost::optional &nThreads = boost::none); /// Getter for the start label id size_t getStartLabelId() const; @@ -79,7 +80,7 @@ private: /// Calculate the disjoint element tree across the image. ConnectedComponentMappingTypes::ClusterMap - calculateDisjointTree(Mantid::API::IMDHistoWorkspace_sptr ws, + calculateDisjointTree(const Mantid::API::IMDHistoWorkspace_sptr &ws, BackgroundStrategy *const baseStrategy, Mantid::API::Progress &progress) const; diff --git a/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h b/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h index 632130b4b9287a240c839200c6b47136b3203c0f..9fe6c3a4ba0c7ec81a274ef36d4b15c751843f33 100644 --- a/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h +++ b/Framework/Crystal/inc/MantidCrystal/FindSXPeaks.h @@ -96,7 +96,7 @@ private: /// Check what x units this workspace has FindSXPeaksHelper::XAxisUnit getWorkspaceXAxisUnit( - Mantid::API::MatrixWorkspace_const_sptr workspace) const; + const Mantid::API::MatrixWorkspace_const_sptr &workspace) const; /// The value in X to start the search from double m_MinRange; diff --git a/Framework/Crystal/inc/MantidCrystal/IntegratePeakTimeSlices.h b/Framework/Crystal/inc/MantidCrystal/IntegratePeakTimeSlices.h index 59da17f824f782bbc22dc69332d39a92b3812fc3..4d12afaf42927217f7f374608967d6ff83d2d576 100644 --- a/Framework/Crystal/inc/MantidCrystal/IntegratePeakTimeSlices.h +++ b/Framework/Crystal/inc/MantidCrystal/IntegratePeakTimeSlices.h @@ -271,14 +271,14 @@ private: void SetUpData(API::MatrixWorkspace_sptr &Data, API::MatrixWorkspace_const_sptr const &inpWkSpace, - boost::shared_ptr comp, + const boost::shared_ptr &comp, const int chanMin, const int chanMax, double CentX, double CentY, Kernel::V3D &CentNghbr, double &neighborRadius, // from CentDet double Radius, std::string &spec_idList); - bool getNeighborPixIDs(boost::shared_ptr comp, + bool getNeighborPixIDs(const boost::shared_ptr &comp, Kernel::V3D &Center, double &Radius, int *&ArryofID); int CalculateTimeChannelSpan(Geometry::IPeak const &peak, const double dQ, diff --git a/Framework/Crystal/inc/MantidCrystal/LoadIsawPeaks.h b/Framework/Crystal/inc/MantidCrystal/LoadIsawPeaks.h index c76fdde23948148b43cdbd12400e193bf48cec0a..a98c1ce1e658346f6694d23c61016c9396d3fb76 100644 --- a/Framework/Crystal/inc/MantidCrystal/LoadIsawPeaks.h +++ b/Framework/Crystal/inc/MantidCrystal/LoadIsawPeaks.h @@ -61,16 +61,16 @@ private: void exec() override; /// Reads first line of peaks file and returns first word of next line - std::string readHeader(Mantid::DataObjects::PeaksWorkspace_sptr outWS, + std::string readHeader(const Mantid::DataObjects::PeaksWorkspace_sptr &outWS, std::ifstream &in, double &T0); /// Read a single peak from peaks file - DataObjects::Peak readPeak(DataObjects::PeaksWorkspace_sptr outWS, + DataObjects::Peak readPeak(const DataObjects::PeaksWorkspace_sptr &outWS, std::string &lastStr, std::ifstream &in, int &seqNum, std::string bankName, double qSign); - int findPixelID(Geometry::Instrument_const_sptr inst, std::string bankName, - int col, int row); + int findPixelID(const Geometry::Instrument_const_sptr &inst, + const std::string &bankName, int col, int row); /// Read the header of a peak block section, returns first word of next line std::string readPeakBlockHeader(std::string lastStr, std::ifstream &in, @@ -78,20 +78,20 @@ private: double &phi, double &omega, double &monCount); /// Append peaks from given file to given workspace - void appendFile(Mantid::DataObjects::PeaksWorkspace_sptr outWS, - std::string filename); + void appendFile(const Mantid::DataObjects::PeaksWorkspace_sptr &outWS, + const std::string &filename); /// Compare number of peaks in given file to given workspace /// Throws std::length_error on mismatch - void checkNumberPeaks(Mantid::DataObjects::PeaksWorkspace_sptr outWS, - std::string filename); + void checkNumberPeaks(const Mantid::DataObjects::PeaksWorkspace_sptr &outWS, + const std::string &filename); /// Local cache of bank IComponents used in file std::map> m_banks; /// Retrieve cached bank (or load and cache for next time) boost::shared_ptr getCachedBankByName( - std::string bankname, + const std::string &bankname, const boost::shared_ptr &inst); }; diff --git a/Framework/Crystal/inc/MantidCrystal/MaskPeaksWorkspace.h b/Framework/Crystal/inc/MantidCrystal/MaskPeaksWorkspace.h index 5528d979322150004dcad129d052e1af7ac1272c..74a48aa5d575dadbae4cf83dc061f683c0d20698 100644 --- a/Framework/Crystal/inc/MantidCrystal/MaskPeaksWorkspace.h +++ b/Framework/Crystal/inc/MantidCrystal/MaskPeaksWorkspace.h @@ -48,11 +48,11 @@ private: void init() override; void exec() override; std::size_t getWkspIndex(const detid2index_map &pixel_to_wi, - Geometry::IComponent_const_sptr comp, const int x, - const int y); + const Geometry::IComponent_const_sptr &comp, + const int x, const int y); void getTofRange(double &tofMin, double &tofMax, const double tofPeak, const HistogramData::HistogramX &tof); - int findPixelID(std::string bankName, int col, int row); + int findPixelID(const std::string &bankName, int col, int row); /// Read in all the input parameters void retrieveProperties(); diff --git a/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h b/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h index 04a1acf43812914aef27219968773963ccd4212a..2bdf5f3d66249a07a264b36b13fde81b7671a79a 100644 --- a/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h +++ b/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h @@ -67,13 +67,15 @@ public: * @return The new peak with the new instrument( adjusted with the *parameters) and time adjusted. */ - static DataObjects::Peak createNewPeak(const Geometry::IPeak &peak_old, - Geometry::Instrument_sptr instrNew, - double T0, double L0); + static DataObjects::Peak + createNewPeak(const Geometry::IPeak &peak_old, + const Geometry::Instrument_sptr &instrNew, double T0, + double L0); - static void cLone(boost::shared_ptr &pmap, - boost::shared_ptr component, - boost::shared_ptr &pmapSv); + static void + cLone(boost::shared_ptr &pmap, + const boost::shared_ptr &component, + boost::shared_ptr &pmapSv); void getRun2MatMap(DataObjects::PeaksWorkspace_sptr &Peaks, const std::string &OptRuns, @@ -87,7 +89,7 @@ public: char axis); boost::shared_ptr - getNewInstrument(DataObjects::PeaksWorkspace_sptr Peaks) const; + getNewInstrument(const DataObjects::PeaksWorkspace_sptr &Peaks) const; std::vector getAttributeNames() const override { return {"OptRuns", "PeakWorkspaceName"}; diff --git a/Framework/Crystal/inc/MantidCrystal/PeakIntegration.h b/Framework/Crystal/inc/MantidCrystal/PeakIntegration.h index 23a6d3a115a0828fce87866319301e52d7386adb..23df95e6d247e3563d872693e27c4d3f93de56d3 100644 --- a/Framework/Crystal/inc/MantidCrystal/PeakIntegration.h +++ b/Framework/Crystal/inc/MantidCrystal/PeakIntegration.h @@ -48,8 +48,9 @@ private: void fitSpectra(const int s, double TOFPeakd, double &I, double &sigI); /// Read in all the input parameters void retrieveProperties(); - int fitneighbours(int ipeak, std::string det_name, int x0, int y0, int idet, - double qspan, DataObjects::PeaksWorkspace_sptr &Peaks, + int fitneighbours(int ipeak, const std::string &det_name, int x0, int y0, + int idet, double qspan, + DataObjects::PeaksWorkspace_sptr &Peaks, const detid2index_map &pixel_to_wi); bool m_IC = false; ///< Ikeida Carpenter fit of TOF diff --git a/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h b/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h index f9d21ad88a2cc758d584aec64a7e8f7d2208fc36..b02fd282c7118ba1b044e6b2e4d310cf95ff88cf 100644 --- a/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h +++ b/Framework/Crystal/inc/MantidCrystal/SCDCalibratePanels.h @@ -48,19 +48,20 @@ public: private: void saveIsawDetCal(boost::shared_ptr &instrument, boost::container::flat_set &AllBankName, - double T0, std::string filename); + double T0, const std::string &filename); /// Function to calculate U - void findU(DataObjects::PeaksWorkspace_sptr peaksWs); + void findU(const DataObjects::PeaksWorkspace_sptr &peaksWs); /// save workspaces - void saveNexus(std::string outputFile, API::MatrixWorkspace_sptr outputWS); + void saveNexus(const std::string &outputFile, + const API::MatrixWorkspace_sptr &outputWS); /// Function to optimize L1 - void findL1(int nPeaks, DataObjects::PeaksWorkspace_sptr peaksWs); + void findL1(int nPeaks, const DataObjects::PeaksWorkspace_sptr &peaksWs); /// Function to optimize L2 void findL2(boost::container::flat_set MyBankNames, - DataObjects::PeaksWorkspace_sptr peaksWs); + const DataObjects::PeaksWorkspace_sptr &peaksWs); /// Function to optimize T0 - void findT0(int nPeaks, DataObjects::PeaksWorkspace_sptr peaksWs); + void findT0(int nPeaks, const DataObjects::PeaksWorkspace_sptr &peaksWs); void exec() override; diff --git a/Framework/Crystal/inc/MantidCrystal/SCDPanelErrors.h b/Framework/Crystal/inc/MantidCrystal/SCDPanelErrors.h index cba356c85889b3c5e9671382a70c9c792aa19a59..2419d33d087c92f0a57c832cfa3948da34aa9444 100644 --- a/Framework/Crystal/inc/MantidCrystal/SCDPanelErrors.h +++ b/Framework/Crystal/inc/MantidCrystal/SCDPanelErrors.h @@ -44,7 +44,8 @@ public: /// Move detectors with parameters void moveDetector(double x, double y, double z, double rotx, double roty, double rotz, double scalex, double scaley, - std::string detname, API::Workspace_sptr inputW) const; + std::string detname, + const API::Workspace_sptr &inputW) const; private: /// Call the appropriate load function diff --git a/Framework/Crystal/inc/MantidCrystal/SaveHKL.h b/Framework/Crystal/inc/MantidCrystal/SaveHKL.h index 411eeeda179bc3c16084edb8e0625b7ccc6a561e..cd708f0c4e04e29fd017aafec80d0871fe98ccf7 100644 --- a/Framework/Crystal/inc/MantidCrystal/SaveHKL.h +++ b/Framework/Crystal/inc/MantidCrystal/SaveHKL.h @@ -49,7 +49,7 @@ private: double spectrumCalc(double TOF, int iSpec, std::vector> time, std::vector> spectra, size_t id); - void sizeBanks(std::string bankName, int &nCols, int &nRows); + void sizeBanks(const std::string &bankName, int &nCols, int &nRows); DataObjects::PeaksWorkspace_sptr m_ws; double m_smu = 0.0; // in 1/cm diff --git a/Framework/Crystal/inc/MantidCrystal/SaveIsawPeaks.h b/Framework/Crystal/inc/MantidCrystal/SaveIsawPeaks.h index d3c853b43cd8d8c9512453d79924a9d5cfc907d6..9e0bad59d5d7d9a636a5b750ed4849b8acd379e9 100644 --- a/Framework/Crystal/inc/MantidCrystal/SaveIsawPeaks.h +++ b/Framework/Crystal/inc/MantidCrystal/SaveIsawPeaks.h @@ -48,10 +48,10 @@ private: /// Run the algorithm void exec() override; /// find position for rectangular and non-rectangular - Kernel::V3D findPixelPos(std::string bankName, int col, int row); - void sizeBanks(std::string bankName, int &NCOLS, int &NROWS, double &xsize, - double &ysize); - bool bankMasked(Geometry::IComponent_const_sptr parent, + Kernel::V3D findPixelPos(const std::string &bankName, int col, int row); + void sizeBanks(const std::string &bankName, int &NCOLS, int &NROWS, + double &xsize, double &ysize); + bool bankMasked(const Geometry::IComponent_const_sptr &parent, const Geometry::DetectorInfo &detectorInfo); void writeOffsets(std::ofstream &out, double qSign, std::vector offset); diff --git a/Framework/Crystal/inc/MantidCrystal/SaveLauenorm.h b/Framework/Crystal/inc/MantidCrystal/SaveLauenorm.h index 9d2885ae95f6e4ff58f52f7ac0a9c26d1d7ae82a..b84323bcaa1fe1a9be295fd31d22b251781d7584 100644 --- a/Framework/Crystal/inc/MantidCrystal/SaveLauenorm.h +++ b/Framework/Crystal/inc/MantidCrystal/SaveLauenorm.h @@ -44,7 +44,7 @@ private: void exec() override; DataObjects::PeaksWorkspace_sptr ws; - void sizeBanks(std::string bankName, int &nCols, int &nRows); + void sizeBanks(const std::string &bankName, int &nCols, int &nRows); const std::vector m_typeList{ "TRICLINIC", "MONOCLINIC", "ORTHORHOMBIC", "TETRAGONAL", diff --git a/Framework/Crystal/inc/MantidCrystal/SetSpecialCoordinates.h b/Framework/Crystal/inc/MantidCrystal/SetSpecialCoordinates.h index 43799f83cb34bdaca13275bc09c62a84aebca80b..274a92a1757f93be9912c3a00fe57fd43730893b 100644 --- a/Framework/Crystal/inc/MantidCrystal/SetSpecialCoordinates.h +++ b/Framework/Crystal/inc/MantidCrystal/SetSpecialCoordinates.h @@ -48,13 +48,13 @@ private: static const std::string QSampleOption(); static const std::string HKLOption(); bool writeCoordinatesToMDEventWorkspace( - Mantid::API::Workspace_sptr inWS, + const Mantid::API::Workspace_sptr &inWS, Mantid::Kernel::SpecialCoordinateSystem coordinateSystem); bool writeCoordinatesToMDHistoWorkspace( - Mantid::API::Workspace_sptr inWS, + const Mantid::API::Workspace_sptr &inWS, Mantid::Kernel::SpecialCoordinateSystem coordinateSystem); bool writeCoordinatesToPeaksWorkspace( - Mantid::API::Workspace_sptr inWS, + const Mantid::API::Workspace_sptr &inWS, Mantid::Kernel::SpecialCoordinateSystem coordinateSystem); }; diff --git a/Framework/Crystal/inc/MantidCrystal/SortHKL.h b/Framework/Crystal/inc/MantidCrystal/SortHKL.h index 1a60a9a270ee9902e0d33cd93b29758d5ae30581..afd51cc4fb28ff2dbf337855f8177ababf84e3c0 100644 --- a/Framework/Crystal/inc/MantidCrystal/SortHKL.h +++ b/Framework/Crystal/inc/MantidCrystal/SortHKL.h @@ -78,7 +78,8 @@ private: DataObjects::PeaksWorkspace_sptr getOutputPeaksWorkspace( const DataObjects::PeaksWorkspace_sptr &inputPeaksWorkspace) const; - void sortOutputPeaksByHKL(API::IPeaksWorkspace_sptr outputPeaksWorkspace); + void + sortOutputPeaksByHKL(const API::IPeaksWorkspace_sptr &outputPeaksWorkspace); /// Point Groups possible std::vector m_pointGroups; diff --git a/Framework/Crystal/inc/MantidCrystal/StatisticsOfPeaksWorkspace.h b/Framework/Crystal/inc/MantidCrystal/StatisticsOfPeaksWorkspace.h index 8d2d3667c092605aa1dec4673cbb6ededa7c29ea..061d0bd973eb111d739c254c34c01dc7d95e327b 100644 --- a/Framework/Crystal/inc/MantidCrystal/StatisticsOfPeaksWorkspace.h +++ b/Framework/Crystal/inc/MantidCrystal/StatisticsOfPeaksWorkspace.h @@ -49,7 +49,8 @@ private: /// Run the algorithm void exec() override; /// Runs SortHKL on workspace - void doSortHKL(Mantid::API::Workspace_sptr ws, std::string runName); + void doSortHKL(const Mantid::API::Workspace_sptr &ws, + const std::string &runName); DataObjects::PeaksWorkspace_sptr ws; }; diff --git a/Framework/Crystal/src/AnvredCorrection.cpp b/Framework/Crystal/src/AnvredCorrection.cpp index 6b788c91761bce06ca7b98ae834ef7726bb9c5d1..56bfbe9f06367294df4b53777dc108359239c04b 100644 --- a/Framework/Crystal/src/AnvredCorrection.cpp +++ b/Framework/Crystal/src/AnvredCorrection.cpp @@ -522,7 +522,7 @@ void AnvredCorrection::BuildLamdaWeights() { } void AnvredCorrection::scale_init(const IDetector &det, - Instrument_const_sptr inst, double &L2, + const Instrument_const_sptr &inst, double &L2, double &depth, double &pathlength, std::string &bankName) { bankName = det.getParent()->getParent()->getName(); @@ -542,7 +542,8 @@ void AnvredCorrection::scale_init(const IDetector &det, } void AnvredCorrection::scale_exec(std::string &bankName, double &lambda, - double &depth, Instrument_const_sptr inst, + double &depth, + const Instrument_const_sptr &inst, double &pathlength, double &value) { // correct for the slant path throught the scintillator glass double mu = (9.614 * lambda) + 0.266; // mu for GS20 glass diff --git a/Framework/Crystal/src/CentroidPeaks.cpp b/Framework/Crystal/src/CentroidPeaks.cpp index 29c1b15f547420792bf7c171203fd8eb105466ec..a6dad7263f33b1ff870d6fb618b62a2756a51159 100644 --- a/Framework/Crystal/src/CentroidPeaks.cpp +++ b/Framework/Crystal/src/CentroidPeaks.cpp @@ -323,7 +323,7 @@ void CentroidPeaks::exec() { } } -int CentroidPeaks::findPixelID(std::string bankName, int col, int row) { +int CentroidPeaks::findPixelID(const std::string &bankName, int col, int row) { boost::shared_ptr parent = inst->getComponentByName(bankName); if (parent->type() == "RectangularDetector") { diff --git a/Framework/Crystal/src/ConnectedComponentLabeling.cpp b/Framework/Crystal/src/ConnectedComponentLabeling.cpp index 46894fbf7fcf4e1ea3ddf18de0b3cc6931ae45c5..04ed2e230a755c6770df6477b5f7a48b77d1d678 100644 --- a/Framework/Crystal/src/ConnectedComponentLabeling.cpp +++ b/Framework/Crystal/src/ConnectedComponentLabeling.cpp @@ -4,6 +4,8 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + +#include + #include "MantidCrystal/ConnectedComponentLabeling.h" #include "MantidAPI/FrameworkManager.h" @@ -226,7 +228,7 @@ void memoryCheck(size_t nPoints) { * @param nThreads : Optional argument of number of threads to use. */ ConnectedComponentLabeling::ConnectedComponentLabeling( - const size_t &startId, const boost::optional nThreads) + const size_t &startId, const boost::optional &nThreads) : m_startId(startId), m_nThreads(nThreads) { if (m_nThreads.is_initialized() && m_nThreads.get() < 0) { throw std::invalid_argument( @@ -278,7 +280,7 @@ int ConnectedComponentLabeling::getNThreads() const { * @return : Map of label ids to clusters. */ ClusterMap ConnectedComponentLabeling::calculateDisjointTree( - IMDHistoWorkspace_sptr ws, BackgroundStrategy *const baseStrategy, + const IMDHistoWorkspace_sptr &ws, BackgroundStrategy *const baseStrategy, Progress &progress) const { std::map> clusterMap; VecElements neighbourElements(ws->getNPoints()); @@ -407,7 +409,8 @@ boost::shared_ptr ConnectedComponentLabeling::execute(IMDHistoWorkspace_sptr ws, BackgroundStrategy *const strategy, Progress &progress) const { - ClusterTuple result = executeAndFetchClusters(ws, strategy, progress); + ClusterTuple result = + executeAndFetchClusters(std::move(ws), strategy, progress); IMDHistoWorkspace_sptr outWS = result.get<0>(); // Get the workspace, but discard cluster objects. return outWS; diff --git a/Framework/Crystal/src/FindClusterFaces.cpp b/Framework/Crystal/src/FindClusterFaces.cpp index 9ee0817ae63f7037b61c3b8f105fdee99b16bac7..97fddf346f6e3c4f6699cdb3758a26235960f6e4 100644 --- a/Framework/Crystal/src/FindClusterFaces.cpp +++ b/Framework/Crystal/src/FindClusterFaces.cpp @@ -43,7 +43,7 @@ using OptionalLabelPeakIndexMap = boost::optional; */ OptionalLabelPeakIndexMap createOptionalLabelFilter(size_t dimensionality, int emptyLabelId, - IPeaksWorkspace_sptr filterWorkspace, + const IPeaksWorkspace_sptr &filterWorkspace, IMDHistoWorkspace_sptr &clusterImage) { OptionalLabelPeakIndexMap optionalAllowedLabels; diff --git a/Framework/Crystal/src/FindSXPeaks.cpp b/Framework/Crystal/src/FindSXPeaks.cpp index 301be49ce7449d35a61a8ce5ae9f5a00cb155e97..c478ebbd9d5678f78e08a848d2a8ea2d192c4743 100644 --- a/Framework/Crystal/src/FindSXPeaks.cpp +++ b/Framework/Crystal/src/FindSXPeaks.cpp @@ -369,8 +369,8 @@ void FindSXPeaks::reducePeakList(const peakvector &pcv, Progress &progress) { * @param workspace :: the workspace to check x-axis units on * @return enum of type XAxisUnit with the value of TOF or DSPACING */ -XAxisUnit -FindSXPeaks::getWorkspaceXAxisUnit(MatrixWorkspace_const_sptr workspace) const { +XAxisUnit FindSXPeaks::getWorkspaceXAxisUnit( + const MatrixWorkspace_const_sptr &workspace) const { const auto xAxis = workspace->getAxis(0); const auto unitID = xAxis->unit()->unitID(); diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp index a210b733ff1706fd1edf3cff94c8c3008f87a5e1..e9d2bb3c35c511c4e69a89e76b02c3e0ef174c1f 100644 --- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp +++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp @@ -26,6 +26,7 @@ #include "MantidHistogramData/BinEdges.h" #include +#include using namespace Mantid::Kernel; using namespace Mantid::API; @@ -657,7 +658,7 @@ void IntegratePeakTimeSlices::exec() { * the center may be included. */ bool IntegratePeakTimeSlices::getNeighborPixIDs( - boost::shared_ptr comp, Kernel::V3D &Center, + const boost::shared_ptr &comp, Kernel::V3D &Center, double &Radius, int *&ArryofID) { int N = ArryofID[1]; @@ -1417,7 +1418,7 @@ void DataModeHandler::setHeightHalfWidthInfo( */ void IntegratePeakTimeSlices::SetUpData( MatrixWorkspace_sptr &Data, MatrixWorkspace_const_sptr const &inpWkSpace, - boost::shared_ptr comp, const int chanMin, + const boost::shared_ptr &comp, const int chanMin, const int chanMax, double CentX, double CentY, Kernel::V3D &CentNghbr, double &neighborRadius, // from CentDetspec double Radius, string &spec_idList) { @@ -1468,7 +1469,7 @@ void IntegratePeakTimeSlices::SetUpData( m_NeighborIDs[1] = 2; neighborRadius = NeighborhoodRadiusDivPeakRadius * NewRadius; CentNghbr = CentPos; - getNeighborPixIDs(comp, CentPos, neighborRadius, m_NeighborIDs); + getNeighborPixIDs(std::move(comp), CentPos, neighborRadius, m_NeighborIDs); } else // big enough neighborhood so neighborRadius -= DD; @@ -2526,7 +2527,8 @@ int IntegratePeakTimeSlices::UpdateOutputWS( m_AttributeValues->StatBaseVals(INCol) - 1; TabWS->getRef(std::string("TotIntensityError"), TableRow) = SQRT(m_AttributeValues->StatBaseVals(IVariance)); - TabWS->getRef(std::string("SpecIDs"), TableRow) = spec_idList; + TabWS->getRef(std::string("SpecIDs"), TableRow) = + std::move(spec_idList); return newRowIndex; } diff --git a/Framework/Crystal/src/LoadIsawPeaks.cpp b/Framework/Crystal/src/LoadIsawPeaks.cpp index 4efad1120942cf249ad755928b3e4ba11a18c4d4..a5dfeb4278dc536886acf0e8a5b705a03bae30f4 100644 --- a/Framework/Crystal/src/LoadIsawPeaks.cpp +++ b/Framework/Crystal/src/LoadIsawPeaks.cpp @@ -21,6 +21,7 @@ #include "MantidKernel/Strings.h" #include "MantidKernel/Unit.h" #include +#include using Mantid::Kernel::Strings::getWord; using Mantid::Kernel::Strings::readToEndOfLine; @@ -124,7 +125,7 @@ void LoadIsawPeaks::exec() { * @param T0 :: Time offset * @return the first word on the next line */ -std::string LoadIsawPeaks::readHeader(PeaksWorkspace_sptr outWS, +std::string LoadIsawPeaks::readHeader(const PeaksWorkspace_sptr &outWS, std::ifstream &in, double &T0) { std::string tag; std::string r = getWord(in, false); @@ -260,7 +261,7 @@ std::string LoadIsawPeaks::readHeader(PeaksWorkspace_sptr outWS, * @param qSign :: For inelastic this is 1; for crystallography this is -1 * @return the Peak the Peak object created */ -DataObjects::Peak LoadIsawPeaks::readPeak(PeaksWorkspace_sptr outWS, +DataObjects::Peak LoadIsawPeaks::readPeak(const PeaksWorkspace_sptr &outWS, std::string &lastStr, std::ifstream &in, int &seqNum, std::string bankName, double qSign) { @@ -339,8 +340,8 @@ DataObjects::Peak LoadIsawPeaks::readPeak(PeaksWorkspace_sptr outWS, if (!inst) throw std::runtime_error("No instrument in PeaksWorkspace!"); - int pixelID = - findPixelID(inst, bankName, static_cast(col), static_cast(row)); + int pixelID = findPixelID(inst, std::move(bankName), static_cast(col), + static_cast(row)); // Create the peak object Peak peak(outWS->getInstrument(), pixelID, wl); @@ -356,10 +357,10 @@ DataObjects::Peak LoadIsawPeaks::readPeak(PeaksWorkspace_sptr outWS, } //---------------------------------------------------------------------------------------------- -int LoadIsawPeaks::findPixelID(Instrument_const_sptr inst, std::string bankName, - int col, int row) { +int LoadIsawPeaks::findPixelID(const Instrument_const_sptr &inst, + const std::string &bankName, int col, int row) { boost::shared_ptr parent = - getCachedBankByName(bankName, inst); + getCachedBankByName(std::move(bankName), inst); if (!parent) return -1; // peak not in any detector. @@ -404,7 +405,7 @@ std::string LoadIsawPeaks::readPeakBlockHeader(std::string lastStr, int &detName, double &chi, double &phi, double &omega, double &monCount) { - std::string s = lastStr; + std::string s = std::move(lastStr); if (s.length() < 1 && in.good()) // blank line { @@ -445,8 +446,8 @@ std::string LoadIsawPeaks::readPeakBlockHeader(std::string lastStr, * @param outWS :: the workspace in which to place the information * @param filename :: path to the .peaks file */ -void LoadIsawPeaks::appendFile(PeaksWorkspace_sptr outWS, - std::string filename) { +void LoadIsawPeaks::appendFile(const PeaksWorkspace_sptr &outWS, + const std::string &filename) { // HKL's are flipped by -1 because of the internal Q convention // unless Crystallography convention double qSign = -1.0; @@ -564,8 +565,8 @@ void LoadIsawPeaks::appendFile(PeaksWorkspace_sptr outWS, * @param outWS :: the workspace in which to place the information * @param filename :: path to the .peaks file */ -void LoadIsawPeaks::checkNumberPeaks(PeaksWorkspace_sptr outWS, - std::string filename) { +void LoadIsawPeaks::checkNumberPeaks(const PeaksWorkspace_sptr &outWS, + const std::string &filename) { // Open the file std::ifstream in(filename.c_str()); @@ -601,7 +602,7 @@ void LoadIsawPeaks::checkNumberPeaks(PeaksWorkspace_sptr outWS, *found) */ boost::shared_ptr LoadIsawPeaks::getCachedBankByName( - std::string bankname, + const std::string &bankname, const boost::shared_ptr &inst) { if (m_banks.count(bankname) == 0) m_banks[bankname] = inst->getComponentByName(bankname); diff --git a/Framework/Crystal/src/MaskPeaksWorkspace.cpp b/Framework/Crystal/src/MaskPeaksWorkspace.cpp index 36bec054374a986571e93b0589069f1d1cdc0302..676c6abeb362528fd005d3ef84ce4008831d7855 100644 --- a/Framework/Crystal/src/MaskPeaksWorkspace.cpp +++ b/Framework/Crystal/src/MaskPeaksWorkspace.cpp @@ -200,9 +200,10 @@ void MaskPeaksWorkspace::retrieveProperties() { } } -size_t MaskPeaksWorkspace::getWkspIndex(const detid2index_map &pixel_to_wi, - Geometry::IComponent_const_sptr comp, - const int x, const int y) { +size_t +MaskPeaksWorkspace::getWkspIndex(const detid2index_map &pixel_to_wi, + const Geometry::IComponent_const_sptr &comp, + const int x, const int y) { Geometry::RectangularDetector_const_sptr det = boost::dynamic_pointer_cast(comp); if (det) { @@ -270,7 +271,8 @@ void MaskPeaksWorkspace::getTofRange(double &tofMin, double &tofMax, tofMax = tofPeak + m_tofMax; } } -int MaskPeaksWorkspace::findPixelID(std::string bankName, int col, int row) { +int MaskPeaksWorkspace::findPixelID(const std::string &bankName, int col, + int row) { Geometry::Instrument_const_sptr Iptr = m_inputW->getInstrument(); boost::shared_ptr parent = Iptr->getComponentByName(bankName); diff --git a/Framework/Crystal/src/PeakBackground.cpp b/Framework/Crystal/src/PeakBackground.cpp index 7d5ad73b744303d9a7634270675dd2f67c7db93c..e1415c17a77e74badd4ce38bc8875f0a2c1cfd79 100644 --- a/Framework/Crystal/src/PeakBackground.cpp +++ b/Framework/Crystal/src/PeakBackground.cpp @@ -4,8 +4,10 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidCrystal/PeakBackground.h" +#include + #include "MantidAPI/IPeaksWorkspace.h" +#include "MantidCrystal/PeakBackground.h" #include "MantidGeometry/Crystal/IPeak.h" using namespace Mantid::API; @@ -24,7 +26,7 @@ PeakBackground::PeakBackground(IPeaksWorkspace_const_sptr peaksWS, const Mantid::API::MDNormalization normalisation, const SpecialCoordinateSystem coordinates) : HardThresholdBackground(thresholdSignal, normalisation), - m_peaksWS(peaksWS), m_radiusEstimate(radiusEstimate), + m_peaksWS(std::move(peaksWS)), m_radiusEstimate(radiusEstimate), m_mdCoordinates(coordinates) { if (m_mdCoordinates == QLab) { diff --git a/Framework/Crystal/src/PeakHKLErrors.cpp b/Framework/Crystal/src/PeakHKLErrors.cpp index 2a6807dfdd0490dd0f5a3da38eb446509462104e..8d4e7eebca125e46dca243481a149e6048c35cc0 100644 --- a/Framework/Crystal/src/PeakHKLErrors.cpp +++ b/Framework/Crystal/src/PeakHKLErrors.cpp @@ -117,7 +117,7 @@ void PeakHKLErrors::setUpOptRuns() { */ void PeakHKLErrors::cLone( boost::shared_ptr &pmap, - boost::shared_ptr component, + const boost::shared_ptr &component, boost::shared_ptr &pmapSv) { if (!component) return; @@ -187,7 +187,7 @@ void PeakHKLErrors::cLone( * NOTE: All the peaks in the PeaksWorkspace must use the same instrument. */ boost::shared_ptr -PeakHKLErrors::getNewInstrument(PeaksWorkspace_sptr Peaks) const { +PeakHKLErrors::getNewInstrument(const PeaksWorkspace_sptr &Peaks) const { Geometry::Instrument_const_sptr instSave = Peaks->getPeak(0).getInstrument(); auto pmap = boost::make_shared(); @@ -643,8 +643,8 @@ void PeakHKLErrors::functionDeriv1D(Jacobian *out, const double *xValues, } Peak PeakHKLErrors::createNewPeak(const Geometry::IPeak &peak_old, - Geometry::Instrument_sptr instrNew, double T0, - double L0) { + const Geometry::Instrument_sptr &instrNew, + double T0, double L0) { Geometry::Instrument_const_sptr inst = peak_old.getInstrument(); if (inst->getComponentID() != instrNew->getComponentID()) { g_log.error("All peaks must have the same instrument"); diff --git a/Framework/Crystal/src/PeakIntegration.cpp b/Framework/Crystal/src/PeakIntegration.cpp index cae56ddc0deb6b269df30b2d04920961324458ea..da992cb6dbfe2183cab67edff372121513647510 100644 --- a/Framework/Crystal/src/PeakIntegration.cpp +++ b/Framework/Crystal/src/PeakIntegration.cpp @@ -301,8 +301,8 @@ void PeakIntegration::retrieveProperties() { } } -int PeakIntegration::fitneighbours(int ipeak, std::string det_name, int x0, - int y0, int idet, double qspan, +int PeakIntegration::fitneighbours(int ipeak, const std::string &det_name, + int x0, int y0, int idet, double qspan, PeaksWorkspace_sptr &Peaks, const detid2index_map &pixel_to_wi) { UNUSED_ARG(ipeak); diff --git a/Framework/Crystal/src/SCDCalibratePanels.cpp b/Framework/Crystal/src/SCDCalibratePanels.cpp index 7eefa117a69a893c8ac810b4ff8711f56141ee51..72bdeb27f5b57cfdd9746e477579ee47aa2b7126 100644 --- a/Framework/Crystal/src/SCDCalibratePanels.cpp +++ b/Framework/Crystal/src/SCDCalibratePanels.cpp @@ -280,16 +280,16 @@ void SCDCalibratePanels::exec() { saveNexus(tofFilename, TofWksp); } -void SCDCalibratePanels::saveNexus(std::string outputFile, - MatrixWorkspace_sptr outputWS) { +void SCDCalibratePanels::saveNexus(const std::string &outputFile, + const MatrixWorkspace_sptr &outputWS) { IAlgorithm_sptr save = this->createChildAlgorithm("SaveNexus"); save->setProperty("InputWorkspace", outputWS); save->setProperty("FileName", outputFile); save->execute(); } -void SCDCalibratePanels::findL1(int nPeaks, - DataObjects::PeaksWorkspace_sptr peaksWs) { +void SCDCalibratePanels::findL1( + int nPeaks, const DataObjects::PeaksWorkspace_sptr &peaksWs) { MatrixWorkspace_sptr L1WS = boost::dynamic_pointer_cast( API::WorkspaceFactory::Instance().create("Workspace2D", 1, 3 * nPeaks, 3 * nPeaks)); @@ -329,8 +329,8 @@ void SCDCalibratePanels::findL1(int nPeaks, << fitL1Status << " Chi2overDoF " << chisqL1 << "\n"; } -void SCDCalibratePanels::findT0(int nPeaks, - DataObjects::PeaksWorkspace_sptr peaksWs) { +void SCDCalibratePanels::findT0( + int nPeaks, const DataObjects::PeaksWorkspace_sptr &peaksWs) { MatrixWorkspace_sptr T0WS = boost::dynamic_pointer_cast( API::WorkspaceFactory::Instance().create("Workspace2D", 1, 3 * nPeaks, 3 * nPeaks)); @@ -385,7 +385,8 @@ void SCDCalibratePanels::findT0(int nPeaks, } } -void SCDCalibratePanels::findU(DataObjects::PeaksWorkspace_sptr peaksWs) { +void SCDCalibratePanels::findU( + const DataObjects::PeaksWorkspace_sptr &peaksWs) { IAlgorithm_sptr ub_alg; try { ub_alg = createChildAlgorithm("CalculateUMatrix", -1, -1, false); @@ -442,7 +443,7 @@ void SCDCalibratePanels::findU(DataObjects::PeaksWorkspace_sptr peaksWs) { void SCDCalibratePanels::saveIsawDetCal( boost::shared_ptr &instrument, boost::container::flat_set &AllBankName, double T0, - string filename) { + const string &filename) { // having a filename triggers doing the work if (filename.empty()) return; @@ -633,8 +634,9 @@ void SCDCalibratePanels::saveXmlFile( oss3.flush(); oss3.close(); } -void SCDCalibratePanels::findL2(boost::container::flat_set MyBankNames, - DataObjects::PeaksWorkspace_sptr peaksWs) { +void SCDCalibratePanels::findL2( + boost::container::flat_set MyBankNames, + const DataObjects::PeaksWorkspace_sptr &peaksWs) { bool changeSize = getProperty("ChangePanelSize"); Geometry::Instrument_const_sptr inst = peaksWs->getInstrument(); diff --git a/Framework/Crystal/src/SCDPanelErrors.cpp b/Framework/Crystal/src/SCDPanelErrors.cpp index 7c53a3b8699b55c6c480d13e122920235eb5b9c5..e22beeaeede971ed058ac9319d09721b621b5ce0 100644 --- a/Framework/Crystal/src/SCDPanelErrors.cpp +++ b/Framework/Crystal/src/SCDPanelErrors.cpp @@ -23,6 +23,7 @@ #include #include #include +#include namespace Mantid { namespace Crystal { @@ -74,7 +75,7 @@ SCDPanelErrors::SCDPanelErrors() : m_setupFinished(false) { void SCDPanelErrors::moveDetector(double x, double y, double z, double rotx, double roty, double rotz, double scalex, double scaley, std::string detname, - Workspace_sptr inputW) const { + const Workspace_sptr &inputW) const { if (detname.compare("none") == 0.0) return; // CORELLI has sixteenpack under bank @@ -340,7 +341,7 @@ void SCDPanelErrors::loadWorkspace(const std::string &wsName) const { * @param ws :: The workspace to load from */ void SCDPanelErrors::loadWorkspace(boost::shared_ptr ws) const { - m_workspace = ws; + m_workspace = std::move(ws); m_setupFinished = false; } diff --git a/Framework/Crystal/src/SaveHKL.cpp b/Framework/Crystal/src/SaveHKL.cpp index 03a11e22ca418b43a9f1469511180d1f372b1b0c..c031b73732ebf8e9830976910f4f37bf6be11875 100644 --- a/Framework/Crystal/src/SaveHKL.cpp +++ b/Framework/Crystal/src/SaveHKL.cpp @@ -747,7 +747,7 @@ double SaveHKL::spectrumCalc(double TOF, int iSpec, return spect; } -void SaveHKL::sizeBanks(std::string bankName, int &nCols, int &nRows) { +void SaveHKL::sizeBanks(const std::string &bankName, int &nCols, int &nRows) { if (bankName == "None") return; boost::shared_ptr parent = diff --git a/Framework/Crystal/src/SaveIsawPeaks.cpp b/Framework/Crystal/src/SaveIsawPeaks.cpp index 83d817599b915d48935bbd4bdc4de0dd3c20fd1f..82685646a586135a12c208e0ba9868c20083c7ff 100644 --- a/Framework/Crystal/src/SaveIsawPeaks.cpp +++ b/Framework/Crystal/src/SaveIsawPeaks.cpp @@ -460,7 +460,7 @@ void SaveIsawPeaks::exec() { out.close(); } -bool SaveIsawPeaks::bankMasked(IComponent_const_sptr parent, +bool SaveIsawPeaks::bankMasked(const IComponent_const_sptr &parent, const Geometry::DetectorInfo &detectorInfo) { std::vector children; auto asmb = @@ -493,7 +493,7 @@ bool SaveIsawPeaks::bankMasked(IComponent_const_sptr parent, return true; } -V3D SaveIsawPeaks::findPixelPos(std::string bankName, int col, int row) { +V3D SaveIsawPeaks::findPixelPos(const std::string &bankName, int col, int row) { auto parent = inst->getComponentByName(bankName); if (parent->type() == "RectangularDetector") { const auto RDet = @@ -523,8 +523,8 @@ V3D SaveIsawPeaks::findPixelPos(std::string bankName, int col, int row) { return first->getPos(); } } -void SaveIsawPeaks::sizeBanks(std::string bankName, int &NCOLS, int &NROWS, - double &xsize, double &ysize) { +void SaveIsawPeaks::sizeBanks(const std::string &bankName, int &NCOLS, + int &NROWS, double &xsize, double &ysize) { if (bankName == "None") return; const auto parent = inst->getComponentByName(bankName); diff --git a/Framework/Crystal/src/SaveLauenorm.cpp b/Framework/Crystal/src/SaveLauenorm.cpp index 0512f5fb3bfd714d73f9607545b3a369b443f42c..1c930b37b47e82bbb130bba2d193b2c50a359d57 100644 --- a/Framework/Crystal/src/SaveLauenorm.cpp +++ b/Framework/Crystal/src/SaveLauenorm.cpp @@ -499,7 +499,8 @@ void SaveLauenorm::exec() { out.flush(); out.close(); } -void SaveLauenorm::sizeBanks(std::string bankName, int &nCols, int &nRows) { +void SaveLauenorm::sizeBanks(const std::string &bankName, int &nCols, + int &nRows) { if (bankName == "None") return; boost::shared_ptr parent = diff --git a/Framework/Crystal/src/SetSpecialCoordinates.cpp b/Framework/Crystal/src/SetSpecialCoordinates.cpp index 5139e8b13ce659610133607687fa33b15c35cfbd..8d661d43fecf6f6fd01882395c8902fe8d012462 100644 --- a/Framework/Crystal/src/SetSpecialCoordinates.cpp +++ b/Framework/Crystal/src/SetSpecialCoordinates.cpp @@ -93,7 +93,7 @@ void SetSpecialCoordinates::init() { } bool SetSpecialCoordinates::writeCoordinatesToMDEventWorkspace( - Workspace_sptr inWS, SpecialCoordinateSystem /*unused*/) { + const Workspace_sptr &inWS, SpecialCoordinateSystem /*unused*/) { bool written = false; if (boost::dynamic_pointer_cast(inWS)) { g_log.warning("SetSpecialCoordinates: This algorithm cannot set the " @@ -105,7 +105,7 @@ bool SetSpecialCoordinates::writeCoordinatesToMDEventWorkspace( } bool SetSpecialCoordinates::writeCoordinatesToMDHistoWorkspace( - Workspace_sptr inWS, SpecialCoordinateSystem /*unused*/) { + const Workspace_sptr &inWS, SpecialCoordinateSystem /*unused*/) { bool written = false; if (boost::dynamic_pointer_cast(inWS)) { g_log.warning("SetSpecialCoordinates: This algorithm cannot set the " @@ -117,7 +117,7 @@ bool SetSpecialCoordinates::writeCoordinatesToMDHistoWorkspace( } bool SetSpecialCoordinates::writeCoordinatesToPeaksWorkspace( - Workspace_sptr inWS, SpecialCoordinateSystem coordinateSystem) { + const Workspace_sptr &inWS, SpecialCoordinateSystem coordinateSystem) { bool written = false; if (auto peaksWS = boost::dynamic_pointer_cast(inWS)) { peaksWS->setCoordinateSystem(coordinateSystem); diff --git a/Framework/Crystal/src/SortHKL.cpp b/Framework/Crystal/src/SortHKL.cpp index ead61efa5e63ad9625b9a1afab04df1b2c079f4b..c5d7122c42bcf36284ec6847ae2f79db09ca01de 100644 --- a/Framework/Crystal/src/SortHKL.cpp +++ b/Framework/Crystal/src/SortHKL.cpp @@ -412,7 +412,8 @@ PeaksWorkspace_sptr SortHKL::getOutputPeaksWorkspace( } /// Sorts the peaks in the workspace by H, K and L. -void SortHKL::sortOutputPeaksByHKL(IPeaksWorkspace_sptr outputPeaksWorkspace) { +void SortHKL::sortOutputPeaksByHKL( + const IPeaksWorkspace_sptr &outputPeaksWorkspace) { // Sort by HKL std::vector> criteria{ {"H", true}, {"K", true}, {"L", true}}; diff --git a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp index c5f46c9a5e9c0a90bca1e002e557ba1bbc761756..a93bf28a13e12ce7cd7a02ccbee524feda20e719 100644 --- a/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp +++ b/Framework/Crystal/src/StatisticsOfPeaksWorkspace.cpp @@ -198,8 +198,8 @@ void StatisticsOfPeaksWorkspace::exec() { * @param ws :: any PeaksWorkspace * @param runName :: string to put in statistics table */ -void StatisticsOfPeaksWorkspace::doSortHKL(Mantid::API::Workspace_sptr ws, - std::string runName) { +void StatisticsOfPeaksWorkspace::doSortHKL( + const Mantid::API::Workspace_sptr &ws, const std::string &runName) { std::string pointGroup = getPropertyValue("PointGroup"); std::string latticeCentering = getPropertyValue("LatticeCentering"); std::string wkspName = getPropertyValue("OutputWorkspace"); diff --git a/Framework/Crystal/test/AnvredCorrectionTest.h b/Framework/Crystal/test/AnvredCorrectionTest.h index 399979d1d8706676e6de43bb712371615a3fe91e..ea03f23516a20d2f64c62d45b65584a9f17f8893 100644 --- a/Framework/Crystal/test/AnvredCorrectionTest.h +++ b/Framework/Crystal/test/AnvredCorrectionTest.h @@ -69,7 +69,7 @@ EventWorkspace_sptr createDiffractionEventWorkspace(int numBanks = 1, return retVal; } -void do_test_events(MatrixWorkspace_sptr workspace, bool ev, +void do_test_events(const MatrixWorkspace_sptr &workspace, bool ev, bool performance = false) { workspace->getAxis(0)->setUnit("Wavelength"); diff --git a/Framework/Crystal/test/CalculateUMatrixTest.h b/Framework/Crystal/test/CalculateUMatrixTest.h index 94648dd3234161b7135752700842239d49376ad5..49ac4859da994b80e4106e548bd12bb066a09ce8 100644 --- a/Framework/Crystal/test/CalculateUMatrixTest.h +++ b/Framework/Crystal/test/CalculateUMatrixTest.h @@ -181,7 +181,7 @@ private: return atan2(-QYUB(H, K, L), -QXUB(H, K, L)); } - void generatePeaks(std::string WSName) { + void generatePeaks(const std::string &WSName) { setupUB(); double Hpeaks[9] = {0, 1, 1, 0, -1, -1, 1, -3, -2}; diff --git a/Framework/Crystal/test/ClusterIntegrationBaseTest.h b/Framework/Crystal/test/ClusterIntegrationBaseTest.h index bb3d0b04dbc32f1ffb788547a54796cb1534b7f7..51331a53e63c47bb8c2b61b481312c5b30a1b4a5 100644 --- a/Framework/Crystal/test/ClusterIntegrationBaseTest.h +++ b/Framework/Crystal/test/ClusterIntegrationBaseTest.h @@ -50,9 +50,9 @@ protected: } // Add a fake peak to an MDEventWorkspace - void add_fake_md_peak(IMDEventWorkspace_sptr mdws, const size_t &nEvents, - const double &h, const double &k, const double &l, - const double &radius) { + void add_fake_md_peak(const IMDEventWorkspace_sptr &mdws, + const size_t &nEvents, const double &h, const double &k, + const double &l, const double &radius) { auto fakeMDEventDataAlg = AlgorithmManager::Instance().createUnmanaged("FakeMDEventData"); fakeMDEventDataAlg->setChild(true); diff --git a/Framework/Crystal/test/FilterPeaksTest.h b/Framework/Crystal/test/FilterPeaksTest.h index b20b55387dcd5a31f838e88b0f49a7b5e1fc6fb2..40bcf59a5d2a3a9dc9f141319f852f56fc4aee3e 100644 --- a/Framework/Crystal/test/FilterPeaksTest.h +++ b/Framework/Crystal/test/FilterPeaksTest.h @@ -39,7 +39,7 @@ private: /* * Helper method to run the algorithm and return the output workspace. */ - IPeaksWorkspace_sptr runAlgorithm(PeaksWorkspace_sptr inWS, + IPeaksWorkspace_sptr runAlgorithm(const PeaksWorkspace_sptr &inWS, const std::string &filterVariable, const double filterValue, const std::string &filterOperator) { diff --git a/Framework/Crystal/test/FindClusterFacesTest.h b/Framework/Crystal/test/FindClusterFacesTest.h index cd84d02fe7f719025dbabcb8ced8cc295eba02bd..86ca859c71298efbe72a3f36daad117e41965104 100644 --- a/Framework/Crystal/test/FindClusterFacesTest.h +++ b/Framework/Crystal/test/FindClusterFacesTest.h @@ -26,7 +26,7 @@ using Mantid::Crystal::FindClusterFaces; namespace { // Helper function to create a peaks workspace. -IPeaksWorkspace_sptr create_peaks_WS(Instrument_sptr inst) { +IPeaksWorkspace_sptr create_peaks_WS(const Instrument_sptr &inst) { PeaksWorkspace *pPeaksWS = new PeaksWorkspace(); pPeaksWS->setCoordinateSystem(Mantid::Kernel::HKL); IPeaksWorkspace_sptr peakWS(pPeaksWS); diff --git a/Framework/Crystal/test/FindSXPeaksTest.h b/Framework/Crystal/test/FindSXPeaksTest.h index 6c50a2ac6484a18170e5171fc33f49c6d2c89a6d..727ecad6df1ecae24f8a6542ddb878ffc62ddc9f 100644 --- a/Framework/Crystal/test/FindSXPeaksTest.h +++ b/Framework/Crystal/test/FindSXPeaksTest.h @@ -24,7 +24,7 @@ using namespace Mantid::Crystal; using namespace Mantid::DataObjects; // Helper method to overwrite spectra. -void overWriteSpectraY(size_t histo, Workspace2D_sptr workspace, +void overWriteSpectraY(size_t histo, const Workspace2D_sptr &workspace, const std::vector &Yvalues) { workspace->dataY(histo) = Yvalues; @@ -32,7 +32,7 @@ void overWriteSpectraY(size_t histo, Workspace2D_sptr workspace, // Helper method to make what will be recognised as a single peak. void makeOnePeak(size_t histo, double peak_intensity, size_t at_bin, - Workspace2D_sptr workspace) { + const Workspace2D_sptr &workspace) { size_t nBins = workspace->y(0).size(); std::vector peaksInY(nBins); @@ -53,7 +53,8 @@ void makeOnePeak(size_t histo, double peak_intensity, size_t at_bin, * @param startIndex :: the workspace index to start searching from * @param endIndex :: the workspace index to stop searching from */ -std::unique_ptr createFindSXPeaks(Workspace2D_sptr workspace) { +std::unique_ptr +createFindSXPeaks(const Workspace2D_sptr &workspace) { auto alg = std::make_unique(); alg->setRethrows(true); alg->initialize(); diff --git a/Framework/Crystal/test/IndexPeaksTest.h b/Framework/Crystal/test/IndexPeaksTest.h index c6a798a96276aa5eb7350d79deb5c7a84236f30d..296e2194246cbba945b89584fed84d3ecc0c2eea 100644 --- a/Framework/Crystal/test/IndexPeaksTest.h +++ b/Framework/Crystal/test/IndexPeaksTest.h @@ -112,7 +112,7 @@ PeaksWorkspace_sptr createTestPeaksWorkspaceWithSatellites( } std::unique_ptr -indexPeaks(PeaksWorkspace_sptr peaksWS, +indexPeaks(const PeaksWorkspace_sptr &peaksWS, const std::unordered_map &arguments) { auto alg = std::make_unique(); alg->setChild(true); diff --git a/Framework/Crystal/test/IndexSXPeaksTest.h b/Framework/Crystal/test/IndexSXPeaksTest.h index d4b1d78460fe2ff83574e41f1fc51b33f1dc47e9..4adba996f3523d9cba6ba15435775a90d9625718 100644 --- a/Framework/Crystal/test/IndexSXPeaksTest.h +++ b/Framework/Crystal/test/IndexSXPeaksTest.h @@ -56,9 +56,9 @@ public: AnalysisDataService::Instance().remove("master_peaks"); } - void doTest(int nPixels, std::string peakIndexes, double a, double b, + void doTest(int nPixels, const std::string &peakIndexes, double a, double b, double c, double alpha, double beta, double gamma, - std::string searchExtents = "-20,20,-20,20,-20,20", + const std::string &searchExtents = "-20,20,-20,20,-20,20", double dTolerance = 0.01) { // Take a copy of the original peaks workspace. diff --git a/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h b/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h index 9b9e0ed455169371daf13c8f98e62eaaf9fb6438..9cb2a3db13146b64d6255509d328d5a70f15c667 100644 --- a/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h +++ b/Framework/Crystal/test/IntegratePeakTimeSlicesTest.h @@ -238,7 +238,7 @@ private: /** * Calculates Q */ - double calcQ(RectangularDetector_const_sptr bankP, + double calcQ(const RectangularDetector_const_sptr &bankP, const DetectorInfo &detectorInfo, int row, int col, double time) { boost::shared_ptr detP = bankP->getAtXY(col, row); diff --git a/Framework/Crystal/test/PeakClusterProjectionTest.h b/Framework/Crystal/test/PeakClusterProjectionTest.h index 2ed35dfa0d4f8f56dbec336ee757c48ce660125a..ee5af061ef4e153b039823e36ab81451df398706 100644 --- a/Framework/Crystal/test/PeakClusterProjectionTest.h +++ b/Framework/Crystal/test/PeakClusterProjectionTest.h @@ -32,7 +32,7 @@ class PeakClusterProjectionTest : public CxxTest::TestSuite { private: // Helper function to create a peaks workspace. - IPeaksWorkspace_sptr create_peaks_WS(Instrument_sptr inst) const { + IPeaksWorkspace_sptr create_peaks_WS(const Instrument_sptr &inst) const { PeaksWorkspace *pPeaksWS = new PeaksWorkspace(); pPeaksWS->setCoordinateSystem(Mantid::Kernel::HKL); IPeaksWorkspace_sptr peakWS(pPeaksWS); diff --git a/Framework/Crystal/test/PeakIntensityVsRadiusTest.h b/Framework/Crystal/test/PeakIntensityVsRadiusTest.h index 2c6884af5fd46b62be31a85243f2d98b3ff60a38..493af63e3238695960c93aa7f3eb4816517845c4 100644 --- a/Framework/Crystal/test/PeakIntensityVsRadiusTest.h +++ b/Framework/Crystal/test/PeakIntensityVsRadiusTest.h @@ -210,12 +210,12 @@ public: assertFlatAfter1(ws); } - void assertFlatAfter1(MatrixWorkspace_sptr ws) { + void assertFlatAfter1(const MatrixWorkspace_sptr &ws) { TSM_ASSERT_DELTA("After 1.0, the signal is flat", ws->y(0)[12], 1000, 1e-6); TSM_ASSERT_DELTA("After 1.0, the signal is flat", ws->y(0)[15], 1000, 1e-6) } - void assertFirstFourYValuesCloseToZero(MatrixWorkspace_sptr ws) { + void assertFirstFourYValuesCloseToZero(const MatrixWorkspace_sptr &ws) { TS_ASSERT_DELTA(ws->y(0)[0], 0, 10); TS_ASSERT_DELTA(ws->y(0)[1], 0, 10); TS_ASSERT_DELTA(ws->y(0)[2], 0, 10); diff --git a/Framework/Crystal/test/PeaksInRegionTest.h b/Framework/Crystal/test/PeaksInRegionTest.h index 70f472cbe4001dd272f9ba809e2621630be0dae8..2e5510a1f62c0d67e2a4bbf8588873a110512790 100644 --- a/Framework/Crystal/test/PeaksInRegionTest.h +++ b/Framework/Crystal/test/PeaksInRegionTest.h @@ -31,7 +31,7 @@ private: Helper function. Creates a peaksworkspace with a single peak */ PeakWorkspaceWithExtents - createPeaksWorkspace(const std::string coordFrame, double xMinFromPeak, + createPeaksWorkspace(const std::string &coordFrame, double xMinFromPeak, double xMaxFromPeak, double yMinFromPeak, double yMaxFromPeak, double zMinFromPeak, double zMaxFromPeak) { @@ -267,7 +267,7 @@ public: -0.5); // outside zmax } - void do_test_bounds_check_extents(const std::string coordFrame, + void do_test_bounds_check_extents(const std::string &coordFrame, double xMinFromPeak, double xMaxFromPeak, double yMinFromPeak, double yMaxFromPeak, double zMinFromPeak, double zMaxFromPeak, diff --git a/Framework/Crystal/test/PeaksOnSurfaceTest.h b/Framework/Crystal/test/PeaksOnSurfaceTest.h index 1231b76c911fc1c817cdf95ef92787290fafeac9..884e15f42c32e87a389bee198517b668a953fd15 100644 --- a/Framework/Crystal/test/PeaksOnSurfaceTest.h +++ b/Framework/Crystal/test/PeaksOnSurfaceTest.h @@ -27,7 +27,7 @@ private: Helper function. Creates a peaksworkspace with a single peak */ PeaksWorkspace_sptr - createPeaksWorkspace(const std::string coordFrame, + createPeaksWorkspace(const std::string &coordFrame, const Mantid::Kernel::V3D &peakPosition) { PeaksWorkspace_sptr ws = WorkspaceCreationHelper::createPeaksWorkspace(1); auto detectorIds = ws->getInstrument()->getDetectorIDs(); diff --git a/Framework/Crystal/test/PredictPeaksTest.h b/Framework/Crystal/test/PredictPeaksTest.h index 49527be7c592861867a09665fb761e39dc66dc07..9935199443f85d6dc90a1adc0b725c6733c659ac 100644 --- a/Framework/Crystal/test/PredictPeaksTest.h +++ b/Framework/Crystal/test/PredictPeaksTest.h @@ -20,6 +20,8 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include +#include + using namespace Mantid; using namespace Mantid::Crystal; using namespace Mantid::API; @@ -37,8 +39,8 @@ public: } /** Make a HKL peaks workspace */ - PeaksWorkspace_sptr getHKLpw(Instrument_sptr inst, std::vector hkls, - detid_t detid) { + PeaksWorkspace_sptr getHKLpw(const Instrument_sptr &inst, + const std::vector &hkls, detid_t detid) { PeaksWorkspace_sptr hklPW; if (hkls.size() > 0) { hklPW = PeaksWorkspace_sptr(new PeaksWorkspace()); @@ -51,9 +53,9 @@ public: return hklPW; } - void do_test_exec(std::string reflectionCondition, size_t expectedNumber, - std::vector hkls, int convention = 1, - bool useExtendedDetectorSpace = false, + void do_test_exec(const std::string &reflectionCondition, + size_t expectedNumber, const std::vector &hkls, + int convention = 1, bool useExtendedDetectorSpace = false, bool addExtendedDetectorDefinition = false, int edge = 0) { // Name of the output workspace. std::string outWSName("PredictPeaksTest_OutputWS"); @@ -78,7 +80,7 @@ public: WorkspaceCreationHelper::setOrientedLattice(inWS, 12.0, 12.0, 12.0); WorkspaceCreationHelper::setGoniometer(inWS, 0., 0., 0.); - PeaksWorkspace_sptr hklPW = getHKLpw(inst, hkls, 10000); + PeaksWorkspace_sptr hklPW = getHKLpw(inst, std::move(hkls), 10000); PredictPeaks alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) diff --git a/Framework/Crystal/test/SetGoniometerTest.h b/Framework/Crystal/test/SetGoniometerTest.h index 7646f706be010c9c6b209b41149e5a0f3c8ee89d..1fd24eeefb748ed9d69fa6d20b6df33423a793b7 100644 --- a/Framework/Crystal/test/SetGoniometerTest.h +++ b/Framework/Crystal/test/SetGoniometerTest.h @@ -193,7 +193,7 @@ public: * @param axis0 :: string to pass * @param numExpected :: how many axes should be created (0 or 1) */ - void do_test_param(std::string axis0, size_t numExpected = 0) { + void do_test_param(const std::string &axis0, size_t numExpected = 0) { Workspace2D_sptr ws = WorkspaceCreationHelper::create2DWorkspace(10, 10); AnalysisDataService::Instance().addOrReplace("SetGoniometerTest_ws", ws); FrameworkManager::Instance().exec( diff --git a/Framework/Crystal/test/SortPeaksWorkspaceTest.h b/Framework/Crystal/test/SortPeaksWorkspaceTest.h index 5f31efbb3aeea9b94889016314430f0083e824f9..3dac4e70097fa8cf84ac11f679276c0e0ce074ca 100644 --- a/Framework/Crystal/test/SortPeaksWorkspaceTest.h +++ b/Framework/Crystal/test/SortPeaksWorkspaceTest.h @@ -25,7 +25,8 @@ private: * @param inWS : Input workspace to sort * @param columnName : Column name to sort by */ - void doExecute(IPeaksWorkspace_sptr inWS, const std::string &columnName, + void doExecute(const IPeaksWorkspace_sptr &inWS, + const std::string &columnName, const bool sortAscending = true) { std::string outWSName("SortPeaksWorkspaceTest_OutputWS"); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h index 382b647c796fb57f463c7c271c14dd7fd194aa04..d20969b16a4aa626ab03e055f14807804487cc4a 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/FitPowderDiffPeaks.h @@ -72,7 +72,7 @@ private: void processInputProperties(); /// Generate peaks from input table workspace - void genPeaksFromTable(DataObjects::TableWorkspace_sptr peakparamws); + void genPeaksFromTable(const DataObjects::TableWorkspace_sptr &peakparamws); /// Generate a peak Functions::BackToBackExponential_sptr @@ -86,11 +86,11 @@ private: /// Import instrument parameters from (input) table workspace void importInstrumentParameterFromTable( - DataObjects::TableWorkspace_sptr parameterWS); + const DataObjects::TableWorkspace_sptr ¶meterWS); /// Import Bragg peak table workspace void - parseBraggPeakTable(DataObjects::TableWorkspace_sptr peakws, + parseBraggPeakTable(const DataObjects::TableWorkspace_sptr &peakws, std::vector> ¶mmaps, std::vector> &hklmaps); @@ -108,27 +108,26 @@ private: //--------------------------------------------------------------------------- /// Fit single peak in robust mode (no hint) - bool - fitSinglePeakRobust(Functions::BackToBackExponential_sptr peak, - Functions::BackgroundFunction_sptr backgroundfunction, - double peakleftbound, double peakrightbound, - std::map rightpeakparammap, - double &finalchi2); + bool fitSinglePeakRobust( + const Functions::BackToBackExponential_sptr &peak, + const Functions::BackgroundFunction_sptr &backgroundfunction, + double peakleftbound, double peakrightbound, + const std::map &rightpeakparammap, + double &finalchi2); /// Fit signle peak by Monte Carlo/simulated annealing - bool - fitSinglePeakSimulatedAnnealing(Functions::BackToBackExponential_sptr peak, - std::vector paramtodomc); + bool fitSinglePeakSimulatedAnnealing( + const Functions::BackToBackExponential_sptr &peak, + const std::vector ¶mtodomc); /// Fit peak with confidence of the centre bool fitSinglePeakConfidentX(Functions::BackToBackExponential_sptr peak); /// Fit peak with trustful peak parameters - bool - fitSinglePeakConfident(Functions::BackToBackExponential_sptr peak, - Functions::BackgroundFunction_sptr backgroundfunction, - double leftbound, double rightbound, double &chi2, - bool &annhilatedpeak); + bool fitSinglePeakConfident( + const Functions::BackToBackExponential_sptr &peak, + const Functions::BackgroundFunction_sptr &backgroundfunction, + double leftbound, double rightbound, double &chi2, bool &annhilatedpeak); /// Fit peak with confident parameters bool fitSinglePeakConfidentY(DataObjects::Workspace2D_sptr dataws, @@ -136,33 +135,32 @@ private: double dampingfactor); /// Fit peaks with confidence in fwhm and etc. - bool - fitOverlappedPeaks(std::vector peaks, - Functions::BackgroundFunction_sptr backgroundfunction, - double gfwhm); + bool fitOverlappedPeaks( + std::vector peaks, + const Functions::BackgroundFunction_sptr &backgroundfunction, + double gfwhm); /// Fit multiple (overlapped) peaks bool doFitMultiplePeaks( - DataObjects::Workspace2D_sptr dataws, size_t wsindex, - API::CompositeFunction_sptr peaksfunc, + const DataObjects::Workspace2D_sptr &dataws, size_t wsindex, + const API::CompositeFunction_sptr &peaksfunc, std::vector peakfuncs, std::vector &vecfitgood, std::vector &vecchi2s); /// Use Le Bail method to estimate and set the peak heights void estimatePeakHeightsLeBail( - DataObjects::Workspace2D_sptr dataws, size_t wsindex, + const DataObjects::Workspace2D_sptr &dataws, size_t wsindex, std::vector peaks); /// Set constraints on a group of overlapped peaks for fitting void setOverlappedPeaksConstraints( - std::vector peaks); + const std::vector &peaks); /// Fit 1 peak by 1 minimizer of 1 call of minimzer (simple version) - bool doFit1PeakSimple(DataObjects::Workspace2D_sptr dataws, - size_t workspaceindex, - Functions::BackToBackExponential_sptr peakfunction, - std::string minimzername, size_t maxiteration, - double &chi2); + bool doFit1PeakSimple( + const DataObjects::Workspace2D_sptr &dataws, size_t workspaceindex, + const Functions::BackToBackExponential_sptr &peakfunction, + const std::string &minimzername, size_t maxiteration, double &chi2); /// Fit 1 peak and background // bool doFit1PeakBackgroundSimple(DataObjects::Workspace2D_sptr dataws, @@ -172,33 +170,32 @@ private: // string minimzername, size_t maxiteration, double &chi2); /// Fit single peak with background to raw data - bool - doFit1PeakBackground(DataObjects::Workspace2D_sptr dataws, size_t wsindex, - Functions::BackToBackExponential_sptr peak, - Functions::BackgroundFunction_sptr backgroundfunction, - double &chi2); + bool doFit1PeakBackground( + const DataObjects::Workspace2D_sptr &dataws, size_t wsindex, + const Functions::BackToBackExponential_sptr &peak, + const Functions::BackgroundFunction_sptr &backgroundfunction, + double &chi2); /// Fit 1 peak by using a sequential of minimizer - bool doFit1PeakSequential(DataObjects::Workspace2D_sptr dataws, - size_t workspaceindex, - Functions::BackToBackExponential_sptr peakfunction, - std::vector minimzernames, - std::vector maxiterations, - std::vector dampfactors, double &chi2); + bool doFit1PeakSequential( + const DataObjects::Workspace2D_sptr &dataws, size_t workspaceindex, + const Functions::BackToBackExponential_sptr &peakfunction, + std::vector minimzernames, std::vector maxiterations, + const std::vector &dampfactors, double &chi2); /// Fit N overlapped peaks in a simple manner bool doFitNPeaksSimple( - DataObjects::Workspace2D_sptr dataws, size_t wsindex, - API::CompositeFunction_sptr peaksfunc, - std::vector peakfuncs, - std::string minimizername, size_t maxiteration, double &chi2); + const DataObjects::Workspace2D_sptr &dataws, size_t wsindex, + const API::CompositeFunction_sptr &peaksfunc, + const std::vector &peakfuncs, + const std::string &minimizername, size_t maxiteration, double &chi2); /// Store the function's parameter values to a map - void storeFunctionParameters(API::IFunction_sptr function, + void storeFunctionParameters(const API::IFunction_sptr &function, std::map ¶mmaps); /// Restore the function's parameter values from a map - void restoreFunctionParameters(API::IFunction_sptr function, + void restoreFunctionParameters(const API::IFunction_sptr &function, std::map parammap); /// Calculate the range to fit peak/peaks group @@ -225,7 +222,8 @@ private: void cropWorkspace(double tofmin, double tofmax); /// Parse Fit() output parameter workspace - std::string parseFitParameterWorkspace(API::ITableWorkspace_sptr paramws); + std::string + parseFitParameterWorkspace(const API::ITableWorkspace_sptr ¶mws); /// Build a partial workspace from source // DataObjects::Workspace2D_sptr @@ -240,8 +238,8 @@ private: double &chi2); /// Observe peak range with hint from right peak's properties - void observePeakRange(Functions::BackToBackExponential_sptr thispeak, - Functions::BackToBackExponential_sptr rightpeak, + void observePeakRange(const Functions::BackToBackExponential_sptr &thispeak, + const Functions::BackToBackExponential_sptr &rightpeak, double refpeakshift, double &peakleftbound, double &peakrightbound); @@ -268,12 +266,12 @@ private: bool calchi2); std::pair - doFitPeak(DataObjects::Workspace2D_sptr dataws, - Functions::BackToBackExponential_sptr peakfunction, + doFitPeak(const DataObjects::Workspace2D_sptr &dataws, + const Functions::BackToBackExponential_sptr &peakfunction, double guessedfwhm); /// Fit background-removed peak by Gaussian - bool doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, + bool doFitGaussianPeak(const DataObjects::Workspace2D_sptr &dataws, size_t workspaceindex, double in_center, double leftfwhm, double rightfwhm, double ¢er, double &sigma, double &height); @@ -288,28 +286,28 @@ private: Functions::BackgroundFunction_sptr background); /// Parse the fitting result - std::string parseFitResult(API::IAlgorithm_sptr fitalg, double &chi2, + std::string parseFitResult(const API::IAlgorithm_sptr &fitalg, double &chi2, bool &fitsuccess); /// Calculate a Bragg peak's centre in TOF from its Miller indices double calculatePeakCentreTOF(int h, int k, int l); /// Get parameter value from m_instrumentParameters - double getParameter(std::string parname); + double getParameter(const std::string &parname); /// Fit peaks in the same group (i.e., single peak or overlapped peaks) void fitPeaksGroup(std::vector peakindexes); /// Build partial workspace for fitting DataObjects::Workspace2D_sptr - buildPartialWorkspace(API::MatrixWorkspace_sptr sourcews, + buildPartialWorkspace(const API::MatrixWorkspace_sptr &sourcews, size_t workspaceindex, double leftbound, double rightbound); /// Plot a single peak to output vector - void plotFunction(API::IFunction_sptr peakfunction, - Functions::BackgroundFunction_sptr background, - API::FunctionDomain1DVector domain); + void plotFunction(const API::IFunction_sptr &peakfunction, + const Functions::BackgroundFunction_sptr &background, + const API::FunctionDomain1DVector &domain); //----------------------------------------------------------------------------------------------- @@ -411,25 +409,25 @@ inline double linearInterpolateY(double x0, double xf, double y0, double yf, } /// Estimate background for a pattern in a coarse mode -void estimateBackgroundCoarse(DataObjects::Workspace2D_sptr dataws, - Functions::BackgroundFunction_sptr background, - size_t wsindexraw, size_t wsindexbkgd, - size_t wsindexpeak); +void estimateBackgroundCoarse( + const DataObjects::Workspace2D_sptr &dataws, + const Functions::BackgroundFunction_sptr &background, size_t wsindexraw, + size_t wsindexbkgd, size_t wsindexpeak); /// Estimate peak parameters; -bool observePeakParameters(DataObjects::Workspace2D_sptr dataws, size_t wsindex, - double ¢re, double &height, double &fwhm, - std::string &errmsg); +bool observePeakParameters(const DataObjects::Workspace2D_sptr &dataws, + size_t wsindex, double ¢re, double &height, + double &fwhm, std::string &errmsg); /// Find maximum value size_t findMaxValue(const std::vector &Y); /// Find maximum value -size_t findMaxValue(API::MatrixWorkspace_sptr dataws, size_t wsindex, +size_t findMaxValue(const API::MatrixWorkspace_sptr &dataws, size_t wsindex, double leftbound, double rightbound); /// Get function parameter name, value and etc information in string -std::string getFunctionInfo(API::IFunction_sptr function); +std::string getFunctionInfo(const API::IFunction_sptr &function); } // namespace Algorithms } // namespace CurveFitting diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h index a0c846385dbe8ac6d2f09350d1904a12eab57e5c..8b44d19e3aaca1e8f8fe9b3e14ba37d7a7beeefc 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFit.h @@ -103,8 +103,8 @@ private: void createLeBailFunction(); /// Crop the workspace for better usage - API::MatrixWorkspace_sptr cropWorkspace(API::MatrixWorkspace_sptr inpws, - size_t wsindex); + API::MatrixWorkspace_sptr + cropWorkspace(const API::MatrixWorkspace_sptr &inpws, size_t wsindex); /// Process and calculate input background void processInputBackground(); @@ -123,10 +123,10 @@ private: void parseBraggPeaksParametersTable(); /// Parse content in a table workspace to vector for background parameters - void - parseBackgroundTableWorkspace(DataObjects::TableWorkspace_sptr bkgdparamws, - std::vector &bkgdparnames, - std::vector &bkgdorderparams); + void parseBackgroundTableWorkspace( + const DataObjects::TableWorkspace_sptr &bkgdparamws, + std::vector &bkgdparnames, + std::vector &bkgdorderparams); /// Create and set up output table workspace for peaks void exportBraggPeakParameterToTable(); @@ -153,12 +153,12 @@ private: /// Set up Monte Carlo random walk strategy void setupBuiltInRandomWalkStrategy(); - void - setupRandomWalkStrategyFromTable(DataObjects::TableWorkspace_sptr tablews); + void setupRandomWalkStrategyFromTable( + const DataObjects::TableWorkspace_sptr &tablews); /// Add parameter (to a vector of string/name) for MC random walk void addParameterToMCMinimize(std::vector &parnamesforMC, - std::string parname); + const std::string &parname); /// Calculate diffraction pattern in Le Bail algorithm for MC Random walk bool calculateDiffractionPattern( @@ -171,7 +171,8 @@ private: bool acceptOrDeny(Kernel::Rfactor currR, Kernel::Rfactor newR); /// Propose new parameters - bool proposeNewValues(std::vector mcgroup, Kernel::Rfactor r, + bool proposeNewValues(const std::vector &mcgroup, + Kernel::Rfactor r, std::map &curparammap, std::map &newparammap, bool prevBetterRwp); @@ -308,7 +309,7 @@ private: /// Write a set of (XY) data to a column file void writeRfactorsToFile(std::vector vecX, std::vector vecR, - std::string filename); + const std::string &filename); } // namespace Algorithms } // namespace CurveFitting diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h index b4a9afb28203e59ec4f25681bec2313af9dff09b..754025d1c0d588d147f649f92b34db3df7f8c50a 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/LeBailFunction.h @@ -34,7 +34,7 @@ it is rewritten. class MANTID_CURVEFITTING_DLL LeBailFunction { public: /// Constructor - LeBailFunction(std::string peaktype); + LeBailFunction(const std::string &peaktype); /// Destructor virtual ~LeBailFunction(); @@ -43,14 +43,14 @@ public: void setProfileParameterValues(std::map parammap); /// Set up a parameter to fit but tied among all peaks - void setFitProfileParameter(std::string paramname, double minvalue, + void setFitProfileParameter(const std::string ¶mname, double minvalue, double maxvalue); /// Function - void setPeakHeights(std::vector inheights); + void setPeakHeights(const std::vector &inheights); /// Check whether a parameter is a profile parameter - bool hasProfileParameter(std::string paramname); + bool hasProfileParameter(const std::string ¶mname); /// Check whether the newly set parameters are correct, i.e., all peaks are /// physical @@ -63,7 +63,7 @@ public: void addPeaks(std::vector> peakhkls); /// Add background function - void addBackgroundFunction(std::string backgroundtype, + void addBackgroundFunction(const std::string &backgroundtype, const unsigned int &order, const std::vector &vecparnames, const std::vector &vecparvalues, @@ -91,13 +91,14 @@ public: void calPeaksParameters(); /// Get peak parameters (calculated) - double getPeakParameter(size_t index, std::string parname) const; + double getPeakParameter(size_t index, const std::string &parname) const; /// Get peak parameters (calculated) - double getPeakParameter(std::vector hkl, std::string parname) const; + double getPeakParameter(std::vector hkl, + const std::string &parname) const; /// Set up a parameter to be fixed - void fixPeakParameter(std::string paramname, double paramvalue); + void fixPeakParameter(const std::string ¶mname, double paramvalue); /// Fix all background parameters void fixBackgroundParameters(); @@ -116,13 +117,13 @@ public: private: /// Set peak parameters - void setPeakParameters(API::IPowderDiffPeakFunction_sptr peak, - std::map parammap, + void setPeakParameters(const API::IPowderDiffPeakFunction_sptr &peak, + const std::map ¶mmap, double peakheight, bool setpeakheight); /// Retrieve peak's parameter. may be native or calculated - double getPeakParameterValue(API::IPowderDiffPeakFunction_sptr peak, - std::string parname) const; + double getPeakParameterValue(const API::IPowderDiffPeakFunction_sptr &peak, + const std::string &parname) const; /// Calculate all peaks' parameter value void calculatePeakParameterValues() const; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h index 37df79315c5ba5367ba53740125b17756660d081..6e6e97f2d6b2739b5d9f640f618eb5c459f9beb9 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValue.h @@ -64,7 +64,8 @@ private: void exec() override; /// Set any WorkspaceIndex attributes in the fitting function - void setWorkspaceIndexAttribute(API::IFunction_sptr fun, int wsIndex) const; + void setWorkspaceIndexAttribute(const API::IFunction_sptr &fun, + int wsIndex) const; boost::shared_ptr runSingleFit(bool createFitOutput, bool outputCompositeMembers, @@ -72,7 +73,8 @@ private: const API::IFunction_sptr &ifun, const InputSpectraToFit &data); - double calculateLogValue(std::string logName, const InputSpectraToFit &data); + double calculateLogValue(const std::string &logName, + const InputSpectraToFit &data); API::ITableWorkspace_sptr createResultsTable(const std::string &logName, diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValueHelper.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValueHelper.h index 68fbe1598766d91b068c3e7a28582f6ac713a066..f83cabaeb310fa25d0154a6b7de8e7c80762ffc8 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValueHelper.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/PlotPeakByLogValueHelper.h @@ -42,7 +42,7 @@ getWorkspace(const std::string &name, int period); /// Create a list of input workspace names MANTID_CURVEFITTING_DLL std::vector -makeNames(std::string inputList, int default_wi, int default_spec); +makeNames(const std::string &inputList, int default_wi, int default_spec); enum SpecialIndex { NOT_SET = -1, diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSequential.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSequential.h index dc0a910b53f81ab94c0fabc29799659df0ccc26d..32f8dfa3c1c9c47b1d73b68236d989947df35f62 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSequential.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSequential.h @@ -46,8 +46,8 @@ private: API::ITableWorkspace_sptr performFit(const std::string &input, const std::string &output); void deleteTemporaryWorkspaces(const std::string &outputBaseName); - void addAdditionalLogs(API::WorkspaceGroup_sptr resultWorkspace); - void addAdditionalLogs(API::Workspace_sptr result); + void addAdditionalLogs(const API::WorkspaceGroup_sptr &resultWorkspace); + void addAdditionalLogs(const API::Workspace_sptr &result); virtual bool throwIfElasticQConversionFails() const; virtual bool isFitParameter(const std::string ¶meterName) const; @@ -57,9 +57,9 @@ private: const std::vector &workspaces) const; std::vector getDatasetGrouping( const std::vector &workspaces) const; - API::WorkspaceGroup_sptr - processIndirectFitParameters(API::ITableWorkspace_sptr parameterWorkspace, - const std::vector &grouping); + API::WorkspaceGroup_sptr processIndirectFitParameters( + const API::ITableWorkspace_sptr ¶meterWorkspace, + const std::vector &grouping); std::vector convertInputToElasticQ( const std::vector &workspaces) const; @@ -77,20 +77,20 @@ private: std::vector const &spectra, std::string const &outputBaseName, std::string const &endOfSuffix); - void copyLogs(API::WorkspaceGroup_sptr resultWorkspaces, + void copyLogs(const API::WorkspaceGroup_sptr &resultWorkspaces, std::vector const &workspaces); - void copyLogs(API::Workspace_sptr resultWorkspace, + void copyLogs(const API::Workspace_sptr &resultWorkspace, std::vector const &workspaces); - void copyLogs(API::MatrixWorkspace_sptr resultWorkspace, - API::WorkspaceGroup_sptr resultGroup); - void copyLogs(API::MatrixWorkspace_sptr resultWorkspace, - API::Workspace_sptr resultGroup); - void extractMembers(API::WorkspaceGroup_sptr resultGroupWs, + void copyLogs(const API::MatrixWorkspace_sptr &resultWorkspace, + const API::WorkspaceGroup_sptr &resultGroup); + void copyLogs(const API::MatrixWorkspace_sptr &resultWorkspace, + const API::Workspace_sptr &resultGroup); + void extractMembers(const API::WorkspaceGroup_sptr &resultGroupWs, const std::vector &workspaces, const std::string &outputWsName); API::IAlgorithm_sptr - extractMembersAlgorithm(API::WorkspaceGroup_sptr resultGroupWs, + extractMembersAlgorithm(const API::WorkspaceGroup_sptr &resultGroupWs, const std::string &outputWsName) const; std::string getTemporaryName() const; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSimultaneous.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSimultaneous.h index 67075de0d749e849c84ce5ecfada6900df137aac..d6af7bbfa52c4bc7d43e5c901a58f537aab3bd4b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSimultaneous.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitSimultaneous.h @@ -47,27 +47,27 @@ private: std::pair performFit(const std::vector &workspaces, const std::string &output); - API::WorkspaceGroup_sptr - processIndirectFitParameters(API::ITableWorkspace_sptr parameterWorkspace, - const std::vector &grouping); - void copyLogs(API::WorkspaceGroup_sptr resultWorkspace, + API::WorkspaceGroup_sptr processIndirectFitParameters( + const API::ITableWorkspace_sptr ¶meterWorkspace, + const std::vector &grouping); + void copyLogs(const API::WorkspaceGroup_sptr &resultWorkspace, const std::vector &workspaces); - void copyLogs(API::MatrixWorkspace_sptr resultWorkspace, - API::WorkspaceGroup_sptr resultGroup); - void extractMembers(API::WorkspaceGroup_sptr resultGroupWs, + void copyLogs(const API::MatrixWorkspace_sptr &resultWorkspace, + const API::WorkspaceGroup_sptr &resultGroup); + void extractMembers(const API::WorkspaceGroup_sptr &resultGroupWs, const std::vector &workspaces, const std::string &outputWsName); - void addAdditionalLogs(API::WorkspaceGroup_sptr group); - void addAdditionalLogs(API::Workspace_sptr result); + void addAdditionalLogs(const API::WorkspaceGroup_sptr &group); + void addAdditionalLogs(const API::Workspace_sptr &result); API::IAlgorithm_sptr - extractMembersAlgorithm(API::WorkspaceGroup_sptr resultGroupWs, + extractMembersAlgorithm(const API::WorkspaceGroup_sptr &resultGroupWs, const std::string &outputWsName) const; std::string getOutputBaseName() const; std::vector getWorkspaceNames() const; std::vector getWorkspaceIndices() const; - void renameWorkspaces(API::WorkspaceGroup_sptr outputGroup, + void renameWorkspaces(const API::WorkspaceGroup_sptr &outputGroup, std::vector const &spectra, std::string const &outputBaseName, std::string const &endOfSuffix, diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitUtilities.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitUtilities.h index 33e822287227570a0bcc5b6c1cd7833ec0834292..4972f7be065693fe668557f9c998f53ec9e32ba5 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitUtilities.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/QENSFitUtilities.h @@ -16,7 +16,7 @@ namespace API { void renameWorkspacesInQENSFit( Algorithm *qensFit, IAlgorithm_sptr renameAlgorithm, - WorkspaceGroup_sptr outputGroup, std::string const &outputBaseName, + const WorkspaceGroup_sptr &outputGroup, std::string const &outputBaseName, std::string const &groupSuffix, std::function const &getNameSuffix); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h index c30d735b846aae5cb23f661b7a48ffb924f4aa11..7afd36cdd810a0b6f916552b6106acbebc453177 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters.h @@ -67,20 +67,22 @@ private: //---------------- Processing Input --------------------- /// Import instrument parameter from table (workspace) - void importParametersFromTable(DataObjects::TableWorkspace_sptr parameterWS, - std::map ¶meters); + void + importParametersFromTable(const DataObjects::TableWorkspace_sptr ¶meterWS, + std::map ¶meters); /// Import the Monte Carlo related parameters from table void importMonteCarloParametersFromTable( - DataObjects::TableWorkspace_sptr tablews, - std::vector parameternames, std::vector &stepsizes, - std::vector &lowerbounds, std::vector &upperbounds); + const DataObjects::TableWorkspace_sptr &tablews, + const std::vector ¶meternames, + std::vector &stepsizes, std::vector &lowerbounds, + std::vector &upperbounds); /// Generate (output) workspace of peak centers void genPeakCentersWorkspace(bool montecarlo, size_t numbestfit); /// Generate peaks from table (workspace) - void genPeaksFromTable(DataObjects::TableWorkspace_sptr peakparamws); + void genPeaksFromTable(const DataObjects::TableWorkspace_sptr &peakparamws); //--------------- Processing Output ------------------ /// Generate (output) table worksspace for instrument parameters @@ -94,12 +96,12 @@ private: void fitInstrumentParameters(); /// Calculate function's statistic - double calculateFunctionStatistic(API::IFunction_sptr func, - API::MatrixWorkspace_sptr dataws, + double calculateFunctionStatistic(const API::IFunction_sptr &func, + const API::MatrixWorkspace_sptr &dataws, size_t workspaceindex); /// Fit function to data - bool fitFunction(API::IFunction_sptr func, double &gslchi2); + bool fitFunction(const API::IFunction_sptr &func, double &gslchi2); /// Parse Fit() output parameter workspace std::string parseFitParameterWorkspace(API::ITableWorkspace_sptr paramws); @@ -108,9 +110,8 @@ private: std::string parseFitResult(API::IAlgorithm_sptr fitalg, double &chi2); /// Set up and run a monte carlo simulation to refine the peak parameters - void - refineInstrumentParametersMC(DataObjects::TableWorkspace_sptr parameterWS, - bool fit2 = false); + void refineInstrumentParametersMC( + const DataObjects::TableWorkspace_sptr ¶meterWS, bool fit2 = false); /// Core Monte Carlo random walk on parameter-space void doParameterSpaceRandomWalk(std::vector parnames, @@ -124,8 +125,8 @@ private: void getD2TOFFuncParamNames(std::vector &parnames); /// Calculate the value and chi2 - double calculateD2TOFFunction(API::IFunction_sptr func, - API::FunctionDomain1DVector domain, + double calculateD2TOFFunction(const API::IFunction_sptr &func, + const API::FunctionDomain1DVector &domain, API::FunctionValues &values, const Mantid::HistogramData::HistogramY &rawY, const Mantid::HistogramData::HistogramE &rawE); @@ -135,7 +136,7 @@ private: /// Calculate value n for thermal neutron peak profile void - calculateThermalNeutronSpecial(API::IFunction_sptr m_Function, + calculateThermalNeutronSpecial(const API::IFunction_sptr &m_Function, const Mantid::HistogramData::HistogramX &xVals, std::vector &vec_n); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h index 22fc3367b2ee22da0bcc0c335ad3b6e595628c2f..bab383a92adf26d2cc43bea5bb075e9f2c99e6d2 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/RefinePowderInstrumentParameters3.h @@ -68,11 +68,11 @@ private: /// Add parameter (to a vector of string/name) for MC random walk void addParameterToMCMinimize(std::vector &parnamesforMC, - std::string parname, + const std::string &parname, std::map parammap); /// Propose new parameters - void proposeNewValues(std::vector mcgroup, + void proposeNewValues(const std::vector &mcgroup, std::map &curparammap, std::map &newparammap, double currchisq); @@ -88,23 +88,23 @@ private: // maxnumresults); /// Implement parameter values, calculate function and its chi square. - double calculateFunction(std::map parammap, + double calculateFunction(const std::map ¶mmap, std::vector &vecY); /// Calculate Chi^2 of the a function with all parameters are fixed - double calculateFunctionError(API::IFunction_sptr function, - DataObjects::Workspace2D_sptr dataws, + double calculateFunctionError(const API::IFunction_sptr &function, + const DataObjects::Workspace2D_sptr &dataws, int wsindex); /// Fit function by non MC minimzer(s) - double fitFunction(API::IFunction_sptr function, - DataObjects::Workspace2D_sptr dataws, int wsindex, + double fitFunction(const API::IFunction_sptr &function, + const DataObjects::Workspace2D_sptr &dataws, int wsindex, bool powerfit); /// Fit function (single step) - bool doFitFunction(API::IFunction_sptr function, - DataObjects::Workspace2D_sptr dataws, int wsindex, - std::string minimizer, int numiters, double &chi2, + bool doFitFunction(const API::IFunction_sptr &function, + const DataObjects::Workspace2D_sptr &dataws, int wsindex, + const std::string &minimizer, int numiters, double &chi2, std::string &fitstatus); /// Process input properties @@ -114,11 +114,11 @@ private: void parseTableWorkspaces(); /// Parse table workspace to a map of Parameters - void parseTableWorkspace(DataObjects::TableWorkspace_sptr tablews, + void parseTableWorkspace(const DataObjects::TableWorkspace_sptr &tablews, std::map ¶mmap); /// Set parameter values to function from Parameter map - void setFunctionParameterValues(API::IFunction_sptr function, + void setFunctionParameterValues(const API::IFunction_sptr &function, std::map params); /// Update parameter values to Parameter map from fuction map @@ -127,13 +127,13 @@ private: /// Set parameter fitting setup (boundary, fix or unfix) to function from /// Parameter map - void setFunctionParameterFitSetups(API::IFunction_sptr function, + void setFunctionParameterFitSetups(const API::IFunction_sptr &function, std::map params); /// Construct output DataObjects::Workspace2D_sptr - genOutputWorkspace(API::FunctionDomain1DVector domain, - API::FunctionValues rawvalues); + genOutputWorkspace(const API::FunctionDomain1DVector &domain, + const API::FunctionValues &rawvalues); /// Construct an output TableWorkspace for refined peak profile parameters DataObjects::TableWorkspace_sptr @@ -143,7 +143,7 @@ private: /// Add a parameter to parameter map. If this parametere does exist, then /// replace the value of it void addOrReplace(std::map ¶meters, - std::string parname, double parvalue); + const std::string &parname, double parvalue); //-------- Variables ------------------------------------------------------ /// Data workspace containg peak positions @@ -189,17 +189,19 @@ void convertToDict(std::vector strvec, std::map &lookupdict); /// Get the index from lookup dictionary (map) -int getStringIndex(std::map lookupdict, std::string key); +int getStringIndex(std::map lookupdict, + const std::string &key); /// Store function parameter values to a map void storeFunctionParameterValue( - API::IFunction_sptr function, + const API::IFunction_sptr &function, std::map> &parvaluemap); /// Restore function parameter values to a map void restoreFunctionParameterValue( std::map> parvaluemap, - API::IFunction_sptr function, std::map ¶mmap); + const API::IFunction_sptr &function, + std::map ¶mmap); /// Copy parameters from source to target void duplicateParameters(std::map source, diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h index dd85faa45c48b3593c1d722d64b23a86349bafa6..f88a7ee49f1d1008e7c5858cd59035c4ae9042ac 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineBackground.h @@ -67,8 +67,8 @@ private: /// Gets the values from the fitted GSL, and creates a clone of input /// workspace with new values - API::MatrixWorkspace_sptr saveSplineOutput(const API::MatrixWorkspace_sptr ws, - const size_t spec); + API::MatrixWorkspace_sptr + saveSplineOutput(const API::MatrixWorkspace_sptr &ws, const size_t spec); /// Sets up the splines for later fitting void setupSpline(double xMin, double xMax, int numBins, int ncoeff); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h index f083aef2a5e86091d87bdd1417187022ddfaa438..74f9b50009991ff95a5688e5b02db5d884df66bf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineInterpolation.h @@ -50,8 +50,8 @@ private: /// setup an output workspace using meta data from inws and taking a number of /// spectra API::MatrixWorkspace_sptr - setupOutputWorkspace(API::MatrixWorkspace_sptr mws, - API::MatrixWorkspace_sptr iws) const; + setupOutputWorkspace(const API::MatrixWorkspace_sptr &mws, + const API::MatrixWorkspace_sptr &iws) const; /// convert a binned workspace to point data using ConvertToPointData API::MatrixWorkspace_sptr @@ -59,28 +59,32 @@ private: /// set the points that define the spline used for interpolation of a /// workspace - void setInterpolationPoints(API::MatrixWorkspace_const_sptr inputWorkspace, - const size_t row) const; + void + setInterpolationPoints(const API::MatrixWorkspace_const_sptr &inputWorkspace, + const size_t row) const; /// Calculate the interpolation of the input workspace against the spline and /// store it in outputWorkspace - void calculateSpline(API::MatrixWorkspace_const_sptr inputWorkspace, - API::MatrixWorkspace_sptr outputWorkspace, + void calculateSpline(const API::MatrixWorkspace_const_sptr &inputWorkspace, + const API::MatrixWorkspace_sptr &outputWorkspace, const size_t row) const; /// Calculate the derivatives of the input workspace from the spline. - void calculateDerivatives(API::MatrixWorkspace_const_sptr inputWorkspace, - API::MatrixWorkspace_sptr outputWorkspace, - const size_t order) const; + void + calculateDerivatives(const API::MatrixWorkspace_const_sptr &inputWorkspace, + const API::MatrixWorkspace_sptr &outputWorkspace, + const size_t order) const; /// Find the the interpolation range std::pair - findInterpolationRange(API::MatrixWorkspace_const_sptr iwspt, - API::MatrixWorkspace_sptr mwspt, const size_t row); + findInterpolationRange(const API::MatrixWorkspace_const_sptr &iwspt, + const API::MatrixWorkspace_sptr &mwspt, + const size_t row); /// Extrapolates flat for the points outside the x-range - void extrapolateFlat(API::MatrixWorkspace_sptr ows, - API::MatrixWorkspace_const_sptr iwspt, const size_t row, + void extrapolateFlat(const API::MatrixWorkspace_sptr &ows, + const API::MatrixWorkspace_const_sptr &iwspt, + const size_t row, const std::pair &indices, const bool doDerivs, std::vector &derivs) const; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h index 044afc59ba7b56844f47d60a76e4a998ec210484..122244214cc8484c970af6a281c85d20607fc472 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Algorithms/SplineSmoothing.h @@ -87,7 +87,8 @@ private: const double *ysmooth) const; /// Use an existing fit function to tidy smoothing - void performAdditionalFitting(API::MatrixWorkspace_sptr ws, const int row); + void performAdditionalFitting(const API::MatrixWorkspace_sptr &ws, + const int row); /// Converts histogram data to point data later processing /// convert a binned workspace to point data. Uses mean of the bins as point diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h index 06e2bdf740111eca52ce6268d2ee7b6ca655100d..5a83c4b628ed43a92d79188b51484cda40db48e3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Constraints/BoundaryConstraint.h @@ -35,12 +35,12 @@ public: BoundaryConstraint(const std::string ¶mName); /// Constructor with boundary arguments - BoundaryConstraint(API::IFunction *fun, const std::string paramName, + BoundaryConstraint(API::IFunction *fun, const std::string ¶mName, const double lowerBound, const double upperBound, bool isDefault = false); /// Constructor with lower boundary argument - BoundaryConstraint(API::IFunction *fun, const std::string paramName, + BoundaryConstraint(API::IFunction *fun, const std::string ¶mName, const double lowerBound, bool isDefault = false); /// Initialize the constraint from an expression diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h index 4b63b8d74e3b2028f3577130940b6b01c9eafda2..044d739a2ee15774a6c3c64037b46a7c2aab8e7b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/CostFunctions/CostFuncRwp.h @@ -65,12 +65,12 @@ private: getFitWeights(API::FunctionValues_sptr values) const override; /// Get weight (1/sigma) - double getWeight(API::FunctionValues_sptr values, size_t i, + double getWeight(const API::FunctionValues_sptr &values, size_t i, double sqrtW = 1.0) const; /// Calcualte sqrt(W). Final cost function = sum_i [ (obs_i - cal_i) / (sigma /// * sqrt(W))]**2 - double calSqrtW(API::FunctionValues_sptr values) const; + double calSqrtW(const API::FunctionValues_sptr &values) const; friend class CurveFitting::SeqDomain; friend class CurveFitting::ParDomain; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h index 7e0abc27ffda2a67775139ac820464a664866e92..29f6560aeef34db60eb850c3f7a7ea2507d1724f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ChebfunBase.h @@ -149,7 +149,7 @@ private: void calcIntegrationWeights() const; /// Calculate function values at odd-valued indices of the base x-points - std::vector fitOdd(ChebfunFunctionType f, + std::vector fitOdd(const ChebfunFunctionType &f, std::vector &p) const; /// Calculate function values at odd-valued indices of the base x-points std::vector fitOdd(const API::IFunction &f, diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h index fa533e4bd7576c9dcc0c3ae1e9eb6c032b2121c7..4074de02293556ab543ad486556838515f7eaa04 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/IkedaCarpenterPV.h @@ -72,7 +72,7 @@ private: double &eta) const; /// constrain all parameters to be non-negative - void lowerConstraint0(std::string paramName); + void lowerConstraint0(const std::string ¶mName); }; } // namespace Functions diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h index bfa8e696ab8696d993ed9d98c00091e8597e4926..04a22d80889ba4de376403386dcff7ee3edb1e88 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h @@ -134,7 +134,7 @@ public: PawleyParameterFunction_sptr getPawleyParameterFunction() const; protected: - void setPeakPositions(std::string centreName, double zeroShift, + void setPeakPositions(const std::string ¢reName, double zeroShift, const Geometry::UnitCell &cell) const; size_t calculateFunctionValues(const API::IPeakFunction_sptr &peak, diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h index 84387d058d436ec698564d34519c1a95ef54e2ae..e6c9144c2403f4d540f23714ee10220f24479a65 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ProcessBackground.h @@ -22,17 +22,18 @@ namespace Functions { class RemovePeaks { public: - void setup(DataObjects::TableWorkspace_sptr peaktablews); + void setup(const DataObjects::TableWorkspace_sptr &peaktablews); DataObjects::Workspace2D_sptr - removePeaks(API::MatrixWorkspace_const_sptr dataws, int wsindex, + removePeaks(const API::MatrixWorkspace_const_sptr &dataws, int wsindex, double numfwhm); private: /// Parse peak centre and FWHM from a table workspace - void parsePeakTableWorkspace(DataObjects::TableWorkspace_sptr peaktablews, - std::vector &vec_peakcentre, - std::vector &vec_peakfwhm); + void + parsePeakTableWorkspace(const DataObjects::TableWorkspace_sptr &peaktablews, + std::vector &vec_peakcentre, + std::vector &vec_peakfwhm); /// Exclude peak regions size_t excludePeaks(std::vector v_inX, std::vector &v_useX, @@ -83,15 +84,15 @@ private: /// Select background points automatically DataObjects::Workspace2D_sptr - autoBackgroundSelection(DataObjects::Workspace2D_sptr bkgdWS); + autoBackgroundSelection(const DataObjects::Workspace2D_sptr &bkgdWS); /// Create a background function from input properties BackgroundFunction_sptr - createBackgroundFunction(const std::string backgroundtype); + createBackgroundFunction(const std::string &backgroundtype); /// Filter non-background data points out and create a background workspace DataObjects::Workspace2D_sptr - filterForBackground(BackgroundFunction_sptr bkgdfunction); + filterForBackground(const BackgroundFunction_sptr &bkgdfunction); DataObjects::Workspace2D_const_sptr m_dataWS; DataObjects::Workspace2D_sptr m_outputWS; @@ -119,7 +120,7 @@ private: /// Add a certain region from a reference workspace void addRegion(); - void fitBackgroundFunction(std::string bkgdfunctiontype); + void fitBackgroundFunction(const std::string &bkgdfunctiontype); }; } // namespace Functions diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h index 5f7a4a5a543f71d11692994f24f65fb78543b857..b8888d9eac2e6bde875b5f70448c70b4b1e6ba9f 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/SimpleChebfun.h @@ -25,7 +25,7 @@ public: /// Constructor. SimpleChebfun(size_t n, const API::IFunction &fun, double start, double end); /// Constructor. - SimpleChebfun(ChebfunFunctionType fun, double start, double end, + SimpleChebfun(const ChebfunFunctionType &fun, double start, double end, double accuracy = 0.0, size_t badSize = 10); /// Constructor. SimpleChebfun(const API::IFunction &fun, double start, double end, @@ -67,11 +67,11 @@ public: /// Integrate the function on its interval double integrate() const; /// Add a C++ function to the function - SimpleChebfun &operator+=(ChebfunFunctionType fun); + SimpleChebfun &operator+=(const ChebfunFunctionType &fun); private: /// Constructor - SimpleChebfun(ChebfunBase_sptr base); + SimpleChebfun(const ChebfunBase_sptr &base); /// Underlying base that does actual job. ChebfunBase_sptr m_base; /// Function values at the chebfun x-points. diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h index 2b92d63f49a64ec1839b47c993603f2f46237bae..f9a3e219759782efce5c8be4a7cdb1bc7d6abd15 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/ThermalNeutronDtoTOFFunction.h @@ -40,7 +40,7 @@ public: /// Calculate function values void function1D(std::vector &out, - const std::vector xValues) const; + const std::vector &xValues) const; protected: /// overwrite IFunction base class method, which declare function parameters diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h index 7729f450edc98bf0b158acce88f47172fab96736..25c64ab84184e7732b532fda0be7505110a59dd3 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/GSLFunctions.h @@ -27,7 +27,7 @@ Various GSL specific functions used GSL specific minimizers /// Structure to contain least squares data and used by GSL struct GSL_FitData { /// Constructor - GSL_FitData(boost::shared_ptr cf); + GSL_FitData(const boost::shared_ptr &cf); /// Destructor ~GSL_FitData(); /// number of points to be fitted (size of X, Y and sqrtWeightData arrays) diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/IMWDomainCreator.h b/Framework/CurveFitting/inc/MantidCurveFitting/IMWDomainCreator.h index 52bc6422ba7c0dfd48640896148f76464603ebfa..fb1fca9f1d183e0f57e720a0291601d5dbaa865e 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/IMWDomainCreator.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/IMWDomainCreator.h @@ -15,6 +15,7 @@ #include #include +#include namespace Mantid { namespace API { @@ -53,7 +54,7 @@ public: /// Set the workspace /// @param ws :: workspace to set. void setWorkspace(boost::shared_ptr ws) { - m_matrixWorkspace = ws; + m_matrixWorkspace = std::move(ws); } /// Set the workspace index /// @param wi :: workspace index to set. @@ -92,7 +93,7 @@ protected: const API::IFunction_sptr &function, boost::shared_ptr &ws, const size_t wsIndex, const boost::shared_ptr &domain, - boost::shared_ptr resultValues) const; + const boost::shared_ptr &resultValues) const; /// Store workspace property name std::string m_workspacePropertyName; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h index 8fe95df9b20ae34f15f42c4f49f93cdb155b8919..7fcffd154851a3d6e092f584083e744f6a84c5cf 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomain.h @@ -38,7 +38,7 @@ public: virtual void getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, API::FunctionValues_sptr &values) const; /// Add new domain creator - void addCreator(API::IDomainCreator_sptr creator); + void addCreator(const API::IDomainCreator_sptr &creator); /// Calculate the value of an additive cost function virtual void additiveCostFunctionVal(const CostFunctions::CostFuncFitting &costFunction); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomainSpectrumCreator.h b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomainSpectrumCreator.h index 419c8b1f2d2ec4f4cb70785921aba4b076ab6f1f..4a2d4bcc73c4391f0513474fbeb7388f1990b78b 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomainSpectrumCreator.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/SeqDomainSpectrumCreator.h @@ -49,7 +49,7 @@ public: protected: void setParametersFromPropertyManager(); - void setMatrixWorkspace(API::MatrixWorkspace_sptr matrixWorkspace); + void setMatrixWorkspace(const API::MatrixWorkspace_sptr &matrixWorkspace); bool histogramIsUsable(size_t i) const; diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/TableWorkspaceDomainCreator.h b/Framework/CurveFitting/inc/MantidCurveFitting/TableWorkspaceDomainCreator.h index b656b1ece051dcfda721c3be6227bc887a702de4..3cb41d153268d38c2c2ade83187a4a1a2a4081f4 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/TableWorkspaceDomainCreator.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/TableWorkspaceDomainCreator.h @@ -16,6 +16,7 @@ #include #include +#include namespace Mantid { namespace API { @@ -55,7 +56,9 @@ public: /// Set the workspace /// @param ws :: workspace to set. - void setWorkspace(API::ITableWorkspace_sptr ws) { m_tableWorkspace = ws; } + void setWorkspace(API::ITableWorkspace_sptr ws) { + m_tableWorkspace = std::move(ws); + } /// Set the startX and endX /// @param startX :: Start of the domain /// @param endX :: End of the domain @@ -88,7 +91,7 @@ private: /// Set all parameters void setParameters() const; /// Set the names of the X, Y and Error columns - void setXYEColumnNames(API::ITableWorkspace_sptr ws) const; + void setXYEColumnNames(const API::ITableWorkspace_sptr &ws) const; /// Creates the blank output workspace of the correct size boost::shared_ptr createEmptyResultWS(const size_t nhistograms, const size_t nyvalues); @@ -109,9 +112,9 @@ private: const API::IFunction_sptr &function, boost::shared_ptr &ws, const size_t wsIndex, const boost::shared_ptr &domain, - boost::shared_ptr resultValues) const; + const boost::shared_ptr &resultValues) const; /// Check workspace is in the correct form - void setAndValidateWorkspace(API::Workspace_sptr ws) const; + void setAndValidateWorkspace(const API::Workspace_sptr &ws) const; /// Store workspace property name std::string m_workspacePropertyName; diff --git a/Framework/CurveFitting/src/Algorithms/ConvolutionFit.cpp b/Framework/CurveFitting/src/Algorithms/ConvolutionFit.cpp index 922def0043a672818ed576def4413b12afe5770e..0467eb66c2534f18e08e4f99a6b00cd2efaf9df9 100644 --- a/Framework/CurveFitting/src/Algorithms/ConvolutionFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvolutionFit.cpp @@ -27,16 +27,17 @@ #include #include +#include namespace { using namespace Mantid::API; using namespace Mantid::Kernel; using Mantid::MantidVec; -std::size_t numberOfFunctions(IFunction_sptr function, +std::size_t numberOfFunctions(const IFunction_sptr &function, const std::string &functionName); -std::size_t numberOfFunctions(CompositeFunction_sptr composite, +std::size_t numberOfFunctions(const CompositeFunction_sptr &composite, const std::string &functionName) { std::size_t count = 0; for (auto i = 0u; i < composite->nFunctions(); ++i) @@ -44,7 +45,7 @@ std::size_t numberOfFunctions(CompositeFunction_sptr composite, return count; } -std::size_t numberOfFunctions(IFunction_sptr function, +std::size_t numberOfFunctions(const IFunction_sptr &function, const std::string &functionName) { const auto composite = boost::dynamic_pointer_cast(function); @@ -53,9 +54,10 @@ std::size_t numberOfFunctions(IFunction_sptr function, return function->name() == functionName ? 1 : 0; } -bool containsFunction(IFunction_sptr function, const std::string &functionName); +bool containsFunction(const IFunction_sptr &function, + const std::string &functionName); -bool containsFunction(CompositeFunction_sptr composite, +bool containsFunction(const CompositeFunction_sptr &composite, const std::string &functionName) { for (auto i = 0u; i < composite->nFunctions(); ++i) { if (containsFunction(composite->getFunction(i), functionName)) @@ -64,7 +66,7 @@ bool containsFunction(CompositeFunction_sptr composite, return false; } -bool containsFunction(IFunction_sptr function, +bool containsFunction(const IFunction_sptr &function, const std::string &functionName) { const auto composite = boost::dynamic_pointer_cast(function); @@ -125,7 +127,7 @@ std::vector squareRootVector(const std::vector &vec) { IFunction_sptr extractFirstBackground(IFunction_sptr function); -IFunction_sptr extractFirstBackground(CompositeFunction_sptr composite) { +IFunction_sptr extractFirstBackground(const CompositeFunction_sptr &composite) { for (auto i = 0u; i < composite->nFunctions(); ++i) { auto background = extractFirstBackground(composite->getFunction(i)); if (background) @@ -145,7 +147,7 @@ IFunction_sptr extractFirstBackground(IFunction_sptr function) { } std::string extractBackgroundType(IFunction_sptr function) { - auto background = extractFirstBackground(function); + auto background = extractFirstBackground(std::move(function)); if (!background) return "None"; @@ -164,7 +166,7 @@ std::string extractBackgroundType(IFunction_sptr function) { std::vector searchForFitParameters(const std::string &suffix, - ITableWorkspace_sptr tableWorkspace) { + const ITableWorkspace_sptr &tableWorkspace) { auto indices = std::vector(); for (auto i = 0u; i < tableWorkspace->columnCount(); ++i) { diff --git a/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp index bcb3d9f203c734b1080c9c7977a0e3420e5d9742..6a877355610cd870d92d49b448a515f9b6231c15 100644 --- a/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp +++ b/Framework/CurveFitting/src/Algorithms/EstimatePeakErrors.cpp @@ -91,7 +91,7 @@ GSLMatrix makeJacobian(IPeakFunction &peak, double ¢re, double &height, /// @param covariance :: The covariance matrix for the parameters of the peak. /// @param prefix :: A prefix for the parameter names. void calculatePeakValues(IPeakFunction &peak, ITableWorkspace &results, - const GSLMatrix covariance, + const GSLMatrix &covariance, const std::string &prefix) { double centre, height, fwhm, intensity; GSLMatrix J = makeJacobian(peak, centre, height, fwhm, intensity); diff --git a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp index 16f1357a3fe5f7e00504b2b24d6c64f51a092f48..06bd9665443a40cf43cff10463e9ddb680d4d365 100644 --- a/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp +++ b/Framework/CurveFitting/src/Algorithms/FitPowderDiffPeaks.cpp @@ -36,6 +36,8 @@ #include #include +#include + #include /// Factor on FWHM for fitting a peak @@ -520,11 +522,10 @@ void FitPowderDiffPeaks::fitPeaksRobust() { /** Observe peak range with hint from right peak's properties * Assumption: the background is reasonably flat within peak range */ -void FitPowderDiffPeaks::observePeakRange(BackToBackExponential_sptr thispeak, - BackToBackExponential_sptr rightpeak, - double refpeakshift, - double &peakleftbound, - double &peakrightbound) { +void FitPowderDiffPeaks::observePeakRange( + const BackToBackExponential_sptr &thispeak, + const BackToBackExponential_sptr &rightpeak, double refpeakshift, + double &peakleftbound, double &peakrightbound) { double predictcentre = thispeak->centre(); double rightfwhm = rightpeak->fwhm(); @@ -607,9 +608,10 @@ void FitPowderDiffPeaks::observePeakRange(BackToBackExponential_sptr thispeak, * Return: chi2 ... all the other parameter should be just in peak */ bool FitPowderDiffPeaks::fitSinglePeakRobust( - BackToBackExponential_sptr peak, BackgroundFunction_sptr backgroundfunction, - double peakleftbound, double peakrightbound, - map rightpeakparammap, double &finalchi2) { + const BackToBackExponential_sptr &peak, + const BackgroundFunction_sptr &backgroundfunction, double peakleftbound, + double peakrightbound, const map &rightpeakparammap, + double &finalchi2) { // 1. Build partial workspace Workspace2D_sptr peakws = buildPartialWorkspace(m_dataWS, m_wsIndex, peakleftbound, peakrightbound); @@ -836,8 +838,9 @@ bool FitPowderDiffPeaks::fitSinglePeakRobust( * Note 1: in a limited range (4*FWHM) */ bool FitPowderDiffPeaks::doFit1PeakBackground( - Workspace2D_sptr dataws, size_t wsindex, BackToBackExponential_sptr peak, - BackgroundFunction_sptr backgroundfunction, double &chi2) { + const Workspace2D_sptr &dataws, size_t wsindex, + const BackToBackExponential_sptr &peak, + const BackgroundFunction_sptr &backgroundfunction, double &chi2) { // 0. Set fit parameters string minimzername("Levenberg-MarquardtMD"); double startx = peak->centre() - 3.0 * peak->fwhm(); @@ -904,7 +907,7 @@ bool FitPowderDiffPeaks::doFit1PeakBackground( /** Fit signle peak by Monte Carlo/simulated annealing */ bool FitPowderDiffPeaks::fitSinglePeakSimulatedAnnealing( - BackToBackExponential_sptr peak, vector paramtodomc) { + const BackToBackExponential_sptr &peak, const vector ¶mtodomc) { UNUSED_ARG(peak); UNUSED_ARG(paramtodomc); throw runtime_error("To Be Implemented Soon!"); @@ -1218,8 +1221,9 @@ void FitPowderDiffPeaks::fitPeaksWithGoodStartingValues() { * @param annhilatedpeak :: (output) annhilatedpeak */ bool FitPowderDiffPeaks::fitSinglePeakConfident( - BackToBackExponential_sptr peak, BackgroundFunction_sptr backgroundfunction, - double leftbound, double rightbound, double &chi2, bool &annhilatedpeak) { + const BackToBackExponential_sptr &peak, + const BackgroundFunction_sptr &backgroundfunction, double leftbound, + double rightbound, double &chi2, bool &annhilatedpeak) { // 1. Build the partial workspace // a) Determine boundary if necessary if (leftbound < 0 || leftbound >= peak->centre()) @@ -1518,8 +1522,8 @@ void FitPowderDiffPeaks::calculatePeakFitBoundary(size_t ileftpeak, *negative, then no constraint */ std::pair -FitPowderDiffPeaks::doFitPeak(Workspace2D_sptr dataws, - BackToBackExponential_sptr peakfunction, +FitPowderDiffPeaks::doFitPeak(const Workspace2D_sptr &dataws, + const BackToBackExponential_sptr &peakfunction, double guessedfwhm) { // 1. Set up boundary if (guessedfwhm > 0) { @@ -1624,7 +1628,7 @@ FitPowderDiffPeaks::doFitPeak(Workspace2D_sptr dataws, /** Store the function's parameter values to a map */ void FitPowderDiffPeaks::storeFunctionParameters( - IFunction_sptr function, std::map ¶mmaps) { + const IFunction_sptr &function, std::map ¶mmaps) { vector paramnames = function->getParameterNames(); parammaps.clear(); for (auto ¶mname : paramnames) @@ -1635,7 +1639,7 @@ void FitPowderDiffPeaks::storeFunctionParameters( /** Restore the function's parameter values from a map */ void FitPowderDiffPeaks::restoreFunctionParameters( - IFunction_sptr function, map parammap) { + const IFunction_sptr &function, map parammap) { vector paramnames = function->getParameterNames(); for (auto &parname : paramnames) { auto miter = parammap.find(parname); @@ -1658,8 +1662,8 @@ void FitPowderDiffPeaks::restoreFunctionParameters( * 2. chi2 */ bool FitPowderDiffPeaks::doFit1PeakSimple( - Workspace2D_sptr dataws, size_t workspaceindex, - BackToBackExponential_sptr peakfunction, string minimzername, + const Workspace2D_sptr &dataws, size_t workspaceindex, + const BackToBackExponential_sptr &peakfunction, const string &minimzername, size_t maxiteration, double &chi2) { stringstream dbss; dbss << peakfunction->asString() << '\n'; @@ -1728,9 +1732,10 @@ bool FitPowderDiffPeaks::doFit1PeakSimple( * @param chi2 :: The chi squared value (output) */ bool FitPowderDiffPeaks::doFit1PeakSequential( - Workspace2D_sptr dataws, size_t workspaceindex, - BackToBackExponential_sptr peakfunction, vector minimzernames, - vector maxiterations, vector dampfactors, double &chi2) { + const Workspace2D_sptr &dataws, size_t workspaceindex, + const BackToBackExponential_sptr &peakfunction, + vector minimzernames, vector maxiterations, + const vector &dampfactors, double &chi2) { // 1. Check if (minimzernames.size() != maxiterations.size() && minimzernames.size() != dampfactors.size()) { @@ -1789,11 +1794,10 @@ bool FitPowderDiffPeaks::doFit1PeakSequential( //---------------------------------------------------------------------------- /** Fit background-removed peak by Gaussian */ -bool FitPowderDiffPeaks::doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, - size_t workspaceindex, - double in_center, double leftfwhm, - double rightfwhm, double ¢er, - double &sigma, double &height) { +bool FitPowderDiffPeaks::doFitGaussianPeak( + const DataObjects::Workspace2D_sptr &dataws, size_t workspaceindex, + double in_center, double leftfwhm, double rightfwhm, double ¢er, + double &sigma, double &height) { // 1. Estimate const auto &X = dataws->x(workspaceindex); const auto &Y = dataws->y(workspaceindex); @@ -1873,7 +1877,7 @@ bool FitPowderDiffPeaks::doFitGaussianPeak(DataObjects::Workspace2D_sptr dataws, */ bool FitPowderDiffPeaks::fitOverlappedPeaks( vector peaks, - BackgroundFunction_sptr backgroundfunction, double gfwhm) { + const BackgroundFunction_sptr &backgroundfunction, double gfwhm) { // 1. Sort peak if necessary vector> tofpeakpairs(peaks.size()); for (size_t i = 0; i < peaks.size(); ++i) @@ -1951,7 +1955,8 @@ bool FitPowderDiffPeaks::fitOverlappedPeaks( /** Fit multiple (overlapped) peaks */ bool FitPowderDiffPeaks::doFitMultiplePeaks( - Workspace2D_sptr dataws, size_t wsindex, CompositeFunction_sptr peaksfunc, + const Workspace2D_sptr &dataws, size_t wsindex, + const CompositeFunction_sptr &peaksfunc, vector peakfuncs, vector &vecfitgood, vector &vecchi2s) { // 0. Pre-debug output @@ -2062,7 +2067,7 @@ bool FitPowderDiffPeaks::doFitMultiplePeaks( * @param peaks :: A vector of instances of BackToBackExponential function */ void FitPowderDiffPeaks::estimatePeakHeightsLeBail( - Workspace2D_sptr dataws, size_t wsindex, + const Workspace2D_sptr &dataws, size_t wsindex, vector peaks) { // 1. Build data structures FunctionDomain1DVector domain(dataws->x(wsindex).rawData()); @@ -2110,7 +2115,7 @@ void FitPowderDiffPeaks::estimatePeakHeightsLeBail( /** Set constraints on a group of overlapped peaks for fitting */ void FitPowderDiffPeaks::setOverlappedPeaksConstraints( - vector peaks) { + const vector &peaks) { for (const auto &thispeak : peaks) { // 1. Set constraint on X. double fwhm = thispeak->fwhm(); @@ -2128,9 +2133,10 @@ void FitPowderDiffPeaks::setOverlappedPeaksConstraints( /** Fit N overlapped peaks in a simple manner */ bool FitPowderDiffPeaks::doFitNPeaksSimple( - Workspace2D_sptr dataws, size_t wsindex, CompositeFunction_sptr peaksfunc, - vector peakfuncs, string minimizername, - size_t maxiteration, double &chi2) { + const Workspace2D_sptr &dataws, size_t wsindex, + const CompositeFunction_sptr &peaksfunc, + const vector &peakfuncs, + const string &minimizername, size_t maxiteration, double &chi2) { // 1. Debug output stringstream dbss0; dbss0 << "Starting Value: "; @@ -2190,8 +2196,9 @@ bool FitPowderDiffPeaks::doFitNPeaksSimple( //---------------------------------------------------------------------------------------------- /** Parse fit result */ -std::string FitPowderDiffPeaks::parseFitResult(API::IAlgorithm_sptr fitalg, - double &chi2, bool &fitsuccess) { +std::string +FitPowderDiffPeaks::parseFitResult(const API::IAlgorithm_sptr &fitalg, + double &chi2, bool &fitsuccess) { stringstream rss; chi2 = fitalg->getProperty("OutputChi2overDoF"); @@ -2209,7 +2216,7 @@ std::string FitPowderDiffPeaks::parseFitResult(API::IAlgorithm_sptr fitalg, /** Parse parameter workspace returned from Fit() */ std::string FitPowderDiffPeaks::parseFitParameterWorkspace( - API::ITableWorkspace_sptr paramws) { + const API::ITableWorkspace_sptr ¶mws) { // 1. Check if (!paramws) { g_log.warning() << "Input table workspace is NULL. \n"; @@ -2239,7 +2246,7 @@ std::string FitPowderDiffPeaks::parseFitParameterWorkspace( * the diffrotometer geometry parameters */ void FitPowderDiffPeaks::importInstrumentParameterFromTable( - DataObjects::TableWorkspace_sptr parameterWS) { + const DataObjects::TableWorkspace_sptr ¶meterWS) { // 1. Check column orders std::vector colnames = parameterWS->getColumnNames(); if (colnames.size() < 2) { @@ -2284,7 +2291,7 @@ void FitPowderDiffPeaks::importInstrumentParameterFromTable( /** Import Bragg peak table workspace */ void FitPowderDiffPeaks::parseBraggPeakTable( - TableWorkspace_sptr peakws, vector> ¶mmaps, + const TableWorkspace_sptr &peakws, vector> ¶mmaps, vector> &hklmaps) { // 1. Get columns' types and names vector paramnames = peakws->getColumnNames(); @@ -2584,7 +2591,8 @@ FitPowderDiffPeaks::genPeakParametersWorkspace() { * Each peak within requirement will put into both (1) m_peaks and (2) * m_peaksmap */ -void FitPowderDiffPeaks::genPeaksFromTable(TableWorkspace_sptr peakparamws) { +void FitPowderDiffPeaks::genPeaksFromTable( + const TableWorkspace_sptr &peakparamws) { // Check and clear input and output if (!peakparamws) { stringstream errss; @@ -2729,7 +2737,7 @@ FitPowderDiffPeaks::genPeak(map hklmap, newpeakptr->initialize(); // Check miller index (HKL) is a valid value in a miller indexes pool (hklmap) - good = getHKLFromMap(hklmap, hkl); + good = getHKLFromMap(std::move(hklmap), hkl); if (!good) { // Ignore and return return newpeakptr; @@ -2909,9 +2917,9 @@ FitPowderDiffPeaks::genPeak(map hklmap, * @param peakfunction: function to plot * @param background: background of the peak */ -void FitPowderDiffPeaks::plotFunction(IFunction_sptr peakfunction, - BackgroundFunction_sptr background, - FunctionDomain1DVector domain) { +void FitPowderDiffPeaks::plotFunction(const IFunction_sptr &peakfunction, + const BackgroundFunction_sptr &background, + const FunctionDomain1DVector &domain) { // 1. Determine range const auto &vecX = m_dataWS->x(m_wsIndex); double x0 = domain[0]; @@ -3010,7 +3018,7 @@ void FitPowderDiffPeaks::cropWorkspace(double tofmin, double tofmax) { * Exception: throw runtime error if there is no such parameter * @param parname: parameter name to get from m_instrumentParameters */ -double FitPowderDiffPeaks::getParameter(string parname) { +double FitPowderDiffPeaks::getParameter(const string &parname) { map::iterator mapiter; mapiter = m_instrumentParmaeters.find(parname); @@ -3033,10 +3041,9 @@ double FitPowderDiffPeaks::getParameter(string parname) { * @param leftbound: lower boundary of the source data * @param rightbound: upper boundary of the source data */ -Workspace2D_sptr -FitPowderDiffPeaks::buildPartialWorkspace(API::MatrixWorkspace_sptr sourcews, - size_t workspaceindex, - double leftbound, double rightbound) { +Workspace2D_sptr FitPowderDiffPeaks::buildPartialWorkspace( + const API::MatrixWorkspace_sptr &sourcews, size_t workspaceindex, + double leftbound, double rightbound) { // 1. Check const auto &X = sourcews->x(workspaceindex); const auto &Y = sourcews->y(workspaceindex); @@ -3093,7 +3100,7 @@ FitPowderDiffPeaks::buildPartialWorkspace(API::MatrixWorkspace_sptr sourcews, /** Get function parameter values information and returned as a string * @param function: function to have information written out */ -string getFunctionInfo(IFunction_sptr function) { +string getFunctionInfo(const IFunction_sptr &function) { stringstream outss; vector parnames = function->getParameterNames(); size_t numpars = parnames.size(); @@ -3117,8 +3124,8 @@ string getFunctionInfo(IFunction_sptr function) { * @param wsindexpeak: workspace index of spectrum holding pure peak data (with * background removed) */ -void estimateBackgroundCoarse(DataObjects::Workspace2D_sptr dataws, - BackgroundFunction_sptr background, +void estimateBackgroundCoarse(const DataObjects::Workspace2D_sptr &dataws, + const BackgroundFunction_sptr &background, size_t wsindexraw, size_t wsindexbkgd, size_t wsindexpeak) { // 1. Get prepared @@ -3192,7 +3199,7 @@ void estimateBackgroundCoarse(DataObjects::Workspace2D_sptr dataws, * @param fwhm :: (output) peak FWHM * @param errmsg :: (output) error message */ -bool observePeakParameters(Workspace2D_sptr dataws, size_t wsindex, +bool observePeakParameters(const Workspace2D_sptr &dataws, size_t wsindex, double ¢re, double &height, double &fwhm, string &errmsg) { // 1. Get the value of the Max Height @@ -3306,7 +3313,7 @@ size_t findMaxValue(const std::vector &Y) { * @param rightbound :: upper constraint for check * @return the index of the maximum value */ -size_t findMaxValue(MatrixWorkspace_sptr dataws, size_t wsindex, +size_t findMaxValue(const MatrixWorkspace_sptr &dataws, size_t wsindex, double leftbound, double rightbound) { const auto &X = dataws->x(wsindex); const auto &Y = dataws->y(wsindex); diff --git a/Framework/CurveFitting/src/Algorithms/IqtFit.cpp b/Framework/CurveFitting/src/Algorithms/IqtFit.cpp index a07141bd11e6ba5f4e999c81e6ab736c77ccb731..698f4868b3f1f330b45f6a417e6cf8bba1fff3d3 100644 --- a/Framework/CurveFitting/src/Algorithms/IqtFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/IqtFit.cpp @@ -17,7 +17,7 @@ using namespace Mantid::API; namespace { Mantid::Kernel::Logger g_log("IqtFit"); -MatrixWorkspace_sptr cropWorkspace(MatrixWorkspace_sptr workspace, +MatrixWorkspace_sptr cropWorkspace(const MatrixWorkspace_sptr &workspace, double startX, double endX) { auto cropper = AlgorithmManager::Instance().create("CropWorkspace"); cropper->setLogging(false); @@ -30,7 +30,7 @@ MatrixWorkspace_sptr cropWorkspace(MatrixWorkspace_sptr workspace, return cropper->getProperty("OutputWorkspace"); } -MatrixWorkspace_sptr convertToHistogram(MatrixWorkspace_sptr workspace) { +MatrixWorkspace_sptr convertToHistogram(const MatrixWorkspace_sptr &workspace) { auto converter = AlgorithmManager::Instance().create("ConvertToHistogram"); converter->setLogging(false); converter->setAlwaysStoreInADS(false); @@ -43,8 +43,8 @@ MatrixWorkspace_sptr convertToHistogram(MatrixWorkspace_sptr workspace) { struct HistogramConverter { explicit HistogramConverter() : m_converted() {} - MatrixWorkspace_sptr operator()(MatrixWorkspace_sptr workspace, double startX, - double endX) const { + MatrixWorkspace_sptr operator()(const MatrixWorkspace_sptr &workspace, + double startX, double endX) const { auto it = m_converted.find(workspace.get()); if (it != m_converted.end()) return it->second; diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index e793fecd3a4f41d158b1d6c408c6ea8904ebfa07..38b2f5b3f91c4788d2956868534211255cff763c 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -763,7 +763,8 @@ void LeBailFit::createLeBailFunction() { * @param wsindex: workspace index of the data to fit against */ API::MatrixWorkspace_sptr -LeBailFit::cropWorkspace(API::MatrixWorkspace_sptr inpws, size_t wsindex) { +LeBailFit::cropWorkspace(const API::MatrixWorkspace_sptr &inpws, + size_t wsindex) { // Process input property 'FitRegion' for range of data to fit/calculate std::vector fitrange = this->getProperty("FitRegion"); @@ -1143,9 +1144,9 @@ void LeBailFit::parseBraggPeaksParametersTable() { /** Parse table workspace (from Fit()) containing background parameters to a * vector */ -void LeBailFit::parseBackgroundTableWorkspace(TableWorkspace_sptr bkgdparamws, - vector &bkgdparnames, - vector &bkgdorderparams) { +void LeBailFit::parseBackgroundTableWorkspace( + const TableWorkspace_sptr &bkgdparamws, vector &bkgdparnames, + vector &bkgdorderparams) { g_log.debug() << "DB1105A Parsing background TableWorkspace.\n"; // Clear (output) map @@ -1746,7 +1747,7 @@ void LeBailFit::doMarkovChain( * @param tablews :: TableWorkspace containing the Monte Carlo setup */ void LeBailFit::setupRandomWalkStrategyFromTable( - DataObjects::TableWorkspace_sptr tablews) { + const DataObjects::TableWorkspace_sptr &tablews) { g_log.information("Set up random walk strategy from table."); // Scan the table @@ -1941,7 +1942,7 @@ void LeBailFit::setupBuiltInRandomWalkStrategy() { *list */ void LeBailFit::addParameterToMCMinimize(vector &parnamesforMC, - string parname) { + const string &parname) { map::iterator pariter; pariter = m_funcParameters.find(parname); if (pariter == m_funcParameters.end()) { @@ -2094,7 +2095,7 @@ bool LeBailFit::calculateDiffractionPattern(const HistogramX &vecX, *proposed new values in * this group */ -bool LeBailFit::proposeNewValues(vector mcgroup, Rfactor r, +bool LeBailFit::proposeNewValues(const vector &mcgroup, Rfactor r, map &curparammap, map &newparammap, bool prevBetterRwp) { @@ -2414,7 +2415,7 @@ LeBailFit::convertToDoubleMap(std::map &inmap) { /** Write a set of (XY) data to a column file */ void writeRfactorsToFile(vector vecX, vector vecR, - string filename) { + const string &filename) { ofstream ofile; ofile.open(filename.c_str()); diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp index 8f87924d8e51706ff5ac83a85024b8d4331fa7ff..8488fa549072ed1db630d781f2cc06a21f717be7 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFunction.cpp @@ -14,6 +14,7 @@ #include "MantidKernel/System.h" #include +#include #include @@ -42,7 +43,7 @@ Kernel::Logger g_log("LeBailFunction"); //---------------------------------------------------------------------------------------------- /** Constructor */ -LeBailFunction::LeBailFunction(std::string peaktype) { +LeBailFunction::LeBailFunction(const std::string &peaktype) { // Set initial values to some class variables CompositeFunction_sptr m_function(new CompositeFunction()); m_compsiteFunction = m_function; @@ -169,7 +170,7 @@ HistogramY LeBailFunction::calPeak(size_t ipk, /** Check whether a parameter is a profile parameter * @param paramname :: parameter name to check with */ -bool LeBailFunction::hasProfileParameter(std::string paramname) { +bool LeBailFunction::hasProfileParameter(const std::string ¶mname) { auto fiter = lower_bound(m_orderedProfileParameterNames.cbegin(), m_orderedProfileParameterNames.cend(), paramname); @@ -619,8 +620,8 @@ bool LeBailFunction::calculateGroupPeakIntensities( * @param peakheight: height of the peak * @param setpeakheight: boolean as the option to set peak height or not. */ -void LeBailFunction::setPeakParameters(IPowderDiffPeakFunction_sptr peak, - map parammap, +void LeBailFunction::setPeakParameters(const IPowderDiffPeakFunction_sptr &peak, + const map ¶mmap, double peakheight, bool setpeakheight) { UNUSED_ARG(peak); UNUSED_ARG(parammap); @@ -855,7 +856,7 @@ void LeBailFunction::groupPeaks( * @param endx :: background's EndX. Used by Chebyshev */ void LeBailFunction::addBackgroundFunction( - string backgroundtype, const unsigned int &order, + const string &backgroundtype, const unsigned int &order, const std::vector &vecparnames, const std::vector &vecparvalues, double startx, double endx) { // Check @@ -911,8 +912,8 @@ void LeBailFunction::addBackgroundFunction( * @param minvalue :: lower boundary * @param maxvalue :: upper boundary */ -void LeBailFunction::setFitProfileParameter(string paramname, double minvalue, - double maxvalue) { +void LeBailFunction::setFitProfileParameter(const string ¶mname, + double minvalue, double maxvalue) { // Make ties in composition function for (size_t ipk = 1; ipk < m_numPeaks; ++ipk) { stringstream ss1, ss2; @@ -939,7 +940,8 @@ void LeBailFunction::setFitProfileParameter(string paramname, double minvalue, * @param paramname :: name of parameter * @param paramvalue :: value of parameter to be fixed to */ -void LeBailFunction::fixPeakParameter(string paramname, double paramvalue) { +void LeBailFunction::fixPeakParameter(const string ¶mname, + double paramvalue) { for (size_t ipk = 0; ipk < m_numPeaks; ++ipk) { stringstream ss1, ss2; ss1 << "f" << ipk << "." << paramname; @@ -987,7 +989,7 @@ void LeBailFunction::setFixPeakHeights() { /** Reset all peaks' height * @param inheights :: list of peak heights corresponding to each peak */ -void LeBailFunction::setPeakHeights(std::vector inheights) { +void LeBailFunction::setPeakHeights(const std::vector &inheights) { UNUSED_ARG(inheights); throw runtime_error("It is not implemented properly."); /* @@ -1026,7 +1028,7 @@ IPowderDiffPeakFunction_sptr LeBailFunction::getPeak(size_t peakindex) { /** Get value of one specific peak's parameter */ double LeBailFunction::getPeakParameter(std::vector hkl, - std::string parname) const { + const std::string &parname) const { // Search peak in map map, IPowderDiffPeakFunction_sptr>::const_iterator fiter; fiter = m_mapHKLPeak.find(hkl); @@ -1040,7 +1042,7 @@ double LeBailFunction::getPeakParameter(std::vector hkl, IPowderDiffPeakFunction_sptr peak = fiter->second; - double parvalue = getPeakParameterValue(peak, parname); + double parvalue = getPeakParameterValue(peak, std::move(parname)); return parvalue; } @@ -1049,7 +1051,7 @@ double LeBailFunction::getPeakParameter(std::vector hkl, /** Get value of one specific peak's parameter */ double LeBailFunction::getPeakParameter(size_t index, - std::string parname) const { + const std::string &parname) const { if (index >= m_numPeaks) { stringstream errss; errss << "getPeakParameter() tries to reach a peak with index " << index @@ -1060,7 +1062,7 @@ double LeBailFunction::getPeakParameter(size_t index, } IPowderDiffPeakFunction_sptr peak = m_vecPeaks[index]; - double value = getPeakParameterValue(peak, parname); + double value = getPeakParameterValue(peak, std::move(parname)); return value; } @@ -1070,9 +1072,9 @@ double LeBailFunction::getPeakParameter(size_t index, * @param peak :: shared pointer to peak function * @param parname :: name of the peak parameter */ -double -LeBailFunction::getPeakParameterValue(API::IPowderDiffPeakFunction_sptr peak, - std::string parname) const { +double LeBailFunction::getPeakParameterValue( + const API::IPowderDiffPeakFunction_sptr &peak, + const std::string &parname) const { // Locate the category of the parameter name auto vsiter = lower_bound(m_orderedProfileParameterNames.cbegin(), m_orderedProfileParameterNames.cend(), parname); diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index 844d1b3418a1b824134a251b91f5c724b4f55762..d051738dae1ea455805dea2a0b51e4fddb5c937e 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -431,7 +431,7 @@ boost::shared_ptr PlotPeakByLogValue::runSingleFit( return fit; } -double PlotPeakByLogValue::calculateLogValue(std::string logName, +double PlotPeakByLogValue::calculateLogValue(const std::string &logName, const InputSpectraToFit &data) { double logValue = 0; if (logName.empty() || logName == "axis-1") { @@ -457,7 +457,7 @@ double PlotPeakByLogValue::calculateLogValue(std::string logName, return logValue; } -void PlotPeakByLogValue::setWorkspaceIndexAttribute(IFunction_sptr fun, +void PlotPeakByLogValue::setWorkspaceIndexAttribute(const IFunction_sptr &fun, int wsIndex) const { const std::string attName = "WorkspaceIndex"; if (fun->hasAttribute(attName)) { diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValueHelper.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValueHelper.cpp index d6c2bfa8721d796335a3092a24c88b9278aaea25..3e92ea95565d37ae9b5bbf56f36b51fda612e20e 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValueHelper.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValueHelper.cpp @@ -85,8 +85,8 @@ void addMatrixworkspace( const boost::optional &workspaceOptional, const boost::shared_ptr &wsMatrix); /// Create a list of input workspace names -std::vector makeNames(std::string inputList, int default_wi, - int default_spec) { +std::vector makeNames(const std::string &inputList, + int default_wi, int default_spec) { std::vector nameList; double start = 0; diff --git a/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp b/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp index dee0ebc28b150d88dfbc2cc586ff6804c4318574..2e901f05f84296d1921ab532c09759670abc5759 100644 --- a/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp +++ b/Framework/CurveFitting/src/Algorithms/QENSFitSequential.cpp @@ -24,6 +24,7 @@ #include #include #include +#include namespace { using namespace Mantid::API; @@ -39,8 +40,9 @@ MatrixWorkspace_sptr getADSMatrixWorkspace(const std::string &workspaceName) { workspaceName); } -MatrixWorkspace_sptr convertSpectrumAxis(MatrixWorkspace_sptr inputWorkspace, - const std::string &outputName) { +MatrixWorkspace_sptr +convertSpectrumAxis(const MatrixWorkspace_sptr &inputWorkspace, + const std::string &outputName) { auto convSpec = AlgorithmManager::Instance().create("ConvertSpectrumAxis"); convSpec->setLogging(false); convSpec->setProperty("InputWorkspace", inputWorkspace); @@ -53,16 +55,16 @@ MatrixWorkspace_sptr convertSpectrumAxis(MatrixWorkspace_sptr inputWorkspace, return getADSMatrixWorkspace(outputName); } -MatrixWorkspace_sptr cloneWorkspace(MatrixWorkspace_sptr inputWorkspace, +MatrixWorkspace_sptr cloneWorkspace(const MatrixWorkspace_sptr &inputWorkspace, const std::string &outputName) { Workspace_sptr workspace = inputWorkspace->clone(); AnalysisDataService::Instance().addOrReplace(outputName, workspace); return boost::dynamic_pointer_cast(workspace); } -MatrixWorkspace_sptr convertToElasticQ(MatrixWorkspace_sptr inputWorkspace, - const std::string &outputName, - bool doThrow) { +MatrixWorkspace_sptr +convertToElasticQ(const MatrixWorkspace_sptr &inputWorkspace, + const std::string &outputName, bool doThrow) { auto axis = inputWorkspace->getAxis(1); if (axis->isSpectra()) return convertSpectrumAxis(inputWorkspace, outputName); @@ -80,8 +82,8 @@ struct ElasticQAppender { explicit ElasticQAppender(std::vector &elasticInput) : m_elasticInput(elasticInput), m_converted() {} - void operator()(MatrixWorkspace_sptr workspace, const std::string &outputBase, - bool doThrow) { + void operator()(const MatrixWorkspace_sptr &workspace, + const std::string &outputBase, bool doThrow) { auto it = m_converted.find(workspace.get()); if (it != m_converted.end()) m_elasticInput.emplace_back(it->second); @@ -111,13 +113,13 @@ convertToElasticQ(const std::vector &workspaces, return elasticInput; } -void extractFunctionNames(CompositeFunction_sptr composite, +void extractFunctionNames(const CompositeFunction_sptr &composite, std::vector &names) { for (auto i = 0u; i < composite->nFunctions(); ++i) names.emplace_back(composite->getFunction(i)->name()); } -void extractFunctionNames(IFunction_sptr function, +void extractFunctionNames(const IFunction_sptr &function, std::vector &names) { auto composite = boost::dynamic_pointer_cast(function); if (composite) @@ -126,16 +128,16 @@ void extractFunctionNames(IFunction_sptr function, names.emplace_back(function->name()); } -void extractConvolvedNames(IFunction_sptr function, +void extractConvolvedNames(const IFunction_sptr &function, std::vector &names); -void extractConvolvedNames(CompositeFunction_sptr composite, +void extractConvolvedNames(const CompositeFunction_sptr &composite, std::vector &names) { for (auto i = 0u; i < composite->nFunctions(); ++i) extractConvolvedNames(composite->getFunction(i), names); } -void extractConvolvedNames(IFunction_sptr function, +void extractConvolvedNames(const IFunction_sptr &function, std::vector &names) { auto composite = boost::dynamic_pointer_cast(function); if (composite) { @@ -147,8 +149,8 @@ void extractConvolvedNames(IFunction_sptr function, } } -std::string constructInputString(MatrixWorkspace_sptr workspace, int specMin, - int specMax) { +std::string constructInputString(const MatrixWorkspace_sptr &workspace, + int specMin, int specMax) { std::ostringstream input; for (auto i = specMin; i < specMax + 1; ++i) input << workspace->getName() << ",i" << std::to_string(i) << ";"; @@ -204,14 +206,16 @@ replaceWorkspaces(const std::string &input, return newInput.str(); } -void renameWorkspace(IAlgorithm_sptr renamer, Workspace_sptr workspace, +void renameWorkspace(const IAlgorithm_sptr &renamer, + const Workspace_sptr &workspace, const std::string &newName) { renamer->setProperty("InputWorkspace", workspace); renamer->setProperty("OutputWorkspace", newName); renamer->executeAsChildAlg(); } -void deleteTemporaries(IAlgorithm_sptr deleter, const std::string &base) { +void deleteTemporaries(const IAlgorithm_sptr &deleter, + const std::string &base) { auto name = base + std::to_string(1); std::size_t i = 2; @@ -234,8 +238,8 @@ bool containsMultipleData(const std::vector &workspaces) { } template -void renameWorkspacesWith(WorkspaceGroup_sptr groupWorkspace, F const &getName, - Renamer const &renamer) { +void renameWorkspacesWith(const WorkspaceGroup_sptr &groupWorkspace, + F const &getName, Renamer const &renamer) { std::unordered_map nameCount; for (auto i = 0u; i < groupWorkspace->size(); ++i) { const auto name = getName(i); @@ -252,7 +256,7 @@ void renameWorkspacesWith(WorkspaceGroup_sptr groupWorkspace, F const &getName, template void renameWorkspacesInQENSFit(Algorithm *qensFit, - IAlgorithm_sptr renameAlgorithm, + const IAlgorithm_sptr &renameAlgorithm, WorkspaceGroup_sptr outputGroup, std::string const &outputBaseName, std::string const &groupSuffix, @@ -264,8 +268,8 @@ void renameWorkspacesInQENSFit(Algorithm *qensFit, return outputBaseName + "_" + getNameSuffix(i); }; - auto renamer = [&](Workspace_sptr workspace, const std::string &name) { - renameWorkspace(renameAlgorithm, workspace, name); + auto renamer = [&](const Workspace_sptr &workspace, const std::string &name) { + renameWorkspace(renameAlgorithm, std::move(workspace), name); renamerProg.report("Renamed workspace in group."); }; renameWorkspacesWith(outputGroup, getName, renamer); @@ -595,12 +599,14 @@ QENSFitSequential::getAdditionalLogNumbers() const { return logs; } -void QENSFitSequential::addAdditionalLogs(WorkspaceGroup_sptr resultWorkspace) { +void QENSFitSequential::addAdditionalLogs( + const WorkspaceGroup_sptr &resultWorkspace) { for (const auto &workspace : *resultWorkspace) addAdditionalLogs(workspace); } -void QENSFitSequential::addAdditionalLogs(Workspace_sptr resultWorkspace) { +void QENSFitSequential::addAdditionalLogs( + const Workspace_sptr &resultWorkspace) { auto logAdder = createChildAlgorithm("AddSampleLog", -1.0, -1.0, false); logAdder->setProperty("Workspace", resultWorkspace); @@ -679,7 +685,7 @@ std::vector QENSFitSequential::getDatasetGrouping( } WorkspaceGroup_sptr QENSFitSequential::processIndirectFitParameters( - ITableWorkspace_sptr parameterWorkspace, + const ITableWorkspace_sptr ¶meterWorkspace, const std::vector &grouping) { std::string const columnX = getProperty("LogName"); std::string const xAxisUnit = getProperty("ResultXAxisUnit"); @@ -709,8 +715,9 @@ void QENSFitSequential::renameWorkspaces( inputWorkspaceNames[i] + "_" + spectra[i] + endOfSuffix; return workspaceName; }; - return renameWorkspacesInQENSFit(this, rename, outputGroup, outputBaseName, - endOfSuffix + "s", getNameSuffix); + return renameWorkspacesInQENSFit(this, rename, std::move(outputGroup), + outputBaseName, endOfSuffix + "s", + getNameSuffix); } void QENSFitSequential::renameWorkspaces( @@ -718,8 +725,9 @@ void QENSFitSequential::renameWorkspaces( std::string const &outputBaseName, std::string const &endOfSuffix) { auto rename = createChildAlgorithm("RenameWorkspace", -1.0, -1.0, false); auto getNameSuffix = [&](std::size_t i) { return spectra[i] + endOfSuffix; }; - return renameWorkspacesInQENSFit(this, rename, outputGroup, outputBaseName, - endOfSuffix + "s", getNameSuffix); + return renameWorkspacesInQENSFit(this, rename, std::move(outputGroup), + outputBaseName, endOfSuffix + "s", + getNameSuffix); } void QENSFitSequential::renameGroupWorkspace( @@ -794,28 +802,31 @@ std::vector QENSFitSequential::convertInputToElasticQ( } void QENSFitSequential::extractMembers( - WorkspaceGroup_sptr resultGroupWs, + const WorkspaceGroup_sptr &resultGroupWs, const std::vector &workspaces, const std::string &outputWsName) { std::vector workspaceNames; - std::transform( - workspaces.begin(), workspaces.end(), std::back_inserter(workspaceNames), - [](API::MatrixWorkspace_sptr workspace) { return workspace->getName(); }); + std::transform(workspaces.begin(), workspaces.end(), + std::back_inserter(workspaceNames), + [](const API::MatrixWorkspace_sptr &workspace) { + return workspace->getName(); + }); - auto extractAlgorithm = extractMembersAlgorithm(resultGroupWs, outputWsName); + auto extractAlgorithm = + extractMembersAlgorithm(std::move(resultGroupWs), outputWsName); extractAlgorithm->setProperty("InputWorkspaces", workspaceNames); extractAlgorithm->execute(); } void QENSFitSequential::copyLogs( - WorkspaceGroup_sptr resultWorkspaces, + const WorkspaceGroup_sptr &resultWorkspaces, std::vector const &workspaces) { for (auto const &resultWorkspace : *resultWorkspaces) copyLogs(resultWorkspace, workspaces); } void QENSFitSequential::copyLogs( - Workspace_sptr resultWorkspace, + const Workspace_sptr &resultWorkspace, std::vector const &workspaces) { auto logCopier = createChildAlgorithm("CopyLogs", -1.0, -1.0, false); logCopier->setProperty("OutputWorkspace", resultWorkspace->getName()); @@ -826,14 +837,14 @@ void QENSFitSequential::copyLogs( } } -void QENSFitSequential::copyLogs(MatrixWorkspace_sptr resultWorkspace, - WorkspaceGroup_sptr resultGroup) { +void QENSFitSequential::copyLogs(const MatrixWorkspace_sptr &resultWorkspace, + const WorkspaceGroup_sptr &resultGroup) { for (auto const &workspace : *resultGroup) copyLogs(resultWorkspace, workspace); } -void QENSFitSequential::copyLogs(MatrixWorkspace_sptr resultWorkspace, - Workspace_sptr resultGroup) { +void QENSFitSequential::copyLogs(const MatrixWorkspace_sptr &resultWorkspace, + const Workspace_sptr &resultGroup) { auto logCopier = createChildAlgorithm("CopyLogs", -1.0, -1.0, false); logCopier->setProperty("InputWorkspace", resultWorkspace); logCopier->setProperty("OutputWorkspace", resultGroup->getName()); @@ -841,7 +852,8 @@ void QENSFitSequential::copyLogs(MatrixWorkspace_sptr resultWorkspace, } IAlgorithm_sptr QENSFitSequential::extractMembersAlgorithm( - WorkspaceGroup_sptr resultGroupWs, const std::string &outputWsName) const { + const WorkspaceGroup_sptr &resultGroupWs, + const std::string &outputWsName) const { const bool convolved = getProperty("ConvolveMembers"); std::vector convolvedMembers; IFunction_sptr function = getProperty("Function"); diff --git a/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp b/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp index bf2d04b5dcc5377a6eee205aa3da9df51acde537..fd6aed132d21060a2a8f6a7db2f3a98bdb02ceba 100644 --- a/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp +++ b/Framework/CurveFitting/src/Algorithms/QENSFitSimultaneous.cpp @@ -24,19 +24,20 @@ #include "MantidKernel/UnitFactory.h" #include +#include namespace { Mantid::Kernel::Logger g_log("QENSFit"); using namespace Mantid::API; -void extractFunctionNames(CompositeFunction_sptr composite, +void extractFunctionNames(const CompositeFunction_sptr &composite, std::vector &names) { for (auto i = 0u; i < composite->nFunctions(); ++i) names.emplace_back(composite->getFunction(i)->name()); } -void extractFunctionNames(IFunction_sptr function, +void extractFunctionNames(const IFunction_sptr &function, std::vector &names) { auto composite = boost::dynamic_pointer_cast(function); if (composite) @@ -45,16 +46,16 @@ void extractFunctionNames(IFunction_sptr function, names.emplace_back(function->name()); } -void extractConvolvedNames(IFunction_sptr function, +void extractConvolvedNames(const IFunction_sptr &function, std::vector &names); -void extractConvolvedNames(CompositeFunction_sptr composite, +void extractConvolvedNames(const CompositeFunction_sptr &composite, std::vector &names) { for (auto i = 0u; i < composite->nFunctions(); ++i) extractConvolvedNames(composite->getFunction(i), names); } -void extractConvolvedNames(IFunction_sptr function, +void extractConvolvedNames(const IFunction_sptr &function, std::vector &names) { auto composite = boost::dynamic_pointer_cast(function); if (composite) { @@ -66,7 +67,8 @@ void extractConvolvedNames(IFunction_sptr function, } } -MatrixWorkspace_sptr convertSpectrumAxis(MatrixWorkspace_sptr inputWorkspace) { +MatrixWorkspace_sptr +convertSpectrumAxis(const MatrixWorkspace_sptr &inputWorkspace) { auto convSpec = AlgorithmManager::Instance().create("ConvertSpectrumAxis"); convSpec->setLogging(false); convSpec->setChild(true); @@ -78,8 +80,8 @@ MatrixWorkspace_sptr convertSpectrumAxis(MatrixWorkspace_sptr inputWorkspace) { return convSpec->getProperty("OutputWorkspace"); } -MatrixWorkspace_sptr convertToElasticQ(MatrixWorkspace_sptr inputWorkspace, - bool doThrow) { +MatrixWorkspace_sptr +convertToElasticQ(const MatrixWorkspace_sptr &inputWorkspace, bool doThrow) { auto axis = inputWorkspace->getAxis(1); if (axis->isSpectra()) return convertSpectrumAxis(inputWorkspace); @@ -97,7 +99,7 @@ struct ElasticQAppender { explicit ElasticQAppender(std::vector &elasticInput) : m_elasticInput(elasticInput), m_converted() {} - void operator()(MatrixWorkspace_sptr workspace, bool doThrow) { + void operator()(const MatrixWorkspace_sptr &workspace, bool doThrow) { auto it = m_converted.find(workspace.get()); if (it != m_converted.end()) m_elasticInput.emplace_back(it->second); @@ -130,7 +132,7 @@ std::string shortParameterName(const std::string &longName) { } void setMultiDataProperties(const IAlgorithm &qensFit, IAlgorithm &fit, - MatrixWorkspace_sptr workspace, + const MatrixWorkspace_sptr &workspace, const std::string &suffix) { fit.setProperty("InputWorkspace" + suffix, workspace); @@ -163,7 +165,7 @@ IFunction_sptr convertToSingleDomain(IFunction_sptr function) { return function; } -WorkspaceGroup_sptr makeGroup(Workspace_sptr workspace) { +WorkspaceGroup_sptr makeGroup(const Workspace_sptr &workspace) { auto group = boost::dynamic_pointer_cast(workspace); if (group) return group; @@ -172,7 +174,7 @@ WorkspaceGroup_sptr makeGroup(Workspace_sptr workspace) { return group; } -ITableWorkspace_sptr transposeFitTable(ITableWorkspace_sptr table, +ITableWorkspace_sptr transposeFitTable(const ITableWorkspace_sptr &table, const IFunction &function, const std::string &yAxisType) { auto transposed = WorkspaceFactory::Instance().createTable(); @@ -496,7 +498,7 @@ QENSFitSimultaneous::performFit( } WorkspaceGroup_sptr QENSFitSimultaneous::processIndirectFitParameters( - ITableWorkspace_sptr parameterWorkspace, + const ITableWorkspace_sptr ¶meterWorkspace, const std::vector &grouping) { std::string const xAxisUnit = getProperty("ResultXAxisUnit"); auto pifp = @@ -511,7 +513,7 @@ WorkspaceGroup_sptr QENSFitSimultaneous::processIndirectFitParameters( } void QENSFitSimultaneous::copyLogs( - WorkspaceGroup_sptr resultWorkspace, + const WorkspaceGroup_sptr &resultWorkspace, const std::vector &workspaces) { auto logCopier = createChildAlgorithm("CopyLogs", -1.0, -1.0, false); for (auto &&result : *resultWorkspace) { @@ -525,8 +527,8 @@ void QENSFitSimultaneous::copyLogs( } } -void QENSFitSimultaneous::copyLogs(MatrixWorkspace_sptr resultWorkspace, - WorkspaceGroup_sptr resultGroup) { +void QENSFitSimultaneous::copyLogs(const MatrixWorkspace_sptr &resultWorkspace, + const WorkspaceGroup_sptr &resultGroup) { auto logCopier = createChildAlgorithm("CopyLogs", -1.0, -1.0, false); logCopier->setProperty("InputWorkspace", resultWorkspace); @@ -539,7 +541,7 @@ void QENSFitSimultaneous::copyLogs(MatrixWorkspace_sptr resultWorkspace, } void QENSFitSimultaneous::extractMembers( - WorkspaceGroup_sptr resultGroupWs, + const WorkspaceGroup_sptr &resultGroupWs, const std::vector &workspaces, const std::string &outputWsName) { std::vector workspaceNames; @@ -549,7 +551,8 @@ void QENSFitSimultaneous::extractMembers( workspaceNames.emplace_back(name); } - auto extractAlgorithm = extractMembersAlgorithm(resultGroupWs, outputWsName); + auto extractAlgorithm = + extractMembersAlgorithm(std::move(resultGroupWs), outputWsName); extractAlgorithm->setProperty("InputWorkspaces", workspaceNames); extractAlgorithm->execute(); @@ -557,12 +560,14 @@ void QENSFitSimultaneous::extractMembers( AnalysisDataService::Instance().remove(workspaceName); } -void QENSFitSimultaneous::addAdditionalLogs(API::WorkspaceGroup_sptr group) { +void QENSFitSimultaneous::addAdditionalLogs( + const API::WorkspaceGroup_sptr &group) { for (auto &&workspace : *group) addAdditionalLogs(workspace); } -void QENSFitSimultaneous::addAdditionalLogs(Workspace_sptr resultWorkspace) { +void QENSFitSimultaneous::addAdditionalLogs( + const Workspace_sptr &resultWorkspace) { auto logAdder = createChildAlgorithm("AddSampleLog", -1.0, -1.0, false); logAdder->setProperty("Workspace", resultWorkspace); @@ -585,7 +590,8 @@ void QENSFitSimultaneous::addAdditionalLogs(Workspace_sptr resultWorkspace) { } IAlgorithm_sptr QENSFitSimultaneous::extractMembersAlgorithm( - WorkspaceGroup_sptr resultGroupWs, const std::string &outputWsName) const { + const WorkspaceGroup_sptr &resultGroupWs, + const std::string &outputWsName) const { const bool convolved = getProperty("ConvolveMembers"); std::vector convolvedMembers; IFunction_sptr function = getProperty("Function"); @@ -697,7 +703,7 @@ ITableWorkspace_sptr QENSFitSimultaneous::processParameterTable( } void QENSFitSimultaneous::renameWorkspaces( - API::WorkspaceGroup_sptr outputGroup, + const API::WorkspaceGroup_sptr &outputGroup, std::vector const &spectra, std::string const &outputBaseName, std::string const &endOfSuffix, std::vector const &inputWorkspaceNames) { @@ -707,8 +713,9 @@ void QENSFitSimultaneous::renameWorkspaces( inputWorkspaceNames[i] + "_" + spectra[i] + endOfSuffix; return workspaceName; }; - return renameWorkspacesInQENSFit(this, rename, outputGroup, outputBaseName, - endOfSuffix + "s", getNameSuffix); + return renameWorkspacesInQENSFit(this, rename, std::move(outputGroup), + outputBaseName, endOfSuffix + "s", + getNameSuffix); } } // namespace Algorithms diff --git a/Framework/CurveFitting/src/Algorithms/QENSFitUtilities.cpp b/Framework/CurveFitting/src/Algorithms/QENSFitUtilities.cpp index 171b3c5c71a3e115d9c8858c4208533d3bbd02f5..cee9bf1ef7245029624ce5c8956e9d801e8bd3b2 100644 --- a/Framework/CurveFitting/src/Algorithms/QENSFitUtilities.cpp +++ b/Framework/CurveFitting/src/Algorithms/QENSFitUtilities.cpp @@ -6,11 +6,13 @@ // SPDX - License - Identifier: GPL - 3.0 + #include "MantidCurveFitting/Algorithms/QENSFitUtilities.h" #include +#include + namespace Mantid { namespace API { void renameWorkspacesWith( - WorkspaceGroup_sptr groupWorkspace, + const WorkspaceGroup_sptr &groupWorkspace, std::function const &getName, std::function const &renamer) { std::unordered_map nameCount; @@ -27,7 +29,8 @@ void renameWorkspacesWith( } } -void renameWorkspace(IAlgorithm_sptr renamer, Workspace_sptr workspace, +void renameWorkspace(const IAlgorithm_sptr &renamer, + const Workspace_sptr &workspace, const std::string &newName) { renamer->setProperty("InputWorkspace", workspace); renamer->setProperty("OutputWorkspace", newName); @@ -43,7 +46,7 @@ bool containsMultipleData(const std::vector &workspaces) { void renameWorkspacesInQENSFit( Algorithm *qensFit, IAlgorithm_sptr renameAlgorithm, - WorkspaceGroup_sptr outputGroup, std::string const &outputBaseName, + const WorkspaceGroup_sptr &outputGroup, std::string const &outputBaseName, std::string const &, std::function const &getNameSuffix) { Progress renamerProg(qensFit, 0.98, 1.0, outputGroup->size() + 1); @@ -54,8 +57,8 @@ void renameWorkspacesInQENSFit( return name; }; - auto renamer = [&](Workspace_sptr workspace, const std::string &name) { - renameWorkspace(renameAlgorithm, workspace, name); + auto renamer = [&](const Workspace_sptr &workspace, const std::string &name) { + renameWorkspace(renameAlgorithm, std::move(workspace), name); renamerProg.report("Renamed workspace in group."); }; renameWorkspacesWith(outputGroup, getName, renamer); diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp index 6fde7cc57b5b92f46d11242805f54a35ad1d225d..4672c0352d7b97db014456fd2da21fb784b735ff 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters.cpp @@ -34,6 +34,7 @@ #include #include +#include #include @@ -383,7 +384,7 @@ void RefinePowderInstrumentParameters::fitInstrumentParameters() { /** Fit function to data */ -bool RefinePowderInstrumentParameters::fitFunction(IFunction_sptr func, +bool RefinePowderInstrumentParameters::fitFunction(const IFunction_sptr &func, double &gslchi2) { API::IAlgorithm_sptr fitalg = createChildAlgorithm("Fit", 0.0, 0.2, true); fitalg->initialize(); @@ -417,7 +418,8 @@ bool RefinePowderInstrumentParameters::fitFunction(IFunction_sptr func, /** Calculate function's statistic */ double RefinePowderInstrumentParameters::calculateFunctionStatistic( - IFunction_sptr func, MatrixWorkspace_sptr dataws, size_t workspaceindex) { + const IFunction_sptr &func, const MatrixWorkspace_sptr &dataws, + size_t workspaceindex) { // 1. Fix all parameters of the function vector funcparameters = func->getParameterNames(); size_t numparams = funcparameters.size(); @@ -456,14 +458,15 @@ double RefinePowderInstrumentParameters::calculateFunctionStatistic( /** Refine instrument parameters by Monte Carlo method */ void RefinePowderInstrumentParameters::refineInstrumentParametersMC( - TableWorkspace_sptr parameterWS, bool fit2) { + const TableWorkspace_sptr ¶meterWS, bool fit2) { // 1. Get function's parameter names getD2TOFFuncParamNames(m_PeakFunctionParameterNames); // 2. Parse parameter (table) workspace vector stepsizes, lowerbounds, upperbounds; - importMonteCarloParametersFromTable(parameterWS, m_PeakFunctionParameterNames, - stepsizes, lowerbounds, upperbounds); + importMonteCarloParametersFromTable(std::move(parameterWS), + m_PeakFunctionParameterNames, stepsizes, + lowerbounds, upperbounds); stringstream dbss; for (size_t i = 0; i < m_PeakFunctionParameterNames.size(); ++i) { @@ -779,7 +782,7 @@ void RefinePowderInstrumentParameters::getD2TOFFuncParamNames( /** Calculate the function */ double RefinePowderInstrumentParameters::calculateD2TOFFunction( - API::IFunction_sptr func, API::FunctionDomain1DVector domain, + const API::IFunction_sptr &func, const API::FunctionDomain1DVector &domain, API::FunctionValues &values, const Mantid::HistogramData::HistogramY &rawY, const Mantid::HistogramData::HistogramE &rawE) { // 1. Check validity @@ -814,7 +817,7 @@ double RefinePowderInstrumentParameters::calculateD2TOFFunction( * m_Peaks are stored in a map. (HKL) is the key */ void RefinePowderInstrumentParameters::genPeaksFromTable( - DataObjects::TableWorkspace_sptr peakparamws) { + const DataObjects::TableWorkspace_sptr &peakparamws) { // 1. Check and clear input and output if (!peakparamws) { g_log.error() << "Input tableworkspace for peak parameters is invalid!\n"; @@ -902,7 +905,7 @@ void RefinePowderInstrumentParameters::genPeaksFromTable( * the diffrotometer geometry parameters */ void RefinePowderInstrumentParameters::importParametersFromTable( - DataObjects::TableWorkspace_sptr parameterWS, + const DataObjects::TableWorkspace_sptr ¶meterWS, std::map ¶meters) { // 1. Check column orders std::vector colnames = parameterWS->getColumnNames(); @@ -945,7 +948,7 @@ void RefinePowderInstrumentParameters::importParametersFromTable( * Arguments */ void RefinePowderInstrumentParameters::importMonteCarloParametersFromTable( - TableWorkspace_sptr tablews, vector parameternames, + const TableWorkspace_sptr &tablews, const vector ¶meternames, vector &stepsizes, vector &lowerbounds, vector &upperbounds) { // 1. Get column information @@ -1054,7 +1057,8 @@ hkl, double lattice) /** Calculate value n for thermal neutron peak profile */ void RefinePowderInstrumentParameters::calculateThermalNeutronSpecial( - IFunction_sptr m_Function, const HistogramX &xVals, vector &vec_n) { + const IFunction_sptr &m_Function, const HistogramX &xVals, + vector &vec_n) { if (m_Function->name() != "ThermalNeutronDtoTOFFunction") { g_log.warning() << "Function (" << m_Function->name() << " is not ThermalNeutronDtoTOFFunction. And it is not " diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index e29bf935259831db9c174ae92860189605c10ee7..06e64a0c28016ec224b8e37ee6d89cb1d5cc430f 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -13,6 +13,7 @@ #include "MantidKernel/ListValidator.h" #include +#include using namespace Mantid::API; using namespace Mantid::CurveFitting; @@ -231,7 +232,7 @@ void RefinePowderInstrumentParameters3::parseTableWorkspaces() { /** Parse table workspace to a map of Parameters */ void RefinePowderInstrumentParameters3::parseTableWorkspace( - TableWorkspace_sptr tablews, map ¶mmap) { + const TableWorkspace_sptr &tablews, map ¶mmap) { // 1. Process Table column names std::vector colnames = tablews->getColumnNames(); map colnamedict; @@ -505,7 +506,7 @@ double RefinePowderInstrumentParameters3::doSimulatedAnnealing( * @param newparammap: parameters map containing new/proposed value */ void RefinePowderInstrumentParameters3::proposeNewValues( - vector mcgroup, map &curparammap, + const vector &mcgroup, map &curparammap, map &newparammap, double currchisq) { for (const auto ¶mname : mcgroup) { // random number between -1 and 1 @@ -652,7 +653,7 @@ void RefinePowderInstrumentParameters3::bookKeepMCResult( // 2. Record for the best parameters if (bestparammap.empty()) { // No record yet - duplicateParameters(parammap, bestparammap); + duplicateParameters(std::move(parammap), bestparammap); } else if (recordparameter) { // Replace the record } @@ -752,7 +753,7 @@ void RefinePowderInstrumentParameters3::setupRandomWalkStrategy( * @param parammap :: parammap */ void RefinePowderInstrumentParameters3::addParameterToMCMinimize( - vector &parnamesforMC, string parname, + vector &parnamesforMC, const string &parname, map parammap) { map::iterator pariter; pariter = parammap.find(parname); @@ -776,7 +777,7 @@ void RefinePowderInstrumentParameters3::addParameterToMCMinimize( * Return: chi^2 */ double RefinePowderInstrumentParameters3::calculateFunction( - map parammap, vector &vecY) { + const map ¶mmap, vector &vecY) { // 1. Implement parameter values to m_positionFunc if (!parammap.empty()) setFunctionParameterValues(m_positionFunc, parammap); @@ -823,7 +824,8 @@ double calculateFunctionChiSquare(const vector &modelY, /** Calculate Chi^2 of the a function with all parameters are fixed */ double RefinePowderInstrumentParameters3::calculateFunctionError( - IFunction_sptr function, Workspace2D_sptr dataws, int wsindex) { + const IFunction_sptr &function, const Workspace2D_sptr &dataws, + int wsindex) { // 1. Record the fitting information vector parnames = function->getParameterNames(); vector vecFix(parnames.size(), false); @@ -839,8 +841,8 @@ double RefinePowderInstrumentParameters3::calculateFunctionError( double chi2; string fitstatus; const std::string minimizer = "Levenberg-MarquardtMD"; - bool fitOK = - doFitFunction(function, dataws, wsindex, minimizer, 0, chi2, fitstatus); + bool fitOK = doFitFunction(function, std::move(dataws), wsindex, minimizer, 0, + chi2, fitstatus); if (!fitOK) { g_log.warning() << "Fit by " << minimizer @@ -868,10 +870,10 @@ double RefinePowderInstrumentParameters3::calculateFunctionError( * Return: double chi2 of the final (best) solution. If fitting fails, chi2 *wil be maximum double */ -double RefinePowderInstrumentParameters3::fitFunction(IFunction_sptr function, - Workspace2D_sptr dataws, - int wsindex, - bool powerfit) { +double +RefinePowderInstrumentParameters3::fitFunction(const IFunction_sptr &function, + const Workspace2D_sptr &dataws, + int wsindex, bool powerfit) { // 1. Store original map> start_paramvaluemap, paramvaluemap1, paramvaluemap2, paramvaluemap3; @@ -972,8 +974,8 @@ double RefinePowderInstrumentParameters3::fitFunction(IFunction_sptr function, * Minimizer: "Levenberg-MarquardtMD"/"Simplex" */ bool RefinePowderInstrumentParameters3::doFitFunction( - IFunction_sptr function, Workspace2D_sptr dataws, int wsindex, - string minimizer, int numiters, double &chi2, string &fitstatus) { + const IFunction_sptr &function, const Workspace2D_sptr &dataws, int wsindex, + const string &minimizer, int numiters, double &chi2, string &fitstatus) { // 0. Debug output stringstream outss; outss << "Fit function: " << m_positionFunc->asString() @@ -1074,7 +1076,8 @@ TableWorkspace_sptr RefinePowderInstrumentParameters3::genOutputProfileTable( * @param parvalue: double, parameter value */ void RefinePowderInstrumentParameters3::addOrReplace( - map ¶meters, string parname, double parvalue) { + map ¶meters, const string &parname, + double parvalue) { auto pariter = parameters.find(parname); if (pariter != parameters.end()) { parameters[parname].curvalue = parvalue; @@ -1090,7 +1093,7 @@ void RefinePowderInstrumentParameters3::addOrReplace( /** Construct output */ Workspace2D_sptr RefinePowderInstrumentParameters3::genOutputWorkspace( - FunctionDomain1DVector domain, FunctionValues rawvalues) { + const FunctionDomain1DVector &domain, const FunctionValues &rawvalues) { // 1. Create and set up output workspace size_t lenx = m_dataWS->x(m_wsIndex).size(); size_t leny = m_dataWS->y(m_wsIndex).size(); @@ -1138,7 +1141,7 @@ Workspace2D_sptr RefinePowderInstrumentParameters3::genOutputWorkspace( /** Set parameter values to function from Parameter map */ void RefinePowderInstrumentParameters3::setFunctionParameterValues( - IFunction_sptr function, map params) { + const IFunction_sptr &function, map params) { // 1. Prepare vector funparamnames = function->getParameterNames(); @@ -1210,7 +1213,7 @@ Parameter>& params) * Parameter map */ void RefinePowderInstrumentParameters3::setFunctionParameterFitSetups( - IFunction_sptr function, map params) { + const IFunction_sptr &function, map params) { // 1. Prepare vector funparamnames = m_positionFunc->getParameterNames(); @@ -1315,7 +1318,7 @@ void convertToDict(vector strvec, map &lookupdict) { //---------------------------------------------------------------------------------------------- /** Get the index from lookup dictionary (map) */ -int getStringIndex(map lookupdict, string key) { +int getStringIndex(map lookupdict, const string &key) { map::iterator fiter; fiter = lookupdict.find(key); @@ -1336,7 +1339,8 @@ int getStringIndex(map lookupdict, string key) { /** Store function parameter values to a map */ void storeFunctionParameterValue( - IFunction_sptr function, map> &parvaluemap) { + const IFunction_sptr &function, + map> &parvaluemap) { parvaluemap.clear(); vector parnames = function->getParameterNames(); @@ -1354,8 +1358,8 @@ void storeFunctionParameterValue( * and a (string, Parameter) map */ void restoreFunctionParameterValue( - map> parvaluemap, IFunction_sptr function, - map ¶mmap) { + map> parvaluemap, + const IFunction_sptr &function, map ¶mmap) { vector parnames = function->getParameterNames(); for (auto &parname : parnames) { diff --git a/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp index d638847df532074cf858104e004b609b74ce6b57..df09ed43a17ae3cd29846741aeb43239e0c1ef58 100644 --- a/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineBackground.cpp @@ -247,7 +247,7 @@ void SplineBackground::freeBSplinePointers() { * @return:: A shared pointer to the output workspace */ MatrixWorkspace_sptr -SplineBackground::saveSplineOutput(const API::MatrixWorkspace_sptr ws, +SplineBackground::saveSplineOutput(const API::MatrixWorkspace_sptr &ws, const size_t spec) { const auto &xInputVals = ws->x(spec); const auto &yInputVals = ws->y(spec); diff --git a/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp index 00b4d7cb584aba107f527f9b07a7f30228e47083..99c4f26e976fc4a3a9b1aa8ae04562f477f3ef8b 100644 --- a/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineInterpolation.cpp @@ -258,9 +258,9 @@ void SplineInterpolation::exec() { * @param iws :: The input workspace to interpolate * @return The pointer to the newly created workspace */ -API::MatrixWorkspace_sptr -SplineInterpolation::setupOutputWorkspace(API::MatrixWorkspace_sptr mws, - API::MatrixWorkspace_sptr iws) const { +API::MatrixWorkspace_sptr SplineInterpolation::setupOutputWorkspace( + const API::MatrixWorkspace_sptr &mws, + const API::MatrixWorkspace_sptr &iws) const { const size_t numSpec = iws->getNumberHistograms(); MatrixWorkspace_sptr outputWorkspace = WorkspaceFactory::Instance().create(mws, numSpec); @@ -300,7 +300,7 @@ SplineInterpolation::convertBinnedData(MatrixWorkspace_sptr workspace) { * @param row :: The row of spectra to use */ void SplineInterpolation::setInterpolationPoints( - MatrixWorkspace_const_sptr inputWorkspace, const size_t row) const { + const MatrixWorkspace_const_sptr &inputWorkspace, const size_t row) const { const auto &xIn = inputWorkspace->x(row); const auto &yIn = inputWorkspace->y(row); const size_t size = xIn.size(); @@ -321,8 +321,9 @@ void SplineInterpolation::setInterpolationPoints( * @param order :: The order of derivatives to calculate */ void SplineInterpolation::calculateDerivatives( - API::MatrixWorkspace_const_sptr inputWorkspace, - API::MatrixWorkspace_sptr outputWorkspace, const size_t order) const { + const API::MatrixWorkspace_const_sptr &inputWorkspace, + const API::MatrixWorkspace_sptr &outputWorkspace, + const size_t order) const { // get x and y parameters from workspaces const size_t nData = inputWorkspace->y(0).size(); const double *xValues = &(inputWorkspace->x(0)[0]); @@ -339,8 +340,8 @@ void SplineInterpolation::calculateDerivatives( * @param row :: The row of spectra to use */ void SplineInterpolation::calculateSpline( - MatrixWorkspace_const_sptr inputWorkspace, - MatrixWorkspace_sptr outputWorkspace, const size_t row) const { + const MatrixWorkspace_const_sptr &inputWorkspace, + const MatrixWorkspace_sptr &outputWorkspace, const size_t row) const { // setup input parameters const size_t nData = inputWorkspace->y(0).size(); const double *xValues = &(inputWorkspace->x(0)[0]); @@ -360,7 +361,7 @@ void SplineInterpolation::calculateSpline( * @param derivs : the vector of derivative workspaces */ void SplineInterpolation::extrapolateFlat( - MatrixWorkspace_sptr ows, MatrixWorkspace_const_sptr iwspt, + const MatrixWorkspace_sptr &ows, const MatrixWorkspace_const_sptr &iwspt, const size_t row, const std::pair &indices, const bool doDerivs, std::vector &derivs) const { @@ -393,10 +394,9 @@ void SplineInterpolation::extrapolateFlat( * @param row : the workspace index * @return : pair of indices for representing the interpolation range */ -std::pair -SplineInterpolation::findInterpolationRange(MatrixWorkspace_const_sptr iwspt, - MatrixWorkspace_sptr mwspt, - const size_t row) { +std::pair SplineInterpolation::findInterpolationRange( + const MatrixWorkspace_const_sptr &iwspt, const MatrixWorkspace_sptr &mwspt, + const size_t row) { auto xAxisIn = iwspt->x(row).rawData(); std::sort(xAxisIn.begin(), xAxisIn.end()); diff --git a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp index dff88dc8f29da996c08e02f129e2bd479e3dbfcd..d906ded7b5e398337bae71f9e96a37e54c1b431b 100644 --- a/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp +++ b/Framework/CurveFitting/src/Algorithms/SplineSmoothing.cpp @@ -158,7 +158,7 @@ void SplineSmoothing::calculateSpectrumDerivatives(const int index, * @param ws :: The input workspace * @param row :: The row of spectra to use */ -void SplineSmoothing::performAdditionalFitting(MatrixWorkspace_sptr ws, +void SplineSmoothing::performAdditionalFitting(const MatrixWorkspace_sptr &ws, const int row) { // perform additional fitting of the points auto fit = createChildAlgorithm("Fit"); diff --git a/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp index 348dd6e25cbf6b3a2ca3e7ee86479518ec06d7db..12b3c9ac613905c0114ad1d27d68cbe1fb2535b1 100644 --- a/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp +++ b/Framework/CurveFitting/src/Constraints/BoundaryConstraint.cpp @@ -51,7 +51,7 @@ BoundaryConstraint::BoundaryConstraint(const std::string ¶mName) * a tie or a constraint. */ BoundaryConstraint::BoundaryConstraint(API::IFunction *fun, - const std::string paramName, + const std::string ¶mName, const double lowerBound, const double upperBound, bool isDefault) : m_penaltyFactor(getDefaultPenaltyFactor()), m_hasLowerBound(true), @@ -61,7 +61,7 @@ BoundaryConstraint::BoundaryConstraint(API::IFunction *fun, } BoundaryConstraint::BoundaryConstraint(API::IFunction *fun, - const std::string paramName, + const std::string ¶mName, const double lowerBound, bool isDefault) : m_penaltyFactor(getDefaultPenaltyFactor()), m_hasLowerBound(true), m_hasUpperBound(false), m_lowerBound(lowerBound), m_upperBound(-DBL_MAX) { diff --git a/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp index 07c6a543b7b80a28093826c40948233e9bfeab85..6beaae1204223bdaaeab1657a08f10ada8cad1a0 100644 --- a/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncFitting.cpp @@ -15,6 +15,7 @@ #include #include +#include namespace Mantid { namespace CurveFitting { @@ -81,9 +82,9 @@ size_t CostFuncFitting::nParams() const { void CostFuncFitting::setFittingFunction(API::IFunction_sptr function, API::FunctionDomain_sptr domain, API::FunctionValues_sptr values) { - m_function = function; - m_domain = domain; - m_values = values; + m_function = std::move(function); + m_domain = std::move(domain); + m_values = std::move(values); reset(); } diff --git a/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp index 6c0905074835e9c27c7a96703e45172face66def..ab616ca25b9dfe05af338ad39471bcf640cee5e2 100644 --- a/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp +++ b/Framework/CurveFitting/src/CostFunctions/CostFuncRwp.cpp @@ -47,7 +47,7 @@ CostFuncRwp::getFitWeights(API::FunctionValues_sptr values) const { //---------------------------------------------------------------------------------------------- /** Get weight of data point i(1/sigma) */ -double CostFuncRwp::getWeight(API::FunctionValues_sptr values, size_t i, +double CostFuncRwp::getWeight(const API::FunctionValues_sptr &values, size_t i, double sqrtW) const { return (values->getFitWeight(i) / sqrtW); } @@ -55,7 +55,7 @@ double CostFuncRwp::getWeight(API::FunctionValues_sptr values, size_t i, //---------------------------------------------------------------------------------------------- /** Get square root of normalization weight (W) */ -double CostFuncRwp::calSqrtW(API::FunctionValues_sptr values) const { +double CostFuncRwp::calSqrtW(const API::FunctionValues_sptr &values) const { double weight = 0.0; // FIXME : This might give a wrong answer in case of multiple-domain diff --git a/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp b/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp index 2db929f691489cfecf372afe1306f2372021ceb4..8be493174ac62ec966d410d82f2873a440cbae60 100644 --- a/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp +++ b/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp @@ -4,6 +4,8 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + +#include + #include "MantidCurveFitting/FunctionDomain1DSpectrumCreator.h" #include "MantidHistogramData/BinEdges.h" #include "MantidHistogramData/Points.h" @@ -29,7 +31,7 @@ FunctionDomain1DSpectrumCreator::FunctionDomain1DSpectrumCreator() */ void FunctionDomain1DSpectrumCreator::setMatrixWorkspace( MatrixWorkspace_sptr matrixWorkspace) { - m_matrixWorkspace = matrixWorkspace; + m_matrixWorkspace = std::move(matrixWorkspace); } /** diff --git a/Framework/CurveFitting/src/Functions/ChebfunBase.cpp b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp index 4b538ddad9e4d6c16b17e6cf8408c2108965a799..989655b8989f01f1437a59a125d697d1e8a4d1e5 100644 --- a/Framework/CurveFitting/src/Functions/ChebfunBase.cpp +++ b/Framework/CurveFitting/src/Functions/ChebfunBase.cpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace Mantid { namespace CurveFitting { @@ -465,7 +466,7 @@ ChebfunBase_sptr ChebfunBase::bestFit(double start, double end, std::vector &p, std::vector &a, double maxA, double tolerance, size_t maxSize) { - return bestFitTempl(start, end, f, p, a, maxA, tolerance, maxSize); + return bestFitTempl(start, end, std::move(f), p, a, maxA, tolerance, maxSize); } /// Template specialization for IFunction @@ -603,7 +604,7 @@ std::vector ChebfunBase::calcP(const std::vector &a) const { */ std::vector ChebfunBase::fit(ChebfunFunctionType f) const { std::vector res(size()); - std::transform(m_x.begin(), m_x.end(), res.begin(), f); + std::transform(m_x.begin(), m_x.end(), res.begin(), std::move(f)); return res; } @@ -626,7 +627,7 @@ std::vector ChebfunBase::fit(const API::IFunction &f) const { * @param f :: Function to calculate. * @param p :: Values of function f at the even-valued indices of m_x. */ -std::vector ChebfunBase::fitOdd(ChebfunFunctionType f, +std::vector ChebfunBase::fitOdd(const ChebfunFunctionType &f, std::vector &p) const { assert(size() == p.size() * 2 - 1); assert(size() % 2 == 1); diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp index e4692b5c89273b06643ff52687436d42362613ff..f1177591bae3e842f477ab5ec1ef924061cdf94a 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldFunction.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace Mantid { namespace CurveFitting { @@ -122,7 +123,7 @@ void CrystalFieldFunction::function(const FunctionDomain &domain, /// Set the source function /// @param source :: New source function. void CrystalFieldFunction::setSource(IFunction_sptr source) const { - m_source = source; + m_source = std::move(source); } size_t CrystalFieldFunction::getNumberDomains() const { diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldMagnetisation.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldMagnetisation.cpp index a5d7c2427002afcf41fb09371257a61bd8519be0..6989124844d42feeea7bcbabe93646837cb2b5a4 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldMagnetisation.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldMagnetisation.cpp @@ -28,7 +28,7 @@ namespace { // Does the actual calculation of the magnetisation void calculate(double *out, const double *xValues, const size_t nData, const ComplexFortranMatrix &ham, const int nre, - const DoubleFortranVector Hmag, const double T, + const DoubleFortranVector &Hmag, const double T, const double convfact, const bool iscgs) { const double beta = 1 / (PhysicalConstants::BoltzmannConstant * T); // x-data is the applied field magnitude. We need to recalculate diff --git a/Framework/CurveFitting/src/Functions/CrystalFieldMoment.cpp b/Framework/CurveFitting/src/Functions/CrystalFieldMoment.cpp index f18a27668c3ab35ff7159c5d4954446bb03dfa41..808f0725dc645df75a979f51e9d229ce683f20ad 100644 --- a/Framework/CurveFitting/src/Functions/CrystalFieldMoment.cpp +++ b/Framework/CurveFitting/src/Functions/CrystalFieldMoment.cpp @@ -28,7 +28,7 @@ namespace { // Does the actual calculation of the magnetic moment void calculate(double *out, const double *xValues, const size_t nData, const ComplexFortranMatrix &ham, const int nre, - const DoubleFortranVector Hdir, const double Hmag, + const DoubleFortranVector &Hdir, const double Hmag, const double convfact) { const double k_B = PhysicalConstants::BoltzmannConstant; DoubleFortranVector en; diff --git a/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp index e6a0bd71e1c674a5d820208f77c80b9917faa24d..21e693426a71998d0951bd2ab9364de071c30374 100644 --- a/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp +++ b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp @@ -128,7 +128,7 @@ void IkedaCarpenterPV::init() { this->lowerConstraint0("X0"); } -void IkedaCarpenterPV::lowerConstraint0(std::string paramName) { +void IkedaCarpenterPV::lowerConstraint0(const std::string ¶mName) { auto mixingConstraint = std::make_unique(this, paramName, 0.0, true); mixingConstraint->setPenaltyFactor(1e9); diff --git a/Framework/CurveFitting/src/Functions/PawleyFunction.cpp b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp index be54a4e856f9ef91a63ee36e5d092277c5d23a4f..1e86a37b92dcf1fd2f0c283a9990d214e46ee70d 100644 --- a/Framework/CurveFitting/src/Functions/PawleyFunction.cpp +++ b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp @@ -405,7 +405,8 @@ double PawleyFunction::getTransformedCenter(double d) const { return d; } -void PawleyFunction::setPeakPositions(std::string centreName, double zeroShift, +void PawleyFunction::setPeakPositions(const std::string ¢reName, + double zeroShift, const UnitCell &cell) const { for (size_t i = 0; i < m_hkls.size(); ++i) { double centre = getTransformedCenter(cell.d(m_hkls[i])); diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index bbced88b361e2a919b37521efccced067662a313..cf4d6c442941cd0e8ffef66436252b251b88d4de 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -22,6 +22,7 @@ #include #include #include +#include using namespace Mantid; @@ -583,7 +584,7 @@ void ProcessBackground::selectFromGivenFunction() { /** Select background automatically */ DataObjects::Workspace2D_sptr -ProcessBackground::autoBackgroundSelection(Workspace2D_sptr bkgdWS) { +ProcessBackground::autoBackgroundSelection(const Workspace2D_sptr &bkgdWS) { // Get background type and create bakground function BackgroundFunction_sptr bkgdfunction = createBackgroundFunction(m_bkgdType); @@ -649,7 +650,7 @@ ProcessBackground::autoBackgroundSelection(Workspace2D_sptr bkgdWS) { /** Create a background function from input properties */ BackgroundFunction_sptr -ProcessBackground::createBackgroundFunction(const string backgroundtype) { +ProcessBackground::createBackgroundFunction(const string &backgroundtype) { Functions::BackgroundFunction_sptr bkgdfunction; if (backgroundtype == "Polynomial") { @@ -679,8 +680,8 @@ ProcessBackground::createBackgroundFunction(const string backgroundtype) { //---------------------------------------------------------------------------------------------- /** Filter non-background data points out and create a background workspace */ -Workspace2D_sptr -ProcessBackground::filterForBackground(BackgroundFunction_sptr bkgdfunction) { +Workspace2D_sptr ProcessBackground::filterForBackground( + const BackgroundFunction_sptr &bkgdfunction) { double posnoisetolerance = getProperty("NoiseTolerance"); double negnoisetolerance = getProperty("NegativeNoiseTolerance"); if (isEmpty(negnoisetolerance)) @@ -751,7 +752,8 @@ ProcessBackground::filterForBackground(BackgroundFunction_sptr bkgdfunction) { //---------------------------------------------------------------------------------------------- /** Fit background function */ -void ProcessBackground::fitBackgroundFunction(std::string bkgdfunctiontype) { +void ProcessBackground::fitBackgroundFunction( + const std::string &bkgdfunctiontype) { // Get background type and create bakground function BackgroundFunction_sptr bkgdfunction = createBackgroundFunction(bkgdfunctiontype); @@ -884,9 +886,10 @@ void ProcessBackground::removePeaks() { //---------------------------------------------------------------------------------------------- /** Set up: parse peak workspace to vectors */ -void RemovePeaks::setup(TableWorkspace_sptr peaktablews) { +void RemovePeaks::setup(const TableWorkspace_sptr &peaktablews) { // Parse table workspace - parsePeakTableWorkspace(peaktablews, m_vecPeakCentre, m_vecPeakFWHM); + parsePeakTableWorkspace(std::move(peaktablews), m_vecPeakCentre, + m_vecPeakFWHM); // Check if (m_vecPeakCentre.size() != m_vecPeakFWHM.size()) @@ -900,8 +903,8 @@ void RemovePeaks::setup(TableWorkspace_sptr peaktablews) { /** Remove peaks from a input workspace */ Workspace2D_sptr -RemovePeaks::removePeaks(API::MatrixWorkspace_const_sptr dataws, int wsindex, - double numfwhm) { +RemovePeaks::removePeaks(const API::MatrixWorkspace_const_sptr &dataws, + int wsindex, double numfwhm) { // Check if (m_vecPeakCentre.empty()) throw runtime_error("RemovePeaks has not been setup yet. "); @@ -956,9 +959,9 @@ RemovePeaks::removePeaks(API::MatrixWorkspace_const_sptr dataws, int wsindex, //---------------------------------------------------------------------------------------------- /** Parse table workspace */ -void RemovePeaks::parsePeakTableWorkspace(TableWorkspace_sptr peaktablews, - vector &vec_peakcentre, - vector &vec_peakfwhm) { +void RemovePeaks::parsePeakTableWorkspace( + const TableWorkspace_sptr &peaktablews, vector &vec_peakcentre, + vector &vec_peakfwhm) { // Get peak table workspace information vector colnames = peaktablews->getColumnNames(); int index_centre = -1; diff --git a/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp index aad46b07eaa898c9083975afa0a3d37e480344c3..bb5562a1a1263a8ce610c82f041df4b06eeef7a3 100644 --- a/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp +++ b/Framework/CurveFitting/src/Functions/SimpleChebfun.cpp @@ -8,6 +8,7 @@ #include "MantidAPI/IFunction.h" #include +#include namespace Mantid { namespace CurveFitting { @@ -27,7 +28,7 @@ SimpleChebfun::SimpleChebfun(size_t n, ChebfunFunctionType fun, double start, double end) : m_badFit(false) { m_base = boost::make_shared(n, start, end); - m_P = m_base->fit(fun); + m_P = m_base->fit(std::move(fun)); } SimpleChebfun::SimpleChebfun(size_t n, const API::IFunction &fun, double start, @@ -49,8 +50,8 @@ SimpleChebfun::SimpleChebfun(size_t n, const API::IFunction &fun, double start, /// @param accuracy :: The accuracy of the approximation. /// @param badSize :: If automatic approxiamtion fails the base will have this /// size. -SimpleChebfun::SimpleChebfun(ChebfunFunctionType fun, double start, double end, - double accuracy, size_t badSize) +SimpleChebfun::SimpleChebfun(const ChebfunFunctionType &fun, double start, + double end, double accuracy, size_t badSize) : m_badFit(false) { m_base = ChebfunBase::bestFitAnyTolerance( start, end, fun, m_P, m_A, accuracy); @@ -84,7 +85,7 @@ SimpleChebfun::SimpleChebfun(const std::vector &x, } /// Construct an empty SimpleChebfun with shared base. -SimpleChebfun::SimpleChebfun(ChebfunBase_sptr base) : m_badFit(false) { +SimpleChebfun::SimpleChebfun(const ChebfunBase_sptr &base) : m_badFit(false) { assert(base); m_base = base; m_P.resize(base->size()); @@ -169,7 +170,7 @@ double SimpleChebfun::integrate() const { return m_base->integrate(m_P); } /// Add a C++ function to the function /// @param fun :: A function to add. -SimpleChebfun &SimpleChebfun::operator+=(ChebfunFunctionType fun) { +SimpleChebfun &SimpleChebfun::operator+=(const ChebfunFunctionType &fun) { auto &x = xPoints(); for (size_t i = 0; i < x.size(); ++i) { m_P[i] += fun(x[i]); diff --git a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp index a6a0ad67d4740d1b8ad32c7c123e09f8548f7ee0..f4f3d938c5ce63719fd00620d6da9993349511f0 100644 --- a/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp +++ b/Framework/CurveFitting/src/Functions/TabulatedFunction.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace Mantid { namespace CurveFitting { @@ -315,7 +316,7 @@ void TabulatedFunction::loadWorkspace(const std::string &wsName) const { */ void TabulatedFunction::loadWorkspace( boost::shared_ptr ws) const { - m_workspace = ws; + m_workspace = std::move(ws); m_setupFinished = false; } diff --git a/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp index 43e30a119cd832743aa301eb617f04f339b0f54e..89be09148de6cd15feb694229a3094b68ed377e1 100644 --- a/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp +++ b/Framework/CurveFitting/src/Functions/ThermalNeutronDtoTOFFunction.cpp @@ -67,7 +67,7 @@ void ThermalNeutronDtoTOFFunction::function1D(double *out, * xValues containing the d-space value of peaks centres */ void ThermalNeutronDtoTOFFunction::function1D( - vector &out, const vector xValues) const { + vector &out, const vector &xValues) const { double dtt1 = getParameter(0); double dtt1t = getParameter(1); double dtt2t = getParameter(2); diff --git a/Framework/CurveFitting/src/GSLFunctions.cpp b/Framework/CurveFitting/src/GSLFunctions.cpp index 9600b1f0df213d3beef80c8a699df3257c357b65..cfa30cce795b97ddccb4c621e6e038c5fa7a2cc9 100644 --- a/Framework/CurveFitting/src/GSLFunctions.cpp +++ b/Framework/CurveFitting/src/GSLFunctions.cpp @@ -163,7 +163,7 @@ int gsl_fdf(const gsl_vector *x, void *params, gsl_vector *f, gsl_matrix *J) { * @param cf :: ICostFunction */ GSL_FitData::GSL_FitData( - boost::shared_ptr cf) + const boost::shared_ptr &cf) : function(cf->getFittingFunction()), costFunction(cf) { gsl_set_error_handler_off(); // number of active parameters diff --git a/Framework/CurveFitting/src/IMWDomainCreator.cpp b/Framework/CurveFitting/src/IMWDomainCreator.cpp index 710fcddc429b9e390dfb5e085cbf1bc6ba225836..6cbb4304fe0b8dea4e541582c411c60f0576aa04 100644 --- a/Framework/CurveFitting/src/IMWDomainCreator.cpp +++ b/Framework/CurveFitting/src/IMWDomainCreator.cpp @@ -409,7 +409,7 @@ void IMWDomainCreator::addFunctionValuesToWS( const API::IFunction_sptr &function, boost::shared_ptr &ws, const size_t wsIndex, const boost::shared_ptr &domain, - boost::shared_ptr resultValues) const { + const boost::shared_ptr &resultValues) const { const size_t nData = resultValues->size(); resultValues->zeroCalculated(); diff --git a/Framework/CurveFitting/src/SeqDomain.cpp b/Framework/CurveFitting/src/SeqDomain.cpp index f7a48a563f7cea74f07a65fc650eacb4d24fee05..e5539de7cb20c20bc668e3a84ebf2ce5eba40c35 100644 --- a/Framework/CurveFitting/src/SeqDomain.cpp +++ b/Framework/CurveFitting/src/SeqDomain.cpp @@ -50,7 +50,7 @@ void SeqDomain::getDomainAndValues(size_t i, API::FunctionDomain_sptr &domain, * Add new domain creator * @param creator :: A shared pointer to a new creator. */ -void SeqDomain::addCreator(API::IDomainCreator_sptr creator) { +void SeqDomain::addCreator(const API::IDomainCreator_sptr &creator) { m_creators.emplace_back(creator); m_domain.emplace_back(API::FunctionDomain_sptr()); m_values.emplace_back(API::FunctionValues_sptr()); diff --git a/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp b/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp index ba7674dd923ca5712bb74c48df7f9ea164ce7437..e93e0e1bd1a92aa83838a408356b50abe15ecced 100644 --- a/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp +++ b/Framework/CurveFitting/src/SeqDomainSpectrumCreator.cpp @@ -208,7 +208,7 @@ void SeqDomainSpectrumCreator::setParametersFromPropertyManager() { /// Sets the MatrixWorkspace the created domain is based on. void SeqDomainSpectrumCreator::setMatrixWorkspace( - MatrixWorkspace_sptr matrixWorkspace) { + const MatrixWorkspace_sptr &matrixWorkspace) { if (!matrixWorkspace) { throw std::invalid_argument( "InputWorkspace must be a valid MatrixWorkspace."); diff --git a/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp b/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp index ee80a475e4a4c6fef11313670a34655052944f56..d419d2f76fb3f202187b11daea4bc157e71dd84a 100644 --- a/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp +++ b/Framework/CurveFitting/src/TableWorkspaceDomainCreator.cpp @@ -461,7 +461,7 @@ void TableWorkspaceDomainCreator::addFunctionValuesToWS( const API::IFunction_sptr &function, boost::shared_ptr &ws, const size_t wsIndex, const boost::shared_ptr &domain, - boost::shared_ptr resultValues) const { + const boost::shared_ptr &resultValues) const { const size_t nData = resultValues->size(); resultValues->zeroCalculated(); @@ -726,7 +726,7 @@ void TableWorkspaceDomainCreator::setParameters() const { */ void TableWorkspaceDomainCreator::setXYEColumnNames( - API::ITableWorkspace_sptr ws) const { + const API::ITableWorkspace_sptr &ws) const { auto columnNames = ws->getColumnNames(); @@ -782,7 +782,7 @@ void TableWorkspaceDomainCreator::setXYEColumnNames( * entries. */ void TableWorkspaceDomainCreator::setAndValidateWorkspace( - API::Workspace_sptr ws) const { + const API::Workspace_sptr &ws) const { auto tableWorkspace = boost::dynamic_pointer_cast(ws); if (!tableWorkspace) { throw std::invalid_argument("InputWorkspace must be a TableWorkspace."); diff --git a/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h b/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h index 1ca7b820ddf4262227badf5fea5216f27a5699e5..eab6d230eaa657691c85d7d2dc2a1deacfe13448 100644 --- a/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h +++ b/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h @@ -328,8 +328,9 @@ public: return AnalysisDataService::Instance().retrieveWS(name); } - MatrixWorkspace_sptr getMatrixWorkspace(WorkspaceGroup_const_sptr group, - std::size_t index) { + MatrixWorkspace_sptr + getMatrixWorkspace(const WorkspaceGroup_const_sptr &group, + std::size_t index) { return boost::dynamic_pointer_cast(group->getItem(index)); } diff --git a/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h index dc71f9854a7068419ceae972090beaf758925eb5..5272a2ec933730c50354e7efaa8adfee00e4d381 100644 --- a/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h +++ b/Framework/CurveFitting/test/Algorithms/FitPowderDiffPeaksTest.h @@ -32,7 +32,8 @@ namespace { //---------------------------------------------------------------------------------------------- /** Import data from a column data file by calling LoadAscii */ -void importDataFromColumnFile(string filename, string datawsname) { +void importDataFromColumnFile(const string &filename, + const string &datawsname) { // 1. Call LoadAscii DataHandling::LoadAscii2 loader; loader.initialize(); @@ -96,7 +97,7 @@ API::MatrixWorkspace_sptr createInputDataWorkspace(int option) { //---------------------------------------------------------------------------------------------- /** Create the Bragg peak parameters table for LaB6, PG3, Bank1 */ -void createLaB6PG3Bank1BraggPeaksTable(TableWorkspace_sptr tablews) { +void createLaB6PG3Bank1BraggPeaksTable(const TableWorkspace_sptr &tablews) { TableRow newrow0 = tablews->appendRow(); newrow0 << 6 << 3 << 1 << .6129000 << 13962.47 << 0.20687 << 0.10063 << 62.64174 << 0.00000; @@ -266,7 +267,7 @@ DataObjects::TableWorkspace_sptr createReflectionWorkspace(int option) { //---------------------------------------------------------------------------------------------- /** Add rows for input table workspace for PG3 bank1 */ -void createPG3Bank1ParameterTable(TableWorkspace_sptr tablews) { +void createPG3Bank1ParameterTable(const TableWorkspace_sptr &tablews) { TableRow newrow0 = tablews->appendRow(); newrow0 << "Alph0" << 2.708; TableRow newrow1 = tablews->appendRow(); diff --git a/Framework/CurveFitting/test/Algorithms/FitTestHelpers.h b/Framework/CurveFitting/test/Algorithms/FitTestHelpers.h index 50624ce827dd18593f9bfb43f259f84324ce8cea..e1c8c657f7ee5d3054914a1d6c7c16224bcc4bf1 100644 --- a/Framework/CurveFitting/test/Algorithms/FitTestHelpers.h +++ b/Framework/CurveFitting/test/Algorithms/FitTestHelpers.h @@ -26,8 +26,8 @@ static API::MatrixWorkspace_sptr generateSmoothCurveWorkspace(); /// Run fit on a (single spectrum) matrix workspace, using the given type /// of function and minimizer option static Mantid::API::IAlgorithm_sptr -runFitAlgorithm(MatrixWorkspace_sptr dataToFit, CurveBenchmarks ctype, - const std::string minimizer = "Levenberg-MarquardtMD") { +runFitAlgorithm(const MatrixWorkspace_sptr &dataToFit, CurveBenchmarks ctype, + const std::string &minimizer = "Levenberg-MarquardtMD") { auto fit = AlgorithmManager::Instance().create("Fit"); fit->initialize(); diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h index b9ce6ac8ca8c0683181f3c72aacb78352c2e401f..c409cc7084ebacd9a37f42615507852b1da5a5eb 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFitTest.h @@ -427,7 +427,8 @@ API::MatrixWorkspace_sptr generateArgSiPeak220() { //---------------------------------------------------------------------------------------------- /** Import data from a column data file */ -void importDataFromColumnFile(std::string filename, std::string wsname) { +void importDataFromColumnFile(const std::string &filename, + const std::string &wsname) { DataHandling::LoadAscii2 load; load.initialize(); @@ -1295,7 +1296,7 @@ public: * Parse parameter table workspace to 2 map */ void - parseParameterTableWorkspace(DataObjects::TableWorkspace_sptr paramws, + parseParameterTableWorkspace(const DataObjects::TableWorkspace_sptr ¶mws, std::map ¶mvalues, std::map ¶mfitstatus) { diff --git a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h index 2529fbea830587d7d99fbcda036d880ce84ba612..cecfffc5b4b93ba29c6888b09f0e6a59f96223c9 100644 --- a/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h +++ b/Framework/CurveFitting/test/Algorithms/LeBailFunctionTest.h @@ -428,7 +428,8 @@ public: return ws; } - void importDataFromColumnFile(std::string filename, std::vector &vecX, + void importDataFromColumnFile(const std::string &filename, + std::vector &vecX, std::vector &vecY, std::vector &vecE) { std::ifstream ins; diff --git a/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h index 97aada54a131dd93a517d0ddf38e61a19c82c736..df033698c0bcb8006e1a55f943594dc5483f245f 100644 --- a/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h +++ b/Framework/CurveFitting/test/Algorithms/PlotPeakByLogValueTest.h @@ -29,6 +29,7 @@ #include "MantidTestHelpers/WorkspaceCreationHelper.h" #include #include +#include using namespace Mantid; using namespace Mantid::API; @@ -67,9 +68,9 @@ DECLARE_FUNCTION(PLOTPEAKBYLOGVALUETEST_Fun) class PropertyNameIs { public: - PropertyNameIs(std::string name) : m_name(name){}; + PropertyNameIs(std::string name) : m_name(std::move(name)){}; - bool operator()(Mantid::Kernel::PropertyHistory_sptr p) { + bool operator()(const Mantid::Kernel::PropertyHistory_sptr &p) { return p->name() == m_name; } diff --git a/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h b/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h index ab36a4758d4107057bdfa60df56f86984954f2bf..b2361e2145b0842a902cde68bd98b59a85394d5b 100644 --- a/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h +++ b/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h @@ -79,8 +79,8 @@ public: } private: - std::string runConvolutionFit(MatrixWorkspace_sptr inputWorkspace, - MatrixWorkspace_sptr resolution) { + std::string runConvolutionFit(const MatrixWorkspace_sptr &inputWorkspace, + const MatrixWorkspace_sptr &resolution) { QENSFitSequential alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); @@ -207,7 +207,7 @@ private: return resolution; } - void addBinsAndCountsToWorkspace(Workspace2D_sptr workspace, + void addBinsAndCountsToWorkspace(const Workspace2D_sptr &workspace, std::size_t totalBinEdges, std::size_t totalCounts, double binValue, double countValue) const { diff --git a/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h b/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h index 1974772d73faf83d9a8b5cd6649e55409a2e2894..bb53acfbbe53e89e0575d388cf89d72e1e9f1583 100644 --- a/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h +++ b/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h @@ -8,6 +8,8 @@ #include +#include + #include "MantidAPI/Axis.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/FunctionFactory.h" @@ -84,8 +86,8 @@ public: } private: - std::string runConvolutionFit(MatrixWorkspace_sptr inputWorkspace, - MatrixWorkspace_sptr resolution) { + std::string runConvolutionFit(const MatrixWorkspace_sptr &inputWorkspace, + const MatrixWorkspace_sptr &resolution) { QENSFitSimultaneous alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); @@ -107,12 +109,12 @@ private: std::string runMultiDatasetFit( const std::vector &workspaces, - IFunction_sptr function) { + const IFunction_sptr &function) { QENSFitSimultaneous alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - alg.setProperty("Function", - createMultiDomainFunction(function, workspaces.size())); + alg.setProperty("Function", createMultiDomainFunction(std::move(function), + workspaces.size())); setMultipleInput(alg, workspaces, 0.0, 10.0); alg.setProperty("ConvolveMembers", true); alg.setProperty("Minimizer", "Levenberg-Marquardt"); @@ -197,7 +199,7 @@ private: return resolution; } - void addBinsAndCountsToWorkspace(Workspace2D_sptr workspace, + void addBinsAndCountsToWorkspace(const Workspace2D_sptr &workspace, std::size_t totalBinEdges, std::size_t totalCounts, double binValue, double countValue) const { @@ -232,7 +234,7 @@ private: } } - IFunction_sptr createMultiDomainFunction(IFunction_sptr function, + IFunction_sptr createMultiDomainFunction(const IFunction_sptr &function, std::size_t numberOfDomains) { auto multiDomainFunction = boost::make_shared(); diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h index cb863647b2fff387c1faa4f47a0dce2ded890d96..c7f8debc5a0f9b21f80fa5ba2848479d8e18e7a2 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParameters3Test.h @@ -117,7 +117,7 @@ TableWorkspace_sptr generateInstrumentProfileTableBank1() { //---------------------------------------------------------------------------------------------- /** Parse Table Workspace to a map of string, double pair */ -void parseParameterTableWorkspace(TableWorkspace_sptr paramws, +void parseParameterTableWorkspace(const TableWorkspace_sptr ¶mws, map ¶mvalues) { for (size_t irow = 0; irow < paramws->rowCount(); ++irow) { Mantid::API::TableRow row = paramws->getRow(irow); diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index fdfffc3524ed304763e8428f1fddb3c3d2dc3a12..e77dff704c4548c7e8a631f7b5c06719c5391047 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -327,7 +327,7 @@ public: * BETA, ... */ void - importPeakParametersFile(std::string filename, + importPeakParametersFile(const std::string &filename, std::vector> &hkls, std::vector> &peakparameters) { // 1. Open file @@ -441,7 +441,7 @@ public: * Input: a text based file * Output: a map for (parameter name, parameter value) */ - void importInstrumentTxtFile(std::string filename, + void importInstrumentTxtFile(const std::string &filename, std::map ¶meters, std::map> ¶metermcs) { // 1. Open file @@ -488,9 +488,9 @@ public: } /// ================= Check Output ================ /// - void - parseParameterTableWorkspace(Mantid::DataObjects::TableWorkspace_sptr paramws, - std::map ¶mvalues) { + void parseParameterTableWorkspace( + const Mantid::DataObjects::TableWorkspace_sptr ¶mws, + std::map ¶mvalues) { for (size_t irow = 0; irow < paramws->rowCount(); ++irow) { Mantid::API::TableRow row = paramws->getRow(irow); diff --git a/Framework/CurveFitting/test/FitMWTest.h b/Framework/CurveFitting/test/FitMWTest.h index b4c0ff6af9e7148b97dead62a86f68932a760ea6..17aff569670c5a3273d45792ddb6f54e059038ed 100644 --- a/Framework/CurveFitting/test/FitMWTest.h +++ b/Framework/CurveFitting/test/FitMWTest.h @@ -63,7 +63,7 @@ API::MatrixWorkspace_sptr createTestWorkspace(const bool histogram, return ws2; } -void doTestExecPointData(API::MatrixWorkspace_sptr ws2, +void doTestExecPointData(const API::MatrixWorkspace_sptr &ws2, bool performance = false) { API::IFunction_sptr fun(new ExpDecay); fun->setParameter("Height", 1.); @@ -169,7 +169,7 @@ void doTestExecPointData(API::MatrixWorkspace_sptr ws2, TS_ASSERT_DELTA(fun->getParameter("Lifetime"), 1.0, 1e-4); } } -void doTestExecHistogramData(API::MatrixWorkspace_sptr ws2, +void doTestExecHistogramData(const API::MatrixWorkspace_sptr &ws2, bool performance = false) { API::IFunction_sptr fun(new ExpDecay); fun->setParameter("Height", 1.); diff --git a/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h index 34b24d12fd5a644940986cc5d08ea932d611abf6..75543a266a9714190e91c26739fd97eba152e9ae 100644 --- a/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h @@ -46,7 +46,7 @@ MatrixWorkspace_sptr createTestWorkspace(size_t NVectors = 2, return ws2; } -void doTestExpDecay(MatrixWorkspace_sptr ws2) { +void doTestExpDecay(const MatrixWorkspace_sptr &ws2) { Mantid::API::IFunction_sptr fun(new ExpDecay); fun->setParameter("Height", 8.); diff --git a/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h index feef3b422ef9baedd3dc5ad4057593ea6e390eb0..32e6baf1132f497965762f302a5734c5bac787c5 100644 --- a/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/LevenbergMarquardtMDTest.h @@ -468,7 +468,8 @@ public: } private: - double fitBSpline(boost::shared_ptr bsp, std::string func) { + double fitBSpline(const boost::shared_ptr &bsp, + const std::string &func) { const double startx = bsp->getAttribute("StartX").asDouble(); const double endx = bsp->getAttribute("EndX").asDouble(); diff --git a/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h index ec23cc49c22307b29720ffa79bcb5739e6fb504b..5552bf2677df3bf6f5809ce1b0e627827a49b81b 100644 --- a/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h +++ b/Framework/CurveFitting/test/Functions/ChebfunBaseTest.h @@ -10,6 +10,7 @@ #include "MantidCurveFitting/Functions/ChebfunBase.h" #include +#include using namespace Mantid; using namespace Mantid::API; @@ -115,8 +116,8 @@ public: void test_roots_SinCos() { do_test_roots(SinCos, -M_PI, M_PI, 2, 1e-5); } private: - void do_test_eval(std::function fun, double start, double end, - size_t n) { + void do_test_eval(const std::function &fun, double start, + double end, size_t n) { ChebfunBase base(n, start, end); auto p = base.fit(fun); auto x = base.linspace(2 * n); @@ -132,7 +133,7 @@ private: x.assign(xarr, xarr + narr); ChebfunBase base(n, start, end); - auto p = base.fit(fun); + auto p = base.fit(std::move(fun)); auto y = base.evalVector(x, p); TS_ASSERT_EQUALS(y.size(), x.size()); for (size_t i = 0; i < x.size(); ++i) { @@ -147,7 +148,7 @@ private: } } - void do_test_bestFit(std::function fun, double start, + void do_test_bestFit(const std::function &fun, double start, double end, size_t expected_n) { std::vector p, a; auto base = ChebfunBase::bestFit(start, end, fun, p, a); @@ -161,14 +162,15 @@ private: void do_test_integrate(std::function fun, double start, double end, double expected_integral) { std::vector p, a; - auto base = ChebfunBase::bestFit(start, end, fun, p, a); + auto base = ChebfunBase::bestFit(start, end, std::move(fun), p, a); TS_ASSERT_DELTA(base->integrate(p), expected_integral, 1e-14); } void do_test_derivative(std::function fun, double start, - double end, std::function deriv) { + double end, + const std::function &deriv) { std::vector p, a, dp, da; - auto base = ChebfunBase::bestFit(start, end, fun, p, a); + auto base = ChebfunBase::bestFit(start, end, std::move(fun), p, a); base->derivative(a, da); dp = base->calcP(da); auto x = base->linspace(2 * base->size()); @@ -181,7 +183,7 @@ private: void do_test_roots(std::function fun, double start, double end, size_t n_roots, double tol = 1e-13) { std::vector p, a; - auto base = ChebfunBase::bestFit(start, end, fun, p, a); + auto base = ChebfunBase::bestFit(start, end, std::move(fun), p, a); auto roots = base->roots(a); TS_ASSERT_EQUALS(n_roots, roots.size()); for (double root : roots) { diff --git a/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h index 3811aa907ade7f87d51ca12833d7fba2f697b79d..9c5dc429d06d0dd7a6b6e4982f3171a8c4d6604b 100644 --- a/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/ProcessBackgroundTest.h @@ -17,6 +17,7 @@ #include "MantidKernel/MersenneTwister.h" #include +#include using Mantid::CurveFitting::Functions::ProcessBackground; using namespace Mantid; @@ -26,7 +27,8 @@ using namespace Mantid::DataObjects; using namespace HistogramData; namespace { -Workspace2D_sptr createInputWS(std::string name, size_t sizex, size_t sizey) { +Workspace2D_sptr createInputWS(const std::string &name, size_t sizex, + size_t sizey) { Workspace2D_sptr inputWS = boost::dynamic_pointer_cast( WorkspaceFactory::Instance().create("Workspace2D", 1, sizex, sizey)); AnalysisDataService::Instance().addOrReplace(name, inputWS); @@ -294,9 +296,9 @@ public: //---------------------------------------------------------------------------------------------- /** Read column file to create a workspace2D */ - Workspace2D_sptr createWorkspace2D(std::string filename) { + Workspace2D_sptr createWorkspace2D(const std::string &filename) { // 1. Read data - auto data = importDataFromColumnFile(filename); + auto data = importDataFromColumnFile(std::move(filename)); // 2. Create workspace size_t datasize = data.x().size(); @@ -314,7 +316,7 @@ public: /** Import data from a column data file */ - Histogram importDataFromColumnFile(std::string filename) { + Histogram importDataFromColumnFile(const std::string &filename) { // 1. Open file std::ifstream ins; ins.open(filename.c_str()); diff --git a/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h index 6faf11ee57fa7479da7ae12db9137d48a03036ca..fec05d704cb2b5a6f4a7bc53e2c5fab46171025d 100644 --- a/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h +++ b/Framework/CurveFitting/test/Functions/SimpleChebfunTest.h @@ -221,8 +221,8 @@ public: private: void do_test_values(const SimpleChebfun &cheb, - std::function fun, double accur1 = 1e-14, - double accur2 = 1e-14) { + const std::function &fun, + double accur1 = 1e-14, double accur2 = 1e-14) { TS_ASSERT(cheb.size() > 0); TS_ASSERT(cheb.width() > 0.0); if (cheb.isGood()) { diff --git a/Framework/CurveFitting/test/HistogramDomainCreatorTest.h b/Framework/CurveFitting/test/HistogramDomainCreatorTest.h index 75853f8cee7ca5357216c09f9430b9018cc6a256..a09450e0550a6e90852599ec757b5fc0d4a493af 100644 --- a/Framework/CurveFitting/test/HistogramDomainCreatorTest.h +++ b/Framework/CurveFitting/test/HistogramDomainCreatorTest.h @@ -463,8 +463,9 @@ private: return ws2; } - MatrixWorkspace_sptr createFitWorkspace(const size_t ny, - std::function fun) { + MatrixWorkspace_sptr + createFitWorkspace(const size_t ny, + const std::function &fun) { MatrixWorkspace_sptr ws(new WorkspaceTester); size_t nx = ny + 1; double x0 = -1.0; diff --git a/Framework/CurveFitting/test/MultiDomainCreatorTest.h b/Framework/CurveFitting/test/MultiDomainCreatorTest.h index ef6499accc9173a80385643f4c1f8606a6cbdcb7..146991f53f43eaa89eb392b6f937c8a064bacf9a 100644 --- a/Framework/CurveFitting/test/MultiDomainCreatorTest.h +++ b/Framework/CurveFitting/test/MultiDomainCreatorTest.h @@ -302,7 +302,7 @@ public: } private: - void doTestOutputSpectrum(MatrixWorkspace_sptr ws, size_t index) { + void doTestOutputSpectrum(const MatrixWorkspace_sptr &ws, size_t index) { TS_ASSERT(ws); TS_ASSERT_EQUALS(ws->getNumberHistograms(), 3); auto &data = ws->readY(0); diff --git a/Framework/CurveFitting/test/TableWorkspaceDomainCreatorTest.h b/Framework/CurveFitting/test/TableWorkspaceDomainCreatorTest.h index 5cecdb61ba482f381a559d86834b135d02e77717..743bac005d50c13b182e8e049207ffb4e01d1394 100644 --- a/Framework/CurveFitting/test/TableWorkspaceDomainCreatorTest.h +++ b/Framework/CurveFitting/test/TableWorkspaceDomainCreatorTest.h @@ -770,8 +770,8 @@ private: } boost::shared_ptr - setupBasicFitPropertiesAlgorithm(API::IFunction_sptr fun, - API::Workspace_sptr ws, + setupBasicFitPropertiesAlgorithm(const API::IFunction_sptr &fun, + const API::Workspace_sptr &ws, bool createOutput = true) { auto fit = boost::make_shared(); fit->initialize(); diff --git a/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h b/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h index 918e89694bb78617d293a47138ea171957785619..971696c075357790711f54d7e5cdca4262d16f48 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h @@ -49,12 +49,12 @@ private: /// Run LoadInstrument as a Child Algorithm bool runLoadInstrument(const std::string &idf_filename, - API::MatrixWorkspace_sptr localWorkspace, + const API::MatrixWorkspace_sptr &localWorkspace, Algorithm *alg); /// Load logs from the NeXus file static bool runLoadNexusLogs(const std::string &nexusFileName, - API::MatrixWorkspace_sptr localWorkspace, + const API::MatrixWorkspace_sptr &localWorkspace, Algorithm *alg); /// Are we going to make a copy of the NeXus file to operate on ? diff --git a/Framework/DataHandling/inc/MantidDataHandling/BankPulseTimes.h b/Framework/DataHandling/inc/MantidDataHandling/BankPulseTimes.h index 8cdc32656f8dd9f07990182dc3e9fc78e14c7dba..5edb30b89ebc93495d86522931ac795789434154 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/BankPulseTimes.h +++ b/Framework/DataHandling/inc/MantidDataHandling/BankPulseTimes.h @@ -32,7 +32,7 @@ public: ~BankPulseTimes(); /// Equals - bool equals(size_t otherNumPulse, std::string otherStartTime); + bool equals(size_t otherNumPulse, const std::string &otherStartTime); /// String describing the start time std::string startTime; diff --git a/Framework/DataHandling/inc/MantidDataHandling/CreateSimulationWorkspace.h b/Framework/DataHandling/inc/MantidDataHandling/CreateSimulationWorkspace.h index c8129c6e205948dee0cfb1d8d443b64701dca82e..e8d09ae03001d2fc5cd7686788788a343b8043d1 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/CreateSimulationWorkspace.h +++ b/Framework/DataHandling/inc/MantidDataHandling/CreateSimulationWorkspace.h @@ -54,7 +54,7 @@ private: /// Apply any instrument adjustments from the file void adjustInstrument(const std::string &filename); /// Set start date for dummy workspace - void setStartDate(API::MatrixWorkspace_sptr workspace); + void setStartDate(const API::MatrixWorkspace_sptr &workspace); /// Pointer to a progress object boost::shared_ptr m_progress; diff --git a/Framework/DataHandling/inc/MantidDataHandling/DataBlockComposite.h b/Framework/DataHandling/inc/MantidDataHandling/DataBlockComposite.h index 41a791773fed785fd958164f5f1ede95b240c363..307d7b84caf8fbac1b4ac4071009b7dacb99fe13 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/DataBlockComposite.h +++ b/Framework/DataHandling/inc/MantidDataHandling/DataBlockComposite.h @@ -33,7 +33,7 @@ public: bool operator==(const DataBlockComposite &other) const; // DataBlockComposite only mehtods - void addDataBlock(DataBlock dataBlock); + void addDataBlock(const DataBlock &dataBlock); std::vector getDataBlocks(); DataBlockComposite operator+(const DataBlockComposite &other); void removeSpectra(DataBlockComposite &toRemove); diff --git a/Framework/DataHandling/inc/MantidDataHandling/DetermineChunking.h b/Framework/DataHandling/inc/MantidDataHandling/DetermineChunking.h index 8dd99ed92b0a17139baa4d0d8bbd63ea2ee83925..5df1afc8758a885cd2641bdcdca2a96043b76509 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/DetermineChunking.h +++ b/Framework/DataHandling/inc/MantidDataHandling/DetermineChunking.h @@ -57,7 +57,7 @@ public: private: void init() override; void exec() override; - std::string setTopEntryName(std::string filename); + std::string setTopEntryName(const std::string &filename); FileType getFileType(const std::string &filename); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h b/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h index 6b0d8bebcebed593d62dd1457ae0ab13789452c5..7e2dcfc33bbd9857fe1f0d2091b3fc1b5d1595b5 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h +++ b/Framework/DataHandling/inc/MantidDataHandling/EventWorkspaceCollection.h @@ -59,7 +59,7 @@ public: void setThickness(const float flag); void setHeight(const float flag); void setWidth(const float flag); - void setSpectrumNumbersFromUniqueSpectra(const std::set uniqueSpectra); + void setSpectrumNumbersFromUniqueSpectra(const std::set &uniqueSpectra); void setSpectrumNumberForAllPeriods(const size_t spectrumNumber, const specnum_t specid); void setDetectorIdsForAllPeriods(const size_t spectrumNumber, @@ -88,8 +88,9 @@ public: void setMonitorWorkspace(const boost::shared_ptr &monitorWS); void updateSpectraUsing(const API::SpectrumDetectorMapping &map); - void setTitle(std::string title); - void applyFilter(boost::function func); + void setTitle(const std::string &title); + void + applyFilter(const boost::function &func); virtual bool threadSafe() const; }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/FilterEventsByLogValuePreNexus.h b/Framework/DataHandling/inc/MantidDataHandling/FilterEventsByLogValuePreNexus.h index e40324effba448213744cf3202f8f4a15a8779bb..9a6d5d706a6e78d9eb423b49efb50bfe7d3fd96b 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/FilterEventsByLogValuePreNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/FilterEventsByLogValuePreNexus.h @@ -122,7 +122,7 @@ private: void readPulseidFile(const std::string &filename, const bool throwError); void runLoadInstrument(const std::string &eventfilename, - API::MatrixWorkspace_sptr localWorkspace); + const API::MatrixWorkspace_sptr &localWorkspace); void procEvents(DataObjects::EventWorkspace_sptr &workspace); @@ -133,15 +133,15 @@ private: void setProtonCharge(DataObjects::EventWorkspace_sptr &workspace); - void addToWorkspaceLog(std::string logtitle, size_t mindex); + void addToWorkspaceLog(const std::string &logtitle, size_t mindex); void processEventLogs(); /// Pad out empty pixel - size_t padOutEmptyPixels(DataObjects::EventWorkspace_sptr eventws); + size_t padOutEmptyPixels(const DataObjects::EventWorkspace_sptr &eventws); /// Set up spectrum/detector ID map inside a workspace - void setupPixelSpectrumMap(DataObjects::EventWorkspace_sptr eventws); + void setupPixelSpectrumMap(const DataObjects::EventWorkspace_sptr &eventws); /// void filterEvents(); diff --git a/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h b/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h index 91f15dbf33c7c04d5a8a9d4bbc84d2ad24948db6..fc590b50ef0a3c2305400075a71b9649e037af6f 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/GroupDetectors2.h @@ -151,23 +151,23 @@ private: void execEvent(); /// read in the input parameters and see what findout what will be to grouped - void getGroups(API::MatrixWorkspace_const_sptr workspace, + void getGroups(const API::MatrixWorkspace_const_sptr &workspace, std::vector &unUsedSpec); /// gets the list of spectra _index_ _numbers_ from a file of _spectra_ /// _numbers_ void processFile(const std::string &fname, - API::MatrixWorkspace_const_sptr workspace, + const API::MatrixWorkspace_const_sptr &workspace, std::vector &unUsedSpec); /// gets groupings from XML file void processXMLFile(const std::string &fname, - API::MatrixWorkspace_const_sptr workspace, + const API::MatrixWorkspace_const_sptr &workspace, std::vector &unUsedSpec); - void - processGroupingWorkspace(DataObjects::GroupingWorkspace_const_sptr groupWS, - API::MatrixWorkspace_const_sptr workspace, - std::vector &unUsedSpec); - void processMatrixWorkspace(API::MatrixWorkspace_const_sptr groupWS, - API::MatrixWorkspace_const_sptr workspace, + void processGroupingWorkspace( + const DataObjects::GroupingWorkspace_const_sptr &groupWS, + const API::MatrixWorkspace_const_sptr &workspace, + std::vector &unUsedSpec); + void processMatrixWorkspace(const API::MatrixWorkspace_const_sptr &groupWS, + const API::MatrixWorkspace_const_sptr &workspace, std::vector &unUsedSpec); /// used while reading the file turns the string into an integer number (if /// possible), white space and # comments ignored @@ -193,14 +193,15 @@ private: /// Copy the and combine the histograms that the user requested from the input /// into the output workspace - size_t formGroups(API::MatrixWorkspace_const_sptr inputWS, - API::MatrixWorkspace_sptr outputWS, const double prog4Copy, - const bool keepAll, const std::set &unGroupedSet, + size_t formGroups(const API::MatrixWorkspace_const_sptr &inputWS, + const API::MatrixWorkspace_sptr &outputWS, + const double prog4Copy, const bool keepAll, + const std::set &unGroupedSet, Indexing::IndexInfo &indexInfo); /// Copy the and combine the event lists that the user requested from the /// input into the output workspace - size_t formGroupsEvent(DataObjects::EventWorkspace_const_sptr inputWS, - DataObjects::EventWorkspace_sptr outputWS, + size_t formGroupsEvent(const DataObjects::EventWorkspace_const_sptr &inputWS, + const DataObjects::EventWorkspace_sptr &outputWS, const double prog4Copy); /// Copy the ungrouped spectra from the input workspace to the output diff --git a/Framework/DataHandling/inc/MantidDataHandling/JoinISISPolarizationEfficiencies.h b/Framework/DataHandling/inc/MantidDataHandling/JoinISISPolarizationEfficiencies.h index b3b794ea2c98cbc9b292ac6beeccfb39e80bcdad..61d2de494c1f0b1c71350307947fbc38663abd61 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/JoinISISPolarizationEfficiencies.h +++ b/Framework/DataHandling/inc/MantidDataHandling/JoinISISPolarizationEfficiencies.h @@ -33,10 +33,10 @@ private: std::vector interpolateWorkspaces( std::vector const &workspaces); API::MatrixWorkspace_sptr - interpolatePointDataWorkspace(API::MatrixWorkspace_sptr ws, + interpolatePointDataWorkspace(const API::MatrixWorkspace_sptr &ws, size_t const maxSize); API::MatrixWorkspace_sptr - interpolateHistogramWorkspace(API::MatrixWorkspace_sptr ws, + interpolateHistogramWorkspace(const API::MatrixWorkspace_sptr &ws, size_t const maxSize); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/Load.h b/Framework/DataHandling/inc/MantidDataHandling/Load.h index dc91b538d0fa54f50531b4d574037789216fcacc..2fa6eb936de13d88971f8ba12e230c223ab37e5b 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/Load.h +++ b/Framework/DataHandling/inc/MantidDataHandling/Load.h @@ -88,7 +88,8 @@ private: API::Workspace_sptr loadFileToWs(const std::string &fileName, const std::string &wsName); /// Plus two workspaces together, "in place". - API::Workspace_sptr plusWs(API::Workspace_sptr ws1, API::Workspace_sptr ws2); + API::Workspace_sptr plusWs(API::Workspace_sptr ws1, + const API::Workspace_sptr &ws2); /// Manually group workspaces. API::WorkspaceGroup_sptr groupWsList(const std::vector &wsList); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadAsciiStl.h b/Framework/DataHandling/inc/MantidDataHandling/LoadAsciiStl.h index 4e24a8d4f844cc7f834542e2892249e4b9793a93..d955e90fec6acf00fd7e6139351b3e02406a2b1c 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadAsciiStl.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadAsciiStl.h @@ -7,6 +7,8 @@ #pragma once #include "MantidDataHandling/LoadStl.h" #include +#include + namespace Mantid { namespace Kernel { @@ -21,12 +23,12 @@ namespace DataHandling { class DLLExport LoadAsciiStl : public LoadStl { public: LoadAsciiStl(std::string filename, ScaleUnits scaleType) - : LoadStl(filename, scaleType) {} + : LoadStl(std::move(filename), scaleType) {} LoadAsciiStl(std::string filename, ScaleUnits scaleType, ReadMaterial::MaterialParameters params) - : LoadStl(filename, scaleType, params) {} + : LoadStl(std::move(filename), scaleType, std::move(params)) {} std::unique_ptr readStl() override; - static bool isAsciiSTL(std::string filename); + static bool isAsciiSTL(const std::string &filename); private: int m_lineNumber = 0; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadBinaryStl.h b/Framework/DataHandling/inc/MantidDataHandling/LoadBinaryStl.h index 802951c614d5da26ca9c8723ffb984b3e0c73c00..c69730cd169127a3069bce82e31b3b9bebc5078f 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadBinaryStl.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadBinaryStl.h @@ -5,6 +5,10 @@ // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + #pragma once +#include + +#include + #include "MantidDataHandling/LoadStl.h" namespace Mantid { @@ -24,12 +28,13 @@ public: static constexpr uint32_t TRIANGLE_COUNT_DATA_SIZE = 4; static constexpr uint32_t VECTOR_DATA_SIZE = 12; LoadBinaryStl(std::string filename, ScaleUnits scaleType) - : LoadStl(filename, scaleType) {} + : LoadStl(std::move(std::move(filename)), scaleType) {} LoadBinaryStl(std::string filename, ScaleUnits scaleType, ReadMaterial::MaterialParameters params) - : LoadStl(filename, scaleType, params) {} + : LoadStl(std::move(std::move(filename)), scaleType, + std::move(std::move(params))) {} std::unique_ptr readStl() override; - static bool isBinarySTL(std::string filename); + static bool isBinarySTL(const std::string &filename); private: void readTriangle(Kernel::BinaryStreamReader, uint32_t &vertexCount); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadCalFile.h b/Framework/DataHandling/inc/MantidDataHandling/LoadCalFile.h index 318a41a699557405fff23f1993c010aa1e66442a..cec536b2ac4ed02aed40d42bc6cf821dee07ff50 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadCalFile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadCalFile.h @@ -53,10 +53,11 @@ public: getInstrument3Ways(API::Algorithm *alg); static bool instrumentIsSpecified(API::Algorithm *alg); - static void readCalFile(const std::string &calFileName, - Mantid::DataObjects::GroupingWorkspace_sptr groupWS, - Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS, - Mantid::DataObjects::MaskWorkspace_sptr maskWS); + static void + readCalFile(const std::string &calFileName, + const Mantid::DataObjects::GroupingWorkspace_sptr &groupWS, + const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS, + const Mantid::DataObjects::MaskWorkspace_sptr &maskWS); protected: Parallel::ExecutionMode getParallelExecutionMode( @@ -70,7 +71,7 @@ private: void exec() override; /// Checks if a detector ID is for a monitor on a given instrument - static bool idIsMonitor(Mantid::Geometry::Instrument_const_sptr inst, + static bool idIsMonitor(const Mantid::Geometry::Instrument_const_sptr &inst, int detID); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadCanSAS1D.h b/Framework/DataHandling/inc/MantidDataHandling/LoadCanSAS1D.h index 885a8014233a9f6674af8feec46ac0d1fbcfa101..398a393a94fe92dce3e260d1798b73a7df21b3d3 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadCanSAS1D.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadCanSAS1D.h @@ -76,18 +76,19 @@ protected: const std::string &name) const; /// Appends the new data workspace creating a workspace group if there was /// existing data - void appendDataToOutput(API::MatrixWorkspace_sptr newWork, + void appendDataToOutput(const API::MatrixWorkspace_sptr &newWork, const std::string &newWorkName, - API::WorkspaceGroup_sptr container); + const API::WorkspaceGroup_sptr &container); /// Run LoadInstrument Child Algorithm void runLoadInstrument(const std::string &inst_name, - API::MatrixWorkspace_sptr localWorkspace); + const API::MatrixWorkspace_sptr &localWorkspace); /// Loads data into the run log void createLogs(const Poco::XML::Element *const sasEntry, - API::MatrixWorkspace_sptr wSpace) const; + const API::MatrixWorkspace_sptr &wSpace) const; /// Loads the information about hhe sample - void createSampleInformation(const Poco::XML::Element *const sasEntry, - Mantid::API::MatrixWorkspace_sptr wSpace) const; + void createSampleInformation( + const Poco::XML::Element *const sasEntry, + const Mantid::API::MatrixWorkspace_sptr &wSpace) const; }; } // namespace DataHandling } // namespace Mantid diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadDaveGrp.h b/Framework/DataHandling/inc/MantidDataHandling/LoadDaveGrp.h index 802b74dd7760a93a342a8bce34c027018e0a9711..ca091548c58af7966b865e004ef7410f80090db8 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadDaveGrp.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadDaveGrp.h @@ -102,7 +102,7 @@ private: * * @param workspace handle to the workspace to to load data into */ - void getData(API::MatrixWorkspace_sptr workspace); + void getData(const API::MatrixWorkspace_sptr &workspace); /** * Function to setup the workspace ready for data to be loaded into it @@ -118,7 +118,7 @@ private: * @param xAxis the x axis data * @param yAxis the y axis data */ - void setWorkspaceAxes(API::MatrixWorkspace_sptr workspace, + void setWorkspaceAxes(const API::MatrixWorkspace_sptr &workspace, const std::vector &xAxis, const std::vector &yAxis) const; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h b/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h index bfc0bf2d36240291ab1bb6181f3603045279724e..66ba3fca07f27f50a888ad3221bc8973d2eca4de 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadDetectorsGroupingFile.h @@ -107,7 +107,7 @@ class DLLExport LoadGroupXMLFile { public: LoadGroupXMLFile(); - void loadXMLFile(std::string xmlfilename); + void loadXMLFile(const std::string &xmlfilename); void setDefaultStartingGroupID(int startgroupid) { m_startGroupID = startgroupid; } @@ -167,7 +167,7 @@ private: void parseXML(); /// Get attribute value from an XML node static std::string getAttributeValueByName(Poco::XML::Node *pNode, - std::string attributename, + const std::string &attributename, bool &found); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadDspacemap.h b/Framework/DataHandling/inc/MantidDataHandling/LoadDspacemap.h index d835ca613f0a9bf9f4f39eaa1bf11a3b5e7fd44a..fe0f2ea36148a5bb42f820ff13a74a54115a778b 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadDspacemap.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadDspacemap.h @@ -48,12 +48,12 @@ private: std::map &vulcan); void CalculateOffsetsFromDSpacemapFile( - const std::string DFileName, - Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS); + const std::string &DFileName, + const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS); void CalculateOffsetsFromVulcanFactors( std::map &vulcan, - Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS); + const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS); }; } // namespace DataHandling diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h index 8dbc0304175c51ea862e97835ef585796f6aea6e..3c2c8141cb82c705f1039663f4d50bed02e735b8 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h @@ -206,8 +206,8 @@ private: void createSpectraMapping( const std::string &nxsfile, const bool monitorsOnly, const std::vector &bankNames = std::vector()); - void deleteBanks(EventWorkspaceCollection_sptr workspace, - std::vector bankNames); + void deleteBanks(const EventWorkspaceCollection_sptr &workspace, + const std::vector &bankNames); bool hasEventMonitors(); void runLoadMonitors(); /// Set the filters on TOF. @@ -223,7 +223,7 @@ private: void setTopEntryName(); /// to open the nexus file with specific exception handling/message - void safeOpenFile(const std::string fname); + void safeOpenFile(const std::string &fname); /// Was the instrument loaded? bool m_instrument_loaded_correctly; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexusIndexSetup.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexusIndexSetup.h index 60feb2504cbd8c7e7a14c8fba398147d1d706359..a653534a18cd997ad2d7730614b602f1d2857832 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexusIndexSetup.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexusIndexSetup.h @@ -28,7 +28,7 @@ class MANTID_DATAHANDLING_DLL LoadEventNexusIndexSetup { public: LoadEventNexusIndexSetup( API::MatrixWorkspace_const_sptr instrumentWorkspace, const int32_t min, - const int32_t max, const std::vector range, + const int32_t max, const std::vector &range, const Parallel::Communicator &communicator = Parallel::Communicator()); std::pair eventIDLimits() const; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus2.h index e6a43703b1af39036de35f41071ea712bb1526ab..cb2b3b406b9d4056fa60823408b943728cd56014 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventPreNexus2.h @@ -188,7 +188,7 @@ private: void readPulseidFile(const std::string &filename, const bool throwError); void runLoadInstrument(const std::string &eventfilename, - API::MatrixWorkspace_sptr localWorkspace); + const API::MatrixWorkspace_sptr &localWorkspace); inline void fixPixelId(PixelType &pixel, uint32_t &period) const; @@ -202,7 +202,7 @@ private: void setProtonCharge(DataObjects::EventWorkspace_sptr &workspace); - void addToWorkspaceLog(std::string logtitle, size_t mindex); + void addToWorkspaceLog(const std::string &logtitle, size_t mindex); void processImbedLogs(); @@ -212,7 +212,7 @@ private: API::MatrixWorkspace_sptr generateEventDistribtionWorkspace(); - void createOutputWorkspace(const std::string event_filename); + void createOutputWorkspace(const std::string &event_filename); /// Processing the input properties for purpose of investigation void processInvestigationInputs(); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h b/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h index c4a46f6f1f89c513ef33d6d243637774e7729647..c1720745222adb9c475b30ab537c636253e3a077 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadFITS.h @@ -91,15 +91,16 @@ private: DataObjects::Workspace2D_sptr makeWorkspace( const FITSInfo &fileInfo, size_t &newFileNumber, std::vector &buffer, API::MantidImage &imageY, - API::MantidImage &imageE, const DataObjects::Workspace2D_sptr parent, + API::MantidImage &imageE, const DataObjects::Workspace2D_sptr &parent, bool loadAsRectImg = false, int binSize = 1, double noiseThresh = false); - void addAxesInfoAndLogs(DataObjects::Workspace2D_sptr ws, bool loadAsRectImg, - const FITSInfo &fileInfo, int binSize, double cmpp); + void addAxesInfoAndLogs(const DataObjects::Workspace2D_sptr &ws, + bool loadAsRectImg, const FITSInfo &fileInfo, + int binSize, double cmpp); // Reads the data from a single FITS file into a workspace (directly, fast) void readDataToWorkspace(const FITSInfo &fileInfo, double cmpp, - DataObjects::Workspace2D_sptr ws, + const DataObjects::Workspace2D_sptr &ws, std::vector &buffer); // Reads the data from a single FITS file into image objects (Y and E) that diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadFullprofResolution.h b/Framework/DataHandling/inc/MantidDataHandling/LoadFullprofResolution.h index 0719e71aeaa6df686dcc6581d09dfc254b5b210c..0796c67a633fb32f7c52e4b9ca49a60489704fe1 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadFullprofResolution.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadFullprofResolution.h @@ -51,48 +51,48 @@ public: std::map ¶mmap); /// Put parameters into a matrix workspace - static void putParametersIntoWorkspace(const API::Column_const_sptr, - API::MatrixWorkspace_sptr ws, + static void putParametersIntoWorkspace(const API::Column_const_sptr &, + const API::MatrixWorkspace_sptr &ws, int nProf, std::string ¶meterXMLString); /// Add an Ikeda-Carpenter PV ALFBE parameter - static void addALFBEParameter(const API::Column_const_sptr, + static void addALFBEParameter(const API::Column_const_sptr &, Poco::XML::Document *mDoc, Poco::XML::Element *parent, const std::string ¶mName); /// Add set of Ikeda-Carpenter PV Sigma parameters - static void addSigmaParameters(const API::Column_const_sptr, + static void addSigmaParameters(const API::Column_const_sptr &, Poco::XML::Document *mDoc, Poco::XML::Element *parent); /// Add set of Ikeda-Carpenter PV Gamma parameters - static void addGammaParameters(const API::Column_const_sptr, + static void addGammaParameters(const API::Column_const_sptr &, Poco::XML::Document *mDoc, Poco::XML::Element *parent); /// Add set of BackToBackExponential S parameters - static void addBBX_S_Parameters(const API::Column_const_sptr, + static void addBBX_S_Parameters(const API::Column_const_sptr &, Poco::XML::Document *mDoc, Poco::XML::Element *parent); /// Add set of BackToBackExponential A parameters - static void addBBX_A_Parameters(const API::Column_const_sptr, + static void addBBX_A_Parameters(const API::Column_const_sptr &, Poco::XML::Document *mDoc, Poco::XML::Element *parent); /// Add set of BackToBackExponential B parameters - static void addBBX_B_Parameters(const API::Column_const_sptr, + static void addBBX_B_Parameters(const API::Column_const_sptr &, Poco::XML::Document *mDoc, Poco::XML::Element *parent); /// Get value for XML eq attribute for parameter - static std::string getXMLEqValue(const API::Column_const_sptr, + static std::string getXMLEqValue(const API::Column_const_sptr &, const std::string &name); /// Get value for XML eq attribute for squared parameter - static std::string getXMLSquaredEqValue(const API::Column_const_sptr column, + static std::string getXMLSquaredEqValue(const API::Column_const_sptr &column, const std::string &name); // Translate a parameter name from as it appears in the table workspace to its @@ -114,7 +114,7 @@ private: void exec() override; /// Load file to a vector of strings - void loadFile(std::string filename, std::vector &lines); + void loadFile(const std::string &filename, std::vector &lines); /// Get the NPROF number int getProfNumber(const std::vector &lines); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadGSASInstrumentFile.h b/Framework/DataHandling/inc/MantidDataHandling/LoadGSASInstrumentFile.h index bafa82c0063f7f5c2706baf268bd16a1ed64cb58..da15be2dc473984baadb9ec6a0fb53d566958b10 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadGSASInstrumentFile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadGSASInstrumentFile.h @@ -49,7 +49,7 @@ private: void exec() override; /// Load file to a vector of strings - void loadFile(std::string filename, std::vector &lines); + void loadFile(const std::string &filename, std::vector &lines); /// Get Histogram type std::string getHistogramType(const std::vector &lines); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadGSS.h b/Framework/DataHandling/inc/MantidDataHandling/LoadGSS.h index 683863dc673ef481c00dc23af23073f0e531518f..cefa59b10e4c8305ff0a36a3a76e287513ddc6d0 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadGSS.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadGSS.h @@ -63,7 +63,7 @@ private: double convertToDouble(std::string inputstring); /// Create an instrument geometry. - void createInstrumentGeometry(API::MatrixWorkspace_sptr workspace, + void createInstrumentGeometry(const API::MatrixWorkspace_sptr &workspace, const std::string &instrumentname, const double &primaryflightpath, const std::vector &detectorids, diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadHelper.h b/Framework/DataHandling/inc/MantidDataHandling/LoadHelper.h index 6d61d25ce6781085de33d93e240feeb10ad07416..e1d76e61361236dfe290af9096dcacfe1718bd56 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadHelper.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadHelper.h @@ -35,18 +35,19 @@ public: static double calculateStandardError(double in) { return sqrt(in); } double calculateEnergy(double); double calculateTOF(double, double); - double getInstrumentProperty(const API::MatrixWorkspace_sptr &, std::string); + double getInstrumentProperty(const API::MatrixWorkspace_sptr &, + const std::string &); void addNexusFieldsToWsRun(NXhandle nxfileID, API::Run &runDetails); void dumpNexusAttributes(NXhandle nxfileID, std::string &indentStr); - std::string dateTimeInIsoFormat(std::string); + std::string dateTimeInIsoFormat(const std::string &); - void moveComponent(API::MatrixWorkspace_sptr ws, + void moveComponent(const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const Kernel::V3D &newPos); - void rotateComponent(API::MatrixWorkspace_sptr ws, + void rotateComponent(const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const Kernel::Quat &rot); - Kernel::V3D getComponentPosition(API::MatrixWorkspace_sptr ws, + Kernel::V3D getComponentPosition(const API::MatrixWorkspace_sptr &ws, const std::string &componentName); private: diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h index 5da9cae6b1aacc765959225c9767158333e48bf3..b1e0389853c021cb04d8d3dd61fa0d830bc67983 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h @@ -59,7 +59,7 @@ public: /// Load the parameters from Nexus file if possible, else from parameter file, /// into workspace void LoadParameters(::NeXus::File *nxfile, - const API::MatrixWorkspace_sptr localWorkspace); + const API::MatrixWorkspace_sptr &localWorkspace); /// Algorithm's version for identification overriding a virtual method int version() const override { return 1; } @@ -77,7 +77,7 @@ private: /// Load Parameter File specified by full pathname into given workspace, /// return success bool loadParameterFile(const std::string &fullPathName, - const API::MatrixWorkspace_sptr localWorkspace); + const API::MatrixWorkspace_sptr &localWorkspace); }; } // namespace DataHandling diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadILLDiffraction.h b/Framework/DataHandling/inc/MantidDataHandling/LoadILLDiffraction.h index d1f7f1456799c8c2c1e7ad5d72eaea2c10f95bfa..5e62681ceae7f0caa121214a7e2303a489327e9d 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadILLDiffraction.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadILLDiffraction.h @@ -6,6 +6,8 @@ // SPDX - License - Identifier: GPL - 3.0 + #pragma once +#include + #include "MantidAPI/IFileLoader.h" #include "MantidDataHandling/DllConfig.h" #include "MantidDataHandling/LoadHelper.h" @@ -45,7 +47,8 @@ private: std::string unit; ScannedVariables(std::string n, std::string p, std::string u) - : axis(0), scanned(0), name(n), property(p), unit(u) {} + : axis(0), scanned(0), name(std::move(n)), property(std::move(p)), + unit(std::move(u)) {} void setAxis(int a) { axis = a; } void setScanned(int s) { scanned = s; } diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadILLIndirect2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadILLIndirect2.h index c495fe9c1e58107a42e3bd734e8a9d41fe756bc6..961712138804b2ffb89b6dab068706f4807b39d3 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadILLIndirect2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadILLIndirect2.h @@ -44,7 +44,7 @@ private: void initWorkSpace(); void setInstrumentName(const NeXus::NXEntry &firstEntry, const std::string &instrumentNamePath); - void loadNexusEntriesIntoProperties(std::string nexusfilename); + void loadNexusEntriesIntoProperties(const std::string &nexusfilename); void loadDataIntoTheWorkSpace(NeXus::NXEntry &entry); void runLoadInstrument(); void moveComponent(const std::string &, double); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h index 16f8fabe5d99aa9f00398b8361500cc5588fba43..464d3ebe2a9ccabd431351d1e709cfee8b01d506 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadISISNexus2.h @@ -129,7 +129,7 @@ private: void createPeriodLogs(int64_t period, DataObjects::Workspace2D_sptr &local_workspace); // Validate multi-period logs - void validateMultiPeriodLogs(Mantid::API::MatrixWorkspace_sptr); + void validateMultiPeriodLogs(const Mantid::API::MatrixWorkspace_sptr &); // build the list of spectra numbers to load and include in the spectra list void buildSpectraInd2SpectraNumMap(bool range_supplied, bool hasSpectraList, diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadInstrument.h b/Framework/DataHandling/inc/MantidDataHandling/LoadInstrument.h index f806e3f60e3383c0f4742907fbc2b13035d928de..af8bcd4fb77fb0e86a76188e6a1d7181b9b2fbd2 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadInstrument.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadInstrument.h @@ -82,12 +82,12 @@ private: /// Run the Child Algorithm LoadParameters void runLoadParameterFile(const boost::shared_ptr &ws, - std::string filename); + const std::string &filename); /// Search directory for Parameter file, return full path name if found, else /// "". - std::string getFullPathParamIDF(std::string directoryName, - std::string filename); + std::string getFullPathParamIDF(const std::string &directoryName, + const std::string &filename); /// Mutex to avoid simultaneous access static std::recursive_mutex m_mutex; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadIsawDetCal.h b/Framework/DataHandling/inc/MantidDataHandling/LoadIsawDetCal.h index c7ba4675acc8ee47c92ce410af2d2851c66a2d2d..a9692c495fc22e48163add0679c910485aae26c0 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadIsawDetCal.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadIsawDetCal.h @@ -66,15 +66,15 @@ private: /// Set the center of the supplied detector name void center(const double x, const double y, const double z, - const std::string &detname, API::Workspace_sptr ws, + const std::string &detname, const API::Workspace_sptr &ws, Geometry::ComponentInfo &componentInfo); - Geometry::Instrument_sptr getCheckInst(API::Workspace_sptr ws); + Geometry::Instrument_sptr getCheckInst(const API::Workspace_sptr &ws); std::vector getFilenames(); void doRotation(Kernel::V3D rX, Kernel::V3D rY, Geometry::ComponentInfo &componentInfo, - boost::shared_ptr comp, + const boost::shared_ptr &comp, bool doWishCorrection = false); void applyScalings( API::Workspace_sptr &ws, diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadLog.h b/Framework/DataHandling/inc/MantidDataHandling/LoadLog.h index 4649af305d46deb3d59f6a4280f29b6f009bf168..34112bb1bc4fe64eb146ece830f5aba4cb597753 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadLog.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadLog.h @@ -114,7 +114,7 @@ private: /// Create timeseries property from .log file and adds that to sample object void loadThreeColumnLogFile(std::ifstream &logFileStream, - std::string logFileName, API::Run &run); + const std::string &logFileName, API::Run &run); /// Loads two column log file data into local workspace void loadTwoColumnLogFile(std::ifstream &logFileStream, diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus.h index d945e813eabe981d03c4878aaceb2050483a25ac..b447ebc7abb4f9d607e76e9d37648bb6e8667062 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus.h @@ -75,7 +75,7 @@ public: protected: virtual void runLoadInstrumentFromNexus(DataObjects::Workspace2D_sptr) {} void checkOptionalProperties(); - void runLoadInstrument(DataObjects::Workspace2D_sptr); + void runLoadInstrument(const DataObjects::Workspace2D_sptr &); /// The name and path of the input file std::string m_filename; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h index b6bd27025c9fe16edab6a9c2e114507eeb2520f2..a79a1ff9070a78daeed6b09623035444e5112c16 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h @@ -84,13 +84,13 @@ protected: private: void loadData(size_t hist, specnum_t &i, specnum_t specNo, MuonNexusReader &nxload, const int64_t lengthIn, - DataObjects::Workspace2D_sptr localWorkspace); + const DataObjects::Workspace2D_sptr &localWorkspace); void runLoadMappingTable(DataObjects::Workspace2D_sptr); - void runLoadLog(DataObjects::Workspace2D_sptr); - void loadRunDetails(DataObjects::Workspace2D_sptr localWorkspace); - void addPeriodLog(DataObjects::Workspace2D_sptr localWorkspace, + void runLoadLog(const DataObjects::Workspace2D_sptr &); + void loadRunDetails(const DataObjects::Workspace2D_sptr &localWorkspace); + void addPeriodLog(const DataObjects::Workspace2D_sptr &localWorkspace, int64_t period); - void addGoodFrames(DataObjects::Workspace2D_sptr localWorkspace, + void addGoodFrames(const DataObjects::Workspace2D_sptr &localWorkspace, int64_t period, int nperiods); /// Loads dead time table for the detector @@ -104,7 +104,7 @@ private: /// Loads detector grouping information API::Workspace_sptr loadDetectorGrouping(Mantid::NeXus::NXRoot &root, - Mantid::Geometry::Instrument_const_sptr inst); + const Mantid::Geometry::Instrument_const_sptr &inst); /// Creates Detector Grouping Table using all the data from the range DataObjects::TableWorkspace_sptr diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h index 027ca711809cdf3cc67126655002bff2b55459f2..0b43a3c127de6bde6f27095e1c3bfdb74352984c 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h @@ -79,9 +79,9 @@ private: HistogramData::Histogram loadData(const Mantid::HistogramData::BinEdges &edges, const Mantid::NeXus::NXInt &counts, int period, int spec); - void loadLogs(API::MatrixWorkspace_sptr ws, Mantid::NeXus::NXEntry &entry, - int period); - void loadRunDetails(DataObjects::Workspace2D_sptr localWorkspace); + void loadLogs(const API::MatrixWorkspace_sptr &ws, + Mantid::NeXus::NXEntry &entry, int period); + void loadRunDetails(const DataObjects::Workspace2D_sptr &localWorkspace); std::map> loadDetectorMapping(const Mantid::NeXus::NXInt &spectrumIndex); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadNexusLogs.h b/Framework/DataHandling/inc/MantidDataHandling/LoadNexusLogs.h index 16888c9d70be2683a014d9f31f7c0f6fb5045936..27d649c53b28bf725932bf3f41af037c2edd2b2f 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadNexusLogs.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadNexusLogs.h @@ -62,18 +62,22 @@ private: /// Load log data from a group void loadLogs(::NeXus::File &file, const std::string &entry_name, const std::string &entry_class, - boost::shared_ptr workspace) const; + const boost::shared_ptr &workspace) const; /// Load an NXlog entry - void loadNXLog(::NeXus::File &file, const std::string &entry_name, - const std::string &entry_class, - boost::shared_ptr workspace) const; + void + loadNXLog(::NeXus::File &file, const std::string &entry_name, + const std::string &entry_class, + const boost::shared_ptr &workspace) const; /// Load an IXseblock entry - void loadSELog(::NeXus::File &file, const std::string &entry_name, - boost::shared_ptr workspace) const; - void loadVetoPulses(::NeXus::File &file, - boost::shared_ptr workspace) const; - void loadNPeriods(::NeXus::File &file, - boost::shared_ptr workspace) const; + void + loadSELog(::NeXus::File &file, const std::string &entry_name, + const boost::shared_ptr &workspace) const; + void loadVetoPulses( + ::NeXus::File &file, + const boost::shared_ptr &workspace) const; + void + loadNPeriods(::NeXus::File &file, + const boost::shared_ptr &workspace) const; /// Progress reporting object boost::shared_ptr m_progress; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadNexusMonitors2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadNexusMonitors2.h index 069b37ed9cacad5266e600bcef2594d905362b29..f1ef867e40190d6bcd5f399daf9ed1e665e9927e 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadNexusMonitors2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadNexusMonitors2.h @@ -82,8 +82,8 @@ private: void fixUDets(::NeXus::File &file); /// Load the logs - void runLoadLogs(const std::string filename, - API::MatrixWorkspace_sptr localWorkspace); + void runLoadLogs(const std::string &filename, + const API::MatrixWorkspace_sptr &localWorkspace); /// is it possible to open the file? bool canOpenAsNeXus(const std::string &fname); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h b/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h index 230499affc16be9454db1929d73d20b652bf3530..48b3d6ffa83f69b253f2d6c06d81a1f8de4b0361 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed.h @@ -160,7 +160,7 @@ private: /// Read the bin masking information void readBinMasking(Mantid::NeXus::NXData &wksp_cls, - API::MatrixWorkspace_sptr local_workspace); + const API::MatrixWorkspace_sptr &local_workspace); /// Load a block of data into the workspace where it is assumed that the x /// bins have already been cached @@ -169,7 +169,7 @@ private: Mantid::NeXus::NXDataSetTyped &farea, bool hasFArea, Mantid::NeXus::NXDouble &xErrors, bool hasXErrors, int blocksize, int nchannels, int &hist, - API::MatrixWorkspace_sptr local_workspace); + const API::MatrixWorkspace_sptr &local_workspace); /// Load a block of data into the workspace where it is assumed that the x /// bins have already been cached @@ -178,7 +178,7 @@ private: Mantid::NeXus::NXDataSetTyped &farea, bool hasFArea, Mantid::NeXus::NXDouble &xErrors, bool hasXErrors, int blocksize, int nchannels, int &hist, int &wsIndex, - API::MatrixWorkspace_sptr local_workspace); + const API::MatrixWorkspace_sptr &local_workspace); /// Load a block of data into the workspace void loadBlock(Mantid::NeXus::NXDataSetTyped &data, Mantid::NeXus::NXDataSetTyped &errors, @@ -186,10 +186,10 @@ private: Mantid::NeXus::NXDouble &xErrors, bool hasXErrors, Mantid::NeXus::NXDouble &xbins, int blocksize, int nchannels, int &hist, int &wsIndex, - API::MatrixWorkspace_sptr local_workspace); + const API::MatrixWorkspace_sptr &local_workspace); /// Load the data from a non-spectra axis (Numeric/Text) into the workspace - void loadNonSpectraAxis(API::MatrixWorkspace_sptr local_workspace, + void loadNonSpectraAxis(const API::MatrixWorkspace_sptr &local_workspace, Mantid::NeXus::NXData &data); /// Validates the optional 'spectra to read' properties, if they have been set @@ -232,8 +232,8 @@ private: std::unique_ptr<::NeXus::File> m_nexusFile; }; /// to sort the algorithmhistory vector -bool UDlesserExecCount(Mantid::NeXus::NXClassInfo elem1, - Mantid::NeXus::NXClassInfo elem2); +bool UDlesserExecCount(const Mantid::NeXus::NXClassInfo &elem1, + const Mantid::NeXus::NXClassInfo &elem2); } // namespace DataHandling } // namespace Mantid diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadOff.h b/Framework/DataHandling/inc/MantidDataHandling/LoadOff.h index a13fc65d74938e7e8b25190268c6abcb0ea2749e..eb30b111e84a9187ccd9cb9d75aa8fa6938bb812 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadOff.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadOff.h @@ -25,7 +25,7 @@ Mantid::Kernel::Logger g_log("LoadOff"); } class DLLExport LoadOff : public MeshFileIO { public: - LoadOff(std::string filename, ScaleUnits scaleType); + LoadOff(const std::string &filename, ScaleUnits scaleType); std::unique_ptr readOFFshape(); private: diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadPDFgetNFile.h b/Framework/DataHandling/inc/MantidDataHandling/LoadPDFgetNFile.h index 4d569896a9a6e3fc8c74fbbc4643c913abffd074..315da9cc9f64a04425765649b11cec586cf09237 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadPDFgetNFile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadPDFgetNFile.h @@ -46,7 +46,7 @@ private: int confidence(Kernel::FileDescriptor &descriptor) const override; /// Parse PDFgetN data file - void parseDataFile(std::string filename); + void parseDataFile(const std::string &filename); /// Check whether a string starts from a specified sub-string bool startsWith(const std::string &s, const std::string &header) const; @@ -70,7 +70,7 @@ private: void generateDataWorkspace(); /// Set X and Y axis unit and lebel - void setUnit(DataObjects::Workspace2D_sptr ws); + void setUnit(const DataObjects::Workspace2D_sptr &ws); void checkSameSize(const std::vector &numptsvec, size_t numsets); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h b/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h index 113ec9642bf6c33d03c6c14ebe57fa42347d2f44..05e96c92574a8e8fd922c58ed046bd3ca5fd2656 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadPSIMuonBin.h @@ -77,7 +77,8 @@ public: private: void init() override; void exec() override; - std::string getFormattedDateTime(std::string date, std::string time); + std::string getFormattedDateTime(const std::string &date, + const std::string &time); void assignOutputWorkspaceParticulars( DataObjects::Workspace2D_sptr &outputWorkspace); void readSingleVariables(Mantid::Kernel::BinaryStreamReader &streamReader); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadPreNexusMonitors.h b/Framework/DataHandling/inc/MantidDataHandling/LoadPreNexusMonitors.h index 5684f3fd53453c0090a1e7b571e7473ef923c3e9..40e77ebfef29bd30e43dadd12989fcb2e67d4b79 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadPreNexusMonitors.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadPreNexusMonitors.h @@ -55,7 +55,7 @@ private: bool instrument_loaded_correctly; void runLoadInstrument(const std::string &instrument, - API::MatrixWorkspace_sptr localWorkspace); + const API::MatrixWorkspace_sptr &localWorkspace); }; } // namespace DataHandling diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h b/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h index 79c99457f429da52a7dfd44ceb27b824abfc59f6..14fa413ddb7dc5bc09e1c9fd4f79852276a4da1d 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadRKH.h @@ -74,7 +74,7 @@ private: MantidVec &axis0Data); const std::string readUnit(const std::string &line); void readNumEntrys(const int nEntries, MantidVec &output); - void binCenter(const MantidVec oldBoundaries, MantidVec &toCenter) const; + void binCenter(const MantidVec &oldBoundaries, MantidVec &toCenter) const; // Remove lines from an input stream void skipLines(std::istream &strm, int nlines); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadRaw3.h b/Framework/DataHandling/inc/MantidDataHandling/LoadRaw3.h index 71f95e5c32cff1d8d08659b3458e45a936b6c3f7..b8d7830f511bc39be6264aabf2252be16d500dbd 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadRaw3.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadRaw3.h @@ -67,18 +67,18 @@ private: /// creates output workspace, monitors excluded from this workspace void excludeMonitors(FILE *file, const int &period, const std::vector &monitorList, - DataObjects::Workspace2D_sptr ws_sptr); + const DataObjects::Workspace2D_sptr &ws_sptr); /// creates output workspace whcih includes monitors void includeMonitors(FILE *file, const int64_t &period, - DataObjects::Workspace2D_sptr ws_sptr); + const DataObjects::Workspace2D_sptr &ws_sptr); /// creates two output workspaces none normal workspace and separate one for /// monitors void separateMonitors(FILE *file, const int64_t &period, const std::vector &monitorList, - DataObjects::Workspace2D_sptr ws_sptr, - DataObjects::Workspace2D_sptr mws_sptr); + const DataObjects::Workspace2D_sptr &ws_sptr, + const DataObjects::Workspace2D_sptr &mws_sptr); /// skip all spectra in a period void skipPeriod(FILE *file, const int64_t &period); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h b/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h index bb1d04fec7a716cbedaa0cc5903ac80f7f756798..a58f0d23642f491bbd0656c1bebe2415df625bd6 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadRawHelper.h @@ -53,7 +53,7 @@ public: /// Opens Raw File FILE *openRawFile(const std::string &fileName); /// Read in run parameters Public so that LoadRaw2 can use it - void loadRunParameters(API::MatrixWorkspace_sptr localWorkspace, + void loadRunParameters(const API::MatrixWorkspace_sptr &localWorkspace, ISISRAW *const = nullptr) const; /// Returns a confidence value that this algorithm can load a file @@ -77,14 +77,15 @@ public: API::WorkspaceGroup_sptr &mongrp_sptr, const int64_t mwsSpecs, const int64_t nwsSpecs, const int64_t numberOfPeriods, const int64_t lengthIn, - std::string title, API::Algorithm *const pAlg); + const std::string &title, API::Algorithm *const pAlg); /// creates shared pointer to group workspace static API::WorkspaceGroup_sptr createGroupWorkspace(); /// creates shared pointer to workspace from parent workspace static DataObjects::Workspace2D_sptr - createWorkspace(DataObjects::Workspace2D_sptr ws_sptr, int64_t nVectors = -1, - int64_t xLengthIn = -1, int64_t yLengthIn = -1); + createWorkspace(const DataObjects::Workspace2D_sptr &ws_sptr, + int64_t nVectors = -1, int64_t xLengthIn = -1, + int64_t yLengthIn = -1); /// overloaded method to create shared pointer to workspace static DataObjects::Workspace2D_sptr @@ -94,14 +95,14 @@ public: /// sets the workspace property static void setWorkspaceProperty(const std::string &propertyName, const std::string &title, - API::WorkspaceGroup_sptr grpws_sptr, - DataObjects::Workspace2D_sptr ws_sptr, + const API::WorkspaceGroup_sptr &grpws_sptr, + const DataObjects::Workspace2D_sptr &ws_sptr, int64_t numberOfPeriods, bool bMonitor, API::Algorithm *const pAlg); /// overloaded method to set the workspace property - static void setWorkspaceProperty(DataObjects::Workspace2D_sptr ws_sptr, - API::WorkspaceGroup_sptr grpws_sptr, + static void setWorkspaceProperty(const DataObjects::Workspace2D_sptr &ws_sptr, + const API::WorkspaceGroup_sptr &grpws_sptr, const int64_t period, bool bmonitors, API::Algorithm *const pAlg); @@ -138,20 +139,20 @@ protected: getTimeChannels(const int64_t ®imes, const int64_t &lengthIn); /// loadinstrument Child Algorithm void runLoadInstrument(const std::string &fileName, - DataObjects::Workspace2D_sptr, double, double); + const DataObjects::Workspace2D_sptr &, double, double); /// loadinstrumentfromraw algorithm void runLoadInstrumentFromRaw(const std::string &fileName, - DataObjects::Workspace2D_sptr); + const DataObjects::Workspace2D_sptr &); /// loadinstrumentfromraw Child Algorithm void runLoadMappingTable(const std::string &fileName, - DataObjects::Workspace2D_sptr); + const DataObjects::Workspace2D_sptr &); /// load log algorithm - void runLoadLog(const std::string &fileName, DataObjects::Workspace2D_sptr, - double, double); + void runLoadLog(const std::string &fileName, + const DataObjects::Workspace2D_sptr &, double, double); /// Create the period specific logs void createPeriodLogs(int64_t period, - DataObjects::Workspace2D_sptr local_workspace); + const DataObjects::Workspace2D_sptr &local_workspace); /// gets the monitor spectrum list from the workspace std::vector @@ -159,7 +160,7 @@ protected: /// This method sets the raw file data to workspace vectors void setWorkspaceData( - DataObjects::Workspace2D_sptr newWorkspace, + const DataObjects::Workspace2D_sptr &newWorkspace, const std::vector> &timeChannelsVec, int64_t wsIndex, specnum_t nspecNum, int64_t noTimeRegimes, @@ -191,9 +192,10 @@ protected: specnum_t &normalwsSpecs, specnum_t &monitorwsSpecs); /// load the spectra - void loadSpectra(FILE *file, const int &period, const int &total_specs, - DataObjects::Workspace2D_sptr ws_sptr, - std::vector>); + void loadSpectra( + FILE *file, const int &period, const int &total_specs, + const DataObjects::Workspace2D_sptr &ws_sptr, + const std::vector> &); /// Has the spectrum_list property been set? bool m_list; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadSPE.h b/Framework/DataHandling/inc/MantidDataHandling/LoadSPE.h index e0988a1b984e403fab515eb95908c775ae078579..2625e5f3a2f27d94952103d84f7c2843cc1b709f 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadSPE.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadSPE.h @@ -53,7 +53,7 @@ private: // Execution code void exec() override; - void readHistogram(FILE *speFile, API::MatrixWorkspace_sptr workspace, + void readHistogram(FILE *speFile, const API::MatrixWorkspace_sptr &workspace, size_t index); void reportFormatError(const std::string &what); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadSampleShape.h b/Framework/DataHandling/inc/MantidDataHandling/LoadSampleShape.h index 3e6c44698d9f77b8848a2f7a632eae85f8d45020..c14c313e1f73e9bc1ee54e01690752e95f716ea6 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadSampleShape.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadSampleShape.h @@ -51,7 +51,7 @@ private: void exec() override; }; void DLLExport rotate(Geometry::MeshObject &sampleMesh, - API::MatrixWorkspace_const_sptr inputWS); + const API::MatrixWorkspace_const_sptr &inputWS); } // namespace DataHandling } // namespace Mantid \ No newline at end of file diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadSassena.h b/Framework/DataHandling/inc/MantidDataHandling/LoadSassena.h index a096ef48ae13878c266c8a73819811aa63410fbc..868bf2eaeec30b4ddc855ef3f1590450b15862ed 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadSassena.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadSassena.h @@ -62,26 +62,27 @@ public: protected: /// Add a workspace to the group and register in the analysis data service - void registerWorkspace(API::WorkspaceGroup_sptr gws, const std::string wsName, - DataObjects::Workspace2D_sptr ws, + void registerWorkspace(const API::WorkspaceGroup_sptr &gws, + const std::string &wsName, + const DataObjects::Workspace2D_sptr &ws, const std::string &description); /// Read info about one HDF5 dataset, log if error - herr_t dataSetInfo(const hid_t &h5file, const std::string setName, + herr_t dataSetInfo(const hid_t &h5file, const std::string &setName, hsize_t *dims) const; /// Read dataset data to a buffer ot type double - herr_t dataSetDouble(const hid_t &h5file, const std::string setName, + herr_t dataSetDouble(const hid_t &h5file, const std::string &setName, std::vector &buf); /// Load qvectors dataset, calculate modulus of vectors HistogramData::Points loadQvectors(const hid_t &h5file, - API::WorkspaceGroup_sptr gws, + const API::WorkspaceGroup_sptr &gws, std::vector &sorting_indexes); /// Load structure factor asa function of q-vector modulus - void loadFQ(const hid_t &h5file, API::WorkspaceGroup_sptr gws, - const std::string setName, const HistogramData::Points &qvmod, + void loadFQ(const hid_t &h5file, const API::WorkspaceGroup_sptr &gws, + const std::string &setName, const HistogramData::Points &qvmod, const std::vector &sorting_indexes); /// Load time-dependent structure factor - void loadFQT(const hid_t &h5file, API::WorkspaceGroup_sptr gws, - const std::string setName, const HistogramData::Points &qvmod, + void loadFQT(const hid_t &h5file, const API::WorkspaceGroup_sptr &gws, + const std::string &setName, const HistogramData::Points &qvmod, const std::vector &sorting_indexes); private: diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadSpice2D.h b/Framework/DataHandling/inc/MantidDataHandling/LoadSpice2D.h index d88b9cb7b75203a720af4bd415a0f6582d34be15..44282d49fa10f11bfe453f968b15056b3b50e5c2 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadSpice2D.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadSpice2D.h @@ -93,7 +93,7 @@ private: const std::string &fileName); /// Run LoadInstrument Child Algorithm void runLoadInstrument(const std::string &inst_name, - DataObjects::Workspace2D_sptr localWorkspace); + const DataObjects::Workspace2D_sptr &localWorkspace); void setInputPropertiesAsMemberProperties(); diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceAscii.h b/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceAscii.h index 921e9c70de08d57b806794e619461f597f9b1009..933ba795ff60126f514a5691a8b5010ba9d8c01b 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceAscii.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceAscii.h @@ -63,13 +63,13 @@ private: const std::string &timeformat); /// Set up run start time - void setupRunStartTime(API::MatrixWorkspace_sptr runinfows, + void setupRunStartTime(const API::MatrixWorkspace_sptr &runinfows, const std::vector &datetimeprop); /// Add property to workspace template - void addProperty(API::MatrixWorkspace_sptr ws, const std::string &pname, - T pvalue); + void addProperty(const API::MatrixWorkspace_sptr &ws, + const std::string &pname, T pvalue); }; } // namespace DataHandling diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceXML2DDet.h b/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceXML2DDet.h index d94532db83bbe5f5f348fe41cded5e335e24b5a9..16779c563688f8f2c7c01d6dd91b6ad32f42aff5 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceXML2DDet.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadSpiceXML2DDet.h @@ -96,22 +96,25 @@ private: /// Set up sample logs from table workspace loaded where SPICE data file is /// loaded - void setupSampleLogFromSpiceTable(API::MatrixWorkspace_sptr matrixws, - API::ITableWorkspace_sptr spicetablews, - int ptnumber); + void + setupSampleLogFromSpiceTable(const API::MatrixWorkspace_sptr &matrixws, + const API::ITableWorkspace_sptr &spicetablews, + int ptnumber); /// Set up sample logs in the output workspace - bool setupSampleLogs(API::MatrixWorkspace_sptr outws); + bool setupSampleLogs(const API::MatrixWorkspace_sptr &outws); /// Load instrument void loadInstrument(API::MatrixWorkspace_sptr matrixws, const std::string &idffilename); /// Get wavelength from workspace - bool getHB3AWavelength(API::MatrixWorkspace_sptr dataws, double &wavelength); + bool getHB3AWavelength(const API::MatrixWorkspace_sptr &dataws, + double &wavelength); /// Set output workspace's X-axs as lab-frame Q space - void setXtoLabQ(API::MatrixWorkspace_sptr dataws, const double &wavelength); + void setXtoLabQ(const API::MatrixWorkspace_sptr &dataws, + const double &wavelength); /// SPICE detector XML file std::string m_detXMLFileName; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h b/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h index 49241fa4bb8cd7f27626df2844e6d6370aa56a54..70f438c3e3f1dea953944c28d549a71232615ca4 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h @@ -14,6 +14,10 @@ #include #include #include +#include + +#include + namespace { Mantid::Kernel::Logger g_logstl("LoadStl"); } @@ -45,11 +49,12 @@ struct V3DTrueComparator { class DLLExport LoadStl : public MeshFileIO { public: LoadStl(std::string filename, ScaleUnits scaleType) - : MeshFileIO(scaleType), m_filename(filename), m_setMaterial(false) {} + : MeshFileIO(scaleType), m_filename(std::move(std::move(filename))), + m_setMaterial(false) {} LoadStl(std::string filename, ScaleUnits scaleType, ReadMaterial::MaterialParameters params) - : MeshFileIO(scaleType), m_filename(filename), m_setMaterial(true), - m_params(params) {} + : MeshFileIO(scaleType), m_filename(std::move(std::move(filename))), + m_setMaterial(true), m_params(std::move(std::move(params))) {} virtual std::unique_ptr readStl() = 0; virtual ~LoadStl() = default; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadStlFactory.h b/Framework/DataHandling/inc/MantidDataHandling/LoadStlFactory.h index 07d00e4119f4b49ccf81dba90c03d72533eaea0a..5fa31d720d3dcbb732459b9554e0a53947eebd95 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadStlFactory.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadStlFactory.h @@ -15,7 +15,7 @@ namespace DataHandling { class MANTID_DATAHANDLING_DLL LoadStlFactory { public: - static std::unique_ptr createReader(std::string filename, + static std::unique_ptr createReader(const std::string &filename, ScaleUnits scaleType) { std::unique_ptr reader = nullptr; if (LoadBinaryStl::isBinarySTL(filename)) { diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadTBL.h b/Framework/DataHandling/inc/MantidDataHandling/LoadTBL.h index f0735d097a4b17e2f3420d4a3800e4703a54430f..b0b805b2b947dbca71aeb88e49ac3779d1fd06d0 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadTBL.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadTBL.h @@ -52,13 +52,13 @@ private: size_t getCells(std::string line, std::vector &cols, size_t expectedCommas, bool isOldTBL) const; /// count the number of commas in the line - size_t countCommas(std::string line) const; + size_t countCommas(const std::string &line) const; /// find all pairs of quotes in the line - size_t findQuotePairs(std::string line, + size_t findQuotePairs(const std::string &line, std::vector> "eBounds) const; /// Parse more complex CSV, used when the data involves commas in the data and /// quoted values - void csvParse(std::string line, std::vector &cols, + void csvParse(const std::string &line, std::vector &cols, std::vector> "eBounds, size_t expectedCommas) const; }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadTOFRawNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadTOFRawNexus.h index e2275e1142d8692c3c84175dbf88699d0bdf6d82..2bced73be98aa817733b6259fb46fee170cabd58 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadTOFRawNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadTOFRawNexus.h @@ -79,7 +79,8 @@ protected: Mantid::NeXus::NXEntry &entry); void loadBank(const std::string &nexusfilename, const std::string &entry_name, - const std::string &bankName, API::MatrixWorkspace_sptr WS, + const std::string &bankName, + const API::MatrixWorkspace_sptr &WS, const detid2index_map &id_to_wi); /// List of the absolute time of each pulse diff --git a/Framework/DataHandling/inc/MantidDataHandling/MaskDetectors.h b/Framework/DataHandling/inc/MantidDataHandling/MaskDetectors.h index 348d60b27da180164b5fede1104ac1fe6e76811c..bed7624a812692c2b1450e279b5ee90863542302 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/MaskDetectors.h +++ b/Framework/DataHandling/inc/MantidDataHandling/MaskDetectors.h @@ -78,41 +78,42 @@ private: /// Choose how to mask given that we have a mask workspace void - handleMaskByMaskWorkspace(const DataObjects::MaskWorkspace_const_sptr maskWs, - const API::MatrixWorkspace_const_sptr WS, + handleMaskByMaskWorkspace(const DataObjects::MaskWorkspace_const_sptr &maskWs, + const API::MatrixWorkspace_const_sptr &WS, std::vector &detectorList, std::vector &indexList, const RangeInfo &rangeInfo); /// Choose how to mask given that we have a matrix workspace - void handleMaskByMatrixWorkspace(const API::MatrixWorkspace_const_sptr maskWs, - const API::MatrixWorkspace_const_sptr WS, - std::vector &detectorList, - std::vector &indexList, - const RangeInfo &rangeInfo); + void + handleMaskByMatrixWorkspace(const API::MatrixWorkspace_const_sptr &maskWs, + const API::MatrixWorkspace_const_sptr &WS, + std::vector &detectorList, + std::vector &indexList, + const RangeInfo &rangeInfo); - void execPeaks(DataObjects::PeaksWorkspace_sptr WS); + void execPeaks(const DataObjects::PeaksWorkspace_sptr &WS); void fillIndexListFromSpectra(std::vector &indexList, std::vector spectraList, - const API::MatrixWorkspace_sptr WS, + const API::MatrixWorkspace_sptr &WS, const RangeInfo &range_info); void appendToDetectorListFromComponentList( std::vector &detectorList, const std::vector &componentList, - const API::MatrixWorkspace_const_sptr WS); - void - appendToIndexListFromWS(std::vector &indexList, - const API::MatrixWorkspace_const_sptr maskedWorkspace, - const RangeInfo &range_info); + const API::MatrixWorkspace_const_sptr &WS); + void appendToIndexListFromWS( + std::vector &indexList, + const API::MatrixWorkspace_const_sptr &maskedWorkspace, + const RangeInfo &range_info); void appendToDetectorListFromWS( std::vector &detectorList, - const API::MatrixWorkspace_const_sptr inputWs, - const API::MatrixWorkspace_const_sptr maskWs, + const API::MatrixWorkspace_const_sptr &inputWs, + const API::MatrixWorkspace_const_sptr &maskWs, const std::tuple &range_info); void appendToIndexListFromMaskWS( std::vector &indexList, - const DataObjects::MaskWorkspace_const_sptr maskedWorkspace, + const DataObjects::MaskWorkspace_const_sptr &maskedWorkspace, const std::tuple &range_info); void extractMaskedWSDetIDs(std::vector &detectorList, diff --git a/Framework/DataHandling/inc/MantidDataHandling/MaskDetectorsInShape.h b/Framework/DataHandling/inc/MantidDataHandling/MaskDetectorsInShape.h index 3cfa902ea957396d54e65ac5a5c55302501313d0..470d7a07065bac5024d3115dabde625150032913 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/MaskDetectorsInShape.h +++ b/Framework/DataHandling/inc/MantidDataHandling/MaskDetectorsInShape.h @@ -58,11 +58,12 @@ private: void exec() override; // internal functions - std::vector runFindDetectorsInShape(API::MatrixWorkspace_sptr workspace, - const std::string shapeXML, - const bool includeMonitors); + std::vector + runFindDetectorsInShape(const API::MatrixWorkspace_sptr &workspace, + const std::string &shapeXML, + const bool includeMonitors); /// Calls MaskDetectors as a Child Algorithm - void runMaskDetectors(API::MatrixWorkspace_sptr workspace, + void runMaskDetectors(const API::MatrixWorkspace_sptr &workspace, const std::vector &detectorIds); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/MeshFileIO.h b/Framework/DataHandling/inc/MantidDataHandling/MeshFileIO.h index cfaecf881b60414ed185bb25bcba592a0a795fab..836cbfa262b5f165b998d815893bc4b6cd596e03 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/MeshFileIO.h +++ b/Framework/DataHandling/inc/MantidDataHandling/MeshFileIO.h @@ -4,6 +4,10 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + +#include + +#include + #include "MantidGeometry/Objects/MeshObject.h" #include "MantidKernel/Logger.h" #include "MantidKernel/Matrix.h" @@ -32,7 +36,7 @@ public: boost::shared_ptr translate(boost::shared_ptr environmentMesh, - const std::vector translationVector); + const std::vector &translationVector); Kernel::V3D createScaledV3D(double xVal, double yVal, double zVal); @@ -40,7 +44,8 @@ protected: MeshFileIO(ScaleUnits scaleType) : m_scaleType(scaleType) {} MeshFileIO(ScaleUnits scaleType, std::vector triangles, std::vector vertices) - : m_scaleType(scaleType), m_triangle(triangles), m_vertices(vertices) {} + : m_scaleType(scaleType), m_triangle(std::move(std::move(triangles))), + m_vertices(std::move(std::move(vertices))) {} double scaleValue(double val) { switch (m_scaleType) { case ScaleUnits::centimetres: diff --git a/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h b/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h index 269124451da6e5d60d1e3f70c9ab15b44103399c..0a56541102e2d0c9cf0912ec3e2820b1524aec08 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h +++ b/Framework/DataHandling/inc/MantidDataHandling/PDLoadCharacterizations.h @@ -32,7 +32,7 @@ private: void init() override; void exec() override; std::vector getFilenames(); - int readFocusInfo(std::ifstream &file, const std::string filename); + int readFocusInfo(std::ifstream &file, const std::string &filename); void readCharInfo(std::ifstream &file, API::ITableWorkspace_sptr &wksp, const std::string &filename, int linenum); void readVersion0(const std::string &filename, diff --git a/Framework/DataHandling/inc/MantidDataHandling/ReadMaterial.h b/Framework/DataHandling/inc/MantidDataHandling/ReadMaterial.h index 8333dba7bdaaba21336e122b020442c7c4cd2d30..5b9e50cf67c841f6f145b4e341906287fb627bd5 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/ReadMaterial.h +++ b/Framework/DataHandling/inc/MantidDataHandling/ReadMaterial.h @@ -88,7 +88,7 @@ private: */ Kernel::MaterialBuilder builder; - void setMaterial(const std::string chemicalSymbol, const int atomicNumber, + void setMaterial(const std::string &chemicalSymbol, const int atomicNumber, const int massNumber); void diff --git a/Framework/DataHandling/inc/MantidDataHandling/SampleEnvironmentSpecParser.h b/Framework/DataHandling/inc/MantidDataHandling/SampleEnvironmentSpecParser.h index c33a6590a50ccd2992d05fa3681b648fa7e1d506..78c8749ad34f366c0b06e7c4004a57b271b7595b 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SampleEnvironmentSpecParser.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SampleEnvironmentSpecParser.h @@ -55,10 +55,10 @@ private: boost::shared_ptr loadMeshFromSTL(Poco::XML::Element *stlfile) const; void LoadOptionalDoubleFromXML(Poco::XML::Element *componentElement, - std::string elementName, + const std::string &elementName, double &targetVariable) const; std::vector - parseTranslationVector(std::string translationVectorStr) const; + parseTranslationVector(const std::string &translationVectorStr) const; // Members MaterialsIndex m_materials; std::string m_filepath; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveAscii2.h b/Framework/DataHandling/inc/MantidDataHandling/SaveAscii2.h index 42390a7540bfcb0fd61674df709e044400b4195c..f8200d93c8dd6ff7825c0b7b4a031b8b5a63c218 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveAscii2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveAscii2.h @@ -71,7 +71,7 @@ private: void init() override; /// Overwrites Algorithm method void exec() override; - void writeTableWorkspace(API::ITableWorkspace_const_sptr tws, + void writeTableWorkspace(const API::ITableWorkspace_const_sptr &tws, const std::string &filename, bool appendToFile, bool writeHeader, int prec, bool scientific, const std::string &comment); diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveCSV.h b/Framework/DataHandling/inc/MantidDataHandling/SaveCSV.h index d5cc8447598607ebd7a5f3775130bf5ff87f87e7..90f55bf118cd0c9d65a482245ca45288594bb8cd 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveCSV.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveCSV.h @@ -93,7 +93,7 @@ private: /// Saves out x errors void saveXerrors(std::ofstream &stream, - const Mantid::DataObjects::Workspace2D_sptr workspace, + const Mantid::DataObjects::Workspace2D_sptr &workspace, const size_t numberOfHist); /// The name of the file used for storing the workspace diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveCalFile.h b/Framework/DataHandling/inc/MantidDataHandling/SaveCalFile.h index 00a1032d55f1b05b373e55b4cec183a5147d0914..4517ae2f2110875514cc96bc4156c7321acda561 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveCalFile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveCalFile.h @@ -46,9 +46,9 @@ public: } void saveCalFile(const std::string &calFileName, - Mantid::DataObjects::GroupingWorkspace_sptr groupWS, - Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS, - Mantid::DataObjects::MaskWorkspace_sptr maskWS); + const Mantid::DataObjects::GroupingWorkspace_sptr &groupWS, + const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS, + const Mantid::DataObjects::MaskWorkspace_sptr &maskWS); private: /// Initialise the properties diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveDetectorsGrouping.h b/Framework/DataHandling/inc/MantidDataHandling/SaveDetectorsGrouping.h index fc19656f86a96c247cb9fc298a3e9d8d350d7e89..c074c823132132df31cad6ab4b0f6f90fae5237c 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveDetectorsGrouping.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveDetectorsGrouping.h @@ -53,8 +53,8 @@ private: std::map> &groupdetidrangemap); /// Print Grouping to XML file - void printToXML(std::map> groupdetidrangemap, - std::string xmlfilename); + void printToXML(const std::map> &groupdetidrangemap, + const std::string &xmlfilename); // GroupingWorkspace DataObjects::GroupingWorkspace_const_sptr mGroupWS; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveDiffCal.h b/Framework/DataHandling/inc/MantidDataHandling/SaveDiffCal.h index 89bdadbcf618ab3bf33535e7168cacccb74d6153..31208c7163e9e419bf0a499bc6759d1b05b6d1c1 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveDiffCal.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveDiffCal.h @@ -37,8 +37,9 @@ private: void writeDoubleFieldFromTable(H5::Group &group, const std::string &name); void writeIntFieldFromTable(H5::Group &group, const std::string &name); - void writeIntFieldFromSVWS(H5::Group &group, const std::string &name, - DataObjects::SpecialWorkspace2D_const_sptr ws); + void + writeIntFieldFromSVWS(H5::Group &group, const std::string &name, + const DataObjects::SpecialWorkspace2D_const_sptr &ws); void generateDetidToIndex(); bool tableHasColumn(const std::string &ColumnName) const; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveDiffFittingAscii.h b/Framework/DataHandling/inc/MantidDataHandling/SaveDiffFittingAscii.h index ed595087a6c93394be00c5b86d401869b8133545..3c21f96289b1ec337303fc1b647c54dbfc5786e6 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveDiffFittingAscii.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveDiffFittingAscii.h @@ -57,7 +57,7 @@ private: std::map validateInputs() override; /// Main exec routine, called for group or individual workspace processing. - void processAll(const std::vector input_ws); + void processAll(const std::vector &input_ws); std::vector splitList(std::string strList); @@ -67,8 +67,8 @@ private: void writeHeader(const std::vector &columnHeadings, std::ofstream &file); - void writeData(const API::ITableWorkspace_sptr workspace, std::ofstream &file, - const size_t columnSize); + void writeData(const API::ITableWorkspace_sptr &workspace, + std::ofstream &file, const size_t columnSize); void writeVal(const std::string &val, std::ofstream &file, const bool endline); diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveDspacemap.h b/Framework/DataHandling/inc/MantidDataHandling/SaveDspacemap.h index 8a8bffd0901741cc6e348c397dc56772b6ae30f7..37581742e89b42152724fe74d9c98fff69f98b3e 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveDspacemap.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveDspacemap.h @@ -39,9 +39,9 @@ private: /// Run the algorithm void exec() override; - void - CalculateDspaceFromCal(Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS, - std::string DFileName); + void CalculateDspaceFromCal( + const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS, + const std::string &DFileName); }; } // namespace DataHandling diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveFITS.h b/Framework/DataHandling/inc/MantidDataHandling/SaveFITS.h index 9542b929f17b50ee990dd21e951e90c4553bddf0..9c4afe889aa51f62ada4f52cc0566480b75a3860 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveFITS.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveFITS.h @@ -36,20 +36,20 @@ private: std::map validateInputs() override; - void saveFITSImage(const API::MatrixWorkspace_sptr img, + void saveFITSImage(const API::MatrixWorkspace_sptr &img, const std::string &filename); - void writeFITSHeaderBlock(const API::MatrixWorkspace_sptr img, + void writeFITSHeaderBlock(const API::MatrixWorkspace_sptr &img, std::ofstream &file); - void writeFITSImageMatrix(const API::MatrixWorkspace_sptr img, + void writeFITSImageMatrix(const API::MatrixWorkspace_sptr &img, std::ofstream &file); void writeFITSHeaderEntry(const std::string &hdr, std::ofstream &file); std::string makeBitDepthHeader(size_t depth) const; - void writeFITSHeaderAxesSizes(const API::MatrixWorkspace_sptr img, + void writeFITSHeaderAxesSizes(const API::MatrixWorkspace_sptr &img, std::ofstream &file); void writePaddingFITSHeaders(size_t count, std::ofstream &file); diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveFullprofResolution.h b/Framework/DataHandling/inc/MantidDataHandling/SaveFullprofResolution.h index 5dd4317b12db6decdf26f19a0fc493ba8e22662c..2ce04b6bce0901256770d5a44200a1d6385aeb9d 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveFullprofResolution.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveFullprofResolution.h @@ -57,7 +57,7 @@ private: void parseTableWorkspace(); /// Check wether a profile parameter map has the parameter - bool has_key(std::map profmap, std::string key); + bool has_key(std::map profmap, const std::string &key); /// Map containing the name of value of each parameter required by .irf file std::map m_profileParamMap; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveGSASInstrumentFile.h b/Framework/DataHandling/inc/MantidDataHandling/SaveGSASInstrumentFile.h index 0ac855d14a38f79832e15ecef497c1876a518cd1..a0024f2f5b488a04c6ca1c29173206c24250c426 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveGSASInstrumentFile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveGSASInstrumentFile.h @@ -66,7 +66,7 @@ private: /// Parse profile table workspace to a map void parseProfileTableWorkspace( - API::ITableWorkspace_sptr ws, + const API::ITableWorkspace_sptr &ws, std::map> &profilemap); /// Convert to GSAS instrument file @@ -113,7 +113,7 @@ private: const std::string ¶mname); /// Load fullprof resolution file. - void loadFullprofResolutionFile(std::string irffilename); + void loadFullprofResolutionFile(const std::string &irffilename); /// Calcualte d-space value. double calDspRange(double dtt1, double zero, double tof); diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveIsawDetCal.h b/Framework/DataHandling/inc/MantidDataHandling/SaveIsawDetCal.h index e3a928646e4c779fd26df3e789de7d2f4a5b402b..2589c5a0b3971398f99f09cdf63f9fce0f6e9044 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveIsawDetCal.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveIsawDetCal.h @@ -46,9 +46,9 @@ private: /// Run the algorithm void exec() override; /// find position for rectangular and non-rectangular - Kernel::V3D findPixelPos(std::string bankName, int col, int row); - void sizeBanks(std::string bankName, int &NCOLS, int &NROWS, double &xsize, - double &ysize); + Kernel::V3D findPixelPos(const std::string &bankName, int col, int row); + void sizeBanks(const std::string &bankName, int &NCOLS, int &NROWS, + double &xsize, double &ysize); Geometry::Instrument_const_sptr inst; }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveNXTomo.h b/Framework/DataHandling/inc/MantidDataHandling/SaveNXTomo.h index 8bef56681d2a08de8f7beda2377cebd929aed092..7a681a780a2138c96418980a8fa2952f7d9471f8 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveNXTomo.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveNXTomo.h @@ -87,16 +87,16 @@ private: ::NeXus::File setupFile(); /// Writes a single workspace into the file - void writeSingleWorkspace(const DataObjects::Workspace2D_sptr workspace, + void writeSingleWorkspace(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile); /// Write various pieces of data from the workspace log with checks on the /// structure of the nexus file - void writeLogValues(const DataObjects::Workspace2D_sptr workspace, + void writeLogValues(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile, int thisFileInd); - void writeIntensityValue(const DataObjects::Workspace2D_sptr workspace, + void writeIntensityValue(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile, int thisFileInd); - void writeImageKeyValue(const DataObjects::Workspace2D_sptr workspace, + void writeImageKeyValue(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile, int thisFileInd); /// Main exec routine, called for group or individual workspace processing. diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h b/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h index 9f918dd374be63f0115a72deaa175d7bffc5d79a..89c4f0f0f537281717fd740805302f391213bf03 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h @@ -74,8 +74,9 @@ protected: void exec() override; private: - void getWSIndexList(std::vector &indices, - Mantid::API::MatrixWorkspace_const_sptr matrixWorkspace); + void getWSIndexList( + std::vector &indices, + const Mantid::API::MatrixWorkspace_const_sptr &matrixWorkspace); template static void appendEventListData(const std::vector &events, size_t offset, @@ -88,7 +89,7 @@ private: void setOtherProperties(IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue, int perioidNum) override; - void doExec(Mantid::API::Workspace_sptr inputWorkspace, + void doExec(const Mantid::API::Workspace_sptr &inputWorkspace, boost::shared_ptr &nexusFile, const bool keepFile = false, boost::optional entryNumber = boost::optional()); diff --git a/Framework/DataHandling/inc/MantidDataHandling/SavePDFGui.h b/Framework/DataHandling/inc/MantidDataHandling/SavePDFGui.h index 8450d6896e798286e7b49855f60f4ad61ec066db..8c95297a31f7e4eb6ee34fef995387927cb75f83 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SavePDFGui.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SavePDFGui.h @@ -36,8 +36,9 @@ private: void init() override; void exec() override; void writeMetaData(std::ofstream &out, - API::MatrixWorkspace_const_sptr inputWS); - void writeWSData(std::ofstream &out, API::MatrixWorkspace_const_sptr inputWS); + const API::MatrixWorkspace_const_sptr &inputWS); + void writeWSData(std::ofstream &out, + const API::MatrixWorkspace_const_sptr &inputWS); }; } // namespace DataHandling diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveRMCProfile.h b/Framework/DataHandling/inc/MantidDataHandling/SaveRMCProfile.h index eeb3cb7e7218dc58c63cc32167c6b541e77cea80..c8c67ab28d4d6f8b48a9e08c2330854e5e0b39da 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveRMCProfile.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveRMCProfile.h @@ -36,8 +36,9 @@ private: void init() override; void exec() override; void writeMetaData(std::ofstream &out, - API::MatrixWorkspace_const_sptr inputWS); - void writeWSData(std::ofstream &out, API::MatrixWorkspace_const_sptr inputWS); + const API::MatrixWorkspace_const_sptr &inputWS); + void writeWSData(std::ofstream &out, + const API::MatrixWorkspace_const_sptr &inputWS); }; } // namespace DataHandling diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveReflectometryAscii.h b/Framework/DataHandling/inc/MantidDataHandling/SaveReflectometryAscii.h index 3bc16d6fc8034312767f5cde4e66cae11187c0bd..f809ddceca51b9438212b2f84ae448c6d4d5df70 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveReflectometryAscii.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveReflectometryAscii.h @@ -49,22 +49,22 @@ private: /// Algorithm execution for WorkspaceGroups bool processGroups() override; /// Check file validity - void checkFile(const std::string filename); + void checkFile(const std::string &filename); /// Write the data void data(); /// Print a double value to file void outputval(double val); /// Write a string value - bool writeString(bool write, std::string s); + bool writeString(bool write, const std::string &s); /// Print a string value to file - void outputval(std::string val); + void outputval(const std::string &val); /// Retrieve sample log value std::string sampleLogValue(const std::string &logName); /// Retrieve sample log unit std::string sampleLogUnit(const std::string &logName); /// Write one header line - void writeInfo(const std::string logName, - const std::string logNameFixed = ""); + void writeInfo(const std::string &logName, + const std::string &logNameFixed = ""); /// Write header void header(); /// Determine the separator diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h b/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h index 52ff3ccbfa93054f69619816b3851ec3041d7cc2..e755e6695aa0169d528674bcb44822fb2a620fcd 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveSPE.h @@ -82,9 +82,9 @@ private: void writeSPEFile(FILE *outSPEFile, const API::MatrixWorkspace_const_sptr &inputWS); - void writeHists(const API::MatrixWorkspace_const_sptr WS, + void writeHists(const API::MatrixWorkspace_const_sptr &WS, FILE *const outFile); - void writeHist(const API::MatrixWorkspace_const_sptr WS, FILE *const outFile, + void writeHist(const API::MatrixWorkspace_const_sptr &WS, FILE *const outFile, const int wsIn) const; void writeMaskFlags(FILE *const outFile) const; void writeBins(const std::vector &Vs, FILE *const outFile) const; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveStl.h b/Framework/DataHandling/inc/MantidDataHandling/SaveStl.h index bfcfd68fe13c406130e0c2c96aa898d13a0fe39d..5ef1d1bac0110cc3801a65aff138e5374fdf2d4a 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveStl.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveStl.h @@ -6,6 +6,10 @@ // SPDX - License - Identifier: GPL - 3.0 + #pragma once +#include + +#include + #include "MantidDataHandling/MeshFileIO.h" #include "MantidKernel/BinaryStreamWriter.h" #include "MantidKernel/Logger.h" @@ -25,9 +29,10 @@ enum class ScaleUnits; */ class DLLExport SaveStl : public MeshFileIO { public: - SaveStl(const std::string &filename, const std::vector triangle, + SaveStl(const std::string &filename, const std::vector &triangle, std::vector vertices, ScaleUnits scaleType) - : MeshFileIO(scaleType, triangle, vertices), m_filename(filename) {} + : MeshFileIO(scaleType, triangle, std::move(std::move(vertices))), + m_filename(filename) {} void writeStl(); diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveTBL.h b/Framework/DataHandling/inc/MantidDataHandling/SaveTBL.h index dd647e3b3ac44efb80009848c8ebe19c3893301d..8e47983f277944003fedfabdbe693790772bd82f 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveTBL.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveTBL.h @@ -53,7 +53,7 @@ private: /// the separator const char m_sep; // populates the map and vector containing grouping information - void findGroups(API::ITableWorkspace_sptr ws); + void findGroups(const API::ITableWorkspace_sptr &ws); /// Map the separator options to their string equivalents std::map> m_stichgroups; std::vector m_nogroup; diff --git a/Framework/DataHandling/inc/MantidDataHandling/SaveToSNSHistogramNexus.h b/Framework/DataHandling/inc/MantidDataHandling/SaveToSNSHistogramNexus.h index 95eac01ee17e7a692cfbbb5639a6ec61aac535bd..4d581a2352b5ce644c545fa88743735050e60d42 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SaveToSNSHistogramNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SaveToSNSHistogramNexus.h @@ -95,12 +95,13 @@ private: int copy_file(const char *inFile, int nx_read_access, const char *outFile, int nx_write_access); - int WriteOutDataOrErrors(Geometry::RectangularDetector_const_sptr det, + int WriteOutDataOrErrors(const Geometry::RectangularDetector_const_sptr &det, int x_pixel_slab, const char *field_name, const char *errors_field_name, bool doErrors, - bool doBoth, int is_definition, std::string bank); + bool doBoth, int is_definition, + const std::string &bank); - int WriteDataGroup(std::string bank, int is_definition); + int WriteDataGroup(const std::string &bank, int is_definition); // // // For iterating through the HDF file... diff --git a/Framework/DataHandling/inc/MantidDataHandling/SetScalingPSD.h b/Framework/DataHandling/inc/MantidDataHandling/SetScalingPSD.h index d177bea3bfe1e32d625a10db9a15953a3c144664..55c7170d7b40f49e606b805779ef2276851848b6 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/SetScalingPSD.h +++ b/Framework/DataHandling/inc/MantidDataHandling/SetScalingPSD.h @@ -86,7 +86,8 @@ private: std::map &posMap, std::map &scaleMap); /// read the positions of detectors defined in the raw file - void getDetPositionsFromRaw(std::string rawfile, std::vector &detID, + void getDetPositionsFromRaw(const std::string &rawfile, + std::vector &detID, std::vector &pos); }; diff --git a/Framework/DataHandling/inc/MantidDataHandling/XmlHandler.h b/Framework/DataHandling/inc/MantidDataHandling/XmlHandler.h index b40b4c2f7dceb2d217262423f89bc809e565d9a7..3042711456f481c32cba6d5c76def87301d18567 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/XmlHandler.h +++ b/Framework/DataHandling/inc/MantidDataHandling/XmlHandler.h @@ -21,7 +21,7 @@ namespace DataHandling { class MANTID_DATAHANDLING_DLL XmlHandler { public: XmlHandler() = default; - XmlHandler(std::string); + XmlHandler(const std::string &); std::map get_metadata(const std::vector &tags_to_ignore); diff --git a/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp b/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp index 9a5ac5075e1915679a34020f3a12e06a04a791e7..762cf3c6eccd687c8b0ee502ff1aa617a5b1e2b5 100644 --- a/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp +++ b/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp @@ -360,8 +360,8 @@ AppendGeometryToSNSNexus::getInstrumentName(const std::string &nxfilename) { */ bool AppendGeometryToSNSNexus::runLoadInstrument( - const std::string &idf_filename, API::MatrixWorkspace_sptr localWorkspace, - Algorithm *alg) { + const std::string &idf_filename, + const API::MatrixWorkspace_sptr &localWorkspace, Algorithm *alg) { IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument", 0, 1, true); // Execute the Child Algorithm. @@ -399,8 +399,8 @@ bool AppendGeometryToSNSNexus::runLoadInstrument( * @return true if successful. */ bool AppendGeometryToSNSNexus::runLoadNexusLogs( - const std::string &nexusFileName, API::MatrixWorkspace_sptr localWorkspace, - Algorithm *alg) { + const std::string &nexusFileName, + const API::MatrixWorkspace_sptr &localWorkspace, Algorithm *alg) { IAlgorithm_sptr loadLogs = alg->createChildAlgorithm("LoadNexusLogs", 0, 1, true); diff --git a/Framework/DataHandling/src/BankPulseTimes.cpp b/Framework/DataHandling/src/BankPulseTimes.cpp index 0340ff8d403cb5a8e7313529ea6157103f60a8d4..02e4ed4436baa0e6d38140e73dfaa9c127f8c7bd 100644 --- a/Framework/DataHandling/src/BankPulseTimes.cpp +++ b/Framework/DataHandling/src/BankPulseTimes.cpp @@ -98,7 +98,8 @@ BankPulseTimes::~BankPulseTimes() { delete[] this->pulseTimes; } * @return true if the pulse times are the same and so don't need to be * reloaded. */ -bool BankPulseTimes::equals(size_t otherNumPulse, std::string otherStartTime) { +bool BankPulseTimes::equals(size_t otherNumPulse, + const std::string &otherStartTime) { return ((this->startTime == otherStartTime) && (this->numPulses == otherNumPulse)); } diff --git a/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp b/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp index 95001bd039db4ad76fc1745c82a4c294e446778c..aa449170b9d58550882ee1aa65f64eff387cda65 100644 --- a/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp +++ b/Framework/DataHandling/src/CreateChunkingFromInstrument.cpp @@ -216,7 +216,7 @@ bool startsWith(const string &str, const string &prefix) { * @return The correct parent name. This is an empty string if the name * isn't found. */ -string parentName(IComponent_const_sptr comp, const string &prefix) { +string parentName(const IComponent_const_sptr &comp, const string &prefix) { // handle the special case of the component has the name if (startsWith(comp->getName(), prefix)) return comp->getName(); @@ -242,7 +242,8 @@ string parentName(IComponent_const_sptr comp, const string &prefix) { * @return The correct parent name. This is an empty string if the name * isn't found. */ -string parentName(IComponent_const_sptr comp, const vector &names) { +string parentName(const IComponent_const_sptr &comp, + const vector &names) { // handle the special case of the component has the name for (const auto &name : names) if (name == comp->getName()) diff --git a/Framework/DataHandling/src/CreateSimulationWorkspace.cpp b/Framework/DataHandling/src/CreateSimulationWorkspace.cpp index d22473db9395b00b85b2addb7c41bf7e71eddc52..e0866c6462a1c5280972e50dc2e1c1519b170d18 100644 --- a/Framework/DataHandling/src/CreateSimulationWorkspace.cpp +++ b/Framework/DataHandling/src/CreateSimulationWorkspace.cpp @@ -38,7 +38,7 @@ struct StartAndEndTime { Mantid::Types::Core::DateAndTime endTime; }; -StartAndEndTime getStartAndEndTimesFromRawFile(std::string filename) { +StartAndEndTime getStartAndEndTimesFromRawFile(const std::string &filename) { FILE *rawFile = fopen(filename.c_str(), "rb"); if (!rawFile) throw std::runtime_error("Cannot open RAW file for reading: " + filename); @@ -58,7 +58,7 @@ StartAndEndTime getStartAndEndTimesFromRawFile(std::string filename) { } StartAndEndTime getStartAndEndTimesFromNexusFile( - std::string filename, + const std::string &filename, const Mantid::Types::Core::DateAndTime &startTimeDefault, const Mantid::Types::Core::DateAndTime &endTimeDefault) { StartAndEndTime startAndEndTime; @@ -411,7 +411,7 @@ void CreateSimulationWorkspace::adjustInstrument(const std::string &filename) { * @param workspace: dummy workspace */ void CreateSimulationWorkspace::setStartDate( - API::MatrixWorkspace_sptr workspace) { + const API::MatrixWorkspace_sptr &workspace) { const std::string detTableFile = getProperty("DetectorTableFilename"); auto hasDetTableFile = !detTableFile.empty(); auto &run = workspace->mutableRun(); diff --git a/Framework/DataHandling/src/DataBlockComposite.cpp b/Framework/DataHandling/src/DataBlockComposite.cpp index e8c7da11196dccb52cf75289704d75eae18f71d7..fe4c1e8bb4e21cc02a1bf6024bdba2ac89230569 100644 --- a/Framework/DataHandling/src/DataBlockComposite.cpp +++ b/Framework/DataHandling/src/DataBlockComposite.cpp @@ -256,7 +256,7 @@ std::unique_ptr DataBlockComposite::getGenerator() const { return std::make_unique(intervals); } -void DataBlockComposite::addDataBlock(DataBlock dataBlock) { +void DataBlockComposite::addDataBlock(const DataBlock &dataBlock) { // Set the number of periods, number of spectra and number of channel m_numberOfPeriods = dataBlock.getNumberOfPeriods(); m_numberOfChannels = dataBlock.getNumberOfChannels(); diff --git a/Framework/DataHandling/src/DetermineChunking.cpp b/Framework/DataHandling/src/DetermineChunking.cpp index bb1455036aa919f8f09287f9ab880e8ad536cc5e..fe074a28eee6d1a81f006fb22cd4b681e4691486 100644 --- a/Framework/DataHandling/src/DetermineChunking.cpp +++ b/Framework/DataHandling/src/DetermineChunking.cpp @@ -292,7 +292,7 @@ void DetermineChunking::exec() { } /// set the name of the top level NXentry m_top_entry_name -std::string DetermineChunking::setTopEntryName(std::string filename) { +std::string DetermineChunking::setTopEntryName(const std::string &filename) { std::string top_entry_name; using string_map_t = std::map; try { diff --git a/Framework/DataHandling/src/EventWorkspaceCollection.cpp b/Framework/DataHandling/src/EventWorkspaceCollection.cpp index 860edfe1f730e8276774d32f7d852c8a442dc25a..459a890bd5be949b4bd29d62fd9c19dfbcb6085b 100644 --- a/Framework/DataHandling/src/EventWorkspaceCollection.cpp +++ b/Framework/DataHandling/src/EventWorkspaceCollection.cpp @@ -162,7 +162,7 @@ EventWorkspaceCollection::getSpectrum(const size_t index) const { return m_WsVec[0]->getSpectrum(index); } void EventWorkspaceCollection::setSpectrumNumbersFromUniqueSpectra( - const std::set uniqueSpectra) { + const std::set &uniqueSpectra) { // For each workspace, update all the spectrum numbers for (auto &ws : m_WsVec) { size_t counter = 0; @@ -279,14 +279,14 @@ void EventWorkspaceCollection::setWidth(const float flag) { } } -void EventWorkspaceCollection::setTitle(std::string title) { +void EventWorkspaceCollection::setTitle(const std::string &title) { for (auto &ws : m_WsVec) { ws->setTitle(title); } } void EventWorkspaceCollection::applyFilter( - boost::function func) { + const boost::function &func) { for (auto &ws : m_WsVec) { func(ws); } diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index 1ace0758f27de18ab26765cb1ab00903b2df1771..813d39664b66513c2351d7355750427783efd7ce 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -671,8 +671,8 @@ void FilterEventsByLogValuePreNexus::processEventLogs() { * @param logtitle :: title of the log to be inserted to workspace * @param mindex :: index of the the series in the wrong detectors map */ -void FilterEventsByLogValuePreNexus::addToWorkspaceLog(std::string logtitle, - size_t mindex) { +void FilterEventsByLogValuePreNexus::addToWorkspaceLog( + const std::string &logtitle, size_t mindex) { // Create TimeSeriesProperty auto property = new TimeSeriesProperty(logtitle); @@ -770,7 +770,8 @@ void FilterEventsByLogValuePreNexus::doStatToEventLog(size_t mindex) { * geometry */ void FilterEventsByLogValuePreNexus::runLoadInstrument( - const std::string &eventfilename, MatrixWorkspace_sptr localWorkspace) { + const std::string &eventfilename, + const MatrixWorkspace_sptr &localWorkspace) { // start by getting just the filename string instrument = Poco::Path(eventfilename).getFileName(); @@ -2118,7 +2119,7 @@ void FilterEventsByLogValuePreNexus::filterEventsLinear( * We want to pad out empty pixels: monitor */ size_t FilterEventsByLogValuePreNexus::padOutEmptyPixels( - DataObjects::EventWorkspace_sptr eventws) { + const DataObjects::EventWorkspace_sptr &eventws) { const auto &detectorInfo = eventws->detectorInfo(); const auto &detIDs = detectorInfo.detectorIDs(); @@ -2158,7 +2159,7 @@ size_t FilterEventsByLogValuePreNexus::padOutEmptyPixels( * pixel-spectrum map */ void FilterEventsByLogValuePreNexus::setupPixelSpectrumMap( - DataObjects::EventWorkspace_sptr eventws) { + const DataObjects::EventWorkspace_sptr &eventws) { const auto &detectorInfo = eventws->detectorInfo(); const auto &detIDs = detectorInfo.detectorIDs(); diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 366ab1ef5fe2acec75ad03892523bf55ccb57205..573a4c4d4e039e75761300da691445bdc096acab 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -311,8 +311,9 @@ void GroupDetectors2::execEvent() { * @param workspace :: the user selected input workspace * @param unUsedSpec :: spectra indexes that are not members of any group */ -void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, - std::vector &unUsedSpec) { +void GroupDetectors2::getGroups( + const API::MatrixWorkspace_const_sptr &workspace, + std::vector &unUsedSpec) { // this is the map that we are going to fill m_GroupWsInds.clear(); @@ -454,9 +455,9 @@ void GroupDetectors2::getGroups(API::MatrixWorkspace_const_sptr workspace, * a group (so far) * @throw FileError if there's any problem with the file or its format */ -void GroupDetectors2::processFile(const std::string &fname, - API::MatrixWorkspace_const_sptr workspace, - std::vector &unUsedSpec) { +void GroupDetectors2::processFile( + const std::string &fname, const API::MatrixWorkspace_const_sptr &workspace, + std::vector &unUsedSpec) { // tring to open the file the user told us exists, skip down 20 lines to find // out what happens if we can read from it g_log.debug() << "Opening input file ... " << fname; @@ -545,9 +546,9 @@ void GroupDetectors2::processFile(const std::string &fname, * a group (so far) * @throw FileError if there's any problem with the file or its format */ -void GroupDetectors2::processXMLFile(const std::string &fname, - API::MatrixWorkspace_const_sptr workspace, - std::vector &unUsedSpec) { +void GroupDetectors2::processXMLFile( + const std::string &fname, const API::MatrixWorkspace_const_sptr &workspace, + std::vector &unUsedSpec) { // 1. Get maps for spectrum No and detector ID spec2index_map specs2index; const SpectraAxis *axis = @@ -630,8 +631,8 @@ void GroupDetectors2::processXMLFile(const std::string &fname, * in a group (so far) */ void GroupDetectors2::processGroupingWorkspace( - GroupingWorkspace_const_sptr groupWS, - API::MatrixWorkspace_const_sptr workspace, + const GroupingWorkspace_const_sptr &groupWS, + const API::MatrixWorkspace_const_sptr &workspace, std::vector &unUsedSpec) { detid2index_map detIdToWiMap = workspace->getDetectorIDToWorkspaceIndexMap(); @@ -683,7 +684,8 @@ void GroupDetectors2::processGroupingWorkspace( * a group (so far) */ void GroupDetectors2::processMatrixWorkspace( - MatrixWorkspace_const_sptr groupWS, MatrixWorkspace_const_sptr workspace, + const MatrixWorkspace_const_sptr &groupWS, + const MatrixWorkspace_const_sptr &workspace, std::vector &unUsedSpec) { detid2index_map detIdToWiMap = workspace->getDetectorIDToWorkspaceIndexMap(); @@ -933,11 +935,12 @@ double GroupDetectors2::fileReadProg( * indexing after grouping * @return number of new grouped spectra */ -size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS, - API::MatrixWorkspace_sptr outputWS, - const double prog4Copy, const bool keepAll, - const std::set &unGroupedSet, - Indexing::IndexInfo &indexInfo) { +size_t +GroupDetectors2::formGroups(const API::MatrixWorkspace_const_sptr &inputWS, + const API::MatrixWorkspace_sptr &outputWS, + const double prog4Copy, const bool keepAll, + const std::set &unGroupedSet, + Indexing::IndexInfo &indexInfo) { const std::string behaviourChoice = getProperty("Behaviour"); const auto behaviour = behaviourChoice == "Sum" ? Behaviour::SUM : Behaviour::AVERAGE; @@ -1056,10 +1059,9 @@ size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS, * a single spectra * @return number of new grouped spectra */ -size_t -GroupDetectors2::formGroupsEvent(DataObjects::EventWorkspace_const_sptr inputWS, - DataObjects::EventWorkspace_sptr outputWS, - const double prog4Copy) { +size_t GroupDetectors2::formGroupsEvent( + const DataObjects::EventWorkspace_const_sptr &inputWS, + const DataObjects::EventWorkspace_sptr &outputWS, const double prog4Copy) { if (inputWS->detectorInfo().isScanning()) throw std::runtime_error("GroupDetectors does not currently support " "EventWorkspaces with detector scans."); diff --git a/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp b/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp index 366841e5fe9ac1a3b680d0c7a35dd0f3fd6277a3..53b7b63f955b45373c4410082c51b345e29c6326 100644 --- a/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp +++ b/Framework/DataHandling/src/JoinISISPolarizationEfficiencies.cpp @@ -196,7 +196,7 @@ JoinISISPolarizationEfficiencies::interpolateWorkspaces( MatrixWorkspace_sptr JoinISISPolarizationEfficiencies::interpolatePointDataWorkspace( - MatrixWorkspace_sptr ws, size_t const maxSize) { + const MatrixWorkspace_sptr &ws, size_t const maxSize) { auto const &x = ws->x(0); auto const startX = x.front(); auto const endX = x.back(); @@ -213,7 +213,7 @@ JoinISISPolarizationEfficiencies::interpolatePointDataWorkspace( MatrixWorkspace_sptr JoinISISPolarizationEfficiencies::interpolateHistogramWorkspace( - MatrixWorkspace_sptr ws, size_t const maxSize) { + const MatrixWorkspace_sptr &ws, size_t const maxSize) { ws->setDistribution(true); auto const &x = ws->x(0); auto const dX = (x.back() - x.front()) / double(maxSize); diff --git a/Framework/DataHandling/src/Load.cpp b/Framework/DataHandling/src/Load.cpp index 9f3aca7aed9625a9b6831918867c026d19fddd60..3dccfb9b1d7d8a9ff72b2b8a7907d765e4af1078 100644 --- a/Framework/DataHandling/src/Load.cpp +++ b/Framework/DataHandling/src/Load.cpp @@ -54,7 +54,8 @@ bool isSingleFile(const std::vector> &fileNames) { * @returns a string containing a suggested ws name based on the given file *names. */ -std::string generateWsNameFromFileNames(std::vector filenames) { +std::string +generateWsNameFromFileNames(const std::vector &filenames) { std::string wsName; for (auto &filename : filenames) { @@ -678,7 +679,8 @@ API::Workspace_sptr Load::loadFileToWs(const std::string &fileName, * * @returns a pointer to the result (the first workspace). */ -API::Workspace_sptr Load::plusWs(Workspace_sptr ws1, Workspace_sptr ws2) { +API::Workspace_sptr Load::plusWs(Workspace_sptr ws1, + const Workspace_sptr &ws2) { WorkspaceGroup_sptr group1 = boost::dynamic_pointer_cast(ws1); WorkspaceGroup_sptr group2 = boost::dynamic_pointer_cast(ws2); diff --git a/Framework/DataHandling/src/LoadAsciiStl.cpp b/Framework/DataHandling/src/LoadAsciiStl.cpp index 5fe2fea8a012a1d639beb68c881b9fc7d682994f..6babcfa54c05091fe578325794aa6b6cc6327b3e 100644 --- a/Framework/DataHandling/src/LoadAsciiStl.cpp +++ b/Framework/DataHandling/src/LoadAsciiStl.cpp @@ -11,7 +11,7 @@ namespace Mantid { namespace DataHandling { -bool LoadAsciiStl::isAsciiSTL(std::string filename) { +bool LoadAsciiStl::isAsciiSTL(const std::string &filename) { std::ifstream file(filename.c_str()); if (!file) { // if the file cannot be read then it is not a valid asciiStl File diff --git a/Framework/DataHandling/src/LoadBBY.cpp b/Framework/DataHandling/src/LoadBBY.cpp index 3fe7461a573831b527ff2914ad46ef511bb326e9..1a35f3da47bea2bd01c6c1da30ef90b4435bdfa3 100644 --- a/Framework/DataHandling/src/LoadBBY.cpp +++ b/Framework/DataHandling/src/LoadBBY.cpp @@ -305,7 +305,7 @@ void LoadBBY::exec() { eventAssigner); } - auto getParam = [&allParams](std::string tag, double defValue) { + auto getParam = [&allParams](const std::string &tag, double defValue) { try { return std::stod(allParams[tag]); } catch (const std::invalid_argument &) { diff --git a/Framework/DataHandling/src/LoadBinaryStl.cpp b/Framework/DataHandling/src/LoadBinaryStl.cpp index 0b05cdd15ed8f743d200ac57b9a863bfa586c780..a43550ec716d1cece46d4f138e8f81eb8ebde543 100644 --- a/Framework/DataHandling/src/LoadBinaryStl.cpp +++ b/Framework/DataHandling/src/LoadBinaryStl.cpp @@ -24,7 +24,7 @@ uint32_t getNumberTriangles(Kernel::BinaryStreamReader streamReader, } } // namespace -bool LoadBinaryStl::isBinarySTL(std::string filename) { +bool LoadBinaryStl::isBinarySTL(const std::string &filename) { Poco::File stlFile = Poco::File(filename); if (!stlFile.exists()) { // if the file cannot be read then it is not a valid binary Stl File diff --git a/Framework/DataHandling/src/LoadCalFile.cpp b/Framework/DataHandling/src/LoadCalFile.cpp index c2ca3f78e0356ad67e92612459ad24452392d5c5..3062ed3fa00c59cf91a7608745425e0d82c79c7e 100644 --- a/Framework/DataHandling/src/LoadCalFile.cpp +++ b/Framework/DataHandling/src/LoadCalFile.cpp @@ -237,9 +237,9 @@ void LoadCalFile::exec() { *initialized to the right instrument. */ void LoadCalFile::readCalFile(const std::string &calFileName, - GroupingWorkspace_sptr groupWS, - OffsetsWorkspace_sptr offsetsWS, - MaskWorkspace_sptr maskWS) { + const GroupingWorkspace_sptr &groupWS, + const OffsetsWorkspace_sptr &offsetsWS, + const MaskWorkspace_sptr &maskWS) { auto doGroup = bool(groupWS); auto doOffsets = bool(offsetsWS); auto doMask = bool(maskWS); @@ -360,7 +360,7 @@ void LoadCalFile::readCalFile(const std::string &calFileName, * @param detID Detector ID to check * @return True if a monitor, false otherwise */ -bool LoadCalFile::idIsMonitor(Instrument_const_sptr inst, int detID) { +bool LoadCalFile::idIsMonitor(const Instrument_const_sptr &inst, int detID) { auto monitorList = inst->getMonitors(); auto it = std::find(monitorList.begin(), monitorList.end(), detID); return (it != monitorList.end()); diff --git a/Framework/DataHandling/src/LoadCanSAS1D.cpp b/Framework/DataHandling/src/LoadCanSAS1D.cpp index 75c723269e51eacdcd4983601e0c6cf104b32821..49edd128199eaafd36aae0fdbe5b94f3d1162951 100644 --- a/Framework/DataHandling/src/LoadCanSAS1D.cpp +++ b/Framework/DataHandling/src/LoadCanSAS1D.cpp @@ -297,9 +297,9 @@ void LoadCanSAS1D::check(const Poco::XML::Element *const toCheck, * @param[out] container the data will be added to this group * @throw ExistsError if a workspace with this name had already been added */ -void LoadCanSAS1D::appendDataToOutput(API::MatrixWorkspace_sptr newWork, - const std::string &newWorkName, - API::WorkspaceGroup_sptr container) { +void LoadCanSAS1D::appendDataToOutput( + const API::MatrixWorkspace_sptr &newWork, const std::string &newWorkName, + const API::WorkspaceGroup_sptr &container) { // the name of the property, like the workspace name must be different for // each workspace. Add "_run" at the end to stop problems with names like // "outputworkspace" @@ -317,8 +317,9 @@ void LoadCanSAS1D::appendDataToOutput(API::MatrixWorkspace_sptr newWork, * @param inst_name :: The name written in the Nexus file * @param localWorkspace :: The workspace to insert the instrument into */ -void LoadCanSAS1D::runLoadInstrument(const std::string &inst_name, - API::MatrixWorkspace_sptr localWorkspace) { +void LoadCanSAS1D::runLoadInstrument( + const std::string &inst_name, + const API::MatrixWorkspace_sptr &localWorkspace) { API::IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument"); @@ -342,7 +343,7 @@ void LoadCanSAS1D::runLoadInstrument(const std::string &inst_name, * @param[in] wSpace the log will be created in this workspace */ void LoadCanSAS1D::createLogs(const Poco::XML::Element *const sasEntry, - API::MatrixWorkspace_sptr wSpace) const { + const API::MatrixWorkspace_sptr &wSpace) const { API::Run &run = wSpace->mutableRun(); Element *runText = sasEntry->getChildElement("Run"); check(runText, "Run"); @@ -369,7 +370,7 @@ void LoadCanSAS1D::createLogs(const Poco::XML::Element *const sasEntry, void LoadCanSAS1D::createSampleInformation( const Poco::XML::Element *const sasEntry, - Mantid::API::MatrixWorkspace_sptr wSpace) const { + const Mantid::API::MatrixWorkspace_sptr &wSpace) const { auto &sample = wSpace->mutableSample(); // Get the thickness information diff --git a/Framework/DataHandling/src/LoadDaveGrp.cpp b/Framework/DataHandling/src/LoadDaveGrp.cpp index 6f62cd3e9e95d0500e8002eb1ff3a16637169ae6..840a1fb136d79519d7fae632caa14ddabe91dffe 100644 --- a/Framework/DataHandling/src/LoadDaveGrp.cpp +++ b/Framework/DataHandling/src/LoadDaveGrp.cpp @@ -176,7 +176,7 @@ API::MatrixWorkspace_sptr LoadDaveGrp::setupWorkspace() const { return outputWorkspace; } -void LoadDaveGrp::setWorkspaceAxes(API::MatrixWorkspace_sptr workspace, +void LoadDaveGrp::setWorkspaceAxes(const API::MatrixWorkspace_sptr &workspace, const std::vector &xAxis, const std::vector &yAxis) const { @@ -231,7 +231,7 @@ void LoadDaveGrp::getAxisValues(std::vector &axis, } } -void LoadDaveGrp::getData(API::MatrixWorkspace_sptr workspace) { +void LoadDaveGrp::getData(const API::MatrixWorkspace_sptr &workspace) { double data_val = 0.0; double err_val = 0.0; diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index cf823778e64e3391505a9330bda154ad3a832d71..b2ccf757b1cea94807d4e8db93b0b10cb4f83e87 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -409,7 +409,7 @@ LoadGroupXMLFile::LoadGroupXMLFile() m_pDoc(), m_groupComponentsMap(), m_groupDetectorsMap(), m_groupSpectraMap(), m_startGroupID(1), m_groupNamesMap() {} -void LoadGroupXMLFile::loadXMLFile(std::string xmlfilename) { +void LoadGroupXMLFile::loadXMLFile(const std::string &xmlfilename) { this->initializeXMLParser(xmlfilename); this->parseXML(); @@ -604,9 +604,8 @@ void LoadGroupXMLFile::parseXML() { /* * Get attribute's value by name from a Node */ -std::string LoadGroupXMLFile::getAttributeValueByName(Poco::XML::Node *pNode, - std::string attributename, - bool &found) { +std::string LoadGroupXMLFile::getAttributeValueByName( + Poco::XML::Node *pNode, const std::string &attributename, bool &found) { // 1. Init Poco::AutoPtr att = pNode->attributes(); found = false; diff --git a/Framework/DataHandling/src/LoadDiffCal.cpp b/Framework/DataHandling/src/LoadDiffCal.cpp index ff6b617b3bb62a865fd430c6ee72625c6e8a264a..a75167db988a85a08dd7744d051363411fe98ccc 100644 --- a/Framework/DataHandling/src/LoadDiffCal.cpp +++ b/Framework/DataHandling/src/LoadDiffCal.cpp @@ -132,7 +132,7 @@ bool endswith(const std::string &str, const std::string &ending) { } void setGroupWSProperty(API::Algorithm *alg, const std::string &prefix, - GroupingWorkspace_sptr wksp) { + const GroupingWorkspace_sptr &wksp) { alg->declareProperty( std::make_unique>( "OutputGroupingWorkspace", prefix + "_group", Direction::Output), @@ -141,7 +141,7 @@ void setGroupWSProperty(API::Algorithm *alg, const std::string &prefix, } void setMaskWSProperty(API::Algorithm *alg, const std::string &prefix, - MaskWorkspace_sptr wksp) { + const MaskWorkspace_sptr &wksp) { alg->declareProperty( std::make_unique>( "OutputMaskWorkspace", prefix + "_mask", Direction::Output), @@ -150,7 +150,7 @@ void setMaskWSProperty(API::Algorithm *alg, const std::string &prefix, } void setCalWSProperty(API::Algorithm *alg, const std::string &prefix, - ITableWorkspace_sptr wksp) { + const ITableWorkspace_sptr &wksp) { alg->declareProperty( std::make_unique>( "OutputCalWorkspace", prefix + "_cal", Direction::Output), diff --git a/Framework/DataHandling/src/LoadDspacemap.cpp b/Framework/DataHandling/src/LoadDspacemap.cpp index ef2ed7bdf70a80d9c75edcf1bbc7703d5dd94c7b..6a5e8ac1596e0eaba40523dbd2684cf02addf649 100644 --- a/Framework/DataHandling/src/LoadDspacemap.cpp +++ b/Framework/DataHandling/src/LoadDspacemap.cpp @@ -95,8 +95,8 @@ void LoadDspacemap::exec() { * @param offsetsWS :: OffsetsWorkspace to be filled. */ void LoadDspacemap::CalculateOffsetsFromDSpacemapFile( - const std::string DFileName, - Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS) { + const std::string &DFileName, + const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS) { // Get a pointer to the instrument contained in the workspace const auto &detectorInfo = offsetsWS->detectorInfo(); @@ -150,7 +150,7 @@ const double CONSTANT = (PhysicalConstants::h * 1e10) / */ void LoadDspacemap::CalculateOffsetsFromVulcanFactors( std::map &vulcan, - Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS) { + const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS) { // Get a pointer to the instrument contained in the workspace // At this point, instrument VULCAN has been created? Instrument_const_sptr instrument = offsetsWS->getInstrument(); diff --git a/Framework/DataHandling/src/LoadEMU.cpp b/Framework/DataHandling/src/LoadEMU.cpp index 3389e0ab82cd6bf644eb939dcb9d5b846459d0d1..99f65416e8314f7ca124ae359d4e30a808f6bcde 100644 --- a/Framework/DataHandling/src/LoadEMU.cpp +++ b/Framework/DataHandling/src/LoadEMU.cpp @@ -680,7 +680,7 @@ void LoadEMU::exec(const std::string &hdfFile, // lambda to simplify loading instrument parameters auto instr = m_localWorkspace->getInstrument(); - auto iparam = [&instr](std::string tag) { + auto iparam = [&instr](const std::string &tag) { return instr->getNumberParameter(tag)[0]; }; diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index e19bcd8f634774dd3af4903940fa5da8ddd0382b..61db89516575f4fe66cc477f89452e79a674ad10 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -1177,8 +1177,8 @@ bool LoadEventNexus::runLoadInstrument( * @param workspace :: The workspace to contain the spectra mapping * @param bankNames :: Bank names that are in Nexus file */ -void LoadEventNexus::deleteBanks(EventWorkspaceCollection_sptr workspace, - std::vector bankNames) { +void LoadEventNexus::deleteBanks(const EventWorkspaceCollection_sptr &workspace, + const std::vector &bankNames) { Instrument_sptr inst = boost::const_pointer_cast( workspace->getInstrument()->baseInstrument()); // Build a list of Rectangular Detectors @@ -1537,7 +1537,7 @@ void LoadEventNexus::loadSampleDataISIScompatibility( * * @param fname name of the nexus file to open */ -void LoadEventNexus::safeOpenFile(const std::string fname) { +void LoadEventNexus::safeOpenFile(const std::string &fname) { try { m_file = std::make_unique<::NeXus::File>(m_filename, NXACC_READ); } catch (std::runtime_error &e) { diff --git a/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp b/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp index 0e7a6f4e212d75d84ccc97997d3565474ec724d8..6a3d324202792265dac3304d609c690b890fab27 100644 --- a/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp +++ b/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp @@ -4,8 +4,10 @@ // NScD Oak Ridge National Laboratory, European Spallation Source, // Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS // SPDX - License - Identifier: GPL - 3.0 + -#include "MantidDataHandling/LoadEventNexusIndexSetup.h" +#include + #include "MantidAPI/SpectrumDetectorMapping.h" +#include "MantidDataHandling/LoadEventNexusIndexSetup.h" #include "MantidGeometry/Instrument.h" #include "MantidGeometry/Instrument/ComponentInfo.h" #include "MantidGeometry/Instrument/DetectorInfo.h" @@ -42,10 +44,10 @@ void setupConsistentSpectrumNumbers(IndexInfo &filtered, LoadEventNexusIndexSetup::LoadEventNexusIndexSetup( MatrixWorkspace_const_sptr instrumentWorkspace, const int32_t min, - const int32_t max, const std::vector range, + const int32_t max, const std::vector &range, const Parallel::Communicator &communicator) - : m_instrumentWorkspace(instrumentWorkspace), m_min(min), m_max(max), - m_range(range), m_communicator(communicator) {} + : m_instrumentWorkspace(std::move(instrumentWorkspace)), m_min(min), + m_max(max), m_range(range), m_communicator(communicator) {} std::pair LoadEventNexusIndexSetup::eventIDLimits() const { return {m_min, m_max}; diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index 04eaff0ec070db6cbef202ef701c1b4259741606..09bca136ffdd8845c6224bc14efa96d5e02ee674 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -405,7 +405,7 @@ void LoadEventPreNexus2::exec() { /** Create and set up output Event Workspace */ void LoadEventPreNexus2::createOutputWorkspace( - const std::string event_filename) { + const std::string &event_filename) { // Create the output workspace localWorkspace = EventWorkspace_sptr(new EventWorkspace()); @@ -570,7 +570,7 @@ void LoadEventPreNexus2::processImbedLogs() { * @param mindex :: index of the log in pulse time ... * - mindex: index of the the series in the list */ -void LoadEventPreNexus2::addToWorkspaceLog(std::string logtitle, +void LoadEventPreNexus2::addToWorkspaceLog(const std::string &logtitle, size_t mindex) { // Create TimeSeriesProperty auto property = new TimeSeriesProperty(logtitle); @@ -601,7 +601,8 @@ void LoadEventPreNexus2::addToWorkspaceLog(std::string logtitle, * geometry */ void LoadEventPreNexus2::runLoadInstrument( - const std::string &eventfilename, MatrixWorkspace_sptr localWorkspace) { + const std::string &eventfilename, + const MatrixWorkspace_sptr &localWorkspace) { // start by getting just the filename string instrument = Poco::Path(eventfilename).getFileName(); diff --git a/Framework/DataHandling/src/LoadFITS.cpp b/Framework/DataHandling/src/LoadFITS.cpp index deb8a6f3a818fd27e9459de6576b86b14c9ef23d..57f2df40ce813f0c338daed43f07fa5eca0716d4 100644 --- a/Framework/DataHandling/src/LoadFITS.cpp +++ b/Framework/DataHandling/src/LoadFITS.cpp @@ -678,7 +678,7 @@ void LoadFITS::parseHeader(FITSInfo &headerInfo) { Workspace2D_sptr LoadFITS::makeWorkspace(const FITSInfo &fileInfo, size_t &newFileNumber, std::vector &buffer, MantidImage &imageY, - MantidImage &imageE, const Workspace2D_sptr parent, + MantidImage &imageE, const Workspace2D_sptr &parent, bool loadAsRectImg, int binSize, double noiseThresh) { // Create workspace (taking into account already here if rebinning is // going to happen) @@ -763,9 +763,9 @@ LoadFITS::makeWorkspace(const FITSInfo &fileInfo, size_t &newFileNumber, * @param cmpp centimeters per pixel (already taking into account * possible rebinning) */ -void LoadFITS::addAxesInfoAndLogs(Workspace2D_sptr ws, bool loadAsRectImg, - const FITSInfo &fileInfo, int binSize, - double cmpp) { +void LoadFITS::addAxesInfoAndLogs(const Workspace2D_sptr &ws, + bool loadAsRectImg, const FITSInfo &fileInfo, + int binSize, double cmpp) { // add axes size_t width = fileInfo.axisPixelLengths[0] / binSize; size_t height = fileInfo.axisPixelLengths[1] / binSize; @@ -848,7 +848,7 @@ void LoadFITS::addAxesInfoAndLogs(Workspace2D_sptr ws, bool loadAsRectImg, * @throws std::runtime_error if there are file input issues */ void LoadFITS::readDataToWorkspace(const FITSInfo &fileInfo, double cmpp, - Workspace2D_sptr ws, + const Workspace2D_sptr &ws, std::vector &buffer) { const size_t bytespp = (fileInfo.bitsPerPixel / 8); const size_t len = m_pixelCount * bytespp; diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index 5095dcb4e6b61d95e7fbd118082070f87243be05..085341074867ca897a0942efc1d6b0687ba5d347 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -240,7 +240,8 @@ void LoadFullprofResolution::exec() { * @param filename :: string for name of the .irf file * @param lines :: vector of strings for each non-empty line in .irf file */ -void LoadFullprofResolution::loadFile(string filename, vector &lines) { +void LoadFullprofResolution::loadFile(const string &filename, + vector &lines) { string line; // the variable of type ifstream: @@ -773,8 +774,8 @@ void LoadFullprofResolution::createBankToWorkspaceMap( * stored */ void LoadFullprofResolution::putParametersIntoWorkspace( - API::Column_const_sptr column, API::MatrixWorkspace_sptr ws, int nProf, - std::string ¶meterXMLString) { + const API::Column_const_sptr &column, const API::MatrixWorkspace_sptr &ws, + int nProf, std::string ¶meterXMLString) { // Get instrument name from matrix workspace std::string instrumentName = ws->getInstrument()->getName(); @@ -833,7 +834,7 @@ void LoadFullprofResolution::putParametersIntoWorkspace( * paramName is the name of the parameter as it appears in the table workspace */ void LoadFullprofResolution::addALFBEParameter( - const API::Column_const_sptr column, Poco::XML::Document *mDoc, + const API::Column_const_sptr &column, Poco::XML::Document *mDoc, Element *parent, const std::string ¶mName) { AutoPtr parameterElem = mDoc->createElement("parameter"); parameterElem->setAttribute("name", getXMLParameterName(paramName)); @@ -856,7 +857,7 @@ void LoadFullprofResolution::addALFBEParameter( * for the bank at the given column of the table workspace */ void LoadFullprofResolution::addSigmaParameters( - const API::Column_const_sptr column, Poco::XML::Document *mDoc, + const API::Column_const_sptr &column, Poco::XML::Document *mDoc, Poco::XML::Element *parent) { AutoPtr parameterElem = mDoc->createElement("parameter"); parameterElem->setAttribute("name", "IkedaCarpenterPV:SigmaSquared"); @@ -878,7 +879,7 @@ void LoadFullprofResolution::addSigmaParameters( * for the bank at the given column of the table workspace */ void LoadFullprofResolution::addGammaParameters( - const API::Column_const_sptr column, Poco::XML::Document *mDoc, + const API::Column_const_sptr &column, Poco::XML::Document *mDoc, Poco::XML::Element *parent) { AutoPtr parameterElem = mDoc->createElement("parameter"); parameterElem->setAttribute("name", "IkedaCarpenterPV:Gamma"); @@ -899,7 +900,7 @@ void LoadFullprofResolution::addGammaParameters( * for the bank at the given column of the table workspace */ void LoadFullprofResolution::addBBX_S_Parameters( - const API::Column_const_sptr column, Poco::XML::Document *mDoc, + const API::Column_const_sptr &column, Poco::XML::Document *mDoc, Poco::XML::Element *parent) { AutoPtr parameterElem = mDoc->createElement("parameter"); parameterElem->setAttribute("name", "BackToBackExponential:S"); @@ -923,7 +924,7 @@ void LoadFullprofResolution::addBBX_S_Parameters( * for the bank at the given column of the table workspace */ void LoadFullprofResolution::addBBX_A_Parameters( - const API::Column_const_sptr column, Poco::XML::Document *mDoc, + const API::Column_const_sptr &column, Poco::XML::Document *mDoc, Poco::XML::Element *parent) { AutoPtr parameterElem = mDoc->createElement("parameter"); parameterElem->setAttribute("name", "BackToBackExponential:A"); @@ -948,7 +949,7 @@ void LoadFullprofResolution::addBBX_A_Parameters( * for the bank at the given column of the table workspace */ void LoadFullprofResolution::addBBX_B_Parameters( - const API::Column_const_sptr column, Poco::XML::Document *mDoc, + const API::Column_const_sptr &column, Poco::XML::Document *mDoc, Poco::XML::Element *parent) { AutoPtr parameterElem = mDoc->createElement("parameter"); parameterElem->setAttribute("name", "BackToBackExponential:B"); @@ -992,7 +993,7 @@ LoadFullprofResolution::getXMLParameterName(const std::string &name) { * given the name of the parameter in the table workspace. */ std::string -LoadFullprofResolution::getXMLEqValue(const API::Column_const_sptr column, +LoadFullprofResolution::getXMLEqValue(const API::Column_const_sptr &column, const std::string &name) { size_t paramNumber = LoadFullprofResolution::m_rowNumbers[name]; // API::Column_const_sptr column = tablews->getColumn( columnIndex ); @@ -1006,7 +1007,7 @@ LoadFullprofResolution::getXMLEqValue(const API::Column_const_sptr column, * given the name of the parameter in the table workspace. */ std::string LoadFullprofResolution::getXMLSquaredEqValue( - const API::Column_const_sptr column, const std::string &name) { + const API::Column_const_sptr &column, const std::string &name) { size_t paramNumber = LoadFullprofResolution::m_rowNumbers[name]; // API::Column_const_sptr column = tablews->getColumn( columnIndex ); double eqValue = column->cell(paramNumber); diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp index aadb1e848b522c141a1b37ac30301631168909af..c72b0bda3f223a7c5bfdd7881d14812abac012d2 100644 --- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp @@ -214,7 +214,8 @@ void LoadGSASInstrumentFile::exec() { * @param filename :: string for name of the .prm file * @param lines :: vector of strings for each non-empty line in .prm file */ -void LoadGSASInstrumentFile::loadFile(string filename, vector &lines) { +void LoadGSASInstrumentFile::loadFile(const string &filename, + vector &lines) { string line; // the variable of type ifstream: diff --git a/Framework/DataHandling/src/LoadGSS.cpp b/Framework/DataHandling/src/LoadGSS.cpp index 9f04a4b9a02f46226cb24039b33e6135a41a9758..4456422c817533eb8153a6675f21cb9e1d74e3e4 100644 --- a/Framework/DataHandling/src/LoadGSS.cpp +++ b/Framework/DataHandling/src/LoadGSS.cpp @@ -488,7 +488,7 @@ double LoadGSS::convertToDouble(std::string inputstring) { /** Create the instrument geometry with Instrument */ void LoadGSS::createInstrumentGeometry( - MatrixWorkspace_sptr workspace, const std::string &instrumentname, + const MatrixWorkspace_sptr &workspace, const std::string &instrumentname, const double &primaryflightpath, const std::vector &detectorids, const std::vector &totalflightpaths, const std::vector &twothetas) { diff --git a/Framework/DataHandling/src/LoadHelper.cpp b/Framework/DataHandling/src/LoadHelper.cpp index 0527c865d70cf696dc02c2f3dba4e64a69c33bdf..6461e0fa1ecee7e18c16136c0dd3847c87c9d370 100644 --- a/Framework/DataHandling/src/LoadHelper.cpp +++ b/Framework/DataHandling/src/LoadHelper.cpp @@ -119,7 +119,7 @@ double LoadHelper::calculateTOF(double distance, double wavelength) { */ double LoadHelper::getInstrumentProperty(const API::MatrixWorkspace_sptr &workspace, - std::string s) { + const std::string &s) { std::vector prop = workspace->getInstrument()->getStringParameter(s); if (prop.empty()) { @@ -509,7 +509,7 @@ void LoadHelper::dumpNexusAttributes(NXhandle nxfileID, * @param dateToParse :: date as string * @return date as required in Mantid */ -std::string LoadHelper::dateTimeInIsoFormat(std::string dateToParse) { +std::string LoadHelper::dateTimeInIsoFormat(const std::string &dateToParse) { namespace bt = boost::posix_time; // parsing format const std::locale format = std::locale( @@ -535,7 +535,7 @@ std::string LoadHelper::dateTimeInIsoFormat(std::string dateToParse) { * @param componentName The name of the component of the instrument * @param newPos New position of the component */ -void LoadHelper::moveComponent(API::MatrixWorkspace_sptr ws, +void LoadHelper::moveComponent(const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const V3D &newPos) { Geometry::IComponent_const_sptr component = @@ -557,7 +557,7 @@ void LoadHelper::moveComponent(API::MatrixWorkspace_sptr ws, * @param rot Rotations defined by setting a quaternion from an angle in degrees * and an axis */ -void LoadHelper::rotateComponent(API::MatrixWorkspace_sptr ws, +void LoadHelper::rotateComponent(const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const Kernel::Quat &rot) { Geometry::IComponent_const_sptr component = @@ -578,7 +578,7 @@ void LoadHelper::rotateComponent(API::MatrixWorkspace_sptr ws, * @param componentName The Name of the component of the instrument * @return The position of the component */ -V3D LoadHelper::getComponentPosition(API::MatrixWorkspace_sptr ws, +V3D LoadHelper::getComponentPosition(const API::MatrixWorkspace_sptr &ws, const std::string &componentName) { Geometry::IComponent_const_sptr component = ws->getInstrument()->getComponentByName(componentName); diff --git a/Framework/DataHandling/src/LoadIDFFromNexus.cpp b/Framework/DataHandling/src/LoadIDFFromNexus.cpp index 5d52c316f66b8d855bf5dc8f874ed61b77f05c0c..e4110c861240910b55f90ff5f918f46c64ee40c7 100644 --- a/Framework/DataHandling/src/LoadIDFFromNexus.cpp +++ b/Framework/DataHandling/src/LoadIDFFromNexus.cpp @@ -271,7 +271,7 @@ void LoadIDFFromNexus::readParameterCorrectionFile( * @throw FileError Thrown if unable to parse XML file */ void LoadIDFFromNexus::LoadParameters( - ::NeXus::File *nxfile, const MatrixWorkspace_sptr localWorkspace) { + ::NeXus::File *nxfile, const MatrixWorkspace_sptr &localWorkspace) { std::string parameterString; @@ -314,7 +314,7 @@ void LoadIDFFromNexus::LoadParameters( // given workspace, returning success. bool LoadIDFFromNexus::loadParameterFile( const std::string &fullPathName, - const MatrixWorkspace_sptr localWorkspace) { + const MatrixWorkspace_sptr &localWorkspace) { try { // load and also populate instrument parameters from this 'fallback' diff --git a/Framework/DataHandling/src/LoadILLIndirect2.cpp b/Framework/DataHandling/src/LoadILLIndirect2.cpp index c4d0b384b01989ea0e5e2fb9ff69fda60d63e527..80aa732d8839dcef9dd7d69eba521e956598ef69 100644 --- a/Framework/DataHandling/src/LoadILLIndirect2.cpp +++ b/Framework/DataHandling/src/LoadILLIndirect2.cpp @@ -271,7 +271,7 @@ void LoadILLIndirect2::loadDataIntoTheWorkSpace(NeXus::NXEntry &entry) { * @param nexusfilename */ void LoadILLIndirect2::loadNexusEntriesIntoProperties( - std::string nexusfilename) { + const std::string &nexusfilename) { API::Run &runDetails = m_localWorkspace->mutableRun(); diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index 63ccf5fb638974a4e9c6ea535d902a1c921ed43c..abebe9c0e77ed172113684b4e6c01ec485b49294 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -459,7 +459,7 @@ Check for a set of synthetic logs associated with multi-period log data. Raise warnings where necessary. */ void LoadISISNexus2::validateMultiPeriodLogs( - Mantid::API::MatrixWorkspace_sptr ws) { + const Mantid::API::MatrixWorkspace_sptr &ws) { const Run &run = ws->run(); if (!run.hasProperty("current_period")) { g_log.warning("Workspace has no current_period log."); diff --git a/Framework/DataHandling/src/LoadInstrument.cpp b/Framework/DataHandling/src/LoadInstrument.cpp index 9451dbb3183029e495432295c579bc6b8e53eb88..4274685e262fcc20afe59aec5d0192e266ee2834 100644 --- a/Framework/DataHandling/src/LoadInstrument.cpp +++ b/Framework/DataHandling/src/LoadInstrument.cpp @@ -255,7 +255,8 @@ void LoadInstrument::exec() { //----------------------------------------------------------------------------------------------------------------------- /// Run the Child Algorithm LoadInstrument (or LoadInstrumentFromRaw) void LoadInstrument::runLoadParameterFile( - const boost::shared_ptr &ws, std::string filename) { + const boost::shared_ptr &ws, + const std::string &filename) { g_log.debug("Loading the parameter definition..."); // First search for XML parameter file in same folder as IDF file @@ -311,8 +312,9 @@ void LoadInstrument::runLoadParameterFile( /// Search the directory for the Parameter IDF file and return full path name if /// found, else return "". // directoryName must include a final '/'. -std::string LoadInstrument::getFullPathParamIDF(std::string directoryName, - std::string filename) { +std::string +LoadInstrument::getFullPathParamIDF(const std::string &directoryName, + const std::string &filename) { Poco::Path directoryPath(directoryName); directoryPath.makeDirectory(); // Remove the path from the filename diff --git a/Framework/DataHandling/src/LoadIsawDetCal.cpp b/Framework/DataHandling/src/LoadIsawDetCal.cpp index a531b2645f3ede3199ea94772c0398b3ccbd1c4c..4c8e0c67a366277621c990efbbcf8e4be04e5b72 100644 --- a/Framework/DataHandling/src/LoadIsawDetCal.cpp +++ b/Framework/DataHandling/src/LoadIsawDetCal.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace Mantid { namespace DataHandling { @@ -74,7 +75,7 @@ std::string getBankName(const std::string &bankPart, const int idnum) { } } -std::string getInstName(API::Workspace_const_sptr wksp) { +std::string getInstName(const API::Workspace_const_sptr &wksp) { MatrixWorkspace_const_sptr matrixWksp = boost::dynamic_pointer_cast(wksp); if (matrixWksp) { @@ -352,10 +353,11 @@ void LoadIsawDetCal::exec() { * @param componentInfo :: The component info object for the workspace */ void LoadIsawDetCal::center(const double x, const double y, const double z, - const std::string &detname, API::Workspace_sptr ws, + const std::string &detname, + const API::Workspace_sptr &ws, Geometry::ComponentInfo &componentInfo) { - Instrument_sptr inst = getCheckInst(ws); + Instrument_sptr inst = getCheckInst(std::move(ws)); IComponent_const_sptr comp = inst->getComponentByName(detname); if (comp == nullptr) { @@ -378,7 +380,7 @@ void LoadIsawDetCal::center(const double x, const double y, const double z, * @throw std::runtime_error if there's any problem with the workspace or it is * not possible to get an instrument object from it */ -Instrument_sptr LoadIsawDetCal::getCheckInst(API::Workspace_sptr ws) { +Instrument_sptr LoadIsawDetCal::getCheckInst(const API::Workspace_sptr &ws) { MatrixWorkspace_sptr inputW = boost::dynamic_pointer_cast(ws); PeaksWorkspace_sptr inputP = boost::dynamic_pointer_cast(ws); @@ -432,7 +434,7 @@ std::vector LoadIsawDetCal::getFilenames() { * @param doWishCorrection if true apply a special correction for WISH */ void LoadIsawDetCal::doRotation(V3D rX, V3D rY, ComponentInfo &componentInfo, - boost::shared_ptr comp, + const boost::shared_ptr &comp, bool doWishCorrection) { // These are the ISAW axes rX.normalize(); diff --git a/Framework/DataHandling/src/LoadLog.cpp b/Framework/DataHandling/src/LoadLog.cpp index 6f528b5b844fa1cd4f32c70bb931d7420e246193..c771655cb7074ad72a821c71a55a2f2ba7b81172 100644 --- a/Framework/DataHandling/src/LoadLog.cpp +++ b/Framework/DataHandling/src/LoadLog.cpp @@ -28,6 +28,7 @@ #include #include // used to get ifstream #include +#include using Mantid::Types::Core::DateAndTime; @@ -202,8 +203,8 @@ void LoadLog::loadTwoColumnLogFile(std::ifstream &logFileStream, } try { - Property *log = - LogParser::createLogProperty(m_filename, stringToLower(logFileName)); + Property *log = LogParser::createLogProperty( + m_filename, stringToLower(std::move(logFileName))); if (log) { run.addLogData(log); } @@ -220,7 +221,8 @@ void LoadLog::loadTwoColumnLogFile(std::ifstream &logFileStream, * @param run :: The run information object */ void LoadLog::loadThreeColumnLogFile(std::ifstream &logFileStream, - std::string logFileName, API::Run &run) { + const std::string &logFileName, + API::Run &run) { std::string str; std::string propname; std::map>> diff --git a/Framework/DataHandling/src/LoadMuonNexus.cpp b/Framework/DataHandling/src/LoadMuonNexus.cpp index 7a7b005de06ac7b29ddb1569afb42d0beb01fd46..214b258eb14a4fd68fb99f1dff7e599ef112ccc0 100644 --- a/Framework/DataHandling/src/LoadMuonNexus.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus.cpp @@ -152,7 +152,7 @@ void LoadMuonNexus::checkOptionalProperties() { /// Run the Child Algorithm LoadInstrument void LoadMuonNexus::runLoadInstrument( - DataObjects::Workspace2D_sptr localWorkspace) { + const DataObjects::Workspace2D_sptr &localWorkspace) { IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument"); diff --git a/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Framework/DataHandling/src/LoadMuonNexus1.cpp index 86ae6243d307d52f40b57eb70f16328dd9edc175..77aac4add36dd6b1ac04b5939ccd21f36d4c1a35 100644 --- a/Framework/DataHandling/src/LoadMuonNexus1.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus1.cpp @@ -448,9 +448,8 @@ void LoadMuonNexus1::loadDeadTimes(NXRoot &root) { * @param inst :: Pointer to instrument (to use if IDF needed) * @returns :: Grouping table - or tables, if per period */ -Workspace_sptr -LoadMuonNexus1::loadDetectorGrouping(NXRoot &root, - Geometry::Instrument_const_sptr inst) { +Workspace_sptr LoadMuonNexus1::loadDetectorGrouping( + NXRoot &root, const Geometry::Instrument_const_sptr &inst) { NXEntry dataEntry = root.openEntry("run/histogram_data_1"); NXInfo infoGrouping = dataEntry.getDataSetInfo("grouping"); @@ -660,9 +659,10 @@ LoadMuonNexus1::createDetectorGroupingTable(std::vector specToLoad, * @param localWorkspace :: A pointer to the workspace in which the data will * be stored */ -void LoadMuonNexus1::loadData(size_t hist, specnum_t &i, specnum_t specNo, - MuonNexusReader &nxload, const int64_t lengthIn, - DataObjects::Workspace2D_sptr localWorkspace) { +void LoadMuonNexus1::loadData( + size_t hist, specnum_t &i, specnum_t specNo, MuonNexusReader &nxload, + const int64_t lengthIn, + const DataObjects::Workspace2D_sptr &localWorkspace) { // Read in a spectrum // Put it into a vector, discarding the 1st entry, which is rubbish // But note that the last (overflow) bin is kept @@ -689,7 +689,7 @@ void LoadMuonNexus1::loadData(size_t hist, specnum_t &i, specnum_t specNo, * @param localWorkspace :: The workspace details to use */ void LoadMuonNexus1::loadRunDetails( - DataObjects::Workspace2D_sptr localWorkspace) { + const DataObjects::Workspace2D_sptr &localWorkspace) { API::Run &runDetails = localWorkspace->mutableRun(); runDetails.addProperty("run_title", localWorkspace->getTitle(), true); @@ -737,7 +737,8 @@ void LoadMuonNexus1::loadRunDetails( } /// Run the LoadLog Child Algorithm -void LoadMuonNexus1::runLoadLog(DataObjects::Workspace2D_sptr localWorkspace) { +void LoadMuonNexus1::runLoadLog( + const DataObjects::Workspace2D_sptr &localWorkspace) { IAlgorithm_sptr loadLog = createChildAlgorithm("LoadMuonLog"); // Pass through the same input filename loadLog->setPropertyValue("Filename", m_filename); @@ -791,8 +792,8 @@ void LoadMuonNexus1::runLoadLog(DataObjects::Workspace2D_sptr localWorkspace) { * @param localWorkspace A workspace to add the log to. * @param period A period for this workspace. */ -void LoadMuonNexus1::addPeriodLog(DataObjects::Workspace2D_sptr localWorkspace, - int64_t period) { +void LoadMuonNexus1::addPeriodLog( + const DataObjects::Workspace2D_sptr &localWorkspace, int64_t period) { auto &run = localWorkspace->mutableRun(); ISISRunLogs runLogs(run); if (period == 0) { @@ -803,8 +804,9 @@ void LoadMuonNexus1::addPeriodLog(DataObjects::Workspace2D_sptr localWorkspace, } } -void LoadMuonNexus1::addGoodFrames(DataObjects::Workspace2D_sptr localWorkspace, - int64_t period, int nperiods) { +void LoadMuonNexus1::addGoodFrames( + const DataObjects::Workspace2D_sptr &localWorkspace, int64_t period, + int nperiods) { // Get handle to nexus file ::NeXus::File handle(m_filename, NXACC_READ); diff --git a/Framework/DataHandling/src/LoadMuonNexus2.cpp b/Framework/DataHandling/src/LoadMuonNexus2.cpp index 7238470ca9ed5fd13cc890616e8ed2b8f6e62413..d1e1ba3e54aa154699164c648b60bfefa5332301 100644 --- a/Framework/DataHandling/src/LoadMuonNexus2.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus2.cpp @@ -335,8 +335,8 @@ Histogram LoadMuonNexus2::loadData(const BinEdges &edges, * @param entry :: The Nexus entry * @param period :: The period of this workspace */ -void LoadMuonNexus2::loadLogs(API::MatrixWorkspace_sptr ws, NXEntry &entry, - int period) { +void LoadMuonNexus2::loadLogs(const API::MatrixWorkspace_sptr &ws, + NXEntry &entry, int period) { // Avoid compiler warning (void)period; @@ -373,7 +373,7 @@ void LoadMuonNexus2::loadLogs(API::MatrixWorkspace_sptr ws, NXEntry &entry, * @param localWorkspace :: The workspace details to use */ void LoadMuonNexus2::loadRunDetails( - DataObjects::Workspace2D_sptr localWorkspace) { + const DataObjects::Workspace2D_sptr &localWorkspace) { API::Run &runDetails = localWorkspace->mutableRun(); runDetails.addProperty("run_title", localWorkspace->getTitle(), true); diff --git a/Framework/DataHandling/src/LoadNXcanSAS.cpp b/Framework/DataHandling/src/LoadNXcanSAS.cpp index c288e53514ce9debfec62f0a68348533e827a6a7..b1cc42fb7c8f0167dcb990305bd0e32ee707788c 100644 --- a/Framework/DataHandling/src/LoadNXcanSAS.cpp +++ b/Framework/DataHandling/src/LoadNXcanSAS.cpp @@ -106,7 +106,8 @@ createWorkspaceForHistogram(H5::DataSet &dataSet) { // ----- LOGS -void loadLogs(H5::Group &entry, Mantid::API::MatrixWorkspace_sptr workspace) { +void loadLogs(H5::Group &entry, + const Mantid::API::MatrixWorkspace_sptr &workspace) { auto &run = workspace->mutableRun(); // Load UserFile (optional) @@ -133,7 +134,7 @@ void loadLogs(H5::Group &entry, Mantid::API::MatrixWorkspace_sptr workspace) { } // ----- INSTRUMENT -std::string extractIdfFileOnCurrentSystem(std::string idf) { +std::string extractIdfFileOnCurrentSystem(const std::string &idf) { // If the idf is is not empty extract the last element from the file if (idf.empty()) { return ""; @@ -161,7 +162,7 @@ std::string extractIdfFileOnCurrentSystem(std::string idf) { } void loadInstrument(H5::Group &entry, - Mantid::API::MatrixWorkspace_sptr workspace) { + const Mantid::API::MatrixWorkspace_sptr &workspace) { auto instrument = entry.openGroup(sasInstrumentGroupName); // Get instrument name @@ -232,7 +233,7 @@ bool hasQDev(H5::Group &dataGroup) { } void loadData1D(H5::Group &dataGroup, - Mantid::API::MatrixWorkspace_sptr workspace) { + const Mantid::API::MatrixWorkspace_sptr &workspace) { // General workspace->setDistribution(true); @@ -268,7 +269,7 @@ void loadData1D(H5::Group &dataGroup, template void read2DWorkspace(H5::DataSet &dataSet, Mantid::API::MatrixWorkspace_sptr workspace, Functor func, - H5::DataType memoryDataType) { + const H5::DataType &memoryDataType) { using namespace Mantid::DataHandling::NXcanSAS; auto dimInfo = getDataSpaceInfo(dataSet); @@ -297,8 +298,8 @@ void read2DWorkspace(H5::DataSet &dataSet, } void readQyInto2DWorkspace(H5::DataSet &dataSet, - Mantid::API::MatrixWorkspace_sptr workspace, - H5::DataType memoryDataType) { + const Mantid::API::MatrixWorkspace_sptr &workspace, + const H5::DataType &memoryDataType) { using namespace Mantid::DataHandling::NXcanSAS; // Get info about the data set @@ -342,13 +343,13 @@ void readQyInto2DWorkspace(H5::DataSet &dataSet, } void loadData2D(H5::Group &dataGroup, - Mantid::API::MatrixWorkspace_sptr workspace) { + const Mantid::API::MatrixWorkspace_sptr &workspace) { // General workspace->setDistribution(true); //----------------------------------------- // Load the I value. auto iDataSet = dataGroup.openDataSet(sasDataI); - auto iExtractor = [](Mantid::API::MatrixWorkspace_sptr ws, + auto iExtractor = [](const Mantid::API::MatrixWorkspace_sptr &ws, size_t index) -> HistogramY & { return ws->mutableY(index); }; @@ -360,7 +361,7 @@ void loadData2D(H5::Group &dataGroup, //----------------------------------------- // Load the Idev value auto eDataSet = dataGroup.openDataSet(sasDataIdev); - auto eExtractor = [](Mantid::API::MatrixWorkspace_sptr ws, + auto eExtractor = [](const Mantid::API::MatrixWorkspace_sptr &ws, size_t index) -> HistogramE & { return ws->mutableE(index); }; @@ -369,7 +370,7 @@ void loadData2D(H5::Group &dataGroup, //----------------------------------------- // Load the Qx value + units auto qxDataSet = dataGroup.openDataSet(sasDataQx); - auto qxExtractor = [](Mantid::API::MatrixWorkspace_sptr ws, + auto qxExtractor = [](const Mantid::API::MatrixWorkspace_sptr &ws, size_t index) -> HistogramX & { return ws->mutableX(index); }; @@ -384,7 +385,8 @@ void loadData2D(H5::Group &dataGroup, readQyInto2DWorkspace(qyDataSet, workspace, qyDataType); } -void loadData(H5::Group &entry, Mantid::API::MatrixWorkspace_sptr workspace) { +void loadData(H5::Group &entry, + const Mantid::API::MatrixWorkspace_sptr &workspace) { auto dataGroup = entry.openGroup(sasDataGroupName); auto dimensionality = getWorkspaceDimensionality(dataGroup); switch (dimensionality) { @@ -433,7 +435,7 @@ bool hasTransmissionEntry(H5::Group &entry, const std::string &name) { } void loadTransmissionData(H5::Group &transmission, - Mantid::API::MatrixWorkspace_sptr workspace) { + const Mantid::API::MatrixWorkspace_sptr &workspace) { //----------------------------------------- // Load T workspace->mutableY(0) = diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index 3e44d7f2aba8a9af6ac34e194aeb2bb940963164..5e328a533e060bf7c39a579f742fa008ae86e623 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -549,7 +549,7 @@ void LoadNexusLogs::exec() { */ void LoadNexusLogs::loadVetoPulses( ::NeXus::File &file, - boost::shared_ptr workspace) const { + const boost::shared_ptr &workspace) const { try { file.openGroup("Veto_pulse", "NXgroup"); } catch (::NeXus::Exception &) { @@ -583,7 +583,7 @@ void LoadNexusLogs::loadVetoPulses( void LoadNexusLogs::loadNPeriods( ::NeXus::File &file, - boost::shared_ptr workspace) const { + const boost::shared_ptr &workspace) const { int value = 1; // Default to 1-period unless try { file.openGroup("periods", "IXperiods"); @@ -648,7 +648,7 @@ void LoadNexusLogs::loadNPeriods( void LoadNexusLogs::loadLogs( ::NeXus::File &file, const std::string &entry_name, const std::string &entry_class, - boost::shared_ptr workspace) const { + const boost::shared_ptr &workspace) const { file.openGroup(entry_name, entry_class); std::map entries = file.getEntries(); std::map::const_iterator iend = entries.end(); @@ -677,7 +677,7 @@ void LoadNexusLogs::loadLogs( void LoadNexusLogs::loadNXLog( ::NeXus::File &file, const std::string &entry_name, const std::string &entry_class, - boost::shared_ptr workspace) const { + const boost::shared_ptr &workspace) const { g_log.debug() << "processing " << entry_name << ":" << entry_class << "\n"; file.openGroup(entry_name, entry_class); @@ -715,7 +715,7 @@ void LoadNexusLogs::loadNXLog( */ void LoadNexusLogs::loadSELog( ::NeXus::File &file, const std::string &entry_name, - boost::shared_ptr workspace) const { + const boost::shared_ptr &workspace) const { // Open the entry file.openGroup(entry_name, "IXseblock"); std::string propName = entry_name; diff --git a/Framework/DataHandling/src/LoadNexusMonitors2.cpp b/Framework/DataHandling/src/LoadNexusMonitors2.cpp index 494bf5036de70680747e9d2c955310c091b65bee..8abcaf1e5414537d323b58731dc580afdfe75f5e 100644 --- a/Framework/DataHandling/src/LoadNexusMonitors2.cpp +++ b/Framework/DataHandling/src/LoadNexusMonitors2.cpp @@ -47,7 +47,7 @@ DECLARE_ALGORITHM(LoadNexusMonitors2) namespace { void loadSampleDataISIScompatibilityInfo( - ::NeXus::File &file, Mantid::API::MatrixWorkspace_sptr const WS) { + ::NeXus::File &file, Mantid::API::MatrixWorkspace_sptr const &WS) { try { file.openGroup("isis_vms_compat", "IXvms"); } catch (::NeXus::Exception &) { @@ -403,8 +403,9 @@ void LoadNexusMonitors2::fixUDets(::NeXus::File &file) { } } -void LoadNexusMonitors2::runLoadLogs(const std::string filename, - API::MatrixWorkspace_sptr localWorkspace) { +void LoadNexusMonitors2::runLoadLogs( + const std::string &filename, + const API::MatrixWorkspace_sptr &localWorkspace) { // do the actual work API::IAlgorithm_sptr loadLogs = createChildAlgorithm("LoadNexusLogs"); diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp index 270d6e2edd89b7c3203467e7f2e2aba9890524c8..beb8c91a4dc5412d098c51e5f0e088aeeba48cbc 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -156,7 +156,7 @@ SpectraInfo extractMappingInfo(NXEntry &mtd_entry, Logger &logger) { * @param log : Information logger object * @return True only if multiperiod. */ -bool isMultiPeriodFile(int nWorkspaceEntries, Workspace_sptr sampleWS, +bool isMultiPeriodFile(int nWorkspaceEntries, const Workspace_sptr &sampleWS, Logger &log) { bool isMultiPeriod = false; if (ExperimentInfo_sptr expInfo = @@ -1736,7 +1736,7 @@ std::map LoadNexusProcessed::validateInputs() { * @param data :: reference to the NeXuS data for the axis */ void LoadNexusProcessed::loadNonSpectraAxis( - API::MatrixWorkspace_sptr local_workspace, NXData &data) { + const API::MatrixWorkspace_sptr &local_workspace, NXData &data) { Axis *axis = local_workspace->getAxis(1); if (axis->isNumeric()) { @@ -1773,7 +1773,7 @@ void LoadNexusProcessed::loadNonSpectraAxis( * @param elem1 :: first element in the vector * @param elem2 :: second element in the vecor */ -bool UDlesserExecCount(NXClassInfo elem1, NXClassInfo elem2) { +bool UDlesserExecCount(const NXClassInfo &elem1, const NXClassInfo &elem2) { std::string::size_type index1, index2; std::string num1, num2; // find the number after "_" in algorithm name ( eg:MantidAlogorthm_1) @@ -1859,7 +1859,7 @@ void LoadNexusProcessed::getWordsInString(const std::string &words4, * @param local_workspace :: The workspace to read into */ void LoadNexusProcessed::readBinMasking( - NXData &wksp_cls, API::MatrixWorkspace_sptr local_workspace) { + NXData &wksp_cls, const API::MatrixWorkspace_sptr &local_workspace) { if (wksp_cls.getDataSetInfo("masked_spectra").stat == NX_ERROR) { return; } @@ -1897,12 +1897,11 @@ void LoadNexusProcessed::readBinMasking( * @param hist :: The workspace index to start reading into * @param local_workspace :: A pointer to the workspace */ -void LoadNexusProcessed::loadBlock(NXDataSetTyped &data, - NXDataSetTyped &errors, - NXDataSetTyped &farea, bool hasFArea, - NXDouble &xErrors, bool hasXErrors, - int blocksize, int nchannels, int &hist, - API::MatrixWorkspace_sptr local_workspace) { +void LoadNexusProcessed::loadBlock( + NXDataSetTyped &data, NXDataSetTyped &errors, + NXDataSetTyped &farea, bool hasFArea, NXDouble &xErrors, + bool hasXErrors, int blocksize, int nchannels, int &hist, + const API::MatrixWorkspace_sptr &local_workspace) { data.load(blocksize, hist); errors.load(blocksize, hist); double *data_start = data(); @@ -1979,13 +1978,11 @@ void LoadNexusProcessed::loadBlock(NXDataSetTyped &data, * @param local_workspace :: A pointer to the workspace */ -void LoadNexusProcessed::loadBlock(NXDataSetTyped &data, - NXDataSetTyped &errors, - NXDataSetTyped &farea, bool hasFArea, - NXDouble &xErrors, bool hasXErrors, - int blocksize, int nchannels, int &hist, - int &wsIndex, - API::MatrixWorkspace_sptr local_workspace) { +void LoadNexusProcessed::loadBlock( + NXDataSetTyped &data, NXDataSetTyped &errors, + NXDataSetTyped &farea, bool hasFArea, NXDouble &xErrors, + bool hasXErrors, int blocksize, int nchannels, int &hist, int &wsIndex, + const API::MatrixWorkspace_sptr &local_workspace) { data.load(blocksize, hist); errors.load(blocksize, hist); double *data_start = data(); @@ -2062,13 +2059,11 @@ void LoadNexusProcessed::loadBlock(NXDataSetTyped &data, * @param wsIndex :: The workspace index to save data into * @param local_workspace :: A pointer to the workspace */ -void LoadNexusProcessed::loadBlock(NXDataSetTyped &data, - NXDataSetTyped &errors, - NXDataSetTyped &farea, bool hasFArea, - NXDouble &xErrors, bool hasXErrors, - NXDouble &xbins, int blocksize, - int nchannels, int &hist, int &wsIndex, - API::MatrixWorkspace_sptr local_workspace) { +void LoadNexusProcessed::loadBlock( + NXDataSetTyped &data, NXDataSetTyped &errors, + NXDataSetTyped &farea, bool hasFArea, NXDouble &xErrors, + bool hasXErrors, NXDouble &xbins, int blocksize, int nchannels, int &hist, + int &wsIndex, const API::MatrixWorkspace_sptr &local_workspace) { data.load(blocksize, hist); double *data_start = data(); double *data_end = data_start + nchannels; diff --git a/Framework/DataHandling/src/LoadOff.cpp b/Framework/DataHandling/src/LoadOff.cpp index 1ef80513f9ff17d0ebca2d6d41056671af8fe5d6..f67ce2dacaa1c14629d2ca915f350c2b6ce1ae06 100644 --- a/Framework/DataHandling/src/LoadOff.cpp +++ b/Framework/DataHandling/src/LoadOff.cpp @@ -15,7 +15,7 @@ namespace Mantid { namespace DataHandling { -LoadOff::LoadOff(std::string filename, ScaleUnits scaleType) +LoadOff::LoadOff(const std::string &filename, ScaleUnits scaleType) : MeshFileIO(scaleType) { m_file = std::ifstream(filename.c_str()); if (!m_file) { diff --git a/Framework/DataHandling/src/LoadPDFgetNFile.cpp b/Framework/DataHandling/src/LoadPDFgetNFile.cpp index 2a934c4cfb37ac4c26a19f85444d6a8d9ef97dc5..6f6fec0ad9add2cdb6b6ba94b1d07ceccca9749e 100644 --- a/Framework/DataHandling/src/LoadPDFgetNFile.cpp +++ b/Framework/DataHandling/src/LoadPDFgetNFile.cpp @@ -106,7 +106,7 @@ void LoadPDFgetNFile::exec() { * 1. a 2D vector for column data * 2. a 1D string vector for column name */ -void LoadPDFgetNFile::parseDataFile(std::string filename) { +void LoadPDFgetNFile::parseDataFile(const std::string &filename) { // 1. Open file std::ifstream ifile; ifile.open((filename.c_str())); @@ -257,7 +257,7 @@ void LoadPDFgetNFile::parseDataLine(string line) { } //---------------------------------------------------------------------------------------------- -void LoadPDFgetNFile::setUnit(Workspace2D_sptr ws) { +void LoadPDFgetNFile::setUnit(const Workspace2D_sptr &ws) { // 1. Set X string xcolname = mColumnNames[0]; diff --git a/Framework/DataHandling/src/LoadPSIMuonBin.cpp b/Framework/DataHandling/src/LoadPSIMuonBin.cpp index e720abdfb82f0e6796fa4acb6ac46f3bcbd0b20a..c0895643e2b450325011680d68cee27c632c16a2 100644 --- a/Framework/DataHandling/src/LoadPSIMuonBin.cpp +++ b/Framework/DataHandling/src/LoadPSIMuonBin.cpp @@ -234,8 +234,8 @@ void LoadPSIMuonBin::makeDeadTimeTable(const size_t &numSpec) { setProperty("DeadTimeTable", deadTimeTable); } -std::string LoadPSIMuonBin::getFormattedDateTime(std::string date, - std::string time) { +std::string LoadPSIMuonBin::getFormattedDateTime(const std::string &date, + const std::string &time) { std::string year; if (date.size() == 11) { year = date.substr(7, 4); diff --git a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp index d674efbbbee724610fe4e1feded2defb73e9c32e..29dd9cca6fb69bdac16d481d8f35ba12b6e03f21 100644 --- a/Framework/DataHandling/src/LoadPreNexusMonitors.cpp +++ b/Framework/DataHandling/src/LoadPreNexusMonitors.cpp @@ -226,7 +226,7 @@ void LoadPreNexusMonitors::exec() { * geometry */ void LoadPreNexusMonitors::runLoadInstrument( - const std::string &instrument, MatrixWorkspace_sptr localWorkspace) { + const std::string &instrument, const MatrixWorkspace_sptr &localWorkspace) { IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument"); diff --git a/Framework/DataHandling/src/LoadRKH.cpp b/Framework/DataHandling/src/LoadRKH.cpp index 2e31b6cb0f8db6551f6e87828395734d33925742..dcaa1c1d5847562c917e8a894f87c3bd71be710f 100644 --- a/Framework/DataHandling/src/LoadRKH.cpp +++ b/Framework/DataHandling/src/LoadRKH.cpp @@ -585,7 +585,7 @@ void LoadRKH::skipLines(std::istream &strm, int nlines) { * @param[out] toCenter an array that is one shorter than oldBoundaries, the * values of the means of pairs of values from the input */ -void LoadRKH::binCenter(const MantidVec oldBoundaries, +void LoadRKH::binCenter(const MantidVec &oldBoundaries, MantidVec &toCenter) const { VectorHelper::convertToBinCentre(oldBoundaries, toCenter); } diff --git a/Framework/DataHandling/src/LoadRaw3.cpp b/Framework/DataHandling/src/LoadRaw3.cpp index 13f5d13647f9625ab0453a0fc74b40dee68d33fe..a964ca6db5f6d4c947247cf905541e57dffdbeac 100644 --- a/Framework/DataHandling/src/LoadRaw3.cpp +++ b/Framework/DataHandling/src/LoadRaw3.cpp @@ -311,7 +311,7 @@ void LoadRaw3::exec() { */ void LoadRaw3::excludeMonitors(FILE *file, const int &period, const std::vector &monitorList, - DataObjects::Workspace2D_sptr ws_sptr) { + const DataObjects::Workspace2D_sptr &ws_sptr) { int64_t histCurrent = -1; int64_t wsIndex = 0; auto histTotal = static_cast(m_total_specs * m_numberOfPeriods); @@ -358,7 +358,7 @@ void LoadRaw3::excludeMonitors(FILE *file, const int &period, *@param ws_sptr :: shared pointer to workspace */ void LoadRaw3::includeMonitors(FILE *file, const int64_t &period, - DataObjects::Workspace2D_sptr ws_sptr) { + const DataObjects::Workspace2D_sptr &ws_sptr) { int64_t histCurrent = -1; int64_t wsIndex = 0; @@ -404,8 +404,8 @@ void LoadRaw3::includeMonitors(FILE *file, const int64_t &period, void LoadRaw3::separateMonitors(FILE *file, const int64_t &period, const std::vector &monitorList, - DataObjects::Workspace2D_sptr ws_sptr, - DataObjects::Workspace2D_sptr mws_sptr) { + const DataObjects::Workspace2D_sptr &ws_sptr, + const DataObjects::Workspace2D_sptr &mws_sptr) { int64_t histCurrent = -1; int64_t wsIndex = 0; int64_t mwsIndex = 0; diff --git a/Framework/DataHandling/src/LoadRawHelper.cpp b/Framework/DataHandling/src/LoadRawHelper.cpp index 83682479d5d30ec5d87b9e74ec490bcea3dc4e3d..49410e7ce21bf7ac8ee03675c71922ed6d050338 100644 --- a/Framework/DataHandling/src/LoadRawHelper.cpp +++ b/Framework/DataHandling/src/LoadRawHelper.cpp @@ -216,7 +216,7 @@ void LoadRawHelper::readworkspaceParameters(specnum_t &numberOfSpectra, * @return an empty workspace of the given parameters */ DataObjects::Workspace2D_sptr -LoadRawHelper::createWorkspace(DataObjects::Workspace2D_sptr ws_sptr, +LoadRawHelper::createWorkspace(const DataObjects::Workspace2D_sptr &ws_sptr, int64_t nVectors, int64_t xLengthIn, int64_t yLengthIn) { DataObjects::Workspace2D_sptr empty; @@ -270,7 +270,7 @@ void LoadRawHelper::createMonitorWorkspace( DataObjects::Workspace2D_sptr &normalws_sptr, WorkspaceGroup_sptr &mongrp_sptr, const int64_t mwsSpecs, const int64_t nwsSpecs, const int64_t numberOfPeriods, - const int64_t lengthIn, const std::string title, + const int64_t lengthIn, const std::string &title, API::Algorithm *const pAlg) { try { // create monitor group workspace @@ -328,10 +328,10 @@ void LoadRawHelper::exec() {} * @param bmonitors :: boolean flag to name the workspaces * @param pAlg :: pointer to algorithm this method works with. */ -void LoadRawHelper::setWorkspaceProperty(DataObjects::Workspace2D_sptr ws_sptr, - WorkspaceGroup_sptr grpws_sptr, - const int64_t period, bool bmonitors, - API::Algorithm *const pAlg) { +void LoadRawHelper::setWorkspaceProperty( + const DataObjects::Workspace2D_sptr &ws_sptr, + const WorkspaceGroup_sptr &grpws_sptr, const int64_t period, bool bmonitors, + API::Algorithm *const pAlg) { if (!ws_sptr) return; if (!grpws_sptr) @@ -366,12 +366,11 @@ void LoadRawHelper::setWorkspaceProperty(DataObjects::Workspace2D_sptr ws_sptr, * workspace * @param pAlg :: pointer to algorithm this method works with. */ -void LoadRawHelper::setWorkspaceProperty(const std::string &propertyName, - const std::string &title, - WorkspaceGroup_sptr grpws_sptr, - DataObjects::Workspace2D_sptr ws_sptr, - int64_t numberOfPeriods, bool bMonitor, - API::Algorithm *const pAlg) { +void LoadRawHelper::setWorkspaceProperty( + const std::string &propertyName, const std::string &title, + const WorkspaceGroup_sptr &grpws_sptr, + const DataObjects::Workspace2D_sptr &ws_sptr, int64_t numberOfPeriods, + bool bMonitor, API::Algorithm *const pAlg) { UNUSED_ARG(bMonitor); Property *ws = pAlg->getProperty("OutputWorkspace"); if (!ws) @@ -401,7 +400,7 @@ void LoadRawHelper::setWorkspaceProperty(const std::string &propertyName, * @param binStart :: start of bin */ void LoadRawHelper::setWorkspaceData( - DataObjects::Workspace2D_sptr newWorkspace, + const DataObjects::Workspace2D_sptr &newWorkspace, const std::vector> &timeChannelsVec, int64_t wsIndex, specnum_t nspecNum, int64_t noTimeRegimes, @@ -544,8 +543,9 @@ LoadRawHelper::getTimeChannels(const int64_t ®imes, /// @param progStart :: progress at start /// @param progEnd :: progress at end void LoadRawHelper::runLoadInstrument( - const std::string &fileName, DataObjects::Workspace2D_sptr localWorkspace, - double progStart, double progEnd) { + const std::string &fileName, + const DataObjects::Workspace2D_sptr &localWorkspace, double progStart, + double progEnd) { g_log.debug("Loading the instrument definition..."); m_prog = progStart; progress(m_prog, "Loading the instrument geometry..."); @@ -631,7 +631,8 @@ void LoadRawHelper::runLoadInstrument( /// @param fileName :: the raw file filename /// @param localWorkspace :: The workspace to load the instrument for void LoadRawHelper::runLoadInstrumentFromRaw( - const std::string &fileName, DataObjects::Workspace2D_sptr localWorkspace) { + const std::string &fileName, + const DataObjects::Workspace2D_sptr &localWorkspace) { IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrumentFromRaw"); loadInst->setPropertyValue("Filename", fileName); // Set the workspace property to be the same one filled above @@ -659,7 +660,8 @@ void LoadRawHelper::runLoadInstrumentFromRaw( /// @param fileName :: the raw file filename /// @param localWorkspace :: The workspace to load the mapping table for void LoadRawHelper::runLoadMappingTable( - const std::string &fileName, DataObjects::Workspace2D_sptr localWorkspace) { + const std::string &fileName, + const DataObjects::Workspace2D_sptr &localWorkspace) { g_log.debug("Loading the spectra-detector mapping..."); progress(m_prog, "Loading the spectra-detector mapping..."); // Now determine the spectra to detector map calling Child Algorithm @@ -685,9 +687,10 @@ void LoadRawHelper::runLoadMappingTable( /// @param localWorkspace :: The workspace to load the logs for /// @param progStart :: starting progress fraction /// @param progEnd :: ending progress fraction -void LoadRawHelper::runLoadLog(const std::string &fileName, - DataObjects::Workspace2D_sptr localWorkspace, - double progStart, double progEnd) { +void LoadRawHelper::runLoadLog( + const std::string &fileName, + const DataObjects::Workspace2D_sptr &localWorkspace, double progStart, + double progEnd) { // search for the log file to load, and save their names in a set. std::list logFiles = searchForLogFiles(fileName); @@ -773,7 +776,7 @@ std::string LoadRawHelper::extractLogName(const std::string &path) { * @param local_workspace :: workspace to add period log data to. */ void LoadRawHelper::createPeriodLogs( - int64_t period, DataObjects::Workspace2D_sptr local_workspace) { + int64_t period, const DataObjects::Workspace2D_sptr &local_workspace) { m_logCreator->addPeriodLogs(static_cast(period), local_workspace->mutableRun()); } @@ -785,8 +788,9 @@ void LoadRawHelper::createPeriodLogs( * @param localWorkspace :: The workspace to attach the information to * @param rawFile :: The handle to an ISIS Raw file */ -void LoadRawHelper::loadRunParameters(API::MatrixWorkspace_sptr localWorkspace, - ISISRAW *const rawFile) const { +void LoadRawHelper::loadRunParameters( + const API::MatrixWorkspace_sptr &localWorkspace, + ISISRAW *const rawFile) const { ISISRAW &localISISRaw = [this, rawFile]() -> ISISRAW & { if (rawFile) return *rawFile; @@ -1098,8 +1102,9 @@ void LoadRawHelper::calculateWorkspacesizes( void LoadRawHelper::loadSpectra( FILE *file, const int &period, const int &total_specs, - DataObjects::Workspace2D_sptr ws_sptr, - std::vector> timeChannelsVec) { + const DataObjects::Workspace2D_sptr &ws_sptr, + const std::vector> + &timeChannelsVec) { double progStart = m_prog; double progEnd = 1.0; // Assume this function is called last diff --git a/Framework/DataHandling/src/LoadSPE.cpp b/Framework/DataHandling/src/LoadSPE.cpp index 11218db3a9ad05f93c688993d9468ad8d966e1f6..791b44ecdf01f8d7179d9e6c3f28ecb5b7d913ce 100644 --- a/Framework/DataHandling/src/LoadSPE.cpp +++ b/Framework/DataHandling/src/LoadSPE.cpp @@ -185,7 +185,8 @@ void LoadSPE::exec() { * @param workspace :: The output workspace * @param index :: The index of the current spectrum */ -void LoadSPE::readHistogram(FILE *speFile, API::MatrixWorkspace_sptr workspace, +void LoadSPE::readHistogram(FILE *speFile, + const API::MatrixWorkspace_sptr &workspace, size_t index) { // First, there should be a comment line char comment[100]; diff --git a/Framework/DataHandling/src/LoadSampleShape.cpp b/Framework/DataHandling/src/LoadSampleShape.cpp index 7e438fe4976fdefdc9225aad6a6772faa65aa685..1ab9f5ac533c4e64934fd78f45845e251020280d 100644 --- a/Framework/DataHandling/src/LoadSampleShape.cpp +++ b/Framework/DataHandling/src/LoadSampleShape.cpp @@ -99,7 +99,7 @@ void LoadSampleShape::exec() { * @param inputWS The workspace to get the rotation from * @returns a shared pointer to the newly rotated Shape */ -void rotate(MeshObject &sampleMesh, MatrixWorkspace_const_sptr inputWS) { +void rotate(MeshObject &sampleMesh, const MatrixWorkspace_const_sptr &inputWS) { const std::vector rotationMatrix = inputWS->run().getGoniometer().getR(); sampleMesh.rotate(rotationMatrix); diff --git a/Framework/DataHandling/src/LoadSassena.cpp b/Framework/DataHandling/src/LoadSassena.cpp index 95ebc7333d7514046aa51934505d7a0d5bc5c130..0635840afa17101d9d464afeec450e8e34fe8e27 100644 --- a/Framework/DataHandling/src/LoadSassena.cpp +++ b/Framework/DataHandling/src/LoadSassena.cpp @@ -20,6 +20,8 @@ #include +#include + namespace Mantid { namespace DataHandling { @@ -47,9 +49,9 @@ int LoadSassena::confidence(Kernel::NexusDescriptor &descriptor) const { * @param ws pointer to workspace to be added and registered * @param description */ -void LoadSassena::registerWorkspace(API::WorkspaceGroup_sptr gws, - const std::string wsName, - DataObjects::Workspace2D_sptr ws, +void LoadSassena::registerWorkspace(const API::WorkspaceGroup_sptr &gws, + const std::string &wsName, + const DataObjects::Workspace2D_sptr &ws, const std::string &description) { UNUSED_ARG(description); API::AnalysisDataService::Instance().add(wsName, ws); @@ -63,7 +65,7 @@ void LoadSassena::registerWorkspace(API::WorkspaceGroup_sptr gws, * @param dims storing dimensionality */ -herr_t LoadSassena::dataSetInfo(const hid_t &h5file, const std::string setName, +herr_t LoadSassena::dataSetInfo(const hid_t &h5file, const std::string &setName, hsize_t *dims) const { H5T_class_t class_id; size_t type_size; @@ -82,7 +84,7 @@ herr_t LoadSassena::dataSetInfo(const hid_t &h5file, const std::string setName, * @param buf storing dataset */ herr_t LoadSassena::dataSetDouble(const hid_t &h5file, - const std::string setName, + const std::string &setName, std::vector &buf) { herr_t errorcode = H5LTread_dataset_double(h5file, setName.c_str(), buf.data()); @@ -110,7 +112,8 @@ bool compare(const mypair &left, const mypair &right) { * increasing order of momemtum transfer */ HistogramData::Points -LoadSassena::loadQvectors(const hid_t &h5file, API::WorkspaceGroup_sptr gws, +LoadSassena::loadQvectors(const hid_t &h5file, + const API::WorkspaceGroup_sptr &gws, std::vector &sorting_indexes) { // store the modulus of the vector @@ -169,7 +172,8 @@ LoadSassena::loadQvectors(const hid_t &h5file, API::WorkspaceGroup_sptr gws, "MomentumTransfer"); // Set the Units this->registerWorkspace( - gws, wsName, ws, "X-axis: origin of Q-vectors; Y-axis: tip of Q-vectors"); + std::move(gws), wsName, ws, + "X-axis: origin of Q-vectors; Y-axis: tip of Q-vectors"); return HistogramData::Points(std::move(qvmod)); } @@ -184,8 +188,9 @@ LoadSassena::loadQvectors(const hid_t &h5file, API::WorkspaceGroup_sptr gws, * @param sorting_indexes permutation of qvmod indexes to render it in * increasing order of momemtum transfer */ -void LoadSassena::loadFQ(const hid_t &h5file, API::WorkspaceGroup_sptr gws, - const std::string setName, +void LoadSassena::loadFQ(const hid_t &h5file, + const API::WorkspaceGroup_sptr &gws, + const std::string &setName, const HistogramData::Points &qvmod, const std::vector &sorting_indexes) { @@ -221,7 +226,7 @@ void LoadSassena::loadFQ(const hid_t &h5file, API::WorkspaceGroup_sptr gws, Kernel::UnitFactory::Instance().create("MomentumTransfer"); this->registerWorkspace( - gws, wsName, ws, + std::move(gws), wsName, ws, "X-axis: Q-vector modulus; Y-axis: intermediate structure factor"); } @@ -238,8 +243,9 @@ void LoadSassena::loadFQ(const hid_t &h5file, API::WorkspaceGroup_sptr gws, * @param sorting_indexes permutation of qvmod indexes to render it in * increasing order of momemtum transfer */ -void LoadSassena::loadFQT(const hid_t &h5file, API::WorkspaceGroup_sptr gws, - const std::string setName, +void LoadSassena::loadFQT(const hid_t &h5file, + const API::WorkspaceGroup_sptr &gws, + const std::string &setName, const HistogramData::Points &qvmod, const std::vector &sorting_indexes) { diff --git a/Framework/DataHandling/src/LoadSpice2D.cpp b/Framework/DataHandling/src/LoadSpice2D.cpp index 34287f8771884a5a17f872282cc687e15f6003f2..0b71b10809625963f8b46093e64cab6cc372cc79 100644 --- a/Framework/DataHandling/src/LoadSpice2D.cpp +++ b/Framework/DataHandling/src/LoadSpice2D.cpp @@ -80,8 +80,9 @@ bool from_string(T &t, const std::string &s, * @param wavelength: wavelength value [Angstrom] * @param dwavelength: error on the wavelength [Angstrom] */ -void store_value(DataObjects::Workspace2D_sptr ws, int specID, double value, - double error, double wavelength, double dwavelength) { +void store_value(const DataObjects::Workspace2D_sptr &ws, int specID, + double value, double error, double wavelength, + double dwavelength) { auto &X = ws->mutableX(specID); auto &Y = ws->mutableY(specID); auto &E = ws->mutableE(specID); @@ -659,7 +660,7 @@ void LoadSpice2D::detectorTranslation( */ void LoadSpice2D::runLoadInstrument( const std::string &inst_name, - DataObjects::Workspace2D_sptr localWorkspace) { + const DataObjects::Workspace2D_sptr &localWorkspace) { API::IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument"); diff --git a/Framework/DataHandling/src/LoadSpiceAscii.cpp b/Framework/DataHandling/src/LoadSpiceAscii.cpp index a2ddfae114427b84875c396b3a2e34552d2981eb..d95e776cdeb1d5d3f0be6b480b9ef259b9312f79 100644 --- a/Framework/DataHandling/src/LoadSpiceAscii.cpp +++ b/Framework/DataHandling/src/LoadSpiceAscii.cpp @@ -436,7 +436,7 @@ LoadSpiceAscii::createRunInfoWS(std::map runinfodict, * @param datetimeprop */ void LoadSpiceAscii::setupRunStartTime( - API::MatrixWorkspace_sptr runinfows, + const API::MatrixWorkspace_sptr &runinfows, const std::vector &datetimeprop) { // Check if no need to process run start time if (datetimeprop.empty()) { @@ -596,7 +596,7 @@ std::string LoadSpiceAscii::processTimeString(const std::string &rawtime, * @param pvalue */ template -void LoadSpiceAscii::addProperty(API::MatrixWorkspace_sptr ws, +void LoadSpiceAscii::addProperty(const API::MatrixWorkspace_sptr &ws, const std::string &pname, T pvalue) { ws->mutableRun().addLogData(new PropertyWithValue(pname, pvalue)); } diff --git a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp index 5ccd00dee3a0f1c87021638ad836b75e7ccd2d06..5efadb955db9087b94c295d663f3601a3ada2c97 100644 --- a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp +++ b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp @@ -283,7 +283,8 @@ void LoadSpiceXML2DDet::processInputs() { * @param outws :: workspace to have sample logs to set up * @return */ -bool LoadSpiceXML2DDet::setupSampleLogs(API::MatrixWorkspace_sptr outws) { +bool LoadSpiceXML2DDet::setupSampleLogs( + const API::MatrixWorkspace_sptr &outws) { // With given spice scan table, 2-theta is read from there. if (m_hasScanTable) { ITableWorkspace_sptr spicetablews = getProperty("SpiceTableWorkspace"); @@ -938,8 +939,8 @@ API::MatrixWorkspace_sptr LoadSpiceXML2DDet::xmlParseDetectorNode( * @param ptnumber */ void LoadSpiceXML2DDet::setupSampleLogFromSpiceTable( - MatrixWorkspace_sptr matrixws, ITableWorkspace_sptr spicetablews, - int ptnumber) { + const MatrixWorkspace_sptr &matrixws, + const ITableWorkspace_sptr &spicetablews, int ptnumber) { size_t numrows = spicetablews->rowCount(); std::vector colnames = spicetablews->getColumnNames(); // FIXME - Shouldn't give a better value? @@ -978,7 +979,7 @@ void LoadSpiceXML2DDet::setupSampleLogFromSpiceTable( * @param wavelength * @return */ -bool LoadSpiceXML2DDet::getHB3AWavelength(MatrixWorkspace_sptr dataws, +bool LoadSpiceXML2DDet::getHB3AWavelength(const MatrixWorkspace_sptr &dataws, double &wavelength) { bool haswavelength(false); wavelength = -1.; @@ -1043,7 +1044,7 @@ bool LoadSpiceXML2DDet::getHB3AWavelength(MatrixWorkspace_sptr dataws, * @param dataws * @param wavelength */ -void LoadSpiceXML2DDet::setXtoLabQ(API::MatrixWorkspace_sptr dataws, +void LoadSpiceXML2DDet::setXtoLabQ(const API::MatrixWorkspace_sptr &dataws, const double &wavelength) { size_t numspec = dataws->getNumberHistograms(); diff --git a/Framework/DataHandling/src/LoadTBL.cpp b/Framework/DataHandling/src/LoadTBL.cpp index 5f8d2412c644d9ca236eb308f79490eeef08c1f2..32b8778f367e9e648c7ffa43de25c71e8545daca 100644 --- a/Framework/DataHandling/src/LoadTBL.cpp +++ b/Framework/DataHandling/src/LoadTBL.cpp @@ -81,7 +81,7 @@ int LoadTBL::confidence(Kernel::FileDescriptor &descriptor) const { * @param line the line to count from * @returns a size_t of how many commas were in line */ -size_t LoadTBL::countCommas(std::string line) const { +size_t LoadTBL::countCommas(const std::string &line) const { size_t found = 0; size_t pos = line.find(',', 0); if (pos != std::string::npos) { @@ -104,7 +104,7 @@ size_t LoadTBL::countCommas(std::string line) const { * @returns a size_t of how many pairs of quotes were in line */ size_t -LoadTBL::findQuotePairs(std::string line, +LoadTBL::findQuotePairs(const std::string &line, std::vector> "eBounds) const { size_t quoteOne = 0; size_t quoteTwo = 0; @@ -137,7 +137,7 @@ LoadTBL::findQuotePairs(std::string line, * @throws std::length_error if anything other than 17 columns (or 16 * cell-delimiting commas) is found */ -void LoadTBL::csvParse(std::string line, std::vector &cols, +void LoadTBL::csvParse(const std::string &line, std::vector &cols, std::vector> "eBounds, size_t expectedCommas) const { size_t pairID = 0; diff --git a/Framework/DataHandling/src/LoadTOFRawNexus.cpp b/Framework/DataHandling/src/LoadTOFRawNexus.cpp index 6e4674f1c1c054da97d1a59354cd7a4b0365b6e2..70e95229d386aa2235aa911d7854350fdd623fa3 100644 --- a/Framework/DataHandling/src/LoadTOFRawNexus.cpp +++ b/Framework/DataHandling/src/LoadTOFRawNexus.cpp @@ -20,6 +20,7 @@ #include #include +#include namespace Mantid { namespace DataHandling { @@ -267,7 +268,7 @@ namespace { // Check the numbers supplied are not in the range and erase the ones that are struct range_check { range_check(specnum_t min, specnum_t max, detid2index_map id_to_wi) - : m_min(min), m_max(max), m_id_to_wi(id_to_wi) {} + : m_min(min), m_max(max), m_id_to_wi(std::move(id_to_wi)) {} bool operator()(specnum_t x) { auto wi = static_cast((m_id_to_wi)[x]); @@ -292,7 +293,7 @@ private: void LoadTOFRawNexus::loadBank(const std::string &nexusfilename, const std::string &entry_name, const std::string &bankName, - API::MatrixWorkspace_sptr WS, + const API::MatrixWorkspace_sptr &WS, const detid2index_map &id_to_wi) { g_log.debug() << "Loading bank " << bankName << '\n'; // To avoid segfaults on RHEL5/6 and Fedora diff --git a/Framework/DataHandling/src/MaskDetectors.cpp b/Framework/DataHandling/src/MaskDetectors.cpp index 6e361b54a98b2dc6e579a0515558a69a03c4817a..1661e4a4605111cc81bbb257a0248d27493cd18a 100644