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"
22
23namespace Mantid {
24namespace DataHandling {
25
27
28/*
29Loads an ANSTO EMU event file and stores it in an event workspace.
30
31@author Geish Miladinovic (ANSTO)
32*/
33
34template <typename FD> class LoadEMU : public API::IFileLoader<FD> {
35
36protected:
38
39 // detailed init and exec code
40 void init(bool hdfLoader);
41 void exec(const std::string &hdfFile, const std::string &eventFile);
42
43private:
44 using Base::exec;
45 using Base::init;
46 // region of intereset
47 std::vector<bool> createRoiVector(const std::string &seltubes, const std::string &maskfile);
48
49protected:
50 // load parameters from input file
51 void loadParameters(const std::string &hdfFile, API::LogManager &logm);
52 void loadEnvironParameters(const std::string &hdfFile, API::LogManager &logm);
53
54 // load the instrument definition and instrument parameters
55 void loadInstrument();
56
57 // create workspace
58 void createWorkspace(const std::string &title);
59
60 // dynamically update the neutronic position
62 void updateNeutronicPostions(detid_t detID, double sampleAnalyser);
63
64 // load and log the Doppler parameters
66
67 // calibrate doppler phase
68 void calibrateDopplerPhase(const std::vector<size_t> &eventCounts, const std::vector<EventVector_pt> &eventVectors);
69 void dopplerTimeToTOF(const std::vector<EventVector_pt> &eventVectors, double &minTOF, double &maxTOF);
70
71 // prepare event storage
72 void prepareEventStorage(ANSTO::ProgressTracker &prog, const std::vector<size_t> &eventCounts,
73 std::vector<EventVector_pt> &eventVectors);
74
75 // set up the detector masks
76 void setupDetectorMasks(const std::vector<bool> &roi);
77
78 // shared member variables
80 std::vector<double> m_detectorL2;
82 std::string m_startRun;
83
84 // Doppler characteristics
88 int32_t m_dopplerRun;
90};
91
92// Implemented the two classes explicitly rather than through specialization as
93// the instantiation and linking did not behave consistently across platforms.
94
95extern template class LoadEMU<Kernel::FileDescriptor>;
96extern template class LoadEMU<Nexus::NexusDescriptor>;
97
119class MANTID_DATAHANDLING_DLL LoadEMUTar : public LoadEMU<Kernel::FileDescriptor> {
120public:
121 int version() const override;
122 const std::vector<std::string> seeAlso() const override;
123 const std::string category() const override;
124 const std::string name() const override;
125 const std::string summary() const override;
126 int confidence(Kernel::FileDescriptor &descriptor) const override;
127
128private:
129 void exec() override;
130 void init() override;
131};
132
156class MANTID_DATAHANDLING_DLL LoadEMUHdf : public LoadEMU<Nexus::NexusDescriptor> {
157public:
158 int version() const override;
159 const std::vector<std::string> seeAlso() const override;
160 const std::string category() const override;
161 const std::string name() const override;
162 const std::string summary() const override;
163 int confidence(Nexus::NexusDescriptor &descriptor) const override;
164
165private:
166 void exec() override;
167 void init() override;
168};
169
170} // namespace DataHandling
171} // namespace Mantid
std::string name
Definition Run.cpp:60
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:156
LoadEMUTar : Loads a merged ANSTO EMU Hdf and event file into a workspace.
Definition LoadEMU.h:119
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:852
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:904
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:1055
void loadInstrument()
Load the instrument definition.
Definition LoadEMU.cpp:1152
void loadParameters(const std::string &hdfFile, API::LogManager &logm)
Load parameters from input hdfFile and save to the log manager, logm.
Definition LoadEMU.cpp:1094
void loadDetectorL2Values()
Recovers the L2 neutronic distance for each detector.
Definition LoadEMU.cpp:1017
void setupDetectorMasks(const std::vector< bool > &roi)
Set up the detector masks to the region of interest roi.
Definition LoadEMU.cpp:828
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:1031
void loadDopplerParameters(API::LogManager &logm)
Get the Doppler parameters and record to the log manager, logm.
Definition LoadEMU.cpp:873
DataObjects::EventWorkspace_sptr m_localWorkspace
Definition LoadEMU.h:79
void createWorkspace(const std::string &title)
Creates an event workspace and sets the title.
Definition LoadEMU.cpp:652
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:1138
std::vector< double > m_detectorL2
Definition LoadEMU.h:80
void dopplerTimeToTOF(const 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:980
Defines a wrapper around an open file.
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.