Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
07a1fa16
Commit
07a1fa16
authored
Oct 02, 2018
by
Peterson, Peter
Browse files
Rename functions to clarify what they do
parent
d77371db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Framework/LiveData/inc/MantidLiveData/LoadLiveData.h
View file @
07a1fa16
...
...
@@ -66,7 +66,7 @@ private:
void
appendChunk
(
Mantid
::
API
::
Workspace_sptr
chunkWS
);
API
::
Workspace_sptr
appendMatrixWSChunk
(
API
::
Workspace_sptr
accumWS
,
Mantid
::
API
::
Workspace_sptr
chunkWS
);
void
resetAllXToSingleBin
(
API
::
Workspace
*
workspace
);
void
updateDefaultBinBoundaries
(
API
::
Workspace
*
workspace
);
/// The "accumulation" workspace = after adding, but before post-processing
Mantid
::
API
::
Workspace_sptr
m_accumWS
;
...
...
Framework/LiveData/src/LoadLiveData.cpp
View file @
07a1fa16
...
...
@@ -418,7 +418,7 @@ Workspace_sptr LoadLiveData::appendMatrixWSChunk(Workspace_sptr accumWS,
}
namespace
{
bool
shouldResetAllXToSingleBin
(
const
EventWorkspace
*
workspace
)
{
bool
isUsingDefaultBinBoundaries
(
const
EventWorkspace
*
workspace
)
{
// only check first spectrum
const
auto
&
x
=
workspace
->
binEdges
(
0
);
if
(
x
.
size
()
>
2
)
...
...
@@ -439,16 +439,16 @@ bool shouldResetAllXToSingleBin(const EventWorkspace *workspace) {
*
* @param workspace :: Workspace(Group) that will have its bins reset
*/
void
LoadLiveData
::
resetAllXToSingleBin
(
API
::
Workspace
*
workspace
)
{
void
LoadLiveData
::
updateDefaultBinBoundaries
(
API
::
Workspace
*
workspace
)
{
if
(
auto
*
ws_event
=
dynamic_cast
<
EventWorkspace
*>
(
workspace
))
{
if
(
shouldResetAllXToSingleBin
(
ws_event
))
if
(
isUsingDefaultBinBoundaries
(
ws_event
))
ws_event
->
resetAllXToSingleBin
();
}
else
if
(
auto
*
ws_group
=
dynamic_cast
<
WorkspaceGroup
*>
(
workspace
))
{
auto
num_entries
=
static_cast
<
size_t
>
(
ws_group
->
getNumberOfEntries
());
for
(
size_t
i
=
0
;
i
<
num_entries
;
++
i
)
{
auto
ws
=
ws_group
->
getItem
(
i
);
if
(
auto
*
ws_event
=
dynamic_cast
<
EventWorkspace
*>
(
ws
.
get
()))
if
(
shouldResetAllXToSingleBin
(
ws_event
))
if
(
isUsingDefaultBinBoundaries
(
ws_event
))
ws_event
->
resetAllXToSingleBin
();
}
}
...
...
@@ -505,11 +505,10 @@ void LoadLiveData::exec() {
this
->
setPropertyValue
(
"LastTimeStamp"
,
lastTimeStamp
.
toISO8601String
());
// For EventWorkspaces, we adjust the X values such that all events fit
// within the bin boundaries. This is done both before and after the
// "Process" step. Any custom rebinning should be done in Post-Processing.
// within the bin boundaries
const
bool
preserveEvents
=
this
->
getProperty
(
"PreserveEvents"
);
if
(
preserveEvents
)
this
->
resetAllXToSingleBin
(
chunkWS
.
get
());
this
->
updateDefaultBinBoundaries
(
chunkWS
.
get
());
// Now we process the chunk
Workspace_sptr
processed
=
this
->
processChunk
(
chunkWS
);
...
...
@@ -569,11 +568,10 @@ void LoadLiveData::exec() {
// Default to Add.
this
->
addChunk
(
processed
);
// For EventWorkspaces, we adjust the X values such that all events fit
// within the bin boundaries. This is done both before and after the
// "Process" step. Any custom rebinning should be done in Post-Processing.
// When adding events, the default bin boundaries may need to be updated.
// The function itself checks to see if it is appropriate
if
(
preserveEvents
)
{
this
->
resetAllXToSingleBin
(
m_accumWS
.
get
());
this
->
updateDefaultBinBoundaries
(
m_accumWS
.
get
());
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment