25using namespace Kernel;
26using namespace Geometry;
28using namespace DataObjects;
34 auto wsValidator = std::make_shared<InstrumentValidator>();
37 "The X values for the input workspace must be in units of "
40 "Output workspace name");
42 auto mustBePositive = std::make_shared<BoundedValidator<double>>();
43 mustBePositive->setLower(0.0);
44 declareProperty(
"Wavelength", 1.0, mustBePositive,
"Normalizes spectra to this wavelength");
50 std::string unitStr =
m_inputWS->getAxis(0)->unit()->unitID();
57 const auto numHists =
static_cast<int64_t
>(
m_inputWS->getNumberHistograms());
58 const auto specSize =
static_cast<int64_t
>(
m_inputWS->blocksize());
61 const auto &spectrumInfo =
m_inputWS->spectrumInfo();
62 double L1 = spectrumInfo.l1();
64 Progress prog(
this, 0.0, 1.0, numHists);
67 for (int64_t i = 0; i < int64_t(numHists); ++i) {
71 auto &
Y = correctionFactors->mutableY(i);
72 auto &E = correctionFactors->mutableE(i);
75 const auto &inSpec =
m_inputWS->getSpectrum(i);
76 correctionFactors->setSharedX(i, inSpec.sharedX());
77 const auto &Yin = inSpec.y();
78 const auto &Ein = inSpec.e();
81 if (!spectrumInfo.hasDetectors(i))
88 auto timeflight = inSpec.points();
90 wl.
fromTOF(timeflight.mutableRawData(), timeflight.mutableRawData(), L1, 0,
pmap);
97 for (int64_t j = 0; j < specSize; j++) {
98 const double lambda = timeflight[j];
107 double normvalue = normm + (lambdanorm - lambm) * (normp - normm) / (lambp - lambm);
108 for (int64_t j = 0; j < specSize; j++) {
109 Y[j] = Yin[j] / normvalue;
110 E[j] = Ein[j] / normvalue;
#define DECLARE_ALGORITHM(classname)
const std::vector< double > * lambda
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
Base class from which all concrete algorithm classes should be derived.
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.
Helper class for reporting progress from algorithms.
A property class for workspaces.
API::MatrixWorkspace_sptr m_inputWS
A virtual function in which additional properties of an algorithm should be declared.
NormaliseVanadium()
(Empty) Constructor
void exec() override
Execution code.
void init() override
Initialisation code.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
void fromTOF(std::vector< double > &xdata, std::vector< double > &ydata, const double &_l1, const int &_emode, std::initializer_list< std::pair< const UnitParams, double > > params)
Convert from time-of-flight to the concrete unit.
Time of flight in microseconds.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::unordered_map< UnitParams, double > UnitParametersMap
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
Generate a tableworkspace to store the calibration results.
@ Input
An input workspace.
@ Output
An output workspace.