21 "Input peaks workspace.");
24 "Workspace from which the instrument will be copied from. If none is provided then the instrument on "
25 "the input workspace is used.");
27 "Output peaks workspace.");
36 if (outputWS != inputWS)
37 outputWS = inputWS->clone();
45 throw std::invalid_argument(
"Wrong type of workspace");
46 instrument = ei->getInstrument();
47 outputWS->setInstrument(instrument);
49 instrument = outputWS->getInstrument();
53 for (
int i = 0; i < outputWS->getNumberPeaks(); ++i) {
54 Peak &peak = outputWS->getPeak(i);
56 const auto tof = peak.
getTOF();
61 energyUnit.
initialize(peak.
getL1(), 0, {{UnitParams::l2, peak.getL2()}});
63 peak.setInitialEnergy(
energy);
64 peak.setFinalEnergy(
energy);
67 setProperty(
"OutputWorkspace", outputWS);
#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.
A property class for workspaces.
void exec() override
Virtual method - must be overridden by concrete algorithm.
void init() override
Virtual method - must be overridden by concrete algorithm.
Structure describing a single-crystal peak.
double getL1() const override
Return the L1 flight path length (source to sample), in meters.
void setDetectorID(int id)
Set the detector ID of the pixel at the centre of the peak and look up and cache values related to it...
double getTOF() const override
Calculate the time of flight (in microseconds) of the neutrons for this peak, using the geometry of t...
int getDetectorID() const
Get the ID of the detector at the center of the peak
void setInstrument(const Geometry::Instrument_const_sptr &inst)
Set the instrument (and save the source/sample pos).
void initialize(const double &_l1, const int &_emode, const UnitParametersMap ¶ms)
Initialize the unit to perform conversion using singleToTof() and singleFromTof()
Energy in milli-electronvolts.
double singleFromTOF(const double tof) const override
Convert a single tof value to this unit.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< ExperimentInfo > ExperimentInfo_sptr
Shared pointer to ExperimentInfo.
std::shared_ptr< PeaksWorkspace > PeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
@ Input
An input workspace.
@ Output
An output workspace.