Skip to content

Commit

Permalink
refs #4201 changed Oriented lattice carried forward to target ws
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Jan 17, 2012
1 parent 33181bb commit dfd255e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class ConvertToMDEvensEventWS: public IConvertToMDEventsMethods
size_t nValidSpectra = this->pDetLoc->det_id.size();
// copy experiment info into target workspace
API::ExperimentInfo_sptr ExperimentInfo(inWS2D->cloneExperimentInfo());

// set oriented lattice from workspace description, as this lattice can be modified by algorithm settings;
ExperimentInfo->mutableSample().setOrientedLattice(&TWS.Latt);

// run index;
runIndex = this->pWSWrapper->pWorkspace()->addExperimentInfo(ExperimentInfo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class ConvertToMDEvensHistoWS: public IConvertToMDEventsMethods
size_t nValidSpectra = pDetLoc->det_id.size();
// copy experiment info into target workspace
API::ExperimentInfo_sptr ExperimentInfo(inWS2D->cloneExperimentInfo());
// set oriented lattice from workspace description, as this lattice can be modified by algorithm settings;
ExperimentInfo->mutableSample().setOrientedLattice(&TWS.Latt);
// run index;
uint16_t runIndex = this->pWSWrapper->pWorkspace()->addExperimentInfo(ExperimentInfo);
// number of dimesnions
Expand Down
12 changes: 6 additions & 6 deletions Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,12 @@ ConvertToMDEvents::getTransfMatrix(API::MatrixWorkspace_sptr inWS,MDEvents::MDWS

Kernel::Matrix<double> mat(3,3,true);
Kernel::Matrix<double> umat;
Geometry::OrientedLattice Latt;


bool has_lattice(false);
try{
// try to get the oriented lattice
Latt = inWS->sample().getOrientedLattice();
TargWSDescription.Latt = inWS->sample().getOrientedLattice();
has_lattice=true;
}catch(std::runtime_error &){
if(!is_powder){
Expand All @@ -716,12 +716,12 @@ ConvertToMDEvents::getTransfMatrix(API::MatrixWorkspace_sptr inWS,MDEvents::MDWS
if(has_lattice){
if(TargWSDescription.is_uv_default){
// we need to set up u,v for axis caption as it defined in UB matrix;
TargWSDescription.u = Latt.getuVector();
TargWSDescription.v = Latt.getvVector();
umat = Latt.getU();
TargWSDescription.u = TargWSDescription.Latt.getuVector();
TargWSDescription.v = TargWSDescription.Latt.getvVector();
umat = TargWSDescription.Latt.getU();
}else{
// thansform the lattice above into the notional coordinate system related to projection vectors u,v;
umat = Latt.setUFromVectors(TargWSDescription.u,TargWSDescription.v);
umat = TargWSDescription.Latt.setUFromVectors(TargWSDescription.u,TargWSDescription.v);
//TODO: This code needs careful verification for non-orthogonal axis
//Latt.setUFromVectors(TargWSDescription.u,TargWSDescription.v);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@

#include "MantidMDEvents/MDEvent.h"
#include "MantidKernel/Logger.h"
#include "MantidGeometry/Crystal/OrientedLattice.h"

namespace Mantid
{
namespace MDEvents
{
/** Lighteweith class wrapping together all parameters, related to MDEventoWorkspace used mainly to reduce number of parameters trasferred between
/** Lighteweith class wrapping together all parameters, related to MDEventoWorkspace description used mainly to reduce number of parameters trasferred between
* an algorithm, creating MD workspace and UI.
* It also defines some auxiliary functions, used for convenient description of MD workspace e.g.
*
* Introduced to decrease code bloat in methods and algorithms, which use MDEvents write interface and run-time defined number of dimensions
@date 2011-28-12
Copyright &copy; 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand Down Expand Up @@ -61,10 +62,12 @@ namespace MDEvents
/** vectors, which describe the projection plain the target ws is based on (notional coordinate system). The transformation matrix below
* should bring the momentums from lab coordinate system into notional coordinate system */
Kernel::V3D u,v;
/// the indicator, informing if the uv plain has been set. If they are not, the UB matrix from the source workspace has to be used unaltered
/// the indicator, informing if the uv plain has been set as a parameter. If they are not, the UB matrix from the source workspace is be used uncnanged
bool is_uv_default;
/// the matrix to transform momentums of the workspace into notional target coordinate system
std::vector<double> rotMatrix; // should it be the Quat?
/// the oriented lattice which should be picked up from source ws and be carryed out to target ws as it can be modified by u,v on the way.
Geometry::OrientedLattice Latt;
/// helper function checks if min values are less them max values and are consistent between each other
void checkMinMaxNdimConsistent(Mantid::Kernel::Logger& log)const;
/// the vector of default names for Q-directrions in reciprocal space;
Expand Down

0 comments on commit dfd255e

Please sign in to comment.