IAP GITLAB

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AirShowerPhysics/corsika
  • rulrich/corsika
  • AAAlvesJr/corsika
  • Andre/corsika
  • arrabito/corsika
  • Nikos/corsika
  • olheiser73/corsika
  • AirShowerPhysics/papers/corsika
  • pranav/corsika
9 results
Show changes
Showing
with 621 additions and 87 deletions
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
#include <corsika/geometry/Plane.h>
#include <corsika/process/ContinuousProcess.h>
#include <corsika/setup/SetupStack.h>
#include <corsika/setup/SetupTrajectory.h>
#include <corsika/units/PhysicalUnits.h>
#include <boost/histogram.hpp>
......@@ -24,22 +21,26 @@
namespace corsika::history {
class HistoryObservationPlane : public ContinuousProcess<HistoryObservationPlane> {
template <typename TStack>
class HistoryObservationPlane
: public ContinuousProcess<HistoryObservationPlane<TStack>> {
public:
HistoryObservationPlane(setup::Stack const&, Plane const&, bool = true);
HistoryObservationPlane(TStack const&, Plane const&, bool = true);
LengthType getMaxStepLength(setup::Stack::particle_type const&,
setup::Trajectory const& vTrajectory);
template <typename TParticle, typename TTrajectory>
LengthType getMaxStepLength(TParticle const&, TTrajectory const& vTrajectory);
ProcessReturn doContinuous(setup::Stack::particle_type const& vParticle,
setup::Trajectory const& vTrajectory);
template <typename TParticle, typename TTrajectory>
ProcessReturn doContinuous(TParticle const& vParticle,
TTrajectory const& vTrajectory);
auto const& histogram() const { return histogram_; }
private:
void fillHistoryHistogram(setup::Stack::particle_type const&);
template <typename TParticle>
void fillHistoryHistogram(TParticle const&);
setup::Stack const& stack_;
TStack const& stack_;
Plane const plane_;
bool const deleteOnHit_;
......
/*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......@@ -67,10 +66,8 @@ namespace corsika::history {
/**
* @class HistoryDataInterface
*
* corresponding defintion of a stack-readout object, the iteractor
* dereference operator will deliver access to these function
// defintion of a stack-readout object, the iteractor dereference
// operator will deliver access to these function
* corresponding definition of a stack-readout object, the iteractor
* dereference operator will deliver access to these function.
*/
template <typename T, typename TEvent>
class HistoryDataInterface : public T {
......
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/
#pragma once
......
#!/usr/bin/env python3
#
# (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
#
# This software is distributed under the terms of the 3-clause BSD license.
# See file LICENSE for a full version of the license.
#
"""
Run clang-format with the style file in the CORSIKA repository.
By default it finds new files and files with modifications with respect to the current master and prints the filenames which need clang-formatting. Returns 1 if there are files which need modifications and 0 otherwise, so it can be used as a test.
By default it finds new files and files with modifications with respect
to the current master and prints the filenames which need clang-formatting.
Returns 1 if there are files which need modifications and 0 otherwise,
so it can be used as a test.
"""
import argparse
import subprocess as subp
import os
......@@ -29,7 +41,9 @@ parser.add_argument("--docker", action="store_true",
args = parser.parse_args()
excludeDirs = [r"^(\./)?modules/", r"^(\./)?externals/", r"^(\./)?build", r"^(\./)?install", r"(\./)?\.git", r"^(\./)?corsika/framework/units",]
excludeDirs = [r"^(\./)?modules/", r"^(\./)?externals/", r"^(\./)?build", r"^(\./)?install",
r"(\./)?\.git", r"^(\./)?corsika/framework/units",
r"^(\./)?Random123/"]
filelist = []
if args.all:
......
#!/usr/bin/env python3
#
# (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
#
# This software is distributed under the terms of the 3-clause BSD license.
# See file LICENSE for a full version of the license.
#
"""
Script to crawl all files (hpp,inl,cpp) in a directory structure and
check if there is an initial comment block within each file that
resembles the CORSIKA 8 copyright notice.
Exceptions can be specified in `excludeDirs` and `excludedFiles`.
"""
import os
import sys, getopt
import re
......@@ -10,9 +26,8 @@ import re
text = """/*
* (c) Copyright YEAR CORSIKA Project, corsika-project@lists.kit.edu
*
* 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.
* This software is distributed under the terms of the 3-clause BSD license.
* See file LICENSE for a full version of the license.
*/\n
"""
......@@ -21,7 +36,7 @@ Debug settings are 0: nothing, 1: checking, 2: filesystem
"""
Debug = 0
excludeDirs = ["./modules", "./externals", "build", "install", "git", "framework/units"]
excludeDirs = ["./modules", "./externals", "build", "install", "git", "framework/units", "Random123"]
excludeFiles = ['PhysicalConstants.h','CorsikaFenvOSX.cc', 'sgn.h', 'quartic.h']
extensions = [".cpp", ".inl", ".hpp"]
......
......@@ -25,8 +25,8 @@ if (DOXYGEN_FOUND)
COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/latex; pdflatex refman.tex
)
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc OPTIONAL)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf DESTINATION share/doc OPTIONAL)
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika/doc OPTIONAL)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika/doc OPTIONAL)
if (SPHINX_FOUND)
......
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.14 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
<tab type="user" url="@CORSIKA_WEBPAGE_URL@" title="@CORSIKA_WEBPAGE_TITLE@"/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmeth title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>
PROJECT_NAME = CORSIKA 8
PROJECT_NUMBER = 0.0.0
PROJECT_NAME = CORSIKA
PROJECT_NUMBER = @c8_version@
PROJECT_BRIEF = "The framework to simulate particle cascades for astroparticle physics"
GENERATE_HTML = YES
......@@ -11,6 +11,7 @@ INPUT = @PROJECT_SOURCE_DIR@/corsika @PROJECT_SOURCE_DIR@/src @
EXCLUDE_PATTERNS = *.inl
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
LAYOUT_FILE = DoxyLayout.xml
FILE_PATTERNS = *.cpp *.hpp *.dox *.md *.inc
EXTENSION_MAPPING = inc=C++
......
Full API
========
Reference Documentation
=======================
Consider using Doxygen directly for a full API reference....
Find the latest full reference manual at `Doxygen`_, or the components on:
* `Classes`_
* `Functions`_
* `Files`_
.. _Doxygen: doxygen/html/index.html
.. _Classes: doxygen/html/classes.html
.. _Functions: doxygen/html/functions.html
.. _Files: doxygen/html/files.html
..
.. doxygenindex::
:project: CORSIKA8
:path: c8
:outline:
:no-link:
.. doxygenindex::
:project: CORSIKA8
:path: c8
:outline:
:no-link:
\ No newline at end of file
#
# (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
#
# This software is distributed under the terms of the 3-clause BSD license.
# See file LICENSE for a full version of the license.
#
"""
Readthedocs script to build documentation remotely.
"""
import sys
import subprocess, os
def configureDoxyfile(input_dir, output_dir):
with open('Doxyfile.in', 'r') as file :
def configureDoxyfile(template_file, output_file, input_dir, output_dir):
with open(template_file, 'r') as file :
filedata = file.read()
filedata = filedata.replace('@PROJECT_SOURCE_DIR@', input_dir)
filedata = filedata.replace('@CMAKE_CURRENT_BINARY_DIR@', output_dir)
filedata = filedata.replace('@CMAKE_BINARY_DIR@', output_dir)
with open('Doxyfile', 'w') as file:
with open(output_file, 'w') as file:
file.write(filedata)
def configureDoxyLayout(template_file, output_file, page_url, page_tile):
with open(template_file, 'r') as file :
filedata = file.read()
filedata = filedata.replace('@CORSIKA_WEBPAGE_URL@', page_url)
filedata = filedata.replace('@CORSIKA_WEBPAGE_TITLE@', page_tile)
with open(output_file, 'w') as file:
file.write(filedata)
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
read_the_docs_build = os.environ.get('READTHEDOCS', None) != None
breathe_projects = {}
if read_the_docs_build:
input_dir = '../'
output_dir = 'build'
configureDoxyfile(input_dir, output_dir)
subprocess.call('mkdir -p build/corsika/framework/core; cd build/corsika/framework/core && ../../../../../src/framework/core/pdxml_reader.py ../../../../../src/framework/core/ParticleData.xml ../../../../../src/framework/core/NuclearData.xml ../../../../../src/framework/core/ParticleClassNames.xml', shell=True)
build_version = os.environ.get('READTHEDOCS_VERSION', None)
doc_url = 'https://corsika-8.readthedocs.io/en/'+build_version
configureDoxyfile("Doxyfile.in", "Doxyfile", "../", "_build/workdir/doxygen")
configureDoxyLayout("DoxyLayout.in", "DoxyLayout.xml", doc_url , "CORSIKA 8 Webpage")
subprocess.call('mkdir -p _build/workdir/doxygen; doxygen Doxyfile', shell=True)
html_extra_path = ['_build/workdir/']
breathe_projects['CORSIKA8'] = '_build/workdir/doxygen/xml'
subprocess.call('mkdir -p build/corsika/media; cd build/corsika/media && ../../../../src/media/readProperties.py ../../../../src/media/properties8.dat', shell=True)
subprocess.call('doxygen', shell=True)
breathe_projects['CORSIKA8'] = output_dir + '/xml'
# -- Project information -----------------------------------------------------
project = u'CORSIKA8'
project = u'CORSIKA8'
copyright = u'2021, CORSIKA 8 Collaboration'
author = u'CORSIKA 8 Collaboration'
author = u'CORSIKA 8 Collaboration'
# The short X.Y version
version = u'0.0.0'
......@@ -54,10 +75,14 @@ extensions = [
breathe_default_project = "CORSIKA8"
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
......@@ -74,11 +99,6 @@ master_doc = 'index'
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
......@@ -86,10 +106,26 @@ pygments_style = 'sphinx'
# -- Options for HTML output -------------------------------------------------
html_theme = 'sphinx_rtd_theme'
# html_theme_options = {}
# html_static_path = []
# html_sidebars = {}
html_theme_options = {
'analytics_id': '', # Provided by Google in your dashboard
'analytics_anonymize_ip': False,
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
htmlhelp_basename = 'C8doc'
......
......@@ -5,12 +5,12 @@
Software documentatin and reference guide for the CORSIKA 8
software framework for air shower simulations. CORSIKA 8 is developed
at <a
href="https://gitlab.ikp.kit.edu/AirShowerPhysics">https://gitlab.ikp.kit.edu</a>. If
href="https://gitlab.iap.kit.edu/AirShowerPhysics">https://gitlab.iap.kit.edu</a>. If
you got the code from somewhere else, consider to switch to the
official development repository. If you want to report bugs, or want
to suggest features or future development, please submit an "issue" on
this gitlab server. We only accept Issues and discussion via our
central development server https://gitlab.ikp.kit.edu.
central development server https://gitlab.iap.kit.edu.
Write to corsika-devel@lists.kit.edu, or even register yourself at
https://www.lists.kit.edu/sympa/info/corsika-devel to get in contact
......
Howto create new physics modules
================================
There are different types of physics modules, which you can add to the CORSIKA 8 physics process
sequence. Modules can act on particles, secondaries or the entire stack. Modules can create new particles
or they can modify or delete particles. They can also produce output.
Types of different modules are explained in ::modules
When creating new modules, we suggest to stick as close as possible to the default CORSIKA 8 coding guidelines
and code structure. This makes code review and sharing with others not more complicated than needed.
When your modules creates output, use the available CORSIKA 8 output machinery. This is not explained here. Also learn
how to use units, and use the loggers from the very beginning. Furthermore, get aquinted with C++17.
Let's consider the case of an "InteractionProcess" which will remove the projectile particle and create
secondary particles on the stack instead. It also has a cross section in order to evaulate the probability
with respect to other InteractionProcesses. Create a header file `SimpleProcess.hpp`, which is conceptually
based to resemble (roughly) a Matthew-Heitler model:
.. code-block:: c++
#pragma once
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/core/PhysicalConstants.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/core/Logging.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
#include <corsika/framework/random/RNGManager.hpp>
namespace corsika::simple_process {
class SimpleProcess : public corsika::InteractionProcess<SimpleProcess> {
public:
SimpleProcess();
template <typename TParticle>
GrammageType getInteractionLength(TParticle const&) const;
template <typename TSecondaryView>
void doInteraction(TSecondaryView& view) const;
private:
// the random number stream
corsika::default_prng_type& rng_ =
corsika::RNGManager<>::getInstance().getRandomStream("simple_process");
// the logger
std::shared_ptr<spdlog::logger> logger_ = get_logger("corsika_SimpleProcess");
};
}
#include <SimpleProcess.inl>
And the corresponding `SimpleProcess.inl` as:
.. code-block:: c++
Namespace corsika::simple_process
{
inline SimpleProcess::SimpleProcess() {}
template <typename TParticle>
inline GrammageType SimpleProcess::getInteractionLength(
TParticle const &particle) const
{
// this process only applies to hadrons above Ekin=100GeV
if (is_hadron(particle.getPID()) && particle.getKineticEnergy()>100_GeV) {
return 2_g/square(1_cm);
}
// otherwise its cross section is 0
return std::numeric_limits<double>::infinity() * 1_g/square(1_cm);
}
template <typename TSecondaryView>
inline void SimpleProcess::doInteraction(TSecondaryView &view) const
{
// the actual projectile particle, which will disappear after the call to doInteraction finished.
auto projectile = view.getProjectile();
int const nMult = 15;
auto pionEnergy = projectile.getEnergy() / nMult;
auto const pOrig = projectile.getPosition();
auto const tOrig = projectile.getTime();
auto const projectileMomentum = projectile.getMomentum();
auto const &cs = projectileMomentum.getCoordinateSystem();
for (int iMult=0; iMult<nMult; ++iMult) {
projectile.addSecondary(std::make_tuple(Code::PiPlus,
projectileMomentum.normalized() * sqrt(square(pionEnergy) + square(PiPlus::mass)),
pOrig,
tOrig));
}
CORSIKA_LOGGER_INFO(logger_, "Created {} new secondaries of energy {}.", nMult, pionEnergy);
}
}
In this example, `TParticle` as used here in the SimpleModule is one
particle on the CORSIKA8 particle stack. It has all methods you expect
as `getPosition()`, `getEnergy()`, `getKineticEnergy()`, etc.
The `TSecondaryView` provides special access to the CORSIKA8 particle
stack as needed for a particle interaction with a projectile and
secondaries. For example, `getProjectil()` will return the actual
projectile particle, `addSecondary(...)` will produce a secondary of
the projectil. The advantage of addSecondary wrt. addParticle is that
there exists a direct reference to the projectile allowing to
automatically copy weights, keep the cascade history,
etc. Furthermore, you can define subsequent `SeoncariesProcesses`
which can further process all the newly created secondaries. This
could perform energy threshold cuts, or also calculate new weights,
etc.
The SimpleProcess is not necessarily useful for anything and its sole purpuse is to illustrate the mechanism to
create your own processes.
You can then include such a process in your programm (e.g. in vertical_EAS) with
- add: `#include <SimpleProcess.hpp>`
- register the new random stream: `RNGManager<>::getInstance().registerRandomStream("simple_process");`
- initialize it with `simple_process::SimpleProcess simple; `
- add it to the physiscs sequence i.e. via `auto extended_sequence = make_sequence(old_sequence, simple);`
Please follow the style and guidelines for programming CORSIKA 8 code even for
private projects. Your code will be covered by the BSD 3-Clause License, too,
and thus should be made public to the community. Any discussion or eventual
bug-fixing is much more complicated if there are deviations from the guidelines.
......@@ -7,13 +7,16 @@ Welcome to the CORSIKA 8 air shower simulation framework.
:maxdepth: 2
readme_link
modules
output
particles
particle_stack
media
units
environment
stack
utilities
modules
howto_create_module
api
Media Properties
================
Medium Properties
=================
.. toctree::
media_classes
......
Output
======
The format of CORSIKA 8 is designed to allow simple and robust managmenet of large libraries, as well as high reading performance. There is a dedicated python library to help processing data.
The basic structure of output is structured on the filesystem itself with a couple of subdirectories and files. Each run of CORSIKA~8 creates a library that can contain any number of showers.
The format is equally suited for single huge showers as well as for a very high number of very low-energy showers. Each module included in the run can
produce output inside this directory. The module output is separeted in individual user-named sub-directories, each containing files produced by the module. The file format is either yaml for basic configuration and summary data, or Apache parquet for any other (binary, compressed)
data. Parquet is optimal for columnar/tabular data as it is produced by CORSIKA 8.
One advantage of this format is that with normal filesystem utilties users can manage the libraries. On all systems there are tools available to
directly read/process yaml as well as parquet files. If you, for example, don't need the particle data for space reasons, this is very simple to remove from a library. Individual
output stream (modules) can be easily separated with no extra effort.
For example, the output of the "vertical_EAS" example program looks like this:
::
vertical_EAS_outputs/
config.yaml
summary.yaml
particles/
config.yaml
summary.yaml
particles.parquet
The "vertical_EAS_outputs" and the "particles" are user-defined names and can be arranged/changed. But the type
of data is well defined, e.g. in "particles" the data from an ObservationPlane object is stored. This is relevant,
since it allows python to access this data in a controlled way.
The top level "config.yaml" contains top-level library information:
.. code-block:: YAML
name: vertical_EAS_outputs
creator: CORSIKA8
version: 8.0.0-prealpha
and the "summary.yaml" is written in the very end (thus, the presence of the summary also indicates that a run is finished):
.. code-block:: YAML
showers: 2
start time: 06/02/2021 23:46:18 HST
end time: 06/02/2021 23:46:42 HST
runtime: 00:00:24.260
Each module has its own "config.yaml" and "summary.yaml" file, too.
To handle thus output for analysis any tool of your preference is feasible. We recommend python. There is a python library accompanied with
CORSIKA~8 to facilitate analysis and output handling (>>> is python prompt):
.. code-block:: python
>>> import corsika
>>> lib = corsika.Library("vertical_EAS_outputs")
>>> lib.config # this gets the library configuration as a Python dictionary
{'name': 'vertical_EAS_outputs',
'creator': 'CORSIKA8',
'version': '8.0.0-prealpha'}
>>> lib.names # get a list of all registered processes in the library
['particles']
>>> lib.summary # you can also load the summary information
{'showers': 1,
'start time': '06/02/2021 23:46:18 HST',
'end time': '06/02/2021 23:46:30 HST',
'runtime': 11.13}
>>> lib.get("particles") # you can then get the process by its registered name.
ObservationPlane('particles')
>>> lib.get("particles").config # and you can also get its config as well
{'type': 'ObservationPlane',
'plane': {'center': [0, 0, 6371000],
'center.units': 'm',
'normal': [0, 0, 1]},
'x-axis': [1, 0, 0],
'y-axis': [0, 1, 0],
'delete_on_hit': True,
'name': 'particles'}
>>> lib.get("particles").data # this returns the data as a Pandas data frame
shower pdg energy x y radius
0 0 211 9.066702e+10 2.449931 -5.913341 7.093710
1 0 22 2.403024e+11 -1.561504 -1.276160 2.024900
2 0 211 1.306354e+11 -4.626045 -3.237780 6.009696
3 0 211 1.773324e+11 -1.566567 4.172961 4.461556
4 0 211 7.835374e+10 3.152863 -1.049201 3.330416
.. ... ... ... ... ... ...
>>> lib.get("particles").astype("arrow") # you can also request the data in a different format
pyarrow.Table
shower: int32 not null
pdg: int32 not null
energy: double not null
x: double not null
y: double not null
radius: double not null
>>>lib.get("particles").astype("pandas") # or astype("arrow"), or astype("pandas").to_numpy()
You can locally install the corsika python analysis library from within your corsika
source code directory by `pip3 install --user -e python pyarrow==0.17.0`. Note, the pyarrow
version fix has shown to be needed on some older systems. You may not need this, or you may
need additional packages, too.
Particle Properties
===================
.. toctree::
particle_classes
.. doxygengroup:: Particles
:project: CORSIKA8
:members:
Particle Properties
===================
Particle Storage and Stack
==========================
.. toctree::
particle_classes
Particles in memory are stored in a Stack. The Stack handles the memory management and access to particle data
properties. The stack can be extended with additional fields that then become part of the particle object.
.. doxygengroup:: Particles
:project: CORSIKA8
:members:
The standard Stack object in CORSIKA 8 is the NuclearStackExtension, further extended with internal
fields like `geometry node` and `weight` or `history`. But the important part is the `NuclearStackExtension`.
There are several ways to create particles:
* novel particles on the stack:
* stack::addParticle(particle_data_type const&)
* stack::addParticle(nuclear_particle_data_type const&)
* stack::addParticle(particle_data_momentum_type const&)
* stack::addParticle(nuclear_particle_data_momentum_type const&)
* secondary particles:
* stack::addSecondary(parent const&, particle_data_type const&)
* stack::addSecondary(parent const&, nuclear_particle_data_type const&)
* stack::addSecondary(parent const&, particle_data_momentum_type const&)
* stack::addSecondary(parent const&, nuclear_particle_data_momentum_type const&)
or directly:
* particle::addSecondary(particle_data_type const&)
* particle::addSecondary(nuclear_particle_data_type const&)
* particle::addSecondary(particle_data_momentum_type const&)
* particle::addSecondary(nuclear_particle_data_momentum_type const&)
The content of these method parameters are:
* particle_data_type: {PID [corsika::Code], kinetic energy [HEPEnergyType], direction [DirectionVector], position [Point], time[TimeType]}
* particle_data_momentum_type: {PID [corsika::Code], momentum [MomentumVector], position [Point], time[TimeType]}
* nuclear_particle_data_type: {PID [corsika::Code], kinetic energy [HEPEnergyType], direction [DirectionVector], position [Point], time[TimeType], A [unsigned int], Z [unsigned int]}
* nuclear_particle_data_momentum_type: {PID [corsika::Code], momentum [MomentumVector], position [Point], time[TimeType], A [unsigned int], Z [unsigned int]}