Mantid
Loading...
Searching...
No Matches
LoadEMU.h
Go to the documentation of this file.
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 "LoadANSTOEventFile.h"
14#include "LoadANSTOHelper.h"
17#include "MantidDataHandling/DllConfig.h"
23
24namespace Mantid {
25namespace DataHandling {
26
28
29/*
30Loads an ANSTO EMU event file and stores it in an event workspace.
31
32@author Geish Miladinovic (ANSTO)
33*/
34
35template <typename FD> class LoadEMU : public API::IFileLoader<FD> {
36
37protected:
39
40 // detailed init and exec code
41 void init(bool hdfLoader);
42 void exec(const std::string &hdfFile, const std::string &eventFile);
43
44private:
45 using Base::exec;
46 using Base::init;
47 // region of intereset
48 std::vector<bool> createRoiVector(const std::string &seltubes, const std::string &maskfile);
49
50protected:
51 // load parameters from input file
52 void loadParameters(const std::string &hdfFile, API::LogManager &logm);
53 void loadEnvironParameters(const std::string &hdfFile, API::LogManager &logm);
54
55 // load the instrument definition and instrument parameters
56 void loadInstrument();
57
58 // create workspace
59 void createWorkspace(const std::string &title);
60
61 // dynamically update the neutronic position
63 void updateNeutronicPostions(detid_t detID, double sampleAnalyser);
64
65 // load and log the Doppler parameters
67
68 // calibrate doppler phase
69 void calibrateDopplerPhase(const std::vector<size_t> &eventCounts, const std::vector<EventVector_pt> &eventVectors);
70 void dopplerTimeToTOF(std::vector<EventVector_pt> &eventVectors, double &minTOF, double &maxTOF);
71
72 // prepare event storage
73 void prepareEventStorage(ANSTO::ProgressTracker &prog, const std::vector<size_t> &eventCounts,
74 std::vector<EventVector_pt> &eventVectors);
75
76 // set up the detector masks
77 void setupDetectorMasks(const std::vector<bool> &roi);
78
79 // shared member variables
81 std::vector<double> m_detectorL2;
83 std::string m_startRun;
84
85 // Doppler characteristics
89 int32_t m_dopplerRun;
91};
92
93// Implemented the two classes explicitly rather than through specialization as
94// the instantiation and linking did not behave consistently across platforms.
95
96extern template class LoadEMU<Kernel::FileDescriptor>;
97extern template class LoadEMU<Kernel::NexusDescriptor>;
98
120class MANTID_DATAHANDLING_DLL LoadEMUTar : public LoadEMU<Kernel::FileDescriptor> {
121public:
122 int version() const override;
123 const std::vector<std::string> seeAlso() const override;
124 const std::string category() const override;
125 const std::string name() const override;
126 const std::string summary() const override;
127 int confidence(Kernel::FileDescriptor &descriptor) const override;
128
129private:
130 void exec() override;
131 void init() override;
132};
133
157class MANTID_DATAHANDLING_DLL LoadEMUHdf : public LoadEMU<Kernel::NexusDescriptor> {
158public:
159 int version() const override;
160 const std::vector<std::string> seeAlso() const override;
161 const std::string category() const override;
162 const std::string name() const override;
163 const std::string summary() const override;
164 int confidence(Kernel::NexusDescriptor &descriptor) const override;
165
166private:
167 void exec() override;
168 void init() override;
169};
170
171} // namespace DataHandling
172} // namespace Mantid
virtual void init()=0
Virtual method - must be overridden by concrete algorithm.
virtual void exec()=0
Virtual method - must be overridden by concrete algorithm.
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
Definition: IFileLoader.h:19
This class contains the information about the log entries.
Definition: LogManager.h:44
helper class to keep track of progress
LoadEMUHdf : Loads an ANSTO EMU Hdf and linked event file into a workspace.
Definition: LoadEMU.h:157
LoadEMUTar : Loads a merged ANSTO EMU Hdf and event file into a workspace.
Definition: LoadEMU.h:120
void prepareEventStorage(ANSTO::ProgressTracker &prog, const std::vector< size_t > &eventCounts, std::vector< EventVector_pt > &eventVectors)
Allocate space for the event storage in eventVectors after the eventCounts have been determined.
Definition: LoadEMU.cpp:860
void calibrateDopplerPhase(const std::vector< size_t > &eventCounts, const std::vector< EventVector_pt > &eventVectors)
Calibrate the doppler phase based on the analysed events using the eventCounts and eventVectors.
Definition: LoadEMU.cpp:912
std::vector< bool > createRoiVector(const std::string &seltubes, const std::string &maskfile)
Region of interest is defined by the selected detectors and the maskfile.
Definition: LoadEMU.cpp:1065
void loadInstrument()
Load the instrument definition.
Definition: LoadEMU.cpp:1164
void loadParameters(const std::string &hdfFile, API::LogManager &logm)
Load parameters from input hdfFile and save to the log manager, logm.
Definition: LoadEMU.cpp:1104
void dopplerTimeToTOF(std::vector< EventVector_pt > &eventVectors, double &minTOF, double &maxTOF)
Convert the doppler time to TOF for all the events in eventVectors and time of flight range as minTOF...
Definition: LoadEMU.cpp:990
void loadDetectorL2Values()
Recovers the L2 neutronic distance for each detector.
Definition: LoadEMU.cpp:1027
void setupDetectorMasks(const std::vector< bool > &roi)
Set up the detector masks to the region of interest roi.
Definition: LoadEMU.cpp:833
void updateNeutronicPostions(detid_t detID, double sampleAnalyser)
Update the neutronic position for the detID using the distance from the source and the sample to anal...
Definition: LoadEMU.cpp:1041
void loadDopplerParameters(API::LogManager &logm)
Get the Doppler parameters and record to the log manager, logm.
Definition: LoadEMU.cpp:881
DataObjects::EventWorkspace_sptr m_localWorkspace
Definition: LoadEMU.h:80
void createWorkspace(const std::string &title)
Creates an event workspace and sets the title.
Definition: LoadEMU.cpp:656
void loadEnvironParameters(const std::string &hdfFile, API::LogManager &logm)
Load the environment variables from the hdfFile and save as time series to the log manager,...
Definition: LoadEMU.cpp:1147
std::vector< double > m_detectorL2
Definition: LoadEMU.h:81
Defines a wrapper around an open file.
Defines a wrapper around a file whose internal structure can be accessed using the NeXus API.
std::vector< Types::Event::TofEvent > * EventVector_pt
pointer to the vector of events
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
Helper class which provides the Collimation Length for SANS instruments.