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 Mantid {
14namespace Geometry {
15class DetectorInfo;
16class Instrument;
17} // namespace Geometry
18
19namespace DataHandling {
40class MANTID_DATAHANDLING_DLL UpdateInstrumentFromFile final : public API::Algorithm {
41public:
45 const std::string name() const override { return "UpdateInstrumentFromFile"; }
47 const std::string summary() const override {
48 return "Updates detector positions initially loaded in from the Instrument "
49 "Definition File (IDF) with information from the provided file.";
50 }
51
53 const std::string alias() const override { return "UpdateInstrumentFromRaw"; }
54
56 int version() const override { return 1; };
57 const std::vector<std::string> seeAlso() const override { return {"LoadInstrument"}; }
58
60 const std::string category() const override { return "DataHandling\\Instrument;DataHandling\\Raw"; }
61
62private:
64 void init() override;
66 void exec() override;
67
69 void updateFromRaw(const std::string &filename);
71 void updateFromNeXus(Nexus::File &nxFile);
73 void updateFromAscii(const std::string &filename);
74
80 : colCount(0), rColIdx(0), thetaColIdx(0), phiColIdx(0) {} // Zero is invalid as this is reserved for detID
81
82 size_t colCount;
83 size_t rColIdx, thetaColIdx, phiColIdx;
84 std::set<size_t> detParCols;
85 std::map<size_t, std::string> colToName;
86 };
87
89 bool parseAsciiHeader(AsciiFileHeader &headerInfo);
91 void setDetectorPositions(const std::vector<int32_t> &detID, const std::vector<float> &l2,
92 const std::vector<float> &theta, const std::vector<float> &phi);
94 void setDetectorPosition(Geometry::DetectorInfo &detectorInfo, const size_t index, const float l2, const float theta,
95 const float phi);
96
99
104};
105
106} // namespace DataHandling
107} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
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....
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.