Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
424d026e
Commit
424d026e
authored
4 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
Core: fix RectangularDetector::setPosition to set m_distance
This resolves issue
#918
by A. Glavic
parent
9b0f8976
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core/Detector/RectangularDetector.cpp
+2
-21
2 additions, 21 deletions
Core/Detector/RectangularDetector.cpp
with
2 additions
and
21 deletions
Core/Detector/RectangularDetector.cpp
+
2
−
21
View file @
424d026e
...
...
@@ -59,6 +59,7 @@ void RectangularDetector::setPosition(const kvector_t normal_to_detector, double
{
m_detector_arrangement
=
GENERIC
;
m_normal_to_detector
=
normal_to_detector
;
m_distance
=
m_normal_to_detector
.
mag
();
m_u0
=
u0
;
m_v0
=
v0
;
m_direction
=
direction
;
...
...
@@ -214,35 +215,20 @@ size_t RectangularDetector::indexOfSpecular(const Beam& beam) const
if
(
dimension
()
!=
2
)
return
totalSize
();
const
double
alpha
=
beam
.
getAlpha
();
const
double
phi
=
.1
+
0
*
beam
.
getPhi
();
const
double
phi
=
beam
.
getPhi
();
const
kvector_t
k_spec
=
vecOfLambdaAlphaPhi
(
beam
.
getWavelength
(),
alpha
,
phi
);
const
kvector_t
normal_unit
=
m_normal_to_detector
.
unit
();
const
double
kd
=
k_spec
.
dot
(
normal_unit
);
std
::
cout
<<
"DEBUG alpha ="
<<
alpha
<<
std
::
endl
;
std
::
cout
<<
"DEBUG phi ="
<<
phi
<<
std
::
endl
;
std
::
cout
<<
"DEBUG k_spec="
<<
k_spec
<<
std
::
endl
;
std
::
cout
<<
"DEBUG normal="
<<
normal_unit
<<
std
::
endl
;
std
::
cout
<<
"DEBUG m_dist="
<<
m_distance
<<
std
::
endl
;
std
::
cout
<<
"DEBUG kd ="
<<
kd
<<
std
::
endl
;
if
(
kd
<=
0.0
)
return
totalSize
();
ASSERT
(
m_distance
!=
0
);
const
kvector_t
rpix
=
k_spec
*
(
m_distance
/
kd
);
std
::
cout
<<
"DEBUG rpix ="
<<
rpix
<<
std
::
endl
;
const
double
u
=
rpix
.
dot
(
m_u_unit
)
+
m_u0
;
const
double
v
=
rpix
.
dot
(
m_v_unit
)
+
m_v0
;
std
::
cout
<<
"DEBUG u="
<<
u
<<
std
::
endl
;
std
::
cout
<<
"DEBUG v="
<<
v
<<
std
::
endl
;
const
IAxis
&
u_axis
=
getAxis
(
0
);
// the x axis, GISAS only
const
IAxis
&
v_axis
=
getAxis
(
1
);
// the y axis, in reflectometer plane
std
::
cout
<<
"DEBUG u axis="
<<
u_axis
.
getMin
()
<<
" ... "
<<
u_axis
.
getMax
()
<<
std
::
endl
;
std
::
cout
<<
"DEBUG v axis="
<<
v_axis
.
getMin
()
<<
" ... "
<<
v_axis
.
getMax
()
<<
std
::
endl
;
std
::
cout
<<
"DEBUG contain u="
<<
u_axis
.
contains
(
u
)
<<
std
::
endl
;
std
::
cout
<<
"DEBUG contain v="
<<
v_axis
.
contains
(
v
)
<<
std
::
endl
;
if
(
!
u_axis
.
contains
(
u
)
||
!
v_axis
.
contains
(
v
))
return
totalSize
();
std
::
cout
<<
"DEBUG idx u="
<<
u_axis
.
findClosestIndex
(
u
)
<<
std
::
endl
;
std
::
cout
<<
"DEBUG idx v="
<<
v_axis
.
findClosestIndex
(
v
)
<<
std
::
endl
;
return
getGlobalIndex
(
u_axis
.
findClosestIndex
(
u
),
v_axis
.
findClosestIndex
(
v
));
}
...
...
@@ -299,9 +285,6 @@ void RectangularDetector::initUandV(double alpha_i)
m_u_unit
=
u_direction
.
unit
();
m_v_unit
=
m_u_unit
.
cross
(
m_normal_to_detector
).
unit
();
std
::
cout
<<
"DEBUG initUandV u unit="
<<
m_u_unit
<<
std
::
endl
;
std
::
cout
<<
"DEBUG initUandV v unit="
<<
m_v_unit
<<
std
::
endl
;
if
(
m_detector_arrangement
==
PERPENDICULAR_TO_REFLECTED_BEAM_DPOS
)
{
kvector_t
z
(
0.0
,
0.0
,
1.0
);
kvector_t
normal_unit
=
m_normal_to_detector
.
unit
();
...
...
@@ -310,7 +293,5 @@ void RectangularDetector::initUandV(double alpha_i)
double
vz
=
zp
.
dot
(
m_v_unit
)
/
zp
.
mag
();
m_u0
=
m_dbeam_u0
+
m_distance
*
std
::
tan
(
2
*
alpha_i
)
*
uz
;
m_v0
=
m_dbeam_v0
+
m_distance
*
std
::
tan
(
2
*
alpha_i
)
*
vz
;
std
::
cout
<<
"DEBUG initUandV u0="
<<
m_u0
<<
std
::
endl
;
std
::
cout
<<
"DEBUG initUandV v0="
<<
m_v0
<<
std
::
endl
;
}
}
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