/** Execute the algorithm. */ void LoadILLReflectometry::exec() { // Retrieve filename std::string filenameData = getPropertyValue("Filename"); // open the root node NeXus::NXRoot dataRoot(filenameData); NXEntry firstEntry = dataRoot.openFirstEntry(); // Load Monitor details: n. monitors x monitor contents std::vector<std::vector<int>> monitorsData = loadMonitors(firstEntry); // Load Data details (number of tubes, channels, etc) loadDataDetails(firstEntry); std::string instrumentPath = m_loader.findInstrumentNexusPath(firstEntry); setInstrumentName(firstEntry, instrumentPath); initWorkSpace(firstEntry, monitorsData); g_log.debug("Building properties..."); loadNexusEntriesIntoProperties(filenameData); g_log.debug("Loading data..."); loadDataIntoTheWorkSpace(firstEntry, monitorsData); // load the instrument from the IDF if it exists g_log.debug("Loading instrument definition..."); runLoadInstrument(); // 1) Move // Get distance and tilt angle stored in nexus file // Mantid way //// auto angleProp = /// dynamic_cast<PropertyWithValue<double>*>(m_localWorkspace->run().getProperty("dan.value")); // Nexus way double angle = firstEntry.getFloat("instrument/dan/value"); // detector angle in degrees double distance = firstEntry.getFloat( "instrument/det/value"); // detector distance in millimeter distance /= 1000.0; // convert to meter g_log.debug() << "Moving detector at angle " << angle << " and distance " << distance << std::endl; placeDetector(distance, angle); // Set the channel width property auto channel_width = dynamic_cast<PropertyWithValue<double> *>( m_localWorkspace->run().getProperty("monitor1.time_of_flight_0")); m_localWorkspace->mutableRun().addProperty<double>( "channel_width", *channel_width, true); // overwrite // Set the output workspace property setProperty("OutputWorkspace", m_localWorkspace); }
//---------------------------------------------------------------------------- QFileInfo ctkPluginContext::getDataFile(const QString& filename) { Q_D(ctkPluginContext); d->isPluginContextValid(); QDir dataRoot(d->plugin->getDataRoot().absolutePath()); if (!dataRoot.exists()) { if (!dataRoot.mkpath(dataRoot.absolutePath())) { qWarning() << "Could not create persistent storage area:" << dataRoot.absolutePath(); } } return QFileInfo(dataRoot.absolutePath() + '/' + filename); }