本文整理汇总了C++中EventWorkspace_sptr::flagMasked方法的典型用法代码示例。如果您正苦于以下问题:C++ EventWorkspace_sptr::flagMasked方法的具体用法?C++ EventWorkspace_sptr::flagMasked怎么用?C++ EventWorkspace_sptr::flagMasked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventWorkspace_sptr
的用法示例。
在下文中一共展示了EventWorkspace_sptr::flagMasked方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execEvent
//.........这里部分代码省略.........
EventWorkspace_sptr outputWorkspace =
boost::dynamic_pointer_cast<EventWorkspace>(
API::WorkspaceFactory::Instance().create(
"EventWorkspace", m_workspaceIndexList.size(), ntcnew,
ntcnew - m_histogram));
eventW->sortAll(TOF_SORT, nullptr);
outputWorkspace->sortAll(TOF_SORT, nullptr);
// Copy required stuff from it
API::WorkspaceFactory::Instance().initializeFromParent(m_inputWorkspace,
outputWorkspace, true);
Progress prog(this, 0.0, 1.0, 2 * m_workspaceIndexList.size());
eventW->sortAll(Mantid::DataObjects::TOF_SORT, &prog);
// Loop over the required workspace indices, copying in the desired bins
PARALLEL_FOR2(m_inputWorkspace, outputWorkspace)
for (int j = 0; j < static_cast<int>(m_workspaceIndexList.size()); ++j) {
PARALLEL_START_INTERUPT_REGION
auto i = m_workspaceIndexList[j];
const EventList &el = eventW->getEventList(i);
// The output event list
EventList &outEL = outputWorkspace->getOrAddEventList(j);
// // left side of the crop - will erase 0 -> endLeft
// std::size_t endLeft;
// // right side of the crop - will erase endRight->numEvents+1
// std::size_t endRight;
switch (el.getEventType()) {
case TOF: {
std::vector<TofEvent> moreevents;
moreevents.reserve(el.getNumberEvents()); // assume all will make it
copyEventsHelper(el.getEvents(), moreevents, minX_val, maxX_val);
outEL += moreevents;
break;
}
case WEIGHTED: {
std::vector<WeightedEvent> moreevents;
moreevents.reserve(el.getNumberEvents()); // assume all will make it
copyEventsHelper(el.getWeightedEvents(), moreevents, minX_val, maxX_val);
outEL += moreevents;
break;
}
case WEIGHTED_NOTIME: {
std::vector<WeightedEventNoTime> moreevents;
moreevents.reserve(el.getNumberEvents()); // assume all will make it
copyEventsHelper(el.getWeightedEventsNoTime(), moreevents, minX_val,
maxX_val);
outEL += moreevents;
break;
}
}
outEL.setSortOrder(el.getSortType());
// Copy spectrum number & detector IDs
outEL.copyInfoFrom(el);
bool hasDx = eventW->hasDx(i);
if (!m_commonBoundaries) {
// If the X axis is NOT common, then keep the initial X axis, just clear
// the events
outEL.setX(el.dataX());
if (hasDx) {
outEL.setDx(el.dataDx());
}
} else {
// Common bin boundaries get all set to the same value
outEL.setX(XValues_new);
if (hasDx) {
const MantidVec &oldDx = m_inputWorkspace->readDx(i);
cow_ptr<MantidVec> DxValues_new;
DxValues_new.access().assign(oldDx.begin() + m_minX,
oldDx.begin() + m_maxX);
outEL.setDx(DxValues_new);
}
}
// Propagate bin masking if there is any
if (m_inputWorkspace->hasMaskedBins(i)) {
const MatrixWorkspace::MaskList &inputMasks =
m_inputWorkspace->maskedBins(i);
MatrixWorkspace::MaskList::const_iterator it;
for (it = inputMasks.begin(); it != inputMasks.end(); ++it) {
const size_t maskIndex = (*it).first;
if (maskIndex >= m_minX && maskIndex < m_maxX - m_histogram)
outputWorkspace->flagMasked(j, maskIndex - m_minX, (*it).second);
}
}
// When cropping in place, you can clear out old memory from the input one!
if (inPlace) {
eventW->getEventList(i).clear();
Mantid::API::MemoryManager::Instance().releaseFreeMemory();
}
prog.report();
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
setProperty("OutputWorkspace",
boost::dynamic_pointer_cast<MatrixWorkspace>(outputWorkspace));
}