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
9d1df4da
Commit
9d1df4da
authored
Nov 10, 2017
by
Simon Spannagel
Browse files
Add units - I really thought I did this already...
parent
5eb4bb83
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/Analysis.cpp
View file @
9d1df4da
...
...
@@ -88,6 +88,9 @@ Analysis::Analysis(std::string config_file_name, std::vector<std::string> option
}
void
Analysis
::
load
()
{
add_units
();
load_detectors
();
load_algorithms
();
}
...
...
@@ -527,3 +530,49 @@ void Analysis::set_algorithm_after(std::tuple<LogLevel, LogFormat> prev) {
LOG
(
TRACE
)
<<
"Reset log format to global level of "
<<
Log
::
getStringFromFormat
(
old_format
);
}
}
void
Analysis
::
add_units
()
{
LOG
(
TRACE
)
<<
"Adding physical units"
;
// LENGTH
Units
::
add
(
"nm"
,
1e-6
);
Units
::
add
(
"um"
,
1e-3
);
Units
::
add
(
"mm"
,
1
);
Units
::
add
(
"cm"
,
1e1
);
Units
::
add
(
"dm"
,
1e2
);
Units
::
add
(
"m"
,
1e3
);
Units
::
add
(
"km"
,
1e6
);
// TIME
Units
::
add
(
"ps"
,
1e-3
);
Units
::
add
(
"ns"
,
1
);
Units
::
add
(
"us"
,
1e3
);
Units
::
add
(
"ms"
,
1e6
);
Units
::
add
(
"s"
,
1e9
);
// TEMPERATURE
Units
::
add
(
"K"
,
1
);
// ENERGY
Units
::
add
(
"eV"
,
1e-6
);
Units
::
add
(
"keV"
,
1e-3
);
Units
::
add
(
"MeV"
,
1
);
Units
::
add
(
"GeV"
,
1e3
);
// CHARGE
Units
::
add
(
"e"
,
1
);
Units
::
add
(
"ke"
,
1e3
);
Units
::
add
(
"C"
,
1.6021766208e-19
);
// VOLTAGE
// NOTE: fixed by above
Units
::
add
(
"V"
,
1e-6
);
Units
::
add
(
"kV"
,
1e-3
);
// ANGLES
// NOTE: these are fake units
Units
::
add
(
"deg"
,
0.01745329252
);
Units
::
add
(
"rad"
,
1
);
Units
::
add
(
"mrad"
,
1e-3
);
}
src/core/Analysis.h
View file @
9d1df4da
...
...
@@ -56,6 +56,7 @@ namespace corryvreckan {
private:
void
load_detectors
();
void
load_algorithms
();
void
add_units
();
// Log file if specified
std
::
ofstream
log_file_
;
...
...
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