12using namespace Types::Core;
30 const auto &begin = std::max(this->
start(), b.
start());
31 const auto &end = std::min(this->
stop(), b.
stop());
40 throw std::invalid_argument(
"SplittingInterval: cannot apply the OR (|) "
41 "operator to non-overlapping "
42 "SplittingInterval's.");
44 const auto &begin = std::min(this->
start(), b.
start());
45 const auto &end = std::max(this->
stop(), b.
stop());
51 if (TimeInterval::operator==(ti)) {
61 ss <<
" index: " <<
index();
71 SplittingIntervalVec::const_iterator it;
72 for (it = a.begin(); it != a.end(); ++it)
73 if (it->index() > max)
89 bool a_filter, b_filter;
93 if (a_filter && b_filter) {
95 }
else if (a_filter && !b_filter) {
97 }
else if (!a_filter && b_filter) {
102 throw std::invalid_argument(
"Cannot combine two splitters together, as the "
103 "output is undefined. Try splitting each "
104 "output workspace by b after the a split has "
124 if ((a.empty()) || (b.empty()))
127 SplittingIntervalVec::const_iterator ait;
128 SplittingIntervalVec::const_iterator bit;
132 for (ait = a.begin(); ait != a.end(); ++ait) {
133 for (bit = b.begin(); bit != b.end(); ++bit) {
134 if (ait->overlaps(&(*bit))) {
139 out.emplace_back(*ait & *bit);
153 out.reserve(a.size());
156 auto it = a.cbegin();
157 while (it != a.cend()) {
159 const DateAndTime &start = it->start();
160 DateAndTime stop = it->stop();
164 while ((it != a.cend()) && (it->start() <= stop)) {
167 if (it->stop() > stop)
172 out.emplace_back(start, stop, 0);
191 std::copy_if(a.begin(), a.end(), std::back_insert_iterator(temp), isValid);
192 std::copy_if(b.begin(), b.end(), std::back_insert_iterator(temp), isValid);
198 std::sort(temp.begin(), temp.end(), compareStart);
219 if ((temp.empty())) {
220 out.emplace_back(DateAndTime::minimum(), DateAndTime::maximum(), 0);
224 SplittingIntervalVec::const_iterator ait;
226 if (ait != temp.end()) {
228 out.emplace_back(DateAndTime::minimum(), ait->start(), 0);
230 while (ait != temp.end()) {
231 DateAndTime start, stop;
234 if (ait == temp.end()) {
235 stop = DateAndTime::maximum();
239 out.emplace_back(start, stop, 0);
251 std::map<int, Kernel::TimeROI> roisMap;
252 for (
auto const &splitter : splitters) {
254 if (splitter.start() >= splitter.stop())
256 int destinationIndex = splitter.index();
257 if (roisMap.find(destinationIndex) == roisMap.end())
258 roisMap.insert({destinationIndex,
TimeROI(splitter.start(), splitter.stop())});
260 roisMap[destinationIndex].addROI(splitter.start(), splitter.stop());
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
Class holding a start/end time and a destination for splitting event lists and logs.
SplittingInterval()
Default constructor.
int index() const
Return the index (destination of this split time block)
int m_index
Index of the destination.
bool operator==(const SplittingInterval &ti) const
SplittingInterval operator|(const SplittingInterval &b) const
Or operator. Return the largest time interval.
std::string debugStrPrint() const
Represents a time interval.
const Types::Core::DateAndTime & start() const
Beginning of the interval.
bool overlaps(const TimeInterval *other) const
Return true if the SplittingInterval overlaps with this one.
const Types::Core::DateAndTime & stop() const
End of the interval.
std::string end_str() const
String representation of the end time.
std::string begin_str() const
String representation of the begin time.
TimeROI : Object that holds information about when the time measurement was active.
MANTID_KERNEL_DLL SplittingIntervalVec operator~(const SplittingIntervalVec &a)
NOT operator for SplittingIntervalVec Only works on Filters.
bool isFilter(const SplittingIntervalVec &a)
Return true if the SplittingIntervalVec provided is a filter, meaning that it only has an output inde...
MANTID_KERNEL_DLL std::map< int, TimeROI > timeROIsFromSplitters(const SplittingIntervalVec &splitters)
For every workspace index, create a TimeROI out of its associated splitting intervals.
MANTID_KERNEL_DLL SplittingIntervalVec operator|(const SplittingIntervalVec &a, const SplittingIntervalVec &b)
OR operator for SplittingIntervalVec Only works on Filters, not splitters.
std::vector< SplittingInterval > SplittingIntervalVec
A typedef for splitting events according their pulse time.
MANTID_KERNEL_DLL SplittingIntervalVec operator&(const SplittingIntervalVec &a, const SplittingIntervalVec &b)
AND operator for SplittingIntervalVec Works on Filters - combines them to only keep times where both ...
SplittingIntervalVec removeFilterOverlap(const SplittingIntervalVec &a)
Remove any overlap in a filter (will not work properly on a splitter)
MANTID_KERNEL_DLL SplittingIntervalVec operator+(const SplittingIntervalVec &a, const SplittingIntervalVec &b)
Plus operator for SplittingIntervalVec.
Helper class which provides the Collimation Length for SANS instruments.