18#include "MantidIndexing/IndexInfo.h"
40 const auto &firstEntryName = descriptor.firstEntryNameType().first;
41 if (descriptor.isEntry(
"/" + firstEntryName +
"/data/hmm_xy"))
56 "The input filename of the stored data");
78 double wavelength =
static_cast<double>(data.
getFloat(
"wavelength"));
86 double wavelength_spread =
static_cast<double>(entry.
getFloat(
"instrument/velocity_selector/wavelength_spread"));
87 double wavelength0 = wavelength - wavelength_spread / 2;
88 double wavelength1 = wavelength + wavelength_spread / 2;
91 size_t ny = hmm.
dim1();
92 size_t nx = hmm.
dim2();
93 size_t nHist = ny * nx;
101 std::string instrumentname =
"QUOKKA";
108 instrument->add(samplepos);
109 instrument->markAsSamplePos(samplepos);
111 samplepos->
setPos(0.0, 0.0, 0.0);
115 instrument->add(source);
116 instrument->markAsSource(source);
119 double l1 =
static_cast<double>(entry.
getFloat(
"instrument/parameters/L1"));
120 source->
setPos(0.0, 0.0, -1.0 * l1);
126 double height =
static_cast<double>(entry.
getFloat(
"instrument/detector/active_height"));
127 double width =
static_cast<double>(entry.
getFloat(
"instrument/detector/active_width"));
134 double pixel_height =
height /
static_cast<double>(ny);
135 double pixel_width = width /
static_cast<double>(nx);
137 std::string pixel_height_str = boost::lexical_cast<std::string>(pixel_height / 2);
138 std::string pixel_width_str = boost::lexical_cast<std::string>(pixel_width / 2);
140 std::string pixel_depth_str =
"0.00001";
146 std::string detXML =
"<cuboid id=\"pixel\">"
147 "<left-front-bottom-point x= \"" +
148 pixel_width_str +
"\" y=\"-" + pixel_height_str +
150 "<left-front-top-point x= \"" +
151 pixel_width_str +
"\" y=\"-" + pixel_height_str +
"\" z=\"" + pixel_depth_str +
153 "<left-back-bottom-point x=\"-" +
154 pixel_width_str +
"\" y=\"-" + pixel_height_str +
156 "<right-front-bottom-point x= \"" +
157 pixel_width_str +
"\" y= \"" + pixel_height_str +
163 bank->
initialize(shape,
int(nx), 0, pixel_width,
int(ny), 0, pixel_height, 1,
true,
int(nx));
164 for (
int i = 0; i < static_cast<int>(ny); ++i)
165 for (
int j = 0; j < static_cast<int>(nx); ++j) {
166 instrument->markAsDetector(bank->
getAtXY(j, i).get());
172 auto outputWorkspace =
173 DataObjects::create<DataObjects::Workspace2D>(instrument, Indexing::IndexInfo(nHist), HistogramData::BinEdges(2));
175 outputWorkspace->getAxis(0)->unit() = UnitFactory::Instance().create(
"Wavelength");
177 outputWorkspace->setYUnitLabel(
"Counts");
179 using namespace HistogramData;
180 const BinEdges binEdges = {wavelength0, wavelength1};
182 auto x =
static_cast<int>(
index % nx);
183 auto y =
static_cast<int>(
index / nx);
184 auto c = hmm(0,
x,
y);
186 Counts yValue = {
static_cast<double>(c)};
187 outputWorkspace->setHistogram(
index, binEdges, yValue);
190 outputWorkspace->setTitle(entry.
getString(
"experiment/title"));
191 setProperty(
"OutputWorkspace", std::move(outputWorkspace));
std::map< DeltaEMode::Type, std::string > index
#define DECLARE_NEXUS_FILELOADER_ALGORITHM(classname)
DECLARE_NEXUS_FILELOADER_ALGORITHM should be used in place of the standard DECLARE_ALGORITHM macro wh...
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.
@ Load
allowed here which will be passed to the algorithm
A property class for workspaces.
Loads a Quokka data file.
void exec() override
Execution code.
void init() override
Initialisation code.
Component is a wrapper for a Component which can modify some of its parameters, e....
void setPos(double, double, double) override
Set the IComponent position, x, y, z respective to parent (if present)
virtual void setPos(double, double, double)=0
Set the IComponent position, x, y, z respective to parent (if present)
Object Component class, this class brings together the physical attributes of the component to the po...
RectangularDetector is a type of CompAssembly, an assembly of components.
std::shared_ptr< Detector > getAtXY(const int X, const int Y) const
Return a pointer to the component in the assembly at the (X,Y) pixel position.
void initialize(std::shared_ptr< IObject > shape, int xpixels, double xstart, double xstep, int ypixels, double ystart, double ystep, int idstart, bool idfillbyfirst_y, int idstepbyrow, int idstep=1)
Create all the detector pixels of this rectangular detector.
Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm.
std::shared_ptr< CSGObject > createShape(Poco::XML::Element *pElem)
Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain t...
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
float getFloat(const std::string &name) const
Returns a float.
std::string getString(const std::string &name) const
Returns a string.
Templated class implementation of NXDataSet.
void load()
Read all of the datablock in.
dimsize_t dim2() const
Returns the number of elements along the third dimension.
dimsize_t dim1() const
Returns the number of elements along the second dimension.
Implements NXdata Nexus class.
NXInt openIntData()
Opens data of int type.
Implements NXentry Nexus class.
NXData openNXData(const std::string &name) const
Opens a NXData.
Implements NXroot Nexus class.
NXEntry openFirstEntry()
Open the first NXentry in the file.
std::shared_ptr< Instrument > Instrument_sptr
Shared pointer to an instrument object.
std::string to_string(const wide_integer< Bits, Signed > &n)
@ Output
An output workspace.