Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
67712616
Commit
67712616
authored
5 years ago
by
Mathieu Tillet
Browse files
Options
Downloads
Patches
Plain Diff
Corrected detector rotation issue
parent
c9e495b6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/DataHandling/inc/MantidDataHandling/LoadILLSANS.h
+1
-0
1 addition, 0 deletions
Framework/DataHandling/inc/MantidDataHandling/LoadILLSANS.h
Framework/DataHandling/src/LoadILLSANS.cpp
+41
-16
41 additions, 16 deletions
Framework/DataHandling/src/LoadILLSANS.cpp
with
42 additions
and
16 deletions
Framework/DataHandling/inc/MantidDataHandling/LoadILLSANS.h
+
1
−
0
View file @
67712616
...
@@ -77,6 +77,7 @@ private:
...
@@ -77,6 +77,7 @@ private:
void
loadMetaData
(
const
NeXus
::
NXEntry
&
,
const
std
::
string
&
);
void
loadMetaData
(
const
NeXus
::
NXEntry
&
,
const
std
::
string
&
);
std
::
string
getInstrumentFilePath
(
const
std
::
string
&
)
const
;
std
::
string
getInstrumentFilePath
(
const
std
::
string
&
)
const
;
void
rotateInstrument
(
double
,
const
std
::
string
&
);
void
rotateInstrument
(
double
,
const
std
::
string
&
);
void
placeD16
(
double
,
double
,
const
std
::
string
&
);
void
adjustTOF
();
void
adjustTOF
();
void
moveSource
();
void
moveSource
();
...
...
This diff is collapsed.
Click to expand it.
Framework/DataHandling/src/LoadILLSANS.cpp
+
41
−
16
View file @
67712616
...
@@ -123,18 +123,23 @@ void LoadILLSANS::exec() {
...
@@ -123,18 +123,23 @@ void LoadILLSANS::exec() {
moveSource
();
moveSource
();
}
}
}
else
if
(
m_instrumentName
==
"D16"
)
{
initWorkSpace
(
firstEntry
,
instrumentPath
);
progress
.
report
(
"Loading the instrument "
+
m_instrumentName
);
runLoadInstrument
();
double
distance
=
firstEntry
.
getFloat
(
instrumentPath
+
"/Det/value"
)
/
1000
;
// mm to metre
const
double
angle
=
firstEntry
.
getFloat
(
instrumentPath
+
"/Gamma/value"
);
placeD16
(
angle
,
distance
,
"detector"
);
}
else
{
}
else
{
initWorkSpace
(
firstEntry
,
instrumentPath
);
initWorkSpace
(
firstEntry
,
instrumentPath
);
progress
.
report
(
"Loading the instrument "
+
m_instrumentName
);
progress
.
report
(
"Loading the instrument "
+
m_instrumentName
);
runLoadInstrument
();
runLoadInstrument
();
double
distance
;
double
distance
=
m_loader
.
getDoubleFromNexusPath
(
if
(
m_instrumentName
==
"D16"
)
{
firstEntry
,
instrumentPath
+
"/detector/det_calc"
);
distance
=
firstEntry
.
getFloat
(
instrumentPath
+
"/Det/value"
)
/
1000
;
// mm to metre
}
else
{
distance
=
m_loader
.
getDoubleFromNexusPath
(
firstEntry
,
instrumentPath
+
"/detector/det_calc"
);
}
progress
.
report
(
"Moving detectors"
);
progress
.
report
(
"Moving detectors"
);
moveDetectorDistance
(
distance
,
"detector"
);
moveDetectorDistance
(
distance
,
"detector"
);
if
(
m_instrumentName
==
"D22"
)
{
if
(
m_instrumentName
==
"D22"
)
{
...
@@ -146,18 +151,13 @@ void LoadILLSANS::exec() {
...
@@ -146,18 +151,13 @@ void LoadILLSANS::exec() {
firstEntry, instrumentPath + "/detector/dan_actual");
firstEntry, instrumentPath + "/detector/dan_actual");
rotateD22(angle, "detector");*/
rotateD22(angle, "detector");*/
}
}
if
(
m_instrumentName
==
"D16"
)
{
const
double
angle
=
firstEntry
.
getFloat
(
instrumentPath
+
"/Gamma/value"
);
rotateInstrument
(
angle
,
"detector"
);
}
}
}
progress
.
report
(
"Setting sample logs"
);
progress
.
report
(
"Setting sample logs"
);
setFinalProperties
(
filename
);
setFinalProperties
(
filename
);
setPixelSize
();
setPixelSize
();
setProperty
(
"OutputWorkspace"
,
m_localWorkspace
);
setProperty
(
"OutputWorkspace"
,
m_localWorkspace
);
}
}
// namespace DataHandling
/**
/**
* Set member variable with the instrument name
* Set member variable with the instrument name
...
@@ -215,7 +215,7 @@ LoadILLSANS::getDetectorPositionD33(const NeXus::NXEntry &firstEntry,
...
@@ -215,7 +215,7 @@ LoadILLSANS::getDetectorPositionD33(const NeXus::NXEntry &firstEntry,
}
}
/**
/**
* Loads data for D11 and D22
* Loads data for D11
, D16
and D22
*/
*/
void
LoadILLSANS
::
initWorkSpace
(
NeXus
::
NXEntry
&
firstEntry
,
void
LoadILLSANS
::
initWorkSpace
(
NeXus
::
NXEntry
&
firstEntry
,
const
std
::
string
&
instrumentPath
)
{
const
std
::
string
&
instrumentPath
)
{
...
@@ -525,7 +525,7 @@ void LoadILLSANS::moveDetectorDistance(double distance,
...
@@ -525,7 +525,7 @@ void LoadILLSANS::moveDetectorDistance(double distance,
}
}
/**
/**
* Rotates
D22
detector around y-axis
* Rotates
instrument
detector around y-axis
in place
* @param angle : the angle to rotate [degree]
* @param angle : the angle to rotate [degree]
* @param componentName : "detector"
* @param componentName : "detector"
*/
*/
...
@@ -545,6 +545,31 @@ void LoadILLSANS::rotateInstrument(double angle,
...
@@ -545,6 +545,31 @@ void LoadILLSANS::rotateInstrument(double angle,
<<
"' to angle = "
<<
angle
<<
" degrees.
\n
"
;
<<
"' to angle = "
<<
angle
<<
" degrees.
\n
"
;
}
}
/**
* @brief LoadILLSANS::placeD16 : place the D16 detector.
* @param angle : the angle between its center and the transmitted beam
* @param distance : the distance between its center and the sample
* @param componentName : "detector"
*/
void
LoadILLSANS
::
placeD16
(
double
angle
,
double
distance
,
const
std
::
string
&
componentName
)
{
API
::
IAlgorithm_sptr
mover
=
createChildAlgorithm
(
"MoveInstrumentComponent"
);
mover
->
setProperty
<
MatrixWorkspace_sptr
>
(
"Workspace"
,
m_localWorkspace
);
mover
->
setProperty
(
"ComponentName"
,
componentName
);
mover
->
setProperty
(
"X"
,
sin
(
angle
*
M_PI
/
180
)
*
distance
);
mover
->
setProperty
(
"Y"
,
0.
);
mover
->
setProperty
(
"Z"
,
cos
(
angle
*
M_PI
/
180
)
*
distance
);
mover
->
setProperty
(
"RelativePosition"
,
false
);
mover
->
executeAsChildAlg
();
// rotate the detector so it faces the sample.
rotateInstrument
(
angle
,
componentName
);
g_log
.
debug
()
<<
"Moving component '"
<<
componentName
<<
"' to angle = "
<<
angle
<<
" degrees and distance = "
<<
distance
<<
"metres.
\n
"
;
}
/**
/**
* Move detectors in X
* Move detectors in X
* @param shift : the distance to move [metres]
* @param shift : the distance to move [metres]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment