|
| 1 | +// Mantid Repository : https://github.com/mantidproject/mantid |
| 2 | +// |
| 3 | +// Copyright © 2010 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 | +//--------------------------------------------------- |
| 10 | +// Includes |
| 11 | +//--------------------------------------------------- |
| 12 | + |
| 13 | +// #include "MantidAPI/IFileLoader.h" |
| 14 | +#include "MantidAPI/NexusFileLoader.h" |
| 15 | +#include "MantidDataHandling/DllConfig.h" |
| 16 | +#include "MantidDataHandling/LoadANSTOHelper.h" |
| 17 | +#include "MantidDataObjects/EventWorkspace.h" |
| 18 | +#include "MantidGeometry/Instrument.h" |
| 19 | +#include "MantidNexus/NexusClasses_fwd.h" |
| 20 | +#include "MantidNexus/NexusDescriptor.h" |
| 21 | + |
| 22 | +namespace Mantid { |
| 23 | +namespace DataHandling { |
| 24 | +/* |
| 25 | +Loads a Bilby data file. Implements API::IFileLoader and its file check methods |
| 26 | +to recognise a file as the one containing Bilby data. |
| 27 | +
|
| 28 | +@author David Mannicke (ANSTO), Anders Markvardsen (ISIS), Roman Tolchenov |
| 29 | +(Tessella plc) |
| 30 | +@date 11/07/2014 |
| 31 | +*/ |
| 32 | + |
| 33 | +class MANTID_DATAHANDLING_DLL LoadBBY2 : public API::NexusFileLoader { |
| 34 | + |
| 35 | + struct InstrumentInfo { |
| 36 | + // core values or non standard conversion |
| 37 | + std::string sample_name; |
| 38 | + std::string sample_description; |
| 39 | + std::string start_time; |
| 40 | + int64_t bm_counts; |
| 41 | + int32_t att_pos; |
| 42 | + int64_t master1_chopper_id; |
| 43 | + int64_t master2_chopper_id; |
| 44 | + bool is_tof; // tof or wavelength data |
| 45 | + double wavelength; // -> /nvs067/lambda |
| 46 | + double period_master; |
| 47 | + double period_slave; |
| 48 | + double phase_slave; |
| 49 | + }; |
| 50 | + |
| 51 | +public: |
| 52 | + // description |
| 53 | + LoadBBY2(); |
| 54 | + int version() const override { return 1; } |
| 55 | + const std::vector<std::string> seeAlso() const override { return {"Load", "LoadBBY"}; } |
| 56 | + const std::string name() const override { return "LoadBBY2"; } |
| 57 | + const std::string category() const override { return "DataHandling\\ANSTO"; } |
| 58 | + const std::string summary() const override { return "Loads a Bilby data file into a workspace."; } |
| 59 | + |
| 60 | + // returns a confidence value that this algorithm can load a specified file |
| 61 | + int confidence(Nexus::NexusDescriptor &descriptor) const override; |
| 62 | + |
| 63 | +protected: |
| 64 | + // initialisation |
| 65 | + void init() override; |
| 66 | + // execution |
| 67 | + void execLoader() override; |
| 68 | + |
| 69 | +private: |
| 70 | + // region of interest |
| 71 | + static std::vector<bool> createRoiVector(const std::string &maskfile); |
| 72 | + |
| 73 | + // instrument creation |
| 74 | + void createInstrument(const Nexus::NXEntry &entry, uint64_t startTime, uint64_t endTime, |
| 75 | + InstrumentInfo &instrumentInfo, std::map<std::string, double> &logParams, |
| 76 | + std::map<std::string, std::string> &logStrings, std::map<std::string, std::string> &allParams); |
| 77 | + void loadInstrumentParameters(const Nexus::NXEntry &entry, uint64_t startTime, uint64_t endTime, |
| 78 | + std::map<std::string, double> &logParams, |
| 79 | + std::map<std::string, std::string> &logStrings, |
| 80 | + std::map<std::string, std::string> &allParams); |
| 81 | + |
| 82 | + bool useHMScanTime{false}; |
| 83 | +}; |
| 84 | + |
| 85 | +} // namespace DataHandling |
| 86 | +} // namespace Mantid |
0 commit comments