IAP GITLAB
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
corsika
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
123
Issues
123
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Air Shower Physics
corsika
Commits
d3e58cb7
Commit
d3e58cb7
authored
Feb 20, 2021
by
Ralf Ulrich
☄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed, improvements and switch off debugging output
parent
c4b8af2e
Pipeline
#3537
passed with stages
in 37 minutes and 48 seconds
Changes
8
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
114 additions
and
85 deletions
+114
-85
corsika/corsika.hpp
corsika/corsika.hpp
+2
-0
corsika/detail/framework/core/Cascade.inl
corsika/detail/framework/core/Cascade.inl
+65
-56
corsika/detail/modules/LongitudinalProfile.inl
corsika/detail/modules/LongitudinalProfile.inl
+5
-5
corsika/detail/modules/StackInspector.inl
corsika/detail/modules/StackInspector.inl
+5
-5
corsika/detail/modules/pythia8/Decay.inl
corsika/detail/modules/pythia8/Decay.inl
+17
-16
corsika/framework/process/ContinuousProcessIndex.hpp
corsika/framework/process/ContinuousProcessIndex.hpp
+2
-0
do-clang-format.py
do-clang-format.py
+17
-0
examples/vertical_EAS.cpp
examples/vertical_EAS.cpp
+1
-3
No files found.
corsika/corsika.hpp
View file @
d3e58cb7
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
...
...
corsika/detail/framework/core/Cascade.inl
View file @
d3e58cb7
...
...
@@ -121,11 +121,17 @@ namespace corsika {
ContinuousProcessStepLength const continuousMaxStep =
sequence_.getMaxStepLength(vParticle, step);
LengthType const continuous_max_dist = continuousMaxStep;
ContinuousProcessIndex
const limitingId = continuousMaxStep
;
ContinuousProcessIndex
limitingId
;
// take minimum of geometry, interaction, decay for next step
auto const min_distance =
std::min({distance_interact, distance_decay, continuous_max_dist, geomMaxLength});
LengthType const min_discrete = std::min(distance_interact, distance_decay);
LengthType const min_non_continuous = std::min(min_discrete, geomMaxLength);
LengthType const min_distance = std::min(min_non_continuous, continuous_max_dist);
if (continuous_max_dist < min_non_continuous) {
limitingId =
continuousMaxStep; // the current step IS limited by known continuous process
}
CORSIKA_LOG_DEBUG(
"transport particle by : {} m "
...
...
@@ -157,51 +163,43 @@ namespace corsika {
}
return;
}
if (continuous_max_dist < min_non_continuous) {
return; // there is nothing further further
}
CORSIKA_LOG_DEBUG("sth. happening before geometric limit ? {}",
((min_distance < geomMaxLength) ? "yes" : "no"));
if (min_distance < geomMaxLength) { // interaction to happen within geometric limit
if (geomMaxLength < min_discrete) {
// geometric / tracking limit
// check whether decay or interaction limits this step the
// outcome of decay or interaction MAY be a) new particles in
// secondaries, b) the projectile particle deleted (or
// changed)
if (nextVol != currentLogicalNode) {
// boundary crossing, step is limited by volume boundary
TStackView secondaries(vParticle
);
CORSIKA_LOG_DEBUG("volume boundary crossing to {}", fmt::ptr(nextVol)
);
if (min_distance < continuous_max_dist) {
if (nextVol == environment_.getUniverse().get()) {
CORSIKA_LOG_DEBUG(
"particle left physics world, is now in unknown space -> delete");
vParticle.erase();
}
vParticle.setNode(nextVol);
/*
Create SecondaryView object on Stack. The data container
remains untouched and identical, and 'projectil' is identical
to 'vParticle' above this line. However,
projectil.AddSecondaries populate the SecondaryView, which can
then be used afterwards for further processing. Thus: it is
important to use projectle/view (and not vParticle) for Interaction,
and Decay!
*/
doBoundary may delete the particle (or not)
[[maybe_unused]] auto projectile = secondaries.getProjectile();
if (distance_interact < distance_decay) {
interaction(secondaries);
} else {
decay(secondaries);
// make sure particle actually did decay if it should have done so
if (secondaries.getSize() == 1 &&
projectile.getPID() == secondaries.getNextParticle().getPID())
throw std::runtime_error(fmt::format("Particle {} decays into itself!",
get_name(projectile.getPID())));
}
caveat: any changes to vParticle, or even the production
of new secondaries is currently not passed to ParticleCut,
thus, particles outside the desired phase space may be produced.
sequence_.doSecondaries(secondaries);
vParticle.erase();
} else { // step-length limitation within volume
\todo: this must be fixed.
*/
CORSIKA_LOG_DEBUG("step-length limitation"
);
// no further physics happens here. just proceed to next step.
sequence_.doBoundaryCrossing(vParticle, *currentLogicalNode, *nextVol
);
return;
}
CORSIKA_LOG_DEBUG("step limit reached. nothing further happens.");
[[maybe_unused]] auto const assertion = [&] {
auto const* numericalNodeAfterStep =
environment_.getUniverse()->getContainingNode(vParticle.getPosition());
...
...
@@ -214,31 +212,42 @@ namespace corsika {
assert(assertion()); // numerical and logical nodes should match, since
// we did not cross any volume boundary
} else { // boundary crossing, step is limited by volume boundary
if (nextVol != currentLogicalNode) {
CORSIKA_LOG_DEBUG("volume boundary crossing to {}", fmt::ptr(nextVol));
if (nextVol == environment_.getUniverse().get()) {
CORSIKA_LOG_DEBUG(
"particle left physics world, is now in unknown space -> delete");
vParticle.erase();
}
vParticle.setNode(nextVol);
/*
doBoundary may delete the particle (or not)
// step length limit
return;
}
caveat: any changes to vParticle, or even the production
of new secondaries is currently not passed to ParticleCut,
thus, particles outside the desired phase space may be produced.
// interaction or decay to happen in this step
// the outcome of decay or interaction MAY be a) new particles in
// secondaries, b) the projectile particle deleted (or
// changed)
\todo: this must be fixed.
*/
TStackView secondaries(vParticle);
sequence_.doBoundaryCrossing(vParticle, *currentLogicalNode, *nextVol);
}
/*
Create SecondaryView object on Stack. The data container
remains untouched and identical, and 'projectil' is identical
to 'vParticle' above this line. However,
projectil.AddSecondaries populate the SecondaryView, which can
then be used afterwards for further processing. Thus: it is
important to use projectle/view (and not vParticle) for Interaction,
and Decay!
*/
[[maybe_unused]] auto projectile = secondaries.getProjectile();
if (distance_interact < distance_decay) {
interaction(secondaries);
} else {
decay(secondaries);
// make sure particle actually did decay if it should have done so
if (secondaries.getSize() == 1 &&
projectile.getPID() == secondaries.getNextParticle().getPID())
throw std::runtime_error(fmt::format("Particle {} decays into itself!",
get_name(projectile.getPID())));
}
sequence_.doSecondaries(secondaries);
vParticle.erase();
}
template <typename TTracking, typename TProcessList, typename TStack,
...
...
corsika/detail/modules/LongitudinalProfile.inl
View file @
d3e58cb7
...
...
@@ -35,11 +35,11 @@ namespace corsika {
GrammageType const grammageStart = shower_axis_.getProjectedX(vTrack.getPosition(0));
GrammageType const grammageEnd = shower_axis_.getProjectedX(vTrack.getPosition(1));
CORSIKA_LOG_
INFO
("pos1={} m, pos2={}, X1={} g/cm2, X2={} g/cm2",
vTrack.getPosition(0).getCoordinates() / 1_m,
vTrack.getPosition(1).getCoordinates() / 1_m,
grammageStart / 1_g * square(1_cm),
grammageEnd / 1_g * square(1_cm));
CORSIKA_LOG_
TRACE
("pos1={} m, pos2={}, X1={} g/cm2, X2={} g/cm2",
vTrack.getPosition(0).getCoordinates() / 1_m,
vTrack.getPosition(1).getCoordinates() / 1_m,
grammageStart / 1_g * square(1_cm),
grammageEnd / 1_g * square(1_cm));
// Note: particle may go also "upward", thus, grammageEnd<grammageStart
const int binStart = std::ceil(grammageStart / dX_);
...
...
corsika/detail/modules/StackInspector.inl
View file @
d3e58cb7
...
...
@@ -24,8 +24,8 @@
namespace corsika {
template <typename TStack>
inline StackInspector<TStack>::StackInspector(
const int vNStep, const bool
vReportStack,
const HEPEnergyType
vE0)
inline StackInspector<TStack>::StackInspector(
int const vNStep, bool const
vReportStack,
HEPEnergyType const
vE0)
: StackProcess<StackInspector<TStack>>(vNStep)
, ReportStack_(vReportStack)
, E0_(vE0)
...
...
@@ -35,12 +35,12 @@ namespace corsika {
inline StackInspector<TStack>::~StackInspector() {}
template <typename TStack>
inline void StackInspector<TStack>::doStack(
const TStack
& vS) {
inline void StackInspector<TStack>::doStack(
TStack const
& vS) {
[[maybe_unused]] int i = 0;
HEPEnergyType Etot = 0_GeV;
for (
const auto
& iterP : vS) {
for (
auto const
& iterP : vS) {
HEPEnergyType E = iterP.getEnergy();
Etot += E;
if (ReportStack_) {
...
...
@@ -60,7 +60,7 @@ namespace corsika {
}
auto const now = std::chrono::system_clock::now();
const std::chrono::duration<double>
elapsed_seconds = now - StartTime_;
std::chrono::duration<double> const
elapsed_seconds = now - StartTime_;
std::time_t const now_time = std::chrono::system_clock::to_time_t(now);
auto const dE = E0_ - Etot;
if (dE < dE_threshold_) return;
...
...
corsika/detail/modules/pythia8/Decay.inl
View file @
d3e58cb7
...
...
@@ -82,7 +82,7 @@ namespace corsika::pythia8 {
inline void Decay::setHandleDecay(Code const vParticleCode) {
handleAllDecays_ = false;
CORSIKA_LOG_
INFO
("Pythia::Decay: set to handle decay of {} ", vParticleCode);
CORSIKA_LOG_
DEBUG
("Pythia::Decay: set to handle decay of {} ", vParticleCode);
if (Decay::canHandleDecay(vParticleCode))
handledDecays_.insert(vParticleCode);
else
...
...
@@ -106,12 +106,12 @@ namespace corsika::pythia8 {
}
inline void Decay::setUnstable(Code const pCode) {
CORSIKA_LOG_
INFO
("Pythia::Decay: setting {} unstable..", pCode);
CORSIKA_LOG_
DEBUG
("Pythia::Decay: setting {} unstable..", pCode);
Pythia8::Pythia::particleData.mayDecay(static_cast<int>(get_PDG(pCode)), true);
}
inline void Decay::setStable(Code const pCode) {
CORSIKA_LOG_
INFO
("Pythia::Decay: setting {} stable..", pCode);
CORSIKA_LOG_
DEBUG
("Pythia::Decay: setting {} stable..", pCode);
Pythia8::Pythia::particleData.mayDecay(static_cast<int>(get_PDG(pCode)), false);
}
...
...
@@ -122,8 +122,8 @@ namespace corsika::pythia8 {
inline bool Decay::canDecay(Code const pCode) {
bool const ans =
Pythia8::Pythia::particleData.canDecay(static_cast<int>(get_PDG(pCode)));
CORSIKA_LOG_
INFO
("Pythia::Decay: checking if particle: {} can decay in PYTHIA? {} ",
pCode, ans);
CORSIKA_LOG_
DEBUG
("Pythia::Decay: checking if particle: {} can decay in PYTHIA? {} ",
pCode, ans);
return ans;
}
...
...
@@ -153,13 +153,13 @@ namespace corsika::pythia8 {
TimeType const t0 = get_lifetime(pid);
auto const lifetime = gamma * t0;
CORSIKA_LOG_
INFO
("Pythia::Decay: code: {}", particle.getPID());
CORSIKA_LOG_
INFO
("Pythia::Decay: MinStep: t0: {}", t0);
CORSIKA_LOG_
INFO
("Pythia::Decay: MinStep: energy: {} GeV", E / 1_GeV);
CORSIKA_LOG_
INFO
("Pythia::Decay: momentum: {} GeV",
particle.getMomentum().getComponents() / 1_GeV);
CORSIKA_LOG_
INFO
("Pythia::Decay: MinStep: gamma: {}", gamma);
CORSIKA_LOG_
INFO
("Pythia::Decay: MinStep: tau: {} ", lifetime);
CORSIKA_LOG_
TRACE
("Pythia::Decay: code: {}", particle.getPID());
CORSIKA_LOG_
TRACE
("Pythia::Decay: MinStep: t0: {}", t0);
CORSIKA_LOG_
TRACE
("Pythia::Decay: MinStep: energy: {} GeV", E / 1_GeV);
CORSIKA_LOG_
TRACE
("Pythia::Decay: momentum: {} GeV",
particle.getMomentum().getComponents() / 1_GeV);
CORSIKA_LOG_
TRACE
("Pythia::Decay: MinStep: gamma: {}", gamma);
CORSIKA_LOG_
TRACE
("Pythia::Decay: MinStep: tau: {} ", lifetime);
return lifetime;
} else
...
...
@@ -209,7 +209,7 @@ namespace corsika::pythia8 {
if (!Pythia8::Pythia::next())
throw std::runtime_error("Pythia::Decay: decay failed!");
else
CORSIKA_LOG_
INFO
("Pythia::Decay: particles after decay: {} ", event.size());
CORSIKA_LOG_
DEBUG
("Pythia::Decay: particles after decay: {} ", event.size());
if (print_listing_) {
// list final state
...
...
@@ -227,9 +227,10 @@ namespace corsika::pythia8 {
FourVector const fourMomRest{Erest, pRest};
auto const fourMomLab = boost.fromCoM(fourMomRest);
CORSIKA_LOG_INFO("particle: id={} momentum={} energy={} ", pyId,
fourMomLab.getSpaceLikeComponents().getComponents(labCS) / 1_GeV,
fourMomLab.getTimeLikeComponent());
CORSIKA_LOG_TRACE(
"particle: id={} momentum={} energy={} ", pyId,
fourMomLab.getSpaceLikeComponents().getComponents(labCS) / 1_GeV,
fourMomLab.getTimeLikeComponent());
view.addSecondary(std::make_tuple(pyId, fourMomLab.getTimeLikeComponent(),
fourMomLab.getSpaceLikeComponents(), decayPoint,
...
...
corsika/framework/process/ContinuousProcessIndex.hpp
View file @
d3e58cb7
...
...
@@ -18,6 +18,8 @@ namespace corsika {
class
ContinuousProcessIndex
{
public:
ContinuousProcessIndex
()
:
id_
(
-
1
)
{}
// default
ContinuousProcessIndex
(
int
const
id
)
:
id_
(
id
)
{}
void
setIndex
(
int
const
id
)
{
id_
=
id
;
}
...
...
do-clang-format.py
View file @
d3e58cb7
...
...
@@ -10,6 +10,14 @@ import os
import
sys
import
re
do_progress
=
False
try
:
from
progress.bar
import
ChargingBar
do_progress
=
True
except
ImportError
as
e
:
do_progress
=
False
# no progress bar
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
.
add_argument
(
'--apply'
,
action
=
"store_true"
,
help
=
"Apply clang-format to files which need changes."
)
...
...
@@ -85,17 +93,26 @@ version = subp.check_output(cmd.split() + ["--version"]).decode("utf-8")
print
(
version
)
print
(
"Note: the clang-format version has an impact on the result. Make sure you are consistent with current CI. Consider
\'
--docker
\'
option."
)
bar
=
None
if
do_progress
:
bar
=
ChargingBar
(
'Processing'
,
max
=
len
(
filelist
))
if
args
.
apply
:
for
filename
in
filelist
:
if
bar
:
bar
.
next
()
subp
.
check_call
(
cmd
.
split
()
+
[
"-i"
,
filename
])
if
bar
:
bar
.
finish
()
else
:
# only print files which need formatting
files_need_formatting
=
0
for
filename
in
filelist
:
if
bar
:
bar
.
next
()
a
=
open
(
filename
,
"rb"
).
read
()
b
=
subp
.
check_output
(
cmd
.
split
()
+
[
filename
])
if
a
!=
b
:
files_need_formatting
+=
1
print
(
filename
)
if
bar
:
bar
.
finish
()
sys
.
exit
(
1
if
files_need_formatting
>
0
else
0
)
examples/vertical_EAS.cpp
View file @
d3e58cb7
...
...
@@ -6,8 +6,6 @@
* the license.
*/
#define DEBUG 1
/* clang-format off */
// InteractionCounter used boost/histogram, which
// fails if boost/type_traits have been included before. Thus, we have
...
...
@@ -96,7 +94,7 @@ using MyExtraEnv = MediumPropertyModel<UniformMagneticField<T>>;
int
main
(
int
argc
,
char
**
argv
)
{
corsika_logger
->
set_pattern
(
"[%n:%^%-8l%$] %s:%#: %v"
);
logging
::
set_level
(
logging
::
level
::
trace
);
logging
::
set_level
(
logging
::
level
::
info
);
CORSIKA_LOG_INFO
(
"vertical_EAS"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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