IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
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
Model registry
Operate
Environments
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
Air Shower Physics
corsika
Commits
d3e36d39
Commit
d3e36d39
authored
1 year ago
by
Alan Coleman
Browse files
Options
Downloads
Plain Diff
Merge branch '593-fix-time-projection-of-stackinspector' into 'master'
Resolve "Fix time projection of StackInspector" Closes
#593
See merge request
!532
parents
281ae9e7
25aedd32
No related branches found
No related tags found
1 merge request
!532
Resolve "Fix time projection of StackInspector"
Pipeline
#11551
passed with warnings
1 year ago
Stage: quality
Stage: config
Stage: build_test_example
Stage: python
Stage: optional
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/modules/StackInspector.inl
+45
-44
45 additions, 44 deletions
corsika/detail/modules/StackInspector.inl
corsika/modules/StackInspector.hpp
+2
-0
2 additions, 0 deletions
corsika/modules/StackInspector.hpp
with
47 additions
and
44 deletions
corsika/detail/modules/StackInspector.inl
+
45
−
44
View file @
d3e36d39
...
@@ -27,7 +27,9 @@ namespace corsika {
...
@@ -27,7 +27,9 @@ namespace corsika {
:
StackProcess
<
StackInspector
<
TStack
>>
(
vNStep
)
:
StackProcess
<
StackInspector
<
TStack
>>
(
vNStep
)
,
ReportStack_
(
vReportStack
)
,
ReportStack_
(
vReportStack
)
,
E0_
(
vE0
)
,
E0_
(
vE0
)
,
StartTime_
(
std
::
chrono
::
system_clock
::
now
())
{}
,
StartTime_
(
std
::
chrono
::
system_clock
::
now
())
,
energyPostInit_
(
HEPEnergyType
::
zero
())
,
timePostInit_
(
std
::
chrono
::
system_clock
::
now
())
{}
template
<
typename
TStack
>
template
<
typename
TStack
>
inline
StackInspector
<
TStack
>::~
StackInspector
()
{}
inline
StackInspector
<
TStack
>::~
StackInspector
()
{}
...
@@ -54,54 +56,53 @@ namespace corsika {
...
@@ -54,54 +56,53 @@ namespace corsika {
}
}
}
}
if
((
E0_
-
Etot
)
<
dE_threshold_
)
return
;
std
::
chrono
::
system_clock
::
time_point
const
now
=
std
::
chrono
::
system_clock
::
now
();
std
::
chrono
::
system_clock
::
time_point
const
now
=
std
::
chrono
::
system_clock
::
now
();
std
::
chrono
::
duration
<
double
>
const
elapsed_seconds
=
now
-
StartTime_
;
// seconds
std
::
chrono
::
duration
<
double
>
const
elapsed_seconds
=
now
-
StartTime_
;
// seconds
auto
const
dE
=
E0_
-
Etot
;
if
(
dE
<
dE_threshold_
)
return
;
double
const
progress
=
dE
/
E0_
;
// Select reference times and energies using either the true start
// or the delayed start to avoid counting overhead in ETA
bool
const
usePostVals
=
(
energyPostInit_
!=
HEPEnergyType
::
zero
());
auto
const
dE
=
(
usePostVals
?
energyPostInit_
:
E0_
)
-
Etot
;
std
::
chrono
::
duration
<
double
>
const
usedSeconds
=
now
-
timePostInit_
;
double
const
dT
=
usedSeconds
.
count
();
double
const
progress
=
(
E0_
-
Etot
)
/
E0_
;
// for printout
// for printout
std
::
time_t
const
now_time
=
std
::
chrono
::
system_clock
::
to_time_t
(
now
);
std
::
time_t
const
now_time
=
std
::
chrono
::
system_clock
::
to_time_t
(
now
);
std
::
time_t
const
start_time
=
std
::
chrono
::
system_clock
::
to_time_t
(
StartTime_
);
double
const
ETA_seconds
=
(
1.0
-
progress
)
*
dT
*
(
E0_
/
dE
);
if
(
progress
>
0
)
{
std
::
chrono
::
system_clock
::
time_point
const
ETA
=
now
+
std
::
chrono
::
seconds
((
int
)
ETA_seconds
);
double
const
eta_seconds
=
elapsed_seconds
.
count
()
/
progress
;
std
::
chrono
::
system_clock
::
time_point
const
eta
=
// for printout
StartTime_
+
std
::
chrono
::
seconds
((
int
)
eta_seconds
);
std
::
time_t
const
ETA_time
=
std
::
chrono
::
system_clock
::
to_time_t
(
ETA
);
// for printout
int
const
yday0
=
std
::
localtime
(
&
now_time
)
->
tm_yday
;
std
::
time_t
const
eta_time
=
std
::
chrono
::
system_clock
::
to_time_t
(
eta
);
int
const
yday1
=
std
::
localtime
(
&
ETA_time
)
->
tm_yday
;
int
const
dyday
=
yday1
-
yday0
;
int
const
yday0
=
std
::
localtime
(
&
start_time
)
->
tm_yday
;
int
const
yday1
=
std
::
localtime
(
&
eta_time
)
->
tm_yday
;
std
::
stringstream
ETA_string
;
int
const
dyday
=
yday1
-
yday0
;
ETA_string
<<
std
::
put_time
(
std
::
localtime
(
&
ETA_time
),
"%T %Z"
);
CORSIKA_LOG_INFO
(
CORSIKA_LOG_INFO
(
"StackInspector: "
"StackInspector: "
" time={}"
" time={}"
", running={} seconds"
", running={:.1f} seconds"
" ( {:.1f}%)"
" ( {:.1f}%)"
", nStep={}"
", nStep={}"
", stackSize={}"
", stackSize={}"
", Estack={} GeV"
", Estack={:.1f} GeV"
", ETA={}{}"
,
", ETA={}{}"
,
std
::
put_time
(
std
::
localtime
(
&
now_time
),
"%T"
),
elapsed_seconds
.
count
(),
std
::
put_time
(
std
::
localtime
(
&
now_time
),
"%T %Z"
),
elapsed_seconds
.
count
(),
(
progress
*
100
),
getStep
(),
vS
.
getSize
(),
Etot
/
1
_GeV
,
(
progress
*
100
),
getStep
(),
vS
.
getSize
(),
Etot
/
1
_GeV
,
(
dyday
==
0
?
""
:
fmt
::
format
(
"+{}d "
,
dyday
)),
(
dyday
==
0
?
""
:
fmt
::
format
(
"+{}d "
,
dyday
)),
ETA_string
.
str
());
std
::
put_time
(
std
::
localtime
(
&
eta_time
),
"%T"
));
}
else
{
// Change reference time once the shower has begin (avoid counting overhead time)
CORSIKA_LOG_INFO
(
if
(
progress
>
0.02
&&
energyPostInit_
==
HEPEnergyType
::
zero
())
{
"StackInspector: "
energyPostInit_
=
Etot
;
" time={}"
timePostInit_
=
std
::
chrono
::
system_clock
::
now
();
", running={} seconds"
" ( {:.1f}%)"
", nStep={}"
", stackSize={}"
", Estack={} GeV"
", ETA={}{}"
,
std
::
put_time
(
std
::
localtime
(
&
now_time
),
"%T"
),
elapsed_seconds
.
count
(),
(
progress
*
100
),
getStep
(),
vS
.
getSize
(),
Etot
/
1
_GeV
,
"---"
,
"---"
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
corsika/modules/StackInspector.hpp
+
2
−
0
View file @
d3e36d39
...
@@ -49,6 +49,8 @@ namespace corsika {
...
@@ -49,6 +49,8 @@ namespace corsika {
HEPEnergyType
E0_
;
HEPEnergyType
E0_
;
const
HEPEnergyType
dE_threshold_
=
1
_eV
;
const
HEPEnergyType
dE_threshold_
=
1
_eV
;
std
::
chrono
::
system_clock
::
time_point
StartTime_
;
std
::
chrono
::
system_clock
::
time_point
StartTime_
;
HEPEnergyType
energyPostInit_
;
std
::
chrono
::
system_clock
::
time_point
timePostInit_
;
};
};
}
// namespace corsika
}
// namespace corsika
...
...
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