Mantid
Loading...
Searching...
No Matches
GenerateEventsFilter.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
11#include "MantidAlgorithms/DllConfig.h"
15
16namespace Mantid {
17namespace Algorithms {
18
46class MANTID_ALGORITHMS_DLL GenerateEventsFilter final : public API::Algorithm {
47public:
48 explicit GenerateEventsFilter();
49
51 const std::string name() const override { return "GenerateEventsFilter"; }
53 const std::string summary() const override {
54 return "Generate one or a set of event filters according to time or "
55 "specified log's value.";
56 }
57
59 int version() const override { return 1; }
60 const std::vector<std::string> seeAlso() const override {
61 return {"FilterEvents", "FilterByTime", "FilterByLogValue"};
62 }
64 const std::string category() const override { return "Events\\EventFiltering"; }
65
66private:
68 void init() override;
70 void exec() override;
71
73 void processInOutWorkspaces();
74
75 void processInputTime();
76 void setFilterByTimeOnly();
77 void setFilterByLogValue(const std::string &logname);
78
79 void processSingleValueFilter(double minvalue, double maxvalue, bool filterincrease, bool filterdecrease);
80
81 void processMultipleValueFilters(double minvalue, double valueinterval, double maxvalue, bool filterincrease,
82 bool filterdecrease);
83
84 void makeFilterBySingleValue(double min, double max, double TimeTolerance, bool centre, bool filterIncrease,
85 bool filterDecrease, Types::Core::DateAndTime startTime,
86 Types::Core::DateAndTime stopTime, int wsindex);
87
89 void makeMultipleFiltersByValues(std::map<size_t, int> indexwsindexmap, const std::vector<double> &logvalueranges,
90 bool centre, bool filterIncrease, bool filterDecrease,
91 Types::Core::DateAndTime startTime, Types::Core::DateAndTime stopTime);
92
94 void makeMultipleFiltersByValuesParallel(const std::map<size_t, int> &indexwsindexmap,
95 const std::vector<double> &logvalueranges, bool centre, bool filterIncrease,
96 bool filterDecrease, Types::Core::DateAndTime startTime,
97 Types::Core::DateAndTime stopTime);
98
100 void makeMultipleFiltersByValuesPartialLog(int istart, int iend, std::vector<Types::Core::DateAndTime> &vecSplitTime,
101 std::vector<int> &vecSplitGroup, std::map<size_t, int> indexwsindexmap,
102 const std::vector<double> &logvalueranges,
103 const Types::Core::time_duration &tol, bool filterIncrease,
104 bool filterDecrease, Types::Core::DateAndTime startTime,
105 Types::Core::DateAndTime stopTime);
106
108 void processIntegerValueFilter(int minvalue, int maxvalue, bool filterIncrease, bool filterDecrease,
109 Types::Core::DateAndTime runend);
110
112 size_t searchValue(const std::vector<double> &sorteddata, double value);
113
115 void addNewTimeFilterSplitter(Types::Core::DateAndTime starttime, Types::Core::DateAndTime stoptime, int wsindex,
116 const std::string &info);
117
119 Types::Core::DateAndTime makeSplitterInVector(std::vector<Types::Core::DateAndTime> &vecSplitTime,
120 std::vector<int> &vecGroupIndex, Types::Core::DateAndTime start,
121 Types::Core::DateAndTime stop, int group, int64_t tol_ns,
122 Types::Core::DateAndTime lasttime);
123
125 void generateSplittersInMatrixWorkspace();
126
128 void generateSplittersInMatrixWorkspaceParallel();
129
131 void generateSplittersInSplitterWS();
132
134 bool identifyLogEntry(const int &index, const Types::Core::DateAndTime &currT, const bool &lastgood,
135 const double &minvalue, const double &maxvalue, const Types::Core::DateAndTime &startT,
136 const Types::Core::DateAndTime &stopT, const bool &filterIncrease, const bool &filterDecrease);
137
139 int determineChangingDirection(int startindex);
140
142 Types::Core::DateAndTime findRunEnd();
143
145
150
152
153 Types::Core::DateAndTime m_startTime;
154 Types::Core::DateAndTime m_stopTime;
155
157 Types::Core::DateAndTime m_runEndTime;
158
160
163
166
169
173 std::vector<Types::Core::DateAndTime> m_vecSplitterTime;
174 std::vector<int> m_vecSplitterGroup;
175
178
180 bool m_isReverseLogarithmic = false;
181
182 std::vector<std::vector<Types::Core::DateAndTime>> m_vecSplitterTimeSet;
183 std::vector<std::vector<int>> m_vecGroupIndexSet;
184};
185
186} // namespace Algorithms
187} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
GenerateEventsFilter : Generate an events-filter, i.e., a SplittersWorkspace according to user's requ...
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
bool m_forFastLog
Flag to output matrix workspace for fast log.
std::vector< Types::Core::DateAndTime > m_vecSplitterTime
Vector as date and time.
Types::Core::DateAndTime m_runEndTime
Run end time.
std::vector< std::vector< Types::Core::DateAndTime > > m_vecSplitterTimeSet
Kernel::TimeSplitterType m_splitters
SplitterType.
const std::string name() const override
Algorithm's name 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.
API::MatrixWorkspace_const_sptr m_dataWS
API::MatrixWorkspace_sptr m_filterWS
Matrix workspace containing splitters.
Kernel::TimeSeriesProperty< int > * m_intLog
const std::string summary() const override
Summary of algorithms purpose.
Kernel::TimeSeriesProperty< double > * m_dblLog
DataObjects::SplittersWorkspace_sptr m_splitWS
SplitterWorkspace.
int version() const override
Algorithm's version for identification overriding a virtual method.
std::vector< std::vector< int > > m_vecGroupIndexSet
bool m_useParallel
Processing algorithm type.
A specialised Property class for holding a series of time-value pairs.
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< SplittersWorkspace > SplittersWorkspace_sptr
std::vector< SplittingInterval > TimeSplitterType
A typedef for splitting events according their pulse time.
Definition: LogManager.h:31
Helper class which provides the Collimation Length for SANS instruments.