Mantid
Loading...
Searching...
No Matches
SaveISISNexus.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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
9#include "../../src/LoadRaw/isisraw2.h"
10#include "MantidAPI/Algorithm.h"
11#include "MantidDataHandling/DllConfig.h"
12
13#include <nexus/NeXusFile.hpp>
14
15#include <climits>
16#include <memory>
17
18namespace Mantid {
19namespace DataHandling {
32class MANTID_DATAHANDLING_DLL SaveISISNexus final : public API::Algorithm {
33public:
37 const std::string name() const override { return "SaveISISNexus"; };
39 const std::string summary() const override {
40 return "The SaveISISNexus algorithm will convert a RAW file to a NeXus "
41 "file.";
42 }
43
45 int version() const override { return 1; };
46 const std::vector<std::string> seeAlso() const override { return {"SaveNexusProcessed", "SaveNexus", "LoadNexus"}; }
48 const std::string category() const override { return "DataHandling\\Nexus"; }
49
50private:
52 void init() override;
53
55 void exec() override;
56
57 std::unique_ptr<ISISRAW2> m_isisRaw;
58 NXhandle handle;
59 FILE *rawFile;
60 std::vector<int> monitorData;
63 std::map<int, int> monitor_index;
64 int nper;
65 int nsp;
66 int ntc;
67 int nmon;
68 int ndet;
69 std::string start_time_str;
70 std::vector<std::string> log_notes;
71
77 int *getMonitorData(int period, int imon);
78
79 void saveInt(const char *name, void *data, int size = 1);
80 void saveChar(const char *name, void *data, int size);
81 void saveFloat(const char *name, void *data, int size);
82 void saveIntOpen(const char *name, void *data, int size = 1);
83 void saveCharOpen(const char *name, void *data, int size);
84 void saveFloatOpen(const char *name, void *data, int size);
85 int saveStringVectorOpen(const char *name, const std::vector<std::string> &str_vec, int max_str_size = -1);
86 void saveString(const char *name, const std::string &str);
87 void saveStringOpen(const char *name, const std::string &str);
88 inline void close() { NXclosedata(handle); }
89 inline void closegroup() { NXclosegroup(handle); }
90 void putAttr(const char *name, const std::string &value);
91 void putAttr(const char *name, char *value, int size);
92 void putAttr(const char *name, int value, int size = 1);
93 void toISO8601(std::string &str);
94
95 template <typename T> friend class getWithoutMonitors;
96
98 void write_isis_vms_compat();
100 void write_monitors();
102 void monitor_i(int i);
104 void instrument();
106 void detector_1();
108 void moderator();
110 void dae();
112 void source();
114 void make_detector_1_link();
116 void user();
118 void sample();
120 void runlog();
122 void write_runlog(const char *name, void *times, void *data, int type, int size, const std::string &units);
124 void write_logOpen(const char *name, void *times, void *data, int type, int size, const std::string &units);
126 void selog();
128 void logNotes();
130 void run_cycle();
131 void write_rpb();
132 void write_spb();
133 void write_vpb();
134
136 std::string inputFilename;
137};
138
139} // namespace DataHandling
140} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
The SaveISISNexus algorithm will convert a RAW file to a NeXus file.
Definition: SaveISISNexus.h:32
std::unique_ptr< ISISRAW2 > m_isisRaw
Definition: SaveISISNexus.h:57
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: SaveISISNexus.h:45
void closegroup()
close an open group.
Definition: SaveISISNexus.h:89
const std::string summary() const override
Summary of algorithms purpose.
Definition: SaveISISNexus.h:39
void close()
close an open dataset.
Definition: SaveISISNexus.h:88
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition: SaveISISNexus.h:48
std::string inputFilename
The name and path of the input file.
int ntc
number of time channels
Definition: SaveISISNexus.h:66
std::vector< std::string > log_notes
Definition: SaveISISNexus.h:70
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: SaveISISNexus.h:37
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition: SaveISISNexus.h:46
std::map< int, int > monitor_index
<spectrum_index,monitor_index>.
Definition: SaveISISNexus.h:63
To be used with std::generate to copy only those values from a dataset that don't relate to monitors.
Helper class which provides the Collimation Length for SANS instruments.