Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
f2bb7238
Commit
f2bb7238
authored
Nov 10, 2017
by
Simon Spannagel
Browse files
Detector: store full displacement vector instead of components
parent
9d1df4da
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/Detector.cpp
View file @
f2bb7238
...
...
@@ -11,7 +11,7 @@ using namespace corryvreckan;
Detector
::
Detector
()
{}
Detector
::
Detector
(
const
Configuration
&
config
)
:
Detector
()
{
// Get information from the conditions file:
auto
position
=
config
.
get
<
ROOT
::
Math
::
XYZPoint
>
(
"position"
,
ROOT
::
Math
::
XYZPoint
());
auto
m_displacement
=
config
.
get
<
ROOT
::
Math
::
XYZPoint
>
(
"position"
,
ROOT
::
Math
::
XYZPoint
());
auto
orientation
=
config
.
get
<
ROOT
::
Math
::
XYZVector
>
(
"orientation"
,
ROOT
::
Math
::
XYZVector
());
// Number of pixels
auto
npixels
=
config
.
get
<
ROOT
::
Math
::
DisplacementVector2D
<
Cartesian2D
<
int
>>>
(
"number_of_pixels"
);
...
...
@@ -24,9 +24,6 @@ Detector::Detector(const Configuration& config) : Detector() {
m_nPixelsY
=
npixels
.
y
();
m_pitchX
=
pitch
.
x
()
/
1000.
;
m_pitchY
=
pitch
.
y
()
/
1000.
;
m_displacementX
=
position
.
x
();
m_displacementY
=
position
.
y
();
m_displacementZ
=
position
.
z
();
m_rotationX
=
orientation
.
x
();
m_rotationY
=
orientation
.
y
();
m_rotationZ
=
orientation
.
z
();
...
...
@@ -36,8 +33,8 @@ Detector::Detector(const Configuration& config) : Detector() {
LOG
(
TRACE
)
<<
"Initialized
\"
"
<<
m_detectorType
<<
"
\"
: "
<<
m_nPixelsX
<<
"x"
<<
m_nPixelsY
<<
" px, pitch of "
<<
m_pitchX
<<
"/"
<<
m_pitchY
<<
"mm"
;
LOG
(
TRACE
)
<<
"Position: "
<<
m_
displa
cementX
<<
","
<<
m_displacementY
<<
","
<<
m_displacementZ
;
LOG
(
TRACE
)
<<
"Orientation: "
<<
m_rotationX
<<
","
<<
m_rotationY
<<
","
<<
m_rotationZ
;
LOG
(
TRACE
)
<<
"
Position: "
<<
displa
y_vector
(
m_displacement
,
{
"mm"
,
"um"
})
;
LOG
(
TRACE
)
<<
"
Orientation: "
<<
m_rotationX
<<
","
<<
m_rotationY
<<
","
<<
m_rotationZ
;
if
(
m_timingOffset
>
0.
)
{
LOG
(
TRACE
)
<<
"Timing offset: "
<<
m_timingOffset
;
}
...
...
@@ -106,7 +103,7 @@ void Detector::initialise() {
// Make the local to global transform, built from a displacement and
// rotation
m_translations
=
new
Translation3D
(
m_displacement
X
,
m_displacement
Y
,
m_displacement
Z
);
m_translations
=
new
Translation3D
(
m_displacement
.
X
()
,
m_displacement
.
Y
()
,
m_displacement
.
Z
()
);
m_rotations
=
new
Rotation3D
(
ROOT
::
Math
::
RotationZ
(
m_rotationZ
)
*
ROOT
::
Math
::
RotationY
(
m_rotationY
)
*
ROOT
::
Math
::
RotationX
(
m_rotationX
));
...
...
@@ -140,7 +137,7 @@ Configuration Detector::getConfiguration() {
Configuration
config
(
name
());
config
.
set
(
"type"
,
m_detectorType
);
auto
position
=
ROOT
::
Math
::
XYZPoint
(
m_displacement
X
,
m_displacement
Y
,
m_displacement
Z
);
auto
position
=
ROOT
::
Math
::
XYZPoint
(
m_displacement
.
X
()
,
m_displacement
.
Y
()
,
m_displacement
.
Z
()
);
config
.
set
(
"position"
,
position
);
auto
orientation
=
ROOT
::
Math
::
XYZVector
(
m_rotationX
,
m_rotationY
,
m_rotationZ
);
config
.
set
(
"orientation"
,
orientation
);
...
...
src/core/Detector.h
View file @
f2bb7238
...
...
@@ -48,12 +48,14 @@ namespace corryvreckan {
double
timingOffset
()
{
return
m_timingOffset
;
}
// Functions to set and retrieve basic translation parameters
void
displacementX
(
double
x
)
{
m_displacementX
=
x
;
}
void
displacementY
(
double
y
)
{
m_displacementY
=
y
;
}
void
displacementZ
(
double
z
)
{
m_displacementZ
=
z
;
}
double
displacementX
()
{
return
m_displacementX
;
}
double
displacementY
()
{
return
m_displacementY
;
}
double
displacementZ
()
{
return
m_displacementZ
;
}
void
displacementX
(
double
x
)
{
m_displacement
.
SetX
(
x
);
}
void
displacementY
(
double
y
)
{
m_displacement
.
SetY
(
y
);
}
void
displacementZ
(
double
z
)
{
m_displacement
.
SetZ
(
z
);
}
void
displacement
(
ROOT
::
Math
::
XYZPoint
displacement
)
{
m_displacement
=
displacement
;
}
double
displacementX
()
{
return
m_displacement
.
X
();
}
double
displacementY
()
{
return
m_displacement
.
Y
();
}
double
displacementZ
()
{
return
m_displacement
.
Z
();
}
ROOT
::
Math
::
XYZPoint
displacement
()
{
return
m_displacement
;
}
// Functions to set and retrieve basic rotation parameters
void
rotationX
(
double
rx
)
{
m_rotationX
=
rx
;
}
...
...
@@ -109,9 +111,7 @@ namespace corryvreckan {
double
m_timingOffset
;
// Displacement and rotation in x,y,z
double
m_displacementX
;
double
m_displacementY
;
double
m_displacementZ
;
ROOT
::
Math
::
XYZPoint
m_displacement
;
double
m_rotationX
;
double
m_rotationY
;
double
m_rotationZ
;
...
...
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