28 std::dynamic_pointer_cast<Mantid::DataObjects::TableWorkspace>(
30 timeZeroTable->addColumn(
"double",
"time zero");
32 for (
size_t specNum = 0; specNum < numSpec; ++specNum) {
34 row << timeZeros[specNum];
42 : m_logger(
g_log), m_filename(
std::move(filename)), m_nexusLoader(nexusLoader) {}
53 auto &run = localWorkspace.
run();
54 std::string mainFieldDirection = run.
getLogData(
"main_field_direction")->
value();
58 return idfGrouping->toTable();
59 }
catch (
const std::runtime_error &) {
60 auto dummyGrouping = std::make_shared<API::Grouping>();
61 if (instrument->getNumberDetectors() != 0) {
66 dummyGrouping->groups.emplace_back(std::move(numDetectors));
67 dummyGrouping->groupNames.emplace_back(
"all");
69 return dummyGrouping->toTable();
79 std::vector<detid_t> loadedDetectors;
80 loadedDetectors.reserve(numberOfSpectra);
81 for (
size_t spectraIndex = 0; spectraIndex < numberOfSpectra; spectraIndex++) {
84 loadedDetectors.emplace_back(*detIdSet.begin());
86 return loadedDetectors;
97 const std::vector<detid_t> &grouping)
const {
98 auto detectorGroupingTable = std::dynamic_pointer_cast<DataObjects::TableWorkspace>(
100 detectorGroupingTable->addColumn(
"vector_int",
"Detectors");
102 std::map<detid_t, std::vector<detid_t>> groupingMap;
103 for (
size_t i = 0; i < detectorsLoaded.size(); ++i) {
105 groupingMap[grouping[i]].emplace_back(detectorsLoaded[i]);
108 for (
auto &group : groupingMap) {
109 if (group.first != 0) {
111 newRow << group.second;
114 return detectorGroupingTable;
123 const std::vector<double> &deadTimes)
const {
124 auto deadTimesTable = std::dynamic_pointer_cast<DataObjects::TableWorkspace>(
127 deadTimesTable->addColumn(
"int",
"spectrum");
128 deadTimesTable->addColumn(
"double",
"dead-time");
130 for (
size_t i = 0; i < detectorsLoaded.size(); i++) {
132 row << detectorsLoaded[i] << deadTimes[i];
135 return deadTimesTable;
const Run & run() const
Run details object access.
Geometry::Instrument_const_sptr getInstrument() const
Returns the parameterized instrument.
GroupingLoader : Loads instrument grouping from IDF file.
std::shared_ptr< Grouping > getDummyGrouping()
Returns a "dummy" grouping of a single group with all the detectors in it.
std::shared_ptr< Grouping > getGroupingFromIDF() const
Load the grouping from the instrument's IDF.
const std::set< detid_t > & getDetectorIDs() const
Get a const reference to the detector IDs set.
Kernel::Property * getLogData(const std::string &name) const
Access a single log entry.
TableRow represents a row in a TableWorkspace.
DataObjects::TableWorkspace_sptr createDeadTimeTable(const std::vector< detid_t > &detectorsLoaded, const std::vector< double > &deadTimes) const
Creates the deadtime table for the loaded detectors .
std::vector< detid_t > getLoadedDetectorsFromWorkspace(const DataObjects::Workspace2D &localWorkspace) const
Determines the detectors loaded in the input workspace.
API::Workspace_sptr loadDefaultDetectorGrouping(const DataObjects::Workspace2D &localWorkspace) const
Loads default detector grouping, if this isn't present return dummy grouping.
LoadMuonStrategy(Kernel::Logger &g_log, std::string filename, LoadMuonNexusV2NexusHelper &nexusLoader)
DataObjects::TableWorkspace_sptr createDetectorGroupingTable(const std::vector< detid_t > &specToLoad, const std::vector< detid_t > &grouping) const
Creates Detector Grouping Table .
Concrete workspace implementation.
std::size_t getNumberHistograms() const override
Returns the histogram number.
Histogram1D & getSpectrum(const size_t index) override
Return the underlying ISpectrum ptr at the given workspace index.
The Logger class is in charge of the publishing messages from the framework through various channels.
virtual std::string value() const =0
Returns the value of the property as a string.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Kernel::Logger g_log("ExperimentInfo")
static logger object
DataObjects::TableWorkspace_sptr createTimeZeroTable(const size_t numSpec, const std::vector< double > &timeZeros)
Creates a timezero table for the loaded detectors.
std::shared_ptr< TableWorkspace > TableWorkspace_sptr
shared pointer to Mantid::DataObjects::TableWorkspace
std::string to_string(const wide_integer< Bits, Signed > &n)