Mantid
Loading...
Searching...
No Matches
UpdateInstrumentFromFile.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10#include "MantidDataHandling/DllConfig.h"
12
13namespace NeXus {
14class File;
15}
16
17namespace Mantid {
18namespace Geometry {
19class DetectorInfo;
20class Instrument;
21} // namespace Geometry
22
23namespace DataHandling {
44class MANTID_DATAHANDLING_DLL UpdateInstrumentFromFile final : public API::Algorithm {
45public:
49 const std::string name() const override { return "UpdateInstrumentFromFile"; }
51 const std::string summary() const override {
52 return "Updates detector positions initially loaded in from the Instrument "
53 "Definition File (IDF) with information from the provided file.";
54 }
55
57 const std::string alias() const override { return "UpdateInstrumentFromRaw"; }
58
60 int version() const override { return 1; };
61 const std::vector<std::string> seeAlso() const override { return {"LoadInstrument"}; }
62
64 const std::string category() const override { return "DataHandling\\Instrument;DataHandling\\Raw"; }
65
66private:
68 void init() override;
70 void exec() override;
71
73 void updateFromRaw(const std::string &filename);
75 void updateFromNeXus(::NeXus::File &nxFile);
77 void updateFromAscii(const std::string &filename);
78
84 : colCount(0), rColIdx(0), thetaColIdx(0), phiColIdx(0) {} // Zero is invalid as this is reserved for detID
85
86 size_t colCount;
87 size_t rColIdx, thetaColIdx, phiColIdx;
88 std::set<size_t> detParCols;
89 std::map<size_t, std::string> colToName;
90 };
91
93 bool parseAsciiHeader(AsciiFileHeader &headerInfo);
95 void setDetectorPositions(const std::vector<int32_t> &detID, const std::vector<float> &l2,
96 const std::vector<float> &theta, const std::vector<float> &phi);
98 void setDetectorPosition(Geometry::DetectorInfo &detectorInfo, const size_t index, const float l2, const float theta,
99 const float phi);
100
103
108};
109
110} // namespace DataHandling
111} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Update detector positions initially loaded in from Instrument Defintion File (IDF) from information i...
const std::string alias() const override
Algorithm's alias for the old UpdateInstrumentFromRaw.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
const std::string summary() const override
Summary of algorithms purpose.
int version() const override
Algorithm's version for identification overriding a virtual method.
API::MatrixWorkspace_sptr m_workspace
The input workspace to modify.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
Definition: DetectorInfo.h:49
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.
Simple structure to store information about the ASCII file header.