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
baa8946a
Commit
baa8946a
authored
4 years ago
by
Maximilian Reininghaus
Browse files
Options
Downloads
Patches
Plain Diff
implemented ShowerAxis
parent
460a24f2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Environment/CMakeLists.txt
+2
-0
2 additions, 0 deletions
Environment/CMakeLists.txt
Environment/ShowerAxis.cc
+41
-0
41 additions, 0 deletions
Environment/ShowerAxis.cc
Environment/ShowerAxis.h
+94
-0
94 additions, 0 deletions
Environment/ShowerAxis.h
with
137 additions
and
0 deletions
Environment/CMakeLists.txt
+
2
−
0
View file @
baa8946a
set
(
ENVIRONMENT_SOURCES
LayeredSphericalAtmosphereBuilder.cc
ShowerAxis.cc
)
set
(
...
...
@@ -19,6 +20,7 @@ set (
FlatExponential.h
SlidingPlanarExponential.h
LayeredSphericalAtmosphereBuilder.h
ShowerAxis.h
)
set
(
...
...
This diff is collapsed.
Click to expand it.
Environment/ShowerAxis.cc
0 → 100644
+
41
−
0
View file @
baa8946a
/*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include
<corsika/environment/ShowerAxis.h>
using
namespace
corsika
::
environment
;
using
namespace
corsika
::
units
::
si
;
GrammageType
ShowerAxis
::
X
(
LengthType
l
)
const
{
auto
const
fractionalBin
=
l
/
steplength_
;
int
const
lower
=
fractionalBin
;
// indices of nearest X support points
auto
const
lambda
=
fractionalBin
-
lower
;
int
const
upper
=
lower
+
1
;
if
(
upper
>=
steps
)
{
throw
std
::
runtime_error
(
"shower axis too short, cannot extrapolate"
);
}
else
if
(
lower
<
0
)
{
throw
std
::
runtime_error
(
"cannot extrapolate to points behind point of injection"
);
}
assert
(
0
<=
lambda
&&
lambda
<=
1.
);
return
(
*
X_
)[
lower
]
*
lambda
+
(
*
X_
)[
upper
]
*
(
1
-
lambda
);
}
LengthType
ShowerAxis
::
steplength
()
const
{
return
steplength_
;
}
GrammageType
ShowerAxis
::
maximumX
()
const
{
return
*
(
X_
->
rbegin
());
}
GrammageType
ShowerAxis
::
minimumX
()
const
{
return
*
(
X_
->
cbegin
());
}
GrammageType
ShowerAxis
::
projectedX
(
geometry
::
Point
const
&
p
)
const
{
auto
const
projectedLength
=
(
p
-
pointStart_
).
dot
(
axis_normalized_
);
return
X
(
projectedLength
);
}
This diff is collapsed.
Click to expand it.
Environment/ShowerAxis.h
0 → 100644
+
94
−
0
View file @
baa8946a
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include
<corsika/environment/Environment.h>
#include
<corsika/geometry/Point.h>
#include
<corsika/geometry/Vector.h>
#include
<corsika/units/PhysicalUnits.h>
#include
<cassert>
#include
<cstdlib>
#include
<fstream>
#include
<functional>
#include
<iterator>
#include
<memory>
#include
<stdexcept>
#include
<vector>
#include
<boost/math/quadrature/gauss_kronrod.hpp>
namespace
corsika
::
environment
{
class
ShowerAxis
{
public:
template
<
typename
TEnvModel
>
ShowerAxis
(
geometry
::
Point
const
&
pStart
,
geometry
::
Vector
<
units
::
si
::
length_d
>
length
,
environment
::
Environment
<
TEnvModel
>
const
&
env
)
:
pointStart_
(
pStart
)
,
length_
(
length
)
,
max_length_
(
length_
.
norm
())
,
steplength_
(
max_length_
/
steps
)
,
axis_normalized_
(
length
/
max_length_
)
{
auto
const
*
const
universe
=
env
.
GetUniverse
().
get
();
auto
rho
=
[
pStart
,
length
,
universe
](
double
x
)
{
auto
const
p
=
pStart
+
length
*
x
;
auto
const
*
node
=
universe
->
GetContainingNode
(
p
);
return
node
->
GetModelProperties
().
GetMassDensity
(
p
).
magnitude
();
};
double
error
;
int
k
=
0
;
for
(
int
i
=
1
;
i
<
steps
;
++
i
)
{
auto
const
x_prev
=
(
i
-
1
)
/
(
steps
-
1.
);
auto
const
d_prev
=
max_length_
*
x_prev
;
auto
const
x
=
i
/
(
steps
-
1.
);
auto
const
r
=
boost
::
math
::
quadrature
::
gauss_kronrod
<
double
,
15
>::
integrate
(
rho
,
x_prev
,
x
,
15
,
1e-9
,
&
error
);
auto
const
result
=
units
::
si
::
MassDensityType
(
phys
::
units
::
detail
::
magnitude_tag
,
r
)
*
max_length_
;
auto
const
resultTotal
=
result
+
(
*
X_
)[
i
-
1
];
(
*
X_
)[
i
]
=
resultTotal
;
for
(;
resultTotal
>
k
*
X_binning_
;
++
k
)
{
d_
.
emplace_back
(
d_prev
+
k
*
X_binning_
*
steplength_
/
result
);
}
}
assert
(
std
::
is_sorted
(
X_
->
cbegin
(),
X_
->
cend
()));
assert
(
std
::
is_sorted
(
d_
.
cbegin
(),
d_
.
cend
()));
}
units
::
si
::
LengthType
steplength
()
const
;
units
::
si
::
GrammageType
maximumX
()
const
;
units
::
si
::
GrammageType
minimumX
()
const
;
units
::
si
::
GrammageType
projectedX
(
geometry
::
Point
const
&
p
)
const
;
units
::
si
::
GrammageType
X
(
units
::
si
::
LengthType
)
const
;
private
:
static
constexpr
int
steps
=
10'000
;
units
::
si
::
GrammageType
const
X_binning_
=
std
::
invoke
([]()
{
using
namespace
units
::
si
;
return
1
_g
/
1
_cm
/
1
_cm
;
});
std
::
unique_ptr
<
std
::
array
<
units
::
si
::
GrammageType
,
steps
>>
const
X_
{
new
std
::
array
<
units
::
si
::
GrammageType
,
steps
>
};
geometry
::
Point
const
pointStart_
;
geometry
::
Vector
<
units
::
si
::
length_d
>
const
length_
;
units
::
si
::
LengthType
const
max_length_
,
steplength_
;
geometry
::
Vector
<
units
::
si
::
dimensionless_d
>
const
axis_normalized_
;
std
::
vector
<
units
::
si
::
LengthType
>
d_
;
};
}
// namespace corsika::environment
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