51 std::string dEModReq =
getProperty(
"dEAnalysisMode");
53 std::vector<std::string> otherDimNames =
getProperty(
"OtherDimensions");
59 std::string convertTo_ =
getProperty(
"QConversionScales");
74 size_t nDim = nMatrixDim + otherDimNames.size();
76 std::vector<double> MinValues, MaxValues;
77 MinValues.resize(nDim, -FLT_MAX / 10);
78 MaxValues.resize(nDim, FLT_MAX / 10);
81 targWSDescr.
setMinMax(MinValues, MaxValues);
85 targWSDescr.
addProperty(
"EXP_INFO_INDEX", uint16_t(0),
true);
97 }
catch (std::invalid_argument &) {
98 g_log.
error() <<
"The projections are coplanar. Will use defaults "
99 "[1,0,0],[0,1,0] and [0,0,1]\n";
119 std::vector<double> &MaxValues) {
122 double signal(1), errorSq(1);
124 size_t nDims = MinValues.size();
125 MinValues.assign(nDims, DBL_MAX);
126 MaxValues.assign(nDims, -DBL_MAX);
128 auto inWS = WSDescription.
getInWS();
129 std::string convUnitsID = pQtransf->
inputUnitID(iEMode, inWS);
131 unitsConverter.
initialize(WSDescription, convUnitsID);
136 auto nSpectra = WSDescription.
m_PreprDetTable->getLogs()->getPropertyValueAsType<uint32_t>(
"ActualDetectorsNum");
137 auto detIDMap = WSDescription.
m_PreprDetTable->getColVector<
size_t>(
"detIDMap");
140 std::vector<coord_t> locCoord(nDims);
144 for (
size_t i = 0; i <
nSpectra; i++) {
146 size_t iSpctr = detIDMap[i];
154 auto source_range = inWS->getSpectrum(iSpctr).getXDataRange();
157 source_range = unitsConverter.
getConversionRange(source_range.first, source_range.second);
159 double x1 = unitsConverter.
convertUnits(source_range.first);
160 double x2 = unitsConverter.
convertUnits(source_range.second);
164 for (
double &k : range) {
168 for (
size_t j = 0; j < nDims; j++) {
169 if (locCoord[j] < MinValues[j])
170 MinValues[j] = locCoord[j];
171 if (locCoord[j] > MaxValues[j])
172 MaxValues[j] = locCoord[j];
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
void addProperty(Kernel::Property *prop, bool overwrite=false)
Add data to the object in the form of a property.
Support for a property that holds an array of values.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void error(const std::string &msg)
Logs at error level.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
ConvertToMDMinMaxLocal : Algorithm to calculate limits for ConvertToMD.
void findMinMaxValues(MDWSDescription &WSDescription, MDTransfInterface *const pQtransf, Kernel::DeltaEMode::Type iEMode, std::vector< double > &MinValues, std::vector< double > &MaxValues)
void init() override
Virtual method - must be overridden by concrete algorithm.
void exec() override
Execute the algorithm.
DataObjects::TableWorkspace_const_sptr preprocessDetectorsPositions(const Mantid::API::MatrixWorkspace_const_sptr &InWS2D, const std::string &dEModeRequested, bool updateMasks, const std::string &OutWSName)
The method responsible for analyzing input workspace parameters and preprocessing detectors positions...
void init() override
Initialize the algorithm's properties.
Interface to set of sub-classes used by ConvertToMD algorithm and responsible for conversion of input...
virtual bool calcYDepCoordinates(std::vector< coord_t > &Coord, size_t i)=0
generalizes the code to calculate Y-variables within the detector's loop of the workspace
virtual const std::string inputUnitID(Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS) const =0
returns the unit ID for the input units, the particular transformation expects.
virtual bool calcMatrixCoord(const double &X, std::vector< coord_t > &Coord, double &signal, double &errSq) const =0
The method to calculate all remaining coordinates, defined within the inner loop given that the input...
virtual void initialize(const MDWSDescription &)=0
set up transformation from the class, which can provide all variables necessary for the conversion
virtual bool calcGenericVariables(std::vector< coord_t > &Coord, size_t n_ws_variabes)=0
Method deployed out of the loop and calculates all variables needed within the loop.
virtual unsigned int getNMatrixDimensions(Kernel::DeltaEMode::Type mode, API::MatrixWorkspace_const_sptr inWS) const =0
return the number of dimensions, calculated by the transformation from the workspace.
virtual std::vector< double > getExtremumPoints(const double xMin, const double xMax, size_t det_num) const =0
method returns the vector of input coordinates values where the transformed coordinates reach its ext...
helper class describes the properties of target MD workspace, which should be obtained as the result ...
void setMinMax(const std::vector< double > &minVal, const std::vector< double > &maxVal)
function sets up min-max values to the dimensions, described by the class
API::MatrixWorkspace_const_sptr getInWS() const
void buildFromMatrixWS(const API::MatrixWorkspace_sptr &pWS, const std::string &QMode, const std::string &dEMode, const std::vector< std::string > &dimPropertyNames=std::vector< std::string >())
method builds MD Event ws description from a matrix workspace and the transformations,...
std::vector< double > m_RotMatrix
DataObjects::TableWorkspace_const_sptr m_PreprDetTable
void updateConversion(size_t i)
Method updates unit conversion given the index of detector parameters in the array of detectors.
void initialize(const MDWSDescription &targetWSDescr, const std::string &unitsTo, bool forceViaTOF=false)
Initialize unit conversion helper This method is interface to internal initialize method,...
double convertUnits(double val) const
do actual unit conversion from input to oputput data
std::pair< double, double > getConversionRange(double x1, double x2) const
Method verify if the Units transformation is well defined in the range provided and if not returns th...
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
static Type fromString(const std::string &modeStr)
Returns the emode from the given string.
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...
@ Output
An output workspace.