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
02e6ae0d
Commit
02e6ae0d
authored
Apr 17, 2020
by
Mathieu Tillet
Browse files
Change m_convertToTOF to a local variable
As the attribute is only used in exec, it can be replaced by a local variable.
parent
cbdda10b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/inc/MantidDataHandling/LoadILLTOF2.h
View file @
02e6ae0d
...
...
@@ -59,7 +59,8 @@ private:
void
loadTimeDetails
(
NeXus
::
NXEntry
&
entry
);
void
loadDataIntoTheWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
);
const
std
::
vector
<
std
::
vector
<
int
>>
&
,
bool
convertToTOF
);
void
loadSpectra
(
size_t
&
spec
,
const
size_t
numberOfTubes
,
const
std
::
vector
<
Mantid
::
detid_t
>
&
detectorIDs
,
const
NeXus
::
NXInt
&
data
,
Mantid
::
API
::
Progress
&
progress
);
...
...
@@ -70,7 +71,6 @@ private:
static
double
calculateError
(
double
in
)
{
return
sqrt
(
in
);
}
API
::
MatrixWorkspace_sptr
m_localWorkspace
;
bool
m_convertToTOF
;
std
::
string
m_instrumentName
=
""
;
///< Name of the instrument
std
::
string
m_instrumentPath
=
""
;
///< Name of the instrument path
...
...
Framework/DataHandling/src/LoadILLTOF2.cpp
View file @
02e6ae0d
...
...
@@ -81,7 +81,7 @@ void LoadILLTOF2::init() {
void
LoadILLTOF2
::
exec
()
{
// Retrieve filename
const
std
::
string
filenameData
=
getPropertyValue
(
"Filename"
);
m_
convertToTOF
=
getProperty
(
"convertToTOF"
);
bool
convertToTOF
=
getProperty
(
"convertToTOF"
);
// open the root node
NeXus
::
NXRoot
dataRoot
(
filenameData
);
...
...
@@ -99,7 +99,7 @@ void LoadILLTOF2::exec() {
runLoadInstrument
();
// just to get IDF contents
loadDataIntoTheWorkSpace
(
dataFirstEntry
,
monitors
);
loadDataIntoTheWorkSpace
(
dataFirstEntry
,
monitors
,
convertToTOF
);
addEnergyToRun
();
addPulseInterval
();
...
...
@@ -355,9 +355,12 @@ void LoadILLTOF2::addPulseInterval() {
*
* @param entry The Nexus entry
* @param monitors List of monitor data
* @param convertToTOF Should the bin edges be converted to time of flight or
* keep the channel indexes
*/
void
LoadILLTOF2
::
loadDataIntoTheWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
monitors
)
{
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
monitors
,
bool
convertToTOF
)
{
g_log
.
debug
()
<<
"Loading data into the workspace...
\n
"
;
// read in the data
...
...
@@ -371,7 +374,7 @@ void LoadILLTOF2::loadDataIntoTheWorkSpace(
// Put tof in an array
auto
&
X0
=
m_localWorkspace
->
mutableX
(
0
);
if
(
monitor
.
containsDataSet
(
"time_of_flight"
))
{
if
(
m_
convertToTOF
)
{
if
(
convertToTOF
)
{
for
(
size_t
i
=
0
;
i
<
m_numberOfChannels
+
1
;
++
i
)
{
X0
[
i
]
=
m_timeOfFlightDelay
+
m_channelWidth
*
static_cast
<
double
>
(
i
)
-
m_channelWidth
/
2
;
// to make sure the bin centre is correct
...
...
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