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
6366ecf9
Commit
6366ecf9
authored
4 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
fixed signed/unsigned comparison
parent
1f4fa520
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Environment/ShowerAxis.cc
+6
-3
6 additions, 3 deletions
Environment/ShowerAxis.cc
with
6 additions
and
3 deletions
Environment/ShowerAxis.cc
+
6
−
3
View file @
6366ecf9
...
@@ -18,18 +18,21 @@ GrammageType ShowerAxis::X(LengthType l) const {
...
@@ -18,18 +18,21 @@ GrammageType ShowerAxis::X(LengthType l) const {
auto
const
fractionalBin
=
l
/
steplength_
;
auto
const
fractionalBin
=
l
/
steplength_
;
int
const
lower
=
fractionalBin
;
// indices of nearest X support points
int
const
lower
=
fractionalBin
;
// indices of nearest X support points
auto
const
lambda
=
fractionalBin
-
lower
;
auto
const
lambda
=
fractionalBin
-
lower
;
int
const
upper
=
lower
+
1
;
decltype
(
X_
.
size
())
const
upper
=
lower
+
1
;
if
(
lower
<
0
)
{
throw
std
::
runtime_error
(
"cannot extrapolate to points behind point of injection"
);
}
if
(
upper
>=
X_
.
size
())
{
if
(
upper
>=
X_
.
size
())
{
std
::
stringstream
errormsg
;
std
::
stringstream
errormsg
;
errormsg
<<
"shower axis too short, cannot extrapolate (l / max_length_ = "
errormsg
<<
"shower axis too short, cannot extrapolate (l / max_length_ = "
<<
l
/
max_length_
<<
")"
;
<<
l
/
max_length_
<<
")"
;
throw
std
::
runtime_error
(
errormsg
.
str
().
c_str
());
throw
std
::
runtime_error
(
errormsg
.
str
().
c_str
());
}
else
if
(
lower
<
0
)
{
throw
std
::
runtime_error
(
"cannot extrapolate to points behind point of injection"
);
}
}
assert
(
0
<=
lambda
&&
lambda
<=
1.
);
assert
(
0
<=
lambda
&&
lambda
<=
1.
);
// linear interpolation between X[lower] and X[upper]
// linear interpolation between X[lower] and X[upper]
return
X_
[
lower
]
*
lambda
+
X_
[
upper
]
*
(
1
-
lambda
);
return
X_
[
lower
]
*
lambda
+
X_
[
upper
]
*
(
1
-
lambda
);
}
}
...
...
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