20const int UNSET_GROUP{-1};
61 for (
auto detID : detIDs) {
62 detIDToGroup[detID] =
group;
84 for (
auto detID : detIDs) {
88 if (detIDToGroup.size() <
static_cast<size_t>(detID + 1))
89 detIDToGroup.resize(detID + 1);
90 detIDToGroup[detID] =
group;
99 std::set<int> groupIDs;
103 if (!includeUnsetGroup &&
group == UNSET_GROUP)
105 groupIDs.insert(
group);
107 std::vector<int> output(groupIDs.begin(), groupIDs.end());
114 return static_cast<int>(groups.size());
118 std::vector<detid_t> detectorIDs;
122 if (
group == groupID) {
125 std::transform(detIDs.cbegin(), detIDs.cend(), std::back_inserter(detectorIDs),
126 [](
const auto &detID) { return static_cast<int>(detID); });
140IPropertyManager::getValue<Mantid::DataObjects::GroupingWorkspace_sptr>(
const std::string &
name)
const {
146 std::string message =
147 "Attempt to assign property " +
name +
" to incorrect type. Expected shared_ptr<GroupingWorkspace>.";
148 throw std::runtime_error(message);
154IPropertyManager::getValue<Mantid::DataObjects::GroupingWorkspace_const_sptr>(
const std::string &
name)
const {
158 return prop->operator()();
160 std::string message =
161 "Attempt to assign property " +
name +
" to incorrect type. Expected const shared_ptr<GroupingWorkspace>.";
162 throw std::runtime_error(message);
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
#define DECLARE_WORKSPACE(classname)
const MantidVec & readY(std::size_t const index) const
Deprecated, use y() instead.
A GroupingWorkspace is a subclass of Workspace2D where each spectrum has a single number entry,...
void makeDetectorIDToGroupVector(std::vector< int > &detIDToGroup, int64_t &ngroups) const
Fill a map where the index is detector ID and the value is the group number by using the values in Y.
int getTotalGroups() const
void makeDetectorIDToGroupMap(std::map< detid_t, int > &detIDToGroup, int64_t &ngroups) const
Fill a map with key = detector ID, value = group number by using the values in Y.
int translateToGroupID(const int n) const
std::vector< detid_t > getDetectorIDsOfGroup(const int groupID) const
GroupingWorkspace()=default
std::vector< int > getGroupIDs(const bool includeUnsetGroup=true) const
std::set< detid_t > getDetectorIDs(const std::size_t workspaceIndex) const
Return the detector ID at the given workspace index (i.e., spectrum/histogram index)
std::size_t getNumberHistograms() const override
Returns the histogram number.
The concrete, templated class for properties.
std::shared_ptr< const GroupingWorkspace > GroupingWorkspace_const_sptr
shared pointer to a const GroupingWorkspace
std::shared_ptr< GroupingWorkspace > GroupingWorkspace_sptr
shared pointer to the GroupingWorkspace class
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.