36 "A peaks workspace.");
38 "An input workspace containing the run information.");
40 declareProperty(
"DetectorID", 0,
"ID of a detector at the peak centre.");
52 auto runInst = runWS->getInstrument()->getName();
53 auto peakInst = peaksWS->getInstrument()->getName();
54 if (peaksWS->getNumberPeaks() > 0 && (runInst != peakInst)) {
55 throw std::runtime_error(
"The peak from " + runWS->getName() +
" comes from a different instrument (" + runInst +
57 "already in the table (" +
58 peakInst +
"). It could not be added.");
66 const auto &detectorInfo = runWS->detectorInfo();
76 double Qx = -sin(theta2) * cos(phi);
77 double Qy = -sin(theta2) * sin(phi);
78 double Qz = 1.0 - cos(theta2);
79 double l1 = detectorInfo.l1();
81 std::vector<int> emptyWarningVec;
85 if (unit->unitID() !=
"TOF") {
98 efixed = par->value<
double>();
100 }
catch (std::runtime_error &) {
108 std::vector<double> xdata(1, tof);
109 std::vector<double> ydata;
110 unit->toTOF(xdata, ydata, l1, emode,
120 std::string m_qConvention = Kernel::ConfigService::Instance().getString(
"Q.convention");
122 if (m_qConvention ==
"Crystallography") {
132 peak->setDetectorID(detID);
133 peak->setGoniometerMatrix(runWS->run().getGoniometer().getR());
134 peak->setBinCount(
count);
135 peak->setRunNumber(runWS->getRunNumber());
136 peak->setIntensity(
height);
138 peak->setSigmaIntensity(std::sqrt(
height));
140 peaksWS->addPeak(*peak);
#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.
bool hasProperty(const std::string &name) const
Does the property exist on the object.
HeldType getPropertyValueAsType(const std::string &name) const
Get the value of a property as the given TYPE.
This class stores information regarding an experimental run as a series of log entries.
A property class for workspaces.
void exec() override
Run the algorithm.
void init() override
Initialise the properties.
Structure describing a single-crystal peak.
The class PeaksWorkspace stores information about a set of SCD peaks.
virtual bool hasParameter(const std::string &name, bool recursive=true) const =0
Returns a boolean indicating if the component has the named parameter.
Interface class for detector objects.
virtual double getPhi() const =0
Gives the phi of this detector object in radians.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< PeaksWorkspace > PeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::unique_ptr< Peak > Peak_uptr
std::shared_ptr< Parameter > Parameter_sptr
Typedef for the shared pointer.
std::unique_ptr< IPeak > IPeak_uptr
std::shared_ptr< Unit > Unit_sptr
Shared pointer to the Unit base class.
A namespace containing physical constants that are required by algorithms and unit routines.
static constexpr double NeutronMass
Mass of the neutron in kg.
static constexpr double h_bar
Planck constant in J*s, divided by 2 PI.
Generate a tableworkspace to store the calibration results.
@ InOut
Both an input & output workspace.
@ Input
An input workspace.