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
95ba9ea8
Commit
95ba9ea8
authored
Jun 28, 2018
by
Simon Spannagel
Browse files
Update Units with possibility to display vectors, update other utils
parent
d9b678a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/core/config/Configuration.hpp
View file @
95ba9ea8
...
...
@@ -16,7 +16,7 @@
#include
<string>
#include
<vector>
#include
"core/utils/
string
.h"
#include
"core/utils/
text
.h"
#include
"exceptions.h"
namespace
corryvreckan
{
...
...
src/core/detector/Detector.cpp
View file @
95ba9ea8
...
...
@@ -48,9 +48,9 @@ Detector::Detector(const Configuration& config) {
this
->
initialise
();
LOG
(
TRACE
)
<<
"Initialized
\"
"
<<
m_detectorType
<<
"
\"
: "
<<
m_nPixelsX
<<
"x"
<<
m_nPixelsY
<<
" px, pitch of "
<<
display
_vector
(
m_pitch
,
{
"mm"
,
"um"
});
LOG
(
TRACE
)
<<
" Position: "
<<
display
_vector
(
m_displacement
,
{
"mm"
,
"um"
});
LOG
(
TRACE
)
<<
" Orientation: "
<<
display
_vector
(
m_orientation
,
{
"deg"
})
<<
" ("
<<
m_orientation_mode
<<
")"
;
<<
Units
::
display
(
m_pitch
,
{
"mm"
,
"um"
});
LOG
(
TRACE
)
<<
" Position: "
<<
Units
::
display
(
m_displacement
,
{
"mm"
,
"um"
});
LOG
(
TRACE
)
<<
" Orientation: "
<<
Units
::
display
(
m_orientation
,
{
"deg"
})
<<
" ("
<<
m_orientation_mode
<<
")"
;
if
(
m_timingOffset
>
0.
)
{
LOG
(
TRACE
)
<<
"Timing offset: "
<<
m_timingOffset
;
}
...
...
@@ -156,6 +156,7 @@ Configuration Detector::getConfiguration() {
config
.
set
(
"type"
,
m_detectorType
);
config
.
set
(
"position"
,
m_displacement
);
config
.
set
(
"postst"
,
Units
::
display
(
m_displacement
,
{
"um"
,
"mm"
}));
config
.
set
(
"orientation_mode"
,
m_orientation_mode
);
config
.
set
(
"orientation"
,
m_orientation
);
auto
npixels
=
ROOT
::
Math
::
DisplacementVector2D
<
Cartesian2D
<
int
>>
(
m_nPixelsX
,
m_nPixelsY
);
...
...
src/core/utils/ROOT.h
View file @
95ba9ea8
...
...
@@ -22,7 +22,7 @@
#include
<Math/PositionVector3D.h>
#include
<TString.h>
#include
"core/utils/
string
.h"
#include
"core/utils/
text
.h"
#include
"core/utils/type.h"
namespace
corryvreckan
{
...
...
@@ -146,21 +146,6 @@ namespace corryvreckan {
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
ROOT
::
Math
::
PositionVector2D
<
T
,
U
>&
vec
)
{
return
os
<<
"("
<<
vec
.
x
()
<<
","
<<
vec
.
y
()
<<
")"
;
}
/**
* @brief Utility function to display vector types with units
* @note Works for all vector types that can be converted to string using \ref StringConversions "the string utilities".
*/
template
<
typename
T
>
inline
std
::
string
display_vector
(
T
inp
,
std
::
initializer_list
<
std
::
string
>
units
)
{
auto
split
=
corryvreckan
::
split
<
Units
::
UnitType
>
(
corryvreckan
::
to_string
(
inp
));
std
::
string
ret_str
=
"("
;
for
(
auto
&
element
:
split
)
{
ret_str
+=
Units
::
display
(
element
,
units
);
ret_str
+=
","
;
}
ret_str
[
ret_str
.
size
()
-
1
]
=
')'
;
return
ret_str
;
}
}
// namespace corryvreckan
#endif
/* CORRYVRECKAN_ROOT_H */
src/core/utils/type.h
View file @
95ba9ea8
...
...
@@ -2,10 +2,8 @@
* @file
* @brief Tags for type dispatching and run time type identification
* @copyright Copyright (c) 2017 CERN and the Allpix Squared authors.
* This software is distributed under the terms of the MIT License, copied
* verbatim in the file "LICENSE.md".
* In applying this license, CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an
* This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md".
* In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*/
...
...
@@ -21,14 +19,12 @@
namespace
corryvreckan
{
/**
* @brief Tag for specific type
* @note This tag is needed in the \ref ::corryvreckan namespace due to ADL
* lookup
* @note This tag is needed in the \ref ::corryvreckan namespace due to ADL lookup
*/
template
<
typename
T
>
struct
type_tag
{};
/**
* @brief Empty tag
* @note This tag is needed in the \ref ::corryvreckan namespace due to ADL
* lookup
* @note This tag is needed in the \ref ::corryvreckan namespace due to ADL lookup
*/
struct
empty_tag
{};
...
...
@@ -54,8 +50,7 @@ namespace corryvreckan {
/**
* @brief Demangle the type to human-readable form if it is mangled
* @param name The possibly mangled name
* @param keep_corryvreckan If true the corryvreckan namespace tag will be kept,
* otherwise it is removed
* @param keep_corryvreckan If true the corryvreckan namespace tag will be kept, otherwise it is removed
*/
inline
std
::
string
demangle
(
const
char
*
name
,
bool
keep_corryvreckan
=
false
)
{
return
name
;
}
#endif
...
...
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