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
53fddd37
Commit
53fddd37
authored
2 years ago
by
Nikos Karastathis
Browse files
Options
Downloads
Patches
Plain Diff
LongitudinalWriter figures out the correct number of bins from the shower axis
parent
06d0f58d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!437
Resolve "Examples need some polishing"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/modules/writers/LongitudinalWriter.inl
+8
-9
8 additions, 9 deletions
corsika/detail/modules/writers/LongitudinalWriter.inl
corsika/modules/writers/LongitudinalWriter.hpp
+1
-2
1 addition, 2 deletions
corsika/modules/writers/LongitudinalWriter.hpp
with
9 additions
and
11 deletions
corsika/detail/modules/writers/LongitudinalWriter.inl
+
8
−
9
View file @
53fddd37
...
...
@@ -15,17 +15,16 @@
#include
<corsika/media/ShowerAxis.hpp>
#include
<exception>
#include
<algorithm>
namespace
corsika
{
template
<
typename
TOutput
>
inline
LongitudinalWriter
<
TOutput
>::
LongitudinalWriter
(
ShowerAxis
const
&
axis
,
GrammageType
dX
,
size_t
const
nBins
)
GrammageType
dX
)
:
TOutput
(
number_profile
::
ProfileIndexNames
)
,
showerAxis_
(
axis
)
,
dX_
(
dX
)
,
nBins_
(
nBins
)
{}
,
dX_
(
dX
)
{}
template
<
typename
TOutput
>
inline
void
LongitudinalWriter
<
TOutput
>::
startOfLibrary
(
...
...
@@ -36,8 +35,8 @@ namespace corsika {
template
<
typename
TOutput
>
inline
void
LongitudinalWriter
<
TOutput
>::
startOfShower
(
unsigned
int
const
showerId
)
{
TOutput
::
startOfShower
(
showerId
);
//
reset profile
profile_
.
clear
()
;
//
figure out the number of bins and resize the profile container accordingly
nBins_
=
static_cast
<
unsigned
int
>
(
showerAxis_
.
getMaximumX
()
/
dX_
)
+
1
;
profile_
.
resize
(
nBins_
);
}
...
...
@@ -66,15 +65,15 @@ namespace corsika {
GrammageType
const
grammageEnd
=
showerAxis_
.
getProjectedX
(
track
.
getPosition
(
1
));
// Note: particle may go also "upward", thus, grammageEnd<grammageStart
in
t
const
binStart
=
std
::
ceil
(
grammageStart
/
dX_
);
in
t
const
binEnd
=
std
::
floor
(
grammageEnd
/
dX_
);
size_
t
const
binStart
=
std
::
ceil
(
grammageStart
/
dX_
);
size_
t
const
binEnd
=
std
::
floor
(
grammageEnd
/
dX_
);
CORSIKA_LOGGER_TRACE
(
TOutput
::
getLogger
(),
"grammageStart={} End={} binStart={}, end={}"
,
grammageStart
/
1
_g
*
square
(
1
_cm
),
grammageEnd
/
1
_g
*
square
(
1
_cm
),
binStart
,
binEnd
);
for
(
in
t
bin
=
binStart
;
bin
<=
binEnd
;
++
bin
)
{
for
(
size_
t
bin
=
binStart
;
bin
<=
std
::
min
(
binEnd
,
profile_
.
size
()
-
1
)
;
++
bin
)
{
if
(
pid
==
Code
::
Photon
)
{
profile_
.
at
(
bin
)[
static_cast
<
int
>
(
number_profile
::
ProfileIndex
::
Photon
)]
+=
weight
;
...
...
This diff is collapsed.
Click to expand it.
corsika/modules/writers/LongitudinalWriter.hpp
+
1
−
2
View file @
53fddd37
...
...
@@ -95,8 +95,7 @@ namespace corsika {
* Construct a new writer.
*/
LongitudinalWriter
(
ShowerAxis
const
&
axis
,
GrammageType
dX
=
10
_g
/
square
(
1
_cm
),
// profile binning
size_t
const
nBins
=
200
);
// number of bins
GrammageType
dX
=
10
_g
/
square
(
1
_cm
));
// profile binning
void
startOfLibrary
(
boost
::
filesystem
::
path
const
&
directory
)
final
override
;
...
...
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