27using namespace Kernel;
29using Geometry::Instrument;
39 "The name of the workspace in which to store the imported instrument.");
41 const std::vector<std::string> exts{
".raw",
".s*"};
43 "The filename (including its full or relative path) of an ISIS RAW file. "
44 "The file extension must either be .raw or .s??");
46 "List of detector ids of monitors loaded into the workspace");
76 instrument->add(samplepos);
77 instrument->markAsSamplePos(samplepos);
78 samplepos->
setPos(0.0, 0.0, 0.0);
81 instrument->add(source);
82 instrument->markAsSource(source);
86 auto l1ConfigValue = Kernel::ConfigService::Instance().getValue<
double>(
"instrument.L1");
88 double l1 = l1ConfigValue.value_or(iraw.
ivpb.
i_l1);
93 source->
setPos(0.0, 0.0, -1.0 * l1);
96 const int numDetector = iraw.
i_det;
97 const int *
const detID = iraw.
udet;
98 const float *
const r = iraw.
len2;
99 const float *
const angle = iraw.
tthe;
102 const float *
const phi = iraw.
ut;
105 bool phiPresent = iraw.
i_use > 0 && phi[0] != 1.0 && phi[0] != 2.0;
106 const int numMonitors = iraw.
i_mon;
107 const int *
const monIndex = iraw.
mdet;
110 for (
int i = 0; i < numDetector; ++i) {
125 instrument->add(detector);
129 if (std::find(monIndex, monIndex + numMonitors, i + 1) != monIndex + numMonitors) {
130 instrument->markAsMonitor(detector);
131 g_log.
information() <<
"Detector with ID " << detID[i] <<
" marked as a monitor.\n";
135 instrument->markAsDetector(detector);
138 prog += (0.5 / numDetector);
141 localWorkspace->setInstrument(instrument);
143 std::vector<detid_t> monitorList = instrument->getMonitors();
146 g_log.
information() <<
"SamplePos component added with position set to (0,0,0).\n"
147 <<
"Detector components added with position coordinates assumed to be "
148 "relative to the position of the sample; \n"
149 <<
"L2 and two-theta values were read from raw file and used to set the "
150 "r and theta spherical coordinates; \n"
151 <<
"the remaining spherical coordinate phi was set to zero.\n"
152 <<
"Source component added with position set to (0,0,-" << l1
153 <<
"). In standard configuration, with \n"
154 <<
"the beam along z-axis pointing from source to sample, this implies "
156 << l1 <<
"m in front \n"
157 <<
"of the sample. This value can be changed via the 'instrument.l1' "
158 "configuration property.\n";
#define DECLARE_ALGORITHM(classname)
float * ut
nuse UT* user tables (total size NUSE*NDET) ut01=phi
int i_use
number of user defined UTn tables NUSE
char i_inst[8]
instrument name
int i_det
number of detectors NDET
int * mdet
detector number for monitors (size NMON)
int readFromFile(const char *filename, bool read_data=true)
stuff
int i_mon
number of monitors NMON
IVPB_STRUCT ivpb
instrument parameter block (64*4 bytes)
int * udet
user detector number for each detector (size NDET)
float * tthe
2theta scattering angle (size NDET)
float * len2
L2 table (size NDET)
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.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
@ Load
allowed here which will be passed to the algorithm
A property class for workspaces.
void init() override
Overwrites Algorithm method. Does nothing at present.
LoadInstrumentFromRaw()
Default constructor.
std::string m_filename
The name and path of the input file.
void exec() override
Overwrites Algorithm method.
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)
This class represents a detector - i.e.
Object Component class, this class brings together the physical attributes of the component to the po...
Support for a property that holds an array of values.
Records the filename and the description of failure.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void error(const std::string &msg)
Logs at error level.
void information(const std::string &msg)
Logs at information level.
void spherical(const double R, const double theta, const double phi) noexcept
Sets the vector position based on spherical coordinates.
ISIS VMS raw file definitions.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< Instrument > Instrument_sptr
Shared pointer to an instrument object.
float i_l1
L1 scattering length.
@ InOut
Both an input & output workspace.
@ Output
An output workspace.