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
074594be
Commit
074594be
authored
Nov 10, 2017
by
Simon Spannagel
Browse files
Detector: store the three angles as vector
parent
f2bb7238
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/Detector.cpp
View file @
074594be
...
...
@@ -12,7 +12,7 @@ Detector::Detector() {}
Detector
::
Detector
(
const
Configuration
&
config
)
:
Detector
()
{
// Get information from the conditions file:
auto
m_displacement
=
config
.
get
<
ROOT
::
Math
::
XYZPoint
>
(
"position"
,
ROOT
::
Math
::
XYZPoint
());
auto
orientation
=
config
.
get
<
ROOT
::
Math
::
XYZVector
>
(
"orientation"
,
ROOT
::
Math
::
XYZVector
());
auto
m_
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"
);
// Size of the 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_rotationX
=
orientation
.
x
();
m_rotationY
=
orientation
.
y
();
m_rotationZ
=
orientation
.
z
();
m_timingOffset
=
config
.
get
<
double
>
(
"time_offset"
,
0.0
);
this
->
initialise
();
...
...
@@ -34,7 +31,7 @@ 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: "
<<
display_vector
(
m_displacement
,
{
"mm"
,
"um"
});
LOG
(
TRACE
)
<<
" Orientation: "
<<
m_rotationX
<<
","
<<
m_rotationY
<<
","
<<
m_rotationZ
;
LOG
(
TRACE
)
<<
" Orientation: "
<<
display_vector
(
m_orientation
,
{
"deg"
})
;
if
(
m_timingOffset
>
0.
)
{
LOG
(
TRACE
)
<<
"Timing offset: "
<<
m_timingOffset
;
}
...
...
@@ -104,8 +101,8 @@ 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_rotations
=
new
Rotation3D
(
ROOT
::
Math
::
RotationZ
(
m_
r
otation
Z
)
*
ROOT
::
Math
::
RotationY
(
m_
r
otation
Y
)
*
ROOT
::
Math
::
RotationX
(
m_
r
otation
X
));
m_rotations
=
new
Rotation3D
(
ROOT
::
Math
::
RotationZ
(
m_o
rien
tation
.
Z
()
)
*
ROOT
::
Math
::
RotationY
(
m_o
rien
tation
.
Y
()
)
*
ROOT
::
Math
::
RotationX
(
m_o
rien
tation
.
X
()
));
m_localToGlobal
=
new
Transform3D
(
*
m_rotations
,
*
m_translations
);
m_globalToLocal
=
new
Transform3D
();
...
...
@@ -137,10 +134,8 @@ 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
());
config
.
set
(
"position"
,
position
);
auto
orientation
=
ROOT
::
Math
::
XYZVector
(
m_rotationX
,
m_rotationY
,
m_rotationZ
);
config
.
set
(
"orientation"
,
orientation
);
config
.
set
(
"position"
,
m_displacement
);
config
.
set
(
"orientation"
,
m_orientation
);
auto
npixels
=
ROOT
::
Math
::
DisplacementVector2D
<
Cartesian2D
<
int
>>
(
m_nPixelsX
,
m_nPixelsY
);
config
.
set
(
"number_of_pixels"
,
npixels
);
...
...
src/core/Detector.h
View file @
074594be
...
...
@@ -58,12 +58,12 @@ namespace corryvreckan {
ROOT
::
Math
::
XYZPoint
displacement
()
{
return
m_displacement
;
}
// Functions to set and retrieve basic rotation parameters
void
rotationX
(
double
rx
)
{
m_
r
otation
X
=
rx
;
}
void
rotationY
(
double
ry
)
{
m_
r
otation
Y
=
ry
;
}
void
rotationZ
(
double
rz
)
{
m_
r
otation
Z
=
rz
;
}
double
rotationX
()
{
return
m_
r
otation
X
;
}
double
rotationY
()
{
return
m_
r
otation
Y
;
}
double
rotationZ
()
{
return
m_
r
otation
Z
;
}
void
rotationX
(
double
rx
)
{
m_o
rien
tation
.
SetX
(
rx
)
;
}
void
rotationY
(
double
ry
)
{
m_o
rien
tation
.
SetY
(
ry
)
;
}
void
rotationZ
(
double
rz
)
{
m_o
rien
tation
.
SetZ
(
rz
)
;
}
double
rotationX
()
{
return
m_o
rien
tation
.
X
()
;
}
double
rotationY
()
{
return
m_o
rien
tation
.
Y
()
;
}
double
rotationZ
()
{
return
m_o
rien
tation
.
Z
()
;
}
// Functions to set and check channel masking
void
setMaskFile
(
std
::
string
file
);
...
...
@@ -112,9 +112,7 @@ namespace corryvreckan {
// Displacement and rotation in x,y,z
ROOT
::
Math
::
XYZPoint
m_displacement
;
double
m_rotationX
;
double
m_rotationY
;
double
m_rotationZ
;
ROOT
::
Math
::
XYZVector
m_orientation
;
// Rotation and translation objects
Translation3D
*
m_translations
;
...
...
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