/** * Load monitors data found in nexus file * * @param entry :: The Nexus entry * */ std::vector<std::vector<int>> LoadILLReflectometry::loadMonitors(NeXus::NXEntry &entry) { // read in the data g_log.debug("Fetching monitor data..."); NXData dataGroup = entry.openNXData("monitor1/data"); NXInt data = dataGroup.openIntData(); // load the counts from the file into memory data.load(); std::vector<std::vector<int>> monitors( 1); // vector of monitors with one entry std::vector<int> monitor1(data(), data() + data.size()); monitors[0].swap(monitor1); // There is two monitors in data file, but the second one seems to be always 0 dataGroup = entry.openNXData("monitor2/data"); data = dataGroup.openIntData(); data.load(); std::vector<int> monitor2(data(), data() + data.size()); monitors.push_back(monitor2); return monitors; }
/** * Load single monitor * * @param entry :: The Nexus entry * @param monitor_data :: A std::string containing the Nexus path to the monitor *data * @return monitor :: A std::vector containing monitor values */ std::vector<int> LoadILLReflectometry::loadSingleMonitor(NeXus::NXEntry &entry, const std::string &monitor_data) { NXData dataGroup = entry.openNXData(monitor_data); NXInt data = dataGroup.openIntData(); // load counts data.load(); return std::vector<int>(data(), data() + data.size()); }
/** * Load monitors data found in nexus file * * @param entry :: The Nexus entry * */ std::vector<std::vector<int>> LoadILLIndirect::loadMonitors(NeXus::NXEntry &entry) { // read in the data g_log.debug("Fetching monitor data..."); NXData dataGroup = entry.openNXData("monitor/data"); NXInt data = dataGroup.openIntData(); // load the counts from the file into memory data.load(); // For the moment, we are aware of only one monitor entry, but we keep the // generalized case of n monitors std::vector<std::vector<int>> monitors(1); std::vector<int> monitor(data(), data() + data.size()); monitors[0].swap(monitor); return monitors; }