/** * Setup a detector cache for randomly picking IDs from the first * instrument in the ExperimentInfo list. * @param workspace The input workspace */ void FakeMD::setupDetectorCache(const API::IMDEventWorkspace &workspace) { try { auto inst = workspace.getExperimentInfo(0)->getInstrument(); m_detIDs = inst->getDetectorIDs(true); // true=skip monitors size_t max = m_detIDs.size() - 1; m_uniformDist = boost::uniform_int<size_t>(0, max); // Includes max } catch (std::invalid_argument &) { } }
/** * Setup a detector cache for randomly picking IDs from the first * instrument in the ExperimentInfo list. * @param ws :: The input workspace */ void FakeMDEventData::setupDetectorCache(const API::IMDEventWorkspace &ws) { try { Geometry::Instrument_const_sptr inst = ws.getExperimentInfo(0)->getInstrument(); m_detIDs = inst->getDetectorIDs(true); // true=skip monitors size_t max = m_detIDs.size() - 1; m_uniformDist = boost::uniform_int<size_t>(0, max); // Includes max } catch (std::invalid_argument &) { g_log.information("Cannot retrieve instrument from input workspace, " "detector information will be garbage."); } }