Skip to content

Commit

Permalink
Start working on MDNormDirectSC. Refs #10698
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiSavici committed Dec 9, 2014
1 parent 0b002bc commit da74966
Show file tree
Hide file tree
Showing 5 changed files with 1,060 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt
Expand Up @@ -40,6 +40,7 @@ set ( SRC_FILES
src/LoadMD.cpp
src/LoadSQW.cpp
src/LogarithmMD.cpp
src/MDNormDirectSC.cpp
src/MDNormSCD.cpp
src/MaskMD.cpp
src/MergeMD.cpp
Expand Down Expand Up @@ -123,6 +124,7 @@ set ( INC_FILES
inc/MantidMDAlgorithms/LoadMD.h
inc/MantidMDAlgorithms/LoadSQW.h
inc/MantidMDAlgorithms/LogarithmMD.h
inc/MantidMDAlgorithms/MDNormDirectSC.h
inc/MantidMDAlgorithms/MDNormSCD.h
inc/MantidMDAlgorithms/MaskMD.h
inc/MantidMDAlgorithms/MergeMD.h
Expand Down Expand Up @@ -205,6 +207,7 @@ set ( TEST_FILES
LoadMDTest.h
LoadSQWTest.h
LogarithmMDTest.h
MDNormDirectSCTest.h
MDNormSCDTest.h
MDResolutionConvolutionFactoryTest.h
MaskMDTest.h
Expand Down
Expand Up @@ -49,7 +49,7 @@ namespace MDAlgorithms

/// limits for h,k,l,dE dimensions
coord_t m_hmin, m_hmax, m_kmin, m_kmax, m_lmin, m_lmax, m_dEmin, m_dEmax;
/// cached values for incident energy and momentum
/// cached values for incident energy and momentum, final momentum min/max
double m_Ei,m_ki, m_kfmin,m_kfmax;
/// flag for integrated h,k,l,dE dimensions
bool m_hIntegrated, m_kIntegrated, m_lIntegrated, m_dEIntegrated;
Expand Down
@@ -0,0 +1,97 @@
#ifndef MANTID_MDALGORITHMS_MDNORMDIRECTSC_H_
#define MANTID_MDALGORITHMS_MDNORMDIRECTSC_H_

#include "MantidAPI/Algorithm.h"
#include "MantidMDAlgorithms/SlicingAlgorithm.h"

namespace Mantid
{
namespace DataObjects
{
class EventWorkspace;
}
namespace MDAlgorithms
{

/** MDNormSCD : Generate MD normalization for single crystal diffraction
Copyright © 2014 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport MDNormDirectSC :public SlicingAlgorithm
{
public:
MDNormDirectSC();

virtual const std::string name() const;
virtual int version() const;
virtual const std::string category() const;
virtual const std::string summary() const;

private:
void init();
void exec();

void cacheInputs();
std::string inputEnergyMode() const;

MDEvents::MDHistoWorkspace_sptr binInputWS();
void createNormalizationWS(const MDEvents::MDHistoWorkspace & dataWS);
std::vector<coord_t> getValuesFromOtherDimensions(bool & skipNormalization) const;
Kernel::Matrix<coord_t> findIntergratedDimensions(const std::vector<coord_t> & otherDimValues,
bool & skipNormalization);
void cacheDimensionXValues();
void calculateNormalization(const std::vector<coord_t> &otherValues,
const Kernel::Matrix<coord_t> &affineTrans);
void calcIntegralsForIntersections( const std::vector<double> &xValues, const API::MatrixWorkspace &integrFlux,
size_t sp, std::vector<double> &yValues ) const;
std::vector<detid_t> removeGroupedIDs(const API::ExperimentInfo & exptInfo,
const std::vector<detid_t> &detIDs);
Geometry::IDetector_const_sptr getThetaPhi(const detid_t detID,
const API::ExperimentInfo & exptInfo,
double &theta, double &phi);
std::vector<Kernel::VMD> calculateIntersections(const double theta, const double phi);

/// Normalization workspace
MDEvents::MDHistoWorkspace_sptr m_normWS;
/// Input workspace
API::IMDEventWorkspace_sptr m_inputWS;
/// limits for h,k,l, dE dimensions
coord_t m_hmin, m_hmax, m_kmin, m_kmax, m_lmin, m_lmax, m_dEmin, m_dEmax;
/// cached values for incident energy and momentum, final momentum min/max
double m_Ei,m_ki, m_kfmin,m_kfmax;
/// flag for integrated h,k,l, dE dimensions
bool m_hIntegrated, m_kIntegrated, m_lIntegrated, m_dEIntegrated;
/// (2*PiRUBW)^-1
Mantid::Kernel::DblMatrix m_rubw;
///index of h,k,l, dE dimensions in the output workspaces
size_t m_hIdx, m_kIdx, m_lIdx, m_eIdx;
/// cached X values along dimensions h,k,l. dE
std::vector<double> m_hX, m_kX, m_lX, m_eX;
/// Sample position
Kernel::V3D m_samplePos;
/// Beam direction
Kernel::V3D m_beamDir;
};

} // namespace MDAlgorithms
} // namespace Mantid

#endif /* MANTID_MDALGORITHMS_MDNORMDIRECTSC_H_ */

0 comments on commit da74966

Please sign in to comment.