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
9cd07a21
Commit
9cd07a21
authored
Jul 29, 2016
by
Ian Bush
Browse files
Refs #17065 New IN6 IDF
Also includes changes to LoadILL to support separate monitor workspace.
parent
56d8eef4
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/inc/MantidDataHandling/LoadILL.h
View file @
9cd07a21
...
...
@@ -84,6 +84,7 @@ private:
int
validateVanadium
(
const
std
::
string
&
);
API
::
MatrixWorkspace_sptr
m_localWorkspace
;
API
::
MatrixWorkspace_sptr
m_monitorWorkspace
;
// NeXus::NXRoot m_dataRoot;
// NeXus::NXRoot m_vanaRoot;
...
...
Framework/DataHandling/src/LoadILL.cpp
View file @
9cd07a21
...
...
@@ -105,6 +105,7 @@ void LoadILL::exec() {
std
::
string
filenameData
=
getPropertyValue
(
"Filename"
);
std
::
string
filenameVanadium
=
getPropertyValue
(
"FilenameVanadium"
);
MatrixWorkspace_sptr
vanaWS
=
getProperty
(
"WorkspaceVanadium"
);
std
::
string
outputWSName
=
getPropertyValue
(
"OutputWorkspace"
);
// open the root node
NeXus
::
NXRoot
dataRoot
(
filenameData
);
...
...
@@ -135,6 +136,10 @@ void LoadILL::exec() {
// Set the output workspace property
setProperty
(
"OutputWorkspace"
,
m_localWorkspace
);
// Set the monitor workspace
std
::
string
monitorWSName
=
outputWSName
+
"_monitors"
;
AnalysisDataService
::
Instance
().
add
(
monitorWSName
,
m_monitorWorkspace
);
}
/**
...
...
@@ -266,10 +271,14 @@ void LoadILL::initWorkSpace(NeXus::NXEntry &entry,
// bin boundaries = m_numberOfChannels + 1
// Z/time dimension
m_localWorkspace
=
WorkspaceFactory
::
Instance
().
create
(
"Workspace2D"
,
m_numberOfHistograms
+
numberOfMonitors
,
"Workspace2D"
,
m_numberOfHistograms
,
m_numberOfChannels
+
1
,
m_numberOfChannels
);
m_monitorWorkspace
=
WorkspaceFactory
::
Instance
().
create
(
"Workspace2D"
,
numberOfMonitors
,
m_numberOfChannels
+
1
,
m_numberOfChannels
);
m_localWorkspace
->
getAxis
(
0
)
->
unit
()
=
UnitFactory
::
Instance
().
create
(
"TOF"
);
m_localWorkspace
->
setYUnitLabel
(
"Counts"
);
m_localWorkspace
->
setMonitorWorkspace
(
m_monitorWorkspace
);
}
/**
...
...
@@ -517,19 +526,25 @@ void LoadILL::loadDataIntoTheWorkSpace(
// The binning for monitors is considered the same as for detectors
size_t
spec
=
0
;
for
(
const
auto
&
monitor
:
monitors
)
{
auto
const
&
instrument
=
m_localWorkspace
->
getInstrument
();
std
::
vector
<
detid_t
>
monitorIDs
=
instrument
->
getMonitors
();
m_localWorkspace
->
dataX
(
spec
)
for
(
const
auto
&
monitor
:
monitors
)
{
m_monitorWorkspace
->
dataX
(
spec
)
.
assign
(
detectorTofBins
.
begin
(),
detectorTofBins
.
end
());
// Assign Y
m_
local
Workspace
->
dataY
(
spec
).
assign
(
monitor
.
begin
(),
monitor
.
end
());
m_
monitor
Workspace
->
dataY
(
spec
).
assign
(
monitor
.
begin
(),
monitor
.
end
());
// Assign Error
MantidVec
&
E
=
m_
local
Workspace
->
dataE
(
spec
);
MantidVec
&
E
=
m_
monitor
Workspace
->
dataE
(
spec
);
std
::
transform
(
monitor
.
begin
(),
monitor
.
end
(),
E
.
begin
(),
LoadILL
::
calculateError
);
m_monitorWorkspace
->
getSpectrum
(
spec
).
setDetectorID
(
monitorIDs
[
spec
]);
++
spec
;
}
spec
=
0
;
std
::
vector
<
detid_t
>
detectorIDs
=
instrument
->
getDetectorIDs
(
true
);
// Assign calculated bins to first X axis
size_t
firstSpec
=
spec
;
m_localWorkspace
->
dataX
(
firstSpec
)
...
...
@@ -551,7 +566,7 @@ void LoadILL::loadDataIntoTheWorkSpace(
MantidVec
&
E
=
m_localWorkspace
->
dataE
(
spec
);
std
::
transform
(
data_p
,
data_p
+
m_numberOfChannels
,
E
.
begin
(),
LoadILL
::
calculateError
);
m_localWorkspace
->
getSpectrum
(
spec
).
setDetectorID
(
detectorIDs
[
spec
]);
++
spec
;
progress
.
report
();
}
...
...
@@ -606,7 +621,18 @@ void LoadILL::runLoadInstrument() {
loadInst
->
setPropertyValue
(
"InstrumentName"
,
m_instrumentName
);
loadInst
->
setProperty
<
MatrixWorkspace_sptr
>
(
"Workspace"
,
m_localWorkspace
);
loadInst
->
setProperty
(
"RewriteSpectraMap"
,
Mantid
::
Kernel
::
OptionalBool
(
true
));
Mantid
::
Kernel
::
OptionalBool
(
false
));
loadInst
->
execute
();
}
catch
(...)
{
g_log
.
information
(
"Cannot load the instrument definition."
);
}
// Now execute the Child Algorithm. Catch and log any error, but don't stop.
try
{
loadInst
->
setPropertyValue
(
"InstrumentName"
,
m_instrumentName
);
loadInst
->
setProperty
<
MatrixWorkspace_sptr
>
(
"Workspace"
,
m_monitorWorkspace
);
loadInst
->
setProperty
(
"RewriteSpectraMap"
,
Mantid
::
Kernel
::
OptionalBool
(
false
));
loadInst
->
execute
();
}
catch
(...)
{
g_log
.
information
(
"Cannot load the instrument definition."
);
...
...
instrument/IN6_Definition.xml
View file @
9cd07a21
This diff is collapsed.
Click to expand it.
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