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
771a12c5
Commit
771a12c5
authored
4 years ago
by
ralfulrich
Committed by
Felix Riehn
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
make dEdX profiles more robust
parent
8b820166
No related branches found
No related tags found
1 merge request
!311
Resolve "testModules fails with segfault on release build with clang-8"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
corsika/detail/modules/energy_loss/BetheBlochPDG.inl
+13
-8
13 additions, 8 deletions
corsika/detail/modules/energy_loss/BetheBlochPDG.inl
with
13 additions
and
8 deletions
corsika/detail/modules/energy_loss/BetheBlochPDG.inl
+
13
−
8
View file @
771a12c5
...
...
@@ -149,7 +149,7 @@ namespace corsika {
p
.
getChargeNumber
(),
dX
/
1
_g
*
square
(
1
_cm
));
HEPEnergyType
dE
=
getTotalEnergyLoss
(
p
,
dX
);
auto
E
=
p
.
getEnergy
();
const
auto
Ekin
=
E
-
p
.
getMass
();
//
const auto Ekin = E - p.getMass();
auto
Enew
=
E
+
dE
;
CORSIKA_LOG_DEBUG
(
"EnergyLoss dE={} MeV, E={} GeV, Ekin={} GeV, Enew={} GeV"
,
dE
/
1
_MeV
,
E
/
1
_GeV
,
Ekin
/
1
_GeV
,
Enew
/
1
_GeV
);
...
...
@@ -199,20 +199,25 @@ namespace corsika {
GrammageType
const
grammageStart
=
shower_axis_
.
getProjectedX
(
vTrack
.
getPosition
(
0
));
GrammageType
const
grammageEnd
=
shower_axis_
.
getProjectedX
(
vTrack
.
getPosition
(
1
));
const
auto
deltaX
=
grammageEnd
-
grammageStart
;
int
const
binStart
=
grammageStart
/
dX_
;
if
(
binStart
<
0
)
return
;
int
const
binEnd
=
grammageEnd
/
dX_
;
if
(
binEnd
>
int
(
profile_
.
size
()
-
1
))
return
;
GrammageType
deltaX
=
grammageEnd
-
grammageStart
;
if
(
deltaX
<
GrammageType
::
zero
())
deltaX
=
-
deltaX
;
if
(
deltaX
<
dX_threshold_
)
return
;
// only register the range that is covered by the profile
int
const
maxBin
=
int
(
profile_
.
size
()
-
1
);
int
binStart
=
grammageStart
/
dX_
;
if
(
binStart
<
0
)
binStart
=
0
;
if
(
binStart
>
maxBin
)
binStart
=
maxBin
;
int
binEnd
=
grammageEnd
/
dX_
;
if
(
binEnd
<
0
)
binEnd
=
0
;
if
(
binEnd
>
maxBin
)
binEnd
=
maxBin
;
CORSIKA_LOG_DEBUG
(
"energy deposit of -dE={} between {} and {}"
,
-
dE
,
grammageStart
,
grammageEnd
);
auto
energyCount
=
HEPEnergyType
::
zero
();
auto
fill
=
[
&
](
const
int
bin
,
const
double
weight
)
{
auto
fill
=
[
&
](
int
const
bin
,
double
const
weight
)
{
auto
const
increment
=
-
dE
*
weight
;
profile_
[
bin
]
+=
increment
;
energyCount
+=
increment
;
...
...
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