Mantid
Loading...
Searching...
No Matches
FilterEvents.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 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
12#include "MantidAlgorithms/DllConfig.h"
19
20namespace Mantid {
21
22namespace Kernel {
23class TimeROI; // forward declaration
24}
25
26namespace API {
27class TimeAtSampleStrategy;
28}
29
30namespace Algorithms {
31
37class MANTID_ALGORITHMS_DLL FilterEvents final : public API::Algorithm {
38
39 enum TOFCorrectionType { NoneCorrect, CustomizedCorrect, DirectCorrect, ElasticCorrect, IndirectCorrect };
40 enum EVENTFILTERSKIP { EventFilterSkipNoDet, EventFilterSkipNoDetTOFCorr };
41
42public:
44
46 const std::string name() const override { return "FilterEvents"; }
48 const std::string summary() const override {
49 return "Filter events from an EventWorkspace to one or multiple target "
50 "event workspaces according to a series of splitters.";
51 }
52
54 int version() const override { return 1; }
55 const std::vector<std::string> seeAlso() const override {
56 return {"GenerateEventsFilter", "FilterByTime", "FilterByLogValue"};
57 }
58
60 const std::string category() const override { return "Events\\EventFiltering"; }
61 std::map<std::string, std::string> validateInputs() override;
62
63private:
64 // Implement abstract Algorithm methods
65 void init() override;
66 // Implement abstract Algorithm methods
67 void exec() override;
68
70 void processAlgorithmProperties();
71
73 void parseInputSplitters();
74
76 void createOutputWorkspaces();
77
79 void setupDetectorTOFCalibration();
80
82 API::TimeAtSampleStrategy *setupElasticTOFCorrection() const;
83
86 API::TimeAtSampleStrategy *setupDirectTOFCorrection() const;
87
90 API::TimeAtSampleStrategy *setupIndirectTOFCorrection() const;
91
93 void setupCustomizedTOFCorrection();
94
96 void filterEvents(double progressamount);
97
99 void examineEventWS();
100
101 void groupOutputWorkspace();
102
104 Kernel::TimeROI partialROI(const int &index);
105
111
114
115 std::map<int, DataObjects::EventWorkspace_sptr> m_outputWorkspacesMap;
116 std::vector<std::string> m_wsNames;
117
118 std::vector<double> m_detTofOffsets;
119 std::vector<double> m_detTofFactors;
120
122
125
127
130
133
136 std::vector<int64_t> m_vecSplitterTime;
138 std::vector<int> m_vecSplitterGroup;
139
142
146 std::vector<bool> m_vecSkip;
147
148 // Flag to have relative time in splitters workspace
150 // Absolute base time for relative times in splitters workspace
151 Types::Core::DateAndTime m_filterStartTime;
152};
153
154} // namespace Algorithms
155} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
TimeAtSampleStrategy : Strategy (technique dependent) for determining Time At Sample.
FilterEvents : Filter Events in EventWorkspace to multiple EventsWorkspace by Splitters.
std::vector< std::string > m_wsNames
DataObjects::SplittersWorkspace_sptr m_splittersWorkspace
std::vector< double > m_detTofOffsets
std::vector< bool > m_vecSkip
Vector for skip information.
DataObjects::TimeSplitter m_timeSplitter
std::vector< double > m_detTofFactors
Types::Core::DateAndTime m_filterStartTime
bool m_toGroupWS
Flag to group workspace.
int version() const override
Algorithm's version for identification overriding a virtual method.
std::set< int > m_targetWorkspaceIndexSet
std::map< int, DataObjects::EventWorkspace_sptr > m_outputWorkspacesMap
std::vector< int > m_vecSplitterGroup
Vector for splitting group.
std::string m_outputWSNameBase
Base of output workspace's name.
EVENTFILTERSKIP m_specSkipType
Spectrum skip type.
std::vector< int64_t > m_vecSplitterTime
Vector for splitting time FIXME - shall we convert this to DateAndTime???.
DataObjects::TableWorkspace_sptr m_informationWS
TOFCorrectionType m_tofCorrType
TOF detector/sample correction type.
DataObjects::TableWorkspace_sptr m_detCorrectWorkspace
DataObjects::EventWorkspace_sptr m_eventWS
const std::string summary() const override
Summary of algorithms purpose.
API::MatrixWorkspace_sptr m_matrixSplitterWS
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
DataObjects::TableWorkspace_sptr m_splitterTableWorkspace
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
TimeROI : Object that holds information about when the time measurement was active.
Definition TimeROI.h:18
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< SplittersWorkspace > SplittersWorkspace_sptr
std::shared_ptr< TableWorkspace > TableWorkspace_sptr
shared pointer to Mantid::DataObjects::TableWorkspace
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
Helper class which provides the Collimation Length for SANS instruments.