29 "An input OffsetsWorkspace to save.");
32 "The DspacemapFile on output contains the d-space mapping");
34 declareProperty(
"PadDetID", 300000,
"Pad Data to this number of pixels");
55 const std::string &DFileName) {
56 const char *filename = DFileName.c_str();
59 const auto &detectorInfo = offsetsWS->detectorInfo();
63 instrument->getInstrumentParameters(l1, beamline, beamline_norm, samplePos);
67 instrument->getDetectors(allDetectors);
69 detid2det_map::const_iterator it;
71 for (it = allDetectors.begin(); it != allDetectors.end(); ++it) {
73 if (detectorID > maxdetID)
74 maxdetID = detectorID;
78 if (maxdetID < paddetID)
82 std::ofstream fout(filename, std::ios_base::out | std::ios_base::binary);
83 Progress prog(
this, 0.0, 1.0, maxdetID);
85 for (
detid_t i = 0; i != maxdetID; ++i) {
90 it = allDetectors.find(i);
91 if (it != allDetectors.end()) {
100 fout.write(
reinterpret_cast<char *
>(&factor),
sizeof(
double));
103 fout.write(
reinterpret_cast<char *
>(&factor),
sizeof(
double));
#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.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
@ Save
to specify a file to write to, the file may or may not exist
Helper class for reporting progress from algorithms.
A property class for workspaces.
void CalculateDspaceFromCal(const Mantid::DataObjects::OffsetsWorkspace_sptr &offsetsWS, const std::string &DFileName)
Make a map of the conversion factors between tof and D-spacing for all pixel IDs in a workspace.
void exec() override
Run the algorithm.
void init() override
Initialise the properties.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
std::shared_ptr< OffsetsWorkspace > OffsetsWorkspace_sptr
shared pointer to the OffsetsWorkspace class
MANTID_GEOMETRY_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta, const double offset)
Calculate and return conversion factor from tof to d-spacing.
std::shared_ptr< const Mantid::Geometry::IDetector > IDetector_const_sptr
Shared pointer to IDetector (const version)
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
int32_t detid_t
Typedef for a detector ID.
std::map< detid_t, Geometry::IDetector_const_sptr > detid2det_map
Typedef of a map from detector ID to detector shared pointer.
@ Input
An input workspace.