IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pranav Sampathkumar
corsika
Commits
2d76ccc1
Commit
2d76ccc1
authored
4 years ago
by
Felix Riehn
Committed by
Ralf Ulrich
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use logger in process OnShellCheck
parent
18f99dec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/modules/OnShellCheck.inl
+25
-23
25 additions, 23 deletions
corsika/detail/modules/OnShellCheck.inl
corsika/modules/OnShellCheck.hpp
+1
-1
1 addition, 1 deletion
corsika/modules/OnShellCheck.hpp
with
26 additions
and
24 deletions
corsika/detail/modules/OnShellCheck.inl
+
25
−
23
View file @
2d76ccc1
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
<corsika/framework/geometry/FourVector.hpp>
#include
<corsika/framework/geometry/FourVector.hpp>
#include
<corsika/modules/OnShellCheck.hpp>
#include
<corsika/modules/OnShellCheck.hpp>
#include
<corsika/framework/core/Logging.hpp>
namespace
corsika
{
namespace
corsika
{
...
@@ -18,19 +19,19 @@ namespace corsika {
...
@@ -18,19 +19,19 @@ namespace corsika {
:
mass_tolerance_
(
vMassTolerance
)
:
mass_tolerance_
(
vMassTolerance
)
,
energy_tolerance_
(
vEnergyTolerance
)
,
energy_tolerance_
(
vEnergyTolerance
)
,
throw_error_
(
vError
)
{
,
throw_error_
(
vError
)
{
std
::
cout
<<
"OnShellCheck: mass tolerance is set to "
<<
mass_tolerance_
*
100
<<
"
%"
CORSIKA_LOGGER_DEBUG
(
logger_
,
"mass tolerance is set to {:3.2f}
%"
,
<<
std
::
endl
mass_tolerance_
*
100
);
<<
" energy tolerance is set to "
<<
energy_tolerance_
*
100
CORSIKA_LOGGER_DEBUG
(
logger_
,
"energy tolerance is set to {:3.2f}%"
,
<<
"%"
<<
std
::
endl
;
energy_tolerance_
*
100
)
;
}
}
OnShellCheck
::~
OnShellCheck
()
{
OnShellCheck
::~
OnShellCheck
()
{
std
::
cout
<<
"OnShellCheck: summary"
<<
std
::
endl
logger_
->
info
(
<<
" particles shifted: "
<<
int
(
count_
)
<<
std
::
endl
;
" summary
\n
"
if
(
count_
)
" particles shifted: {}
\n
"
std
::
cout
<<
" average energy shift (%):
"
<<
average_shift_
/
count_
*
100.
" average energy shift (%):
{}
\n
"
<<
std
::
endl
" max. energy shift (%): {} "
,
<<
" max. energy shift (%): "
<<
max_shift_
*
100.
<<
std
::
endl
;
int
(
count_
),
(
count_
?
average_shift_
/
count_
*
100
:
0
),
max_shift_
*
100.
)
;
}
}
template
<
typename
TView
>
template
<
typename
TView
>
...
@@ -51,23 +52,24 @@ namespace corsika {
...
@@ -51,23 +52,24 @@ namespace corsika {
count_
=
count_
+
1
;
count_
=
count_
+
1
;
average_shift_
+=
abs
(
e_shift_relative
);
average_shift_
+=
abs
(
e_shift_relative
);
if
(
abs
(
e_shift_relative
)
>
max_shift_
)
max_shift_
=
abs
(
e_shift_relative
);
if
(
abs
(
e_shift_relative
)
>
max_shift_
)
max_shift_
=
abs
(
e_shift_relative
);
std
::
cout
<<
"OnShellCheck: shift particle mass for "
<<
pid
<<
std
::
endl
CORSIKA_LOGGER_TRACE
(
<<
std
::
setw
(
40
)
<<
std
::
setfill
(
' '
)
logger_
,
<<
"corsika mass (GeV): "
<<
m_corsika
/
1
_GeV
<<
std
::
endl
"shift particle mass for {}
\n
"
<<
std
::
setw
(
40
)
<<
std
::
setfill
(
' '
)
"{:>45} {:7.5f}
\n
"
<<
"kinetic mass (GeV): "
<<
m_kinetic
/
1
_GeV
<<
std
::
endl
"{:>45} {:7.5f}
\n
"
<<
std
::
setw
(
40
)
<<
std
::
setfill
(
' '
)
"{:>45} {:7.5f}
\n
"
<<
"m_kin-m_cor (GeV): "
<<
m_err_abs
/
1
_GeV
<<
std
::
endl
"{:>45} {:7.5f}
\n
"
,
<<
std
::
setw
(
40
)
<<
std
::
setfill
(
' '
)
pid
,
"corsika mass (GeV):"
,
m_corsika
/
1
_GeV
,
<<
"mass tolerance (GeV): "
<<
(
m_corsika
*
mass_tolerance_
)
/
1
_GeV
"kinetic mass (GeV): "
,
m_kinetic
/
1
_GeV
,
<<
std
::
endl
;
"m_kin-m_cor (GeV): "
,
m_err_abs
/
1
_GeV
,
"mass tolerance (GeV): "
,
(
m_corsika
*
mass_tolerance_
)
/
1
_GeV
);
/*
/*
For now we warn if the necessary shift is larger than 1%.
For now we warn if the necessary shift is larger than 1%.
we could promote this to an error.
we could promote this to an error.
*/
*/
if
(
abs
(
e_shift_relative
)
>
energy_tolerance_
)
{
if
(
abs
(
e_shift_relative
)
>
energy_tolerance_
)
{
std
::
cout
<<
"OnShellCheck:
warning! shifted particle energy by
"
logger_
->
warn
(
"
warning! shifted particle energy by
{} %"
,
<<
e_shift_relative
*
100
<<
" %"
<<
std
::
endl
;
e_shift_relative
*
100
)
;
if
(
throw_error_
)
if
(
throw_error_
)
throw
std
::
runtime_error
(
throw
std
::
runtime_error
(
"OnShellCheck: error! shifted energy by large amount!"
);
"OnShellCheck: error! shifted energy by large amount!"
);
...
@@ -76,7 +78,7 @@ namespace corsika {
...
@@ -76,7 +78,7 @@ namespace corsika {
// reset energy
// reset energy
p
.
setEnergy
(
e_shifted
);
p
.
setEnergy
(
e_shifted
);
}
else
}
else
std
::
cout
<<
"OnShellCheck: particle mass for
"
<<
pid
<<
" OK"
<<
std
::
endl
;
CORSIKA_LOGGER_DEBUG
(
logger_
,
"OnShellCheck: particle mass for
{} OK"
,
pid
)
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
corsika/modules/OnShellCheck.hpp
+
1
−
1
View file @
2d76ccc1
...
@@ -31,7 +31,7 @@ namespace corsika {
...
@@ -31,7 +31,7 @@ namespace corsika {
double
average_shift_
=
0
;
double
average_shift_
=
0
;
double
max_shift_
=
0
;
double
max_shift_
=
0
;
double
count_
=
0
;
double
count_
=
0
;
std
::
shared_ptr
<
spdlog
::
logger
>
logger_
=
get_logger
(
"on_shell_check"
);
double
mass_tolerance_
;
double
mass_tolerance_
;
double
energy_tolerance_
;
double
energy_tolerance_
;
bool
throw_error_
;
bool
throw_error_
;
...
...
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