Commit 13eb7141 authored by Ricardo Leal's avatar Ricardo Leal
Browse files

Re #7452 Added property monitor with average monitor counts.

parent ed15dc3e
......@@ -277,6 +277,14 @@ size_t LoadILLSANS::loadDataIntoWorkspaceFromMonitors(NeXus::NXEntry &firstEntry
MantidVec& E = m_localWorkspace->dataE(firstIndex);
std::transform(data(), data() + data.dim2(), E.begin(),LoadHelper::calculateStandardError);
// Add average monitor counts to a property:
double averageMonitorCounts = std::accumulate(data(), data() + data.dim2(), 0) / data.dim2();
// make sure the monitor has values!
if (averageMonitorCounts > 0) {
API::Run & runDetails = m_localWorkspace->mutableRun();
runDetails.addProperty("monitor", averageMonitorCounts,true);
}
firstIndex++;
}
}
......
......@@ -59,6 +59,7 @@ public:
TS_ASSERT_EQUALS(output2D->getNumberHistograms(), 65536+2);
TS_ASSERT_EQUALS(output2D->blocksize(), 100);
TS_ASSERT_DIFFERS(output2D->run().getPropertyValueAsType<double>("monitor"),0.0);
AnalysisDataService::Instance().clear();
}
......@@ -81,6 +82,7 @@ public:
TS_ASSERT_EQUALS(output2D->getNumberHistograms(), 65536+2);
TS_ASSERT_EQUALS(output2D->blocksize(), 1);
TS_ASSERT_DIFFERS(output2D->run().getPropertyValueAsType<double>("monitor"),0.0);
AnalysisDataService::Instance().clear();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment