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 groupIDs.insert(
group);
105 std::vector<int> output(groupIDs.begin(), groupIDs.end());
112 return static_cast<int>(groups.size());
116 std::vector<int> detectorIDs;
120 if (
group == groupID) {
123 std::transform(detIDs.cbegin(), detIDs.cend(), std::back_inserter(detectorIDs),
124 [](
const auto &detID) { return static_cast<int>(detID); });
138IPropertyManager::getValue<Mantid::DataObjects::GroupingWorkspace_sptr>(
const std::string &
name)
const {
144 std::string message =
145 "Attempt to assign property " +
name +
" to incorrect type. Expected shared_ptr<GroupingWorkspace>.";
146 throw std::runtime_error(message);
152IPropertyManager::getValue<Mantid::DataObjects::GroupingWorkspace_const_sptr>(
const std::string &
name)
const {
156 return prop->operator()();
158 std::string message =
159 "Attempt to assign property " +
name +
" to incorrect type. Expected const shared_ptr<GroupingWorkspace>.";
160 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.
std::vector< int > getGroupIDs() const
int translateToGroupID(const int n) const
GroupingWorkspace()=default
std::vector< int > getDetectorIDsOfGroup(const int groupID) 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.