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
Commits on Source (2399)
Showing with 687 additions and 1470 deletions
......@@ -57,6 +57,7 @@ IncludeCategories:
Priority: 2
- Regex: '.*'
Priority: 3
SortIncludes: false
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
......@@ -76,7 +77,6 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
......
*.inl gitlab-language=c++
\ No newline at end of file
*gcov
**/*~
**/*.bak
**/*log
build/
install/
.vscode/
Framework/Particles/GeneratedParticleProperties.inc
flymd.html
flymd.md
Testing
tags
Environment/GeneratedMediaProperties.inc
CMakeUserPresets.json
corsika/framework/core/GeneratedParticleClasses.inc
corsika/framework/core/GeneratedParticleProperties.inc
corsika/framework/core/particle_db.pkl
corsika/media/GeneratedMediaProperties.inc
corsika/modules/epos/Generated.inc
corsika/modules/fluka/Generated.inc
corsika/modules/qgsjetII/Generated.inc
corsika/modules/sibyll/Generated.inc
corsika/modules/sophia/Generated.inc
conan_cmake/
corsika-cmake.sh
This diff is collapsed.
The code approval procedure is described in the [code approval procedure wiki](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
Issues: Closes #....
- [ ] The MR is without WIP (work in progress) status
- [ ] Make sure the most recent CI jobs (config, quality, build, tests) all run fine with no failures
The code approval procedure is described in the wiki: [Code approval procedure wiki](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
- [ ] The MR is without `WIP/Draft` status
- [ ] Make sure the most recent CI jobs (config, quality, build_test_example) all run fine with no failures
- if "check clang-format" failed: the code contributor has to run `./do-clang-format.py --apply` eventually with the `--all` option
- if "check copyright" failed the code contributor has to run`./do-copyright.py --add=20xy`
- [ ] Also run all the extra optional jobs "coverage", "release-clang-8", "release-u-18.04" and make sure no problems occur
- [ ] Check in the "coverage" job output that the coverage did not decreases (!). It should always stay, or increase. If it decreased --> ask contributor to add further unit tests, and check coverage report.
- [ ] Make sure also the jobs with MR-label `ready for code review` succeed. This includes the optional jobs, in particular 'coverage', 'release-full-clang-14", "release-full-u-22_04" and make sure no problems occur. You may have to trigger a pipeline manually to check this.
- [ ] Check in the "coverage" job output that the coverage did not decrease. It should always stay, or increase. If it decreased --> ask contributor to add further needed unit tests, and check coverage report.
- On the MR page, open the "Open in Web IDE" tool
- [ ] Check if the provided solution solves the Issue, discuss on gitlab
- [ ] Check that all changes are actually related to the issue
- [ ] There are no debug statements left, not even commented out
- [ ] Check all changes for coding rules and guidelines
- When all above is done
- [ ] **Add label "Code Review Finished"**
- When all above is done:
- **Add MR label "Code Review Finished"**
[submodule "Data"]
path = Data
url = ../../AirShowerPhysics/corsika-data
[submodule "modules/data"]
path = modules/data
url = ../../AirShowerPhysics/corsika-data.git
branch = master
shallow = true
[submodule "modules/conex"]
path = modules/conex/cxroot
url = ../../AirShowerPhysics/cxroot.git
branch = master
[submodule "ThirdParty/spdlog"]
path = ThirdParty/spdlog
url = https://github.com/gabime/spdlog.git
shallow = true
[submodule "Processes/Proposal/PROPOSAL"]
path = Processes/Proposal/PROPOSAL
url = https://github.com/tudo-astroparticlephysics/PROPOSAL.git
shallow = true
* milestone1 release: So 7. Okt 15:51:07 CEST 2018
#
# (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 3-clause BSD license.
# See file LICENSE for a full version of the license.
#
cmake_minimum_required (VERSION 3.9)
# we would need 3.16 to have CMP0097 for external subproject submodule (non) support
#+++++++++++++++++++++++++++++
# project name
# version is: "8.major.minor.patch"
# major: API changes
# minor: no API changes
# patch: bug fix and small improvements
#
set (c8_version 8.0.0.0)
project (
corsika
VERSION ${c8_version}
DESCRIPTION "CORSIKA C++ project (alpha status)"
LANGUAGES CXX
)
#+++++++++++++++++++++++++++++
# for pre-defined standard path
#
include (GNUInstallDirs)
#+++++++++++++++++++++++++++++
# prevent in-source builds and give warning message
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
#
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message (FATAL_ERROR "In-source builds are disabled.
Please create a subfolder and use `cmake ..` inside it.
Please create a build-dir and use `cmake <source-dir>` inside it.
NOTE: cmake will now create CMakeCache.txt and CMakeFiles/*.
You must delete them, or cmake will refuse to work.")
endif ()
endif ()
project (
corsika
VERSION 8.0.0
DESCRIPTION "CORSIKA C++ project"
LANGUAGES CXX
)
#++++++++++++++++++++++++++++
# cmake version-specific settings
#
# https://cmake.org/cmake/help/latest/policy/CMP0079.html
if (POLICY CMP0079)
cmake_policy (SET CMP0079 NEW)
endif ()
# Download timestamp for external modules
if (POLICY CMP0135)
cmake_policy (SET CMP0135 OLD)
endif ()
# AUtomatically add extensions to filenames if needed (old behaviour)
if (POLICY CMP0115)
cmake_policy (SET CMP0115 OLD)
endif ()
#+++++++++++++++++++++++++++++
# warn user if system is not UNIX
#
if (NOT UNIX)
message (FATAL_ERROR "| CORSIKA8 > This is an unsupported system.")
endif ()
# as long as there still are modules using it:
enable_language (Fortran)
#+++++++++++++++++++++++++++++
# cmake path dir, and cmake config
#
set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
# TEMPORARY: this should be removed, the sanitizers should be always enabled
option (WITH_CORSIKA_SANITIZERS_ENABLED "temporary way to globally disable sanitizers until the currently failing tests are fixed" OFF)
option (WITH_COAST "Flag to switch on/off COAST (reverse) interface" OFF)
set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
# check for python
set (Python_ADDITIONAL_VERSIONS 3)
find_package (PythonInterp 3 REQUIRED)
if(DEFINED CONAN_CMAKE_DIR)
list(APPEND CMAKE_MODULE_PATH "${CONAN_CMAKE_DIR}")
endif(DEFINED CONAN_CMAKE_DIR)
set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1`
# ignore many irrelevant Up-to-date messages during install
set (CMAKE_INSTALL_MESSAGE LAZY)
# directory for local cmake modules
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
include (CorsikaUtilities) # a few cmake function
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_EXTENSIONS OFF)
enable_testing ()
set (CTEST_OUTPUT_ON_FAILURE 1)
#+++++++++++++++++++++++++++++
# Extra cmake functions for registering and running tests
#
include (corsikaUtilities) # extra cmake functions
# Set the possible values of build type for cmake-gui and command line check
set (ALLOWED_BUILD_TYPES Debug Release MinSizeRel RelWithDebInfo Coverage)
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${ALLOWED_BUILD_TYPES})
#+++++++++++++++++++++++++++++
# Setup hardware and infrastructure dependent defines, and general settings
#
include (corsikaDefines)
# Set a default build type if none was specified
# by default: "Debug", if local ".git" directory is found, otherwise "Release"
set (DEFAULT_BUILD_TYPE "Release")
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
set (DEFAULT_BUILD_TYPE "Debug")
#+++++++++++++++++++++++++++++
# check if compiler is C++17 compliant
#
include (CheckCXXCompilerFlag)
check_CXX_compiler_flag ("-std=c++17" COMPILER_SUPPORTS_CXX17)
if (NOT COMPILER_SUPPORTS_CXX17)
message (FATAL "| CORSIKA8 > The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
endif ()
# set CXX compile flags and options and warning settings
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_EXTENSIONS OFF)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message (STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as no other was specified.")
set (CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE
STRING "Choose the type of build." FORCE)
else (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# Ignore capitalization when build type is selected manually and check for valid setting
string (TOLOWER ${CMAKE_BUILD_TYPE} SELECTED_LOWER)
string (TOLOWER "${ALLOWED_BUILD_TYPES}" BUILD_TYPES_LOWER)
if (NOT SELECTED_LOWER IN_LIST BUILD_TYPES_LOWER)
message (FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE} [allowed: ${ALLOWED_BUILD_TYPES}]")
endif ()
message (STATUS "Build type is: ${CMAKE_BUILD_TYPE}")
endif (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
#+++++++++++++++++++++++++++++
# Compiler and linker flags, settings
#
# enable warnings and disallow non-standard language
# configure the various build types here, too
# FYI: optimizer flags: -O2 would not trade speed for size, neither O2/3 use fast-math
# debug: O0, relwithdebinfo: 02, release: O3, minsizerel: Os (all defaults)
set (CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers")
set (CMAKE_Fortran_FLAGS "-std=legacy -Wfunction-elimination")
# setup coverage build type
set (CMAKE_CXX_FLAGS_COVERAGE "-g --coverage")
set (CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage")
set (CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage")
if (CORSIKA_SCL_CXX)
add_definitions (-D_GLIBCXX_USE_CXX11_ABI=0)
endif()
# clang produces a lot of unecessary warnings without this:
add_compile_options ("$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-nonportable-include-path>")
add_compile_options (
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-nonportable-include-path>
)
# set a flag to inform code that we are in debug mode
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
# COAST - interface, this requires CORSIKA7 to be installed first
# COAST will allow you to program code in CORSIKA8 and execute it inside CORSIKA7
if (WITH_COAST)
message (STATUS "Compiling CORSIKA8 for the use with COAST/corsika7.")
add_compile_options ("-fPIC")
endif ()
#+++++++++++++++++++++++++++++
# Setup external dependencies.
#
###
#
# add cnpy temporarily. As long as SaveBoostHistogram does not save to parquet directly
#
add_subdirectory (externals/cnpy)
#+++++++++++++++++++++++++++++
# Coverage
#
# targets and settings needed to generate coverage reports
if (CMAKE_BUILD_TYPE STREQUAL Coverage)
#if (CMAKE_BUILD_TYPE STREQUAL Coverage)
SET(COVERAGE_BUILD OFF CACHE BOOL "Activate coverage build")
if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
message(INFO "\n|==========> COVERAGE TARGET ACTIVATED.\n")
set (c8_lcov_download_url "https://github.com/linux-test-project/lcov/releases/download")
set (c8_lcov_version "1.16")
set (c8_lcov_install_dir "${CMAKE_BINARY_DIR}/lcov")
include(ExternalProject)
ExternalProject_Add(lcov
URL ${c8_lcov_download_url}/v${c8_lcov_version}/lcov-${c8_lcov_version}.tar.gz
DOWNLOAD_NO_EXTRACT 0
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND make -C <SOURCE_DIR> install PREFIX=${c8_lcov_install_dir}
)
find_package (Perl REQUIRED)
# compile coverage under -O2 to remove unused functions
add_compile_options ("-O2")
# compile coverage under -O0 to avoid any optimization, function elimation etc.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage")
# search for local lcov
find_program (c8_lcov_bin lcov)
if (NOT c8_lcov_bin)
set (c8_lcov_bin "${c8_lcov_install_dir}/bin/lcov")
message ("use C8 version of lcov ${c8_lcov_bin}")
endif ()
# search for local genhtml
find_program (c8_genhtml_bin genhtml)
if (NOT c8_genhtml_bin)
set (c8_genhtml_bin "${c8_lcov_install_dir}/bin/genhtml")
message ("use C8 version of genhtml ${c8_genhtml_bin}")
endif ()
set (GCOV gcov CACHE STRING "gcov executable" FORCE)
set (LCOV_BIN_DIR "${PROJECT_SOURCE_DIR}/ThirdParty/lcov/bin")
# collect coverage data
add_custom_command (
OUTPUT raw-coverage.info
COMMAND ${CMAKE_COMMAND} -E echo "Note: you need to run ctest at least once to generate the coverage data"
COMMAND ${LCOV_BIN_DIR}/lcov --gcov-tool=${GCOV} --directory . --capture --output-file raw-coverage.info
COMMAND ${c8_lcov_bin} --gcov-tool=${GCOV} --rc lcov_branch_coverage=1
--directory . --capture --output-file raw-coverage.info
)
# remove uninteresting entries
add_custom_command (
OUTPUT coverage.info
COMMAND ${LCOV_BIN_DIR}/lcov -q --remove raw-coverage.info "*/usr/*" --output-file coverage2.info
COMMAND ${LCOV_BIN_DIR}/lcov --remove coverage2.info "*/ThirdParty/*" --output-file coverage.info
COMMAND ${c8_lcov_bin} -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info
COMMAND ${c8_lcov_bin} --remove coverage2.info
"*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*"
"*/include/Pythia8/*" "*/install/*"
"${CMAKE_SOURCE_DIR}/modules/*" "${CMAKE_BINARY_DIR}/modules/*"
"*/cxroot/*" "*/.conan2/*" "/boost/*"
--output-file coverage.info
COMMAND ${CMAKE_COMMAND} -E remove coverage2.info
DEPENDS raw-coverage.info
)
# generate html report
add_custom_command (
OUTPUT coverage-report
COMMAND ${LCOV_BIN_DIR}/genhtml --demangle-cpp coverage.info -o coverage-report
COMMAND ${c8_genhtml_bin} --branch-coverage --show-details --title "CORSIKA 8 test coverage" --legend --demangle-cpp coverage.info -o coverage-report
DEPENDS coverage.info
)
add_custom_target (coverage DEPENDS coverage-report)
endif ()
# include this test only if NOT run on gitlab-ci, since there we have a dedicated job for it:
#+++++++++++++++++++++++++++++
# CTest config
#
enable_testing ()
if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
list (APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
else (${CMAKE_VERSION} VERSION_LESS "3.12.0")
set (CTEST_OUTPUT_ON_FAILURE 1) # this is for new versions of cmake
endif (${CMAKE_VERSION} VERSION_LESS "3.12.0")
set (CTEST_CUSTOM_COVERAGE_EXCLUDE "./tests/" "./examples/" "./modules/" "test*.(hpp/cpp)$")
# include this test only if NOT run on gitlab-ci; On CI this is a dedicated job:
if (NOT DEFINED ENV{CI})
# add call to ./do-copyright.py to run as unit-test-case
add_test (NAME copyright_notices COMMAND ./do-copyright.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_test (NAME copyright_notices COMMAND ./do-copyright.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif (NOT DEFINED ENV{CI})
if (DEFINED ENV{CORSIKA_DATA})
message ("Found corsika-data in $ENV{CORSIKA_DATA}")
set (CORSIKA_DATA $ENV{CORSIKA_DATA})
add_subdirectory ($ENV{CORSIKA_DATA} corsika_data)
else ()
message ("CORSIKA_DATA not defined: NEED to download AirShowerPhysics/corsika-data via git submodule")
message ("cmake will fail if you did not do this already.")
set (CORSIKA_DATA ${PROJECT_SOURCE_DIR}/Data)
add_subdirectory (Data)
endif ()
# include potential ThirdParty code provided with CORSIKA
add_subdirectory (ThirdParty)
# order of subdirectories
add_subdirectory (Framework)
add_subdirectory (Environment)
add_subdirectory (Stack)
add_subdirectory (Setup)
add_subdirectory (Processes)
add_subdirectory (Documentation)
add_subdirectory (Main)
add_subdirectory (Tools)
if (WITH_COAST)
add_subdirectory (COAST)
endif ()
#+++++++++++++++++++++++++++++
# Externals
#
set (Python_ADDITIONAL_VERSIONS 3)
find_package (PythonInterp 3 REQUIRED)
#+++++++++++++++++++++++++++++++
# exporting of CMake targets
#
include (CMakePackageConfigHelpers)
# list of targets that will be INSTALLed and EXPORTed
# Important: all those targets must be individually INSTALLed with "EXPORT CORSIKA8PublicTargets"
set (public_CORSIKA8_targets CORSIKA8)
#+++++++++++++++++++++++++++++
# CORSIKA8
#
add_library (CORSIKA8 INTERFACE)
set_target_properties (
CORSIKA8
PROPERTIES
INTERFACE_CORSIKA8_MAJOR_VERSION 0
COMPATIBLE_INTERFACE_STRING CORSIKA8_MAJOR_VERSION
)
target_include_directories (
CORSIKA8
INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
)
# since CORSIKA8 is a header only library we must specify all link dependencies here:
find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(CLI11 REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(spdlog REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(Arrow REQUIRED)
find_package(PROPOSAL REQUIRED)
find_package(Catch2 REQUIRED)
target_link_libraries (
CORSIKA8
INTERFACE
BZip2::BZip2
Boost::filesystem
CLI11::CLI11
Eigen3::Eigen
spdlog::spdlog
yaml-cpp::yaml-cpp
Parquet::parquet_static
PROPOSAL::PROPOSAL
cnpy # for SaveBoostHistogram
)
# "src" is needed, since some headers (namely GeneratedParticleProperties.inc ec.) are produced by python script from e.g. ParticleData.xml
add_subdirectory (src)
add_subdirectory (documentation)
#+++++++++++++++++++++++++++++
# = Add of subdirectories =
#
#+++++++++++++++++++++++++++++
# modules
#
set (CORSIKA_DATA_WITH_TEST ON) # we want to run the corsika-data unit test
add_subdirectory (modules/data) # this is corsika-data (submodule)
add_subdirectory (modules/common)
add_subdirectory (modules/pythia8)
add_subdirectory (modules/sibyll)
add_subdirectory (modules/sophia)
add_subdirectory (modules/qgsjetII)
add_subdirectory (modules/urqmd)
add_subdirectory (modules/conex)
add_subdirectory (modules/epos)
add_subdirectory (modules/tauola)
add_subdirectory (modules/fluka)
#
#+++++++++++++++++++++++++++++++
# standard applications
#
add_subdirectory(applications)
#+++++++++++++++++++++++++++++++
# unit testing
#
add_subdirectory (tests)
#+++++++++++++++++++++++++++++++
# installation
#
install (
TARGETS CORSIKA8
EXPORT CORSIKA8PublicTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# header only part, just copy entire directory tree
#
install (DIRECTORY corsika DESTINATION include)
#
# generate cmake config package version (for find_package)
#
write_basic_package_version_file (
${PROJECT_BINARY_DIR}/corsikaConfigVersion.cmake
VERSION ${c8_version}
COMPATIBILITY SameMajorVersion
)
#
# export targets in build tree (for find_package)
#
export (
EXPORT CORSIKA8PublicTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/corsikaTargets.cmake"
NAMESPACE CORSIKA8::
)
#
# export targets in install tree (for find_package)
#
install (
EXPORT CORSIKA8PublicTargets
FILE corsikaTargets.cmake
NAMESPACE CORSIKA8::
DESTINATION lib/cmake/corsika
)
if(DEFINED CONAN_CMAKE_DIR)
install (
DIRECTORY conan_cmake/
DESTINATION lib/cmake/dependencies
)
endif(DEFINED CONAN_CMAKE_DIR)
#
# config for build tree (for find_package)
#
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/corsikaConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# corsikaDefines
#
configure_package_config_file (
cmake/corsikaDefines.cmake
${PROJECT_BINARY_DIR}/corsikaDefines.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# config for install tree (for find_package)
# overwrite with install locations (if it was build as part of corsika)
#
set (Pythia8_INCDIR ${Pythia8_INCDIR_INSTALL})
set (Pythia8_LIBDIR ${Pythia8_LIBDIR_INSTALL})
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/corsikaConfig.cmake-install
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# generate "corsika/corsika.hpp" file with cmake-level details and paths
# first for build-tree
#
# the location of the "corsika-data" is of fundamental importance
set (CORSIKA_CMAKE_DATA_DIR ${CMAKE_SOURCE_DIR}/modules/data)
configure_file (
src/corsika.hpp.in
${PROJECT_BINARY_DIR}/corsika/corsika.hpp
)
#
# second also for install-tree
#
set (CORSIKA_CMAKE_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/corsika/data")
configure_file (
src/corsika.hpp.in
${PROJECT_BINARY_DIR}/corsika.hpp-install
)
#
# installation of cmake and config files
#
install (
FILES
${CMAKE_BINARY_DIR}/corsikaDefines.cmake
${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake
DESTINATION lib/cmake/corsika
)
#
# install and rename install-level corsikaConfig.cmake
#
install (
FILES
${CMAKE_BINARY_DIR}/corsikaConfig.cmake-install
RENAME corsikaConfig.cmake
DESTINATION lib/cmake/corsika
)
#
# also install-level config.hpp
#
install (FILES
${PROJECT_BINARY_DIR}/corsika.hpp-install
RENAME corsika.hpp
DESTINATION include/corsika
)
#
# examples
#
install (DIRECTORY examples DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika)
#
# data
#
install (DIRECTORY modules/data DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika)
#
# tools
#
add_subdirectory (tools)
#+++++++++++++++++++++++++++++++
#
# final summary output
#
include (FeatureSummary)
feature_summary (WHAT ALL)
set (
COAST_HEADERS
COASTProcess.h
COASTStack.h
ParticleConversion.h
)
set (
COAST_SOURCES
COASTUserLib.cc
COASTProcess.cc
ParticleConversion.cc
)
set (
COAST_NAMESPACE
corsika/coast
)
add_library (COAST SHARED ${COAST_SOURCES})
CORSIKA_COPY_HEADERS_TO_NAMESPACE (COAST ${COAST_NAMESPACE} ${COAST_HEADERS})
set_target_properties (
COAST
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
# PUBLIC_HEADER "${MODEL_HEADERS}"
)
target_link_libraries (
COAST
PUBLIC
CORSIKAgeometry
CORSIKAunits
CORSIKAparticles
CORSIKAgeometry
CORSIKAsetup
# SuperStupidStack
)
target_include_directories (
COAST
PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/include>
)
target_include_directories (
COAST
SYSTEM
PUBLIC
$ENV{COAST_DIR}/include
)
install (
TARGETS COAST
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include/${COAST_NAMESPACE}
)
#install (
# FILES ${COAST_HEADERS}
# DESTINATION include/${COAST_NAMESPACE}
# )
/*
* (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.
*/
#include <corsika/coast/COASTProcess.h>
#include <corsika/coast/COASTStack.h>
#include <iostream>
using namespace std;
namespace corsika::coast {
/**
the init function is called during the start of corsika.
*/
void COASTProcess::Init() {
cout << "************* Greetings from CORSIKA8 *****************" << endl;
}
/**
the docontinous function is called for each tracking step in
corsika. Take care: you cannot modify the particle, the track or
the stack from here (docontinuous) inside corisika7. In corsika8
you will be able to do that.
*/
corsika::process::EProcessReturn COASTProcess::DoContinuous(const Particle& p,
const Track& t,
const Stack&) {
using namespace corsika::units::si;
auto const start = t.GetPosition(0).GetCoordinates();
auto const delta = t.GetPosition(1).GetCoordinates() - start;
auto const name = corsika::particles::GetName(p.GetPID());
cout << "CORSIKA8: particle=" << name << ", pos=" << start
<< " track-l=" << delta.norm() << ", track-t=" << t.GetDuration() << endl;
return corsika::process::EProcessReturn::eOk;
}
} // namespace corsika::coast
/*
* (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.
*/
#pragma once
#include <corsika/particles/ParticleProperties.h>
#include <corsika/process/ContinuousProcess.h>
#include <corsika/setup/SetupTrajectory.h>
#include <corsika/units/PhysicalUnits.h>
#include <corsika/coast/COASTStack.h>
#include <limits>
typedef corsika::coast::COASTStack Stack;
typedef corsika::coast::COASTStack::ParticleType Particle;
typedef corsika::geometry::Trajectory<corsika::geometry::Line> Track;
namespace corsika::coast {
class COASTProcess : public corsika::process::ContinuousProcess<COASTProcess> {
public:
void Init();
corsika::process::EProcessReturn DoContinuous(const Particle&, const Track&,
const Stack&);
corsika::units::si::LengthType MaxStepLength(Particle&, Track&) {
return corsika::units::si::meter * std::numeric_limits<double>::infinity();
}
private:
};
} // namespace corsika::coast
/*
* (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.
*/
#pragma once
#include <corsika/coast/ParticleConversion.h>
#include <corsika/particles/ParticleProperties.h>
#include <corsika/stack/ParticleBase.h>
#include <corsika/stack/Stack.h>
#include <corsika/units/PhysicalUnits.h>
#include <corsika/geometry/Point.h>
#include <corsika/geometry/RootCoordinateSystem.h> // remove
#include <corsika/geometry/Vector.h>
#include <crs/CParticle.h>
#include <crs/CorsikaTypes.h>
#include <algorithm>
#include <vector>
namespace corsika::coast {
typedef corsika::geometry::Vector<corsika::units::si::hepmomentum_d> MomentumVector;
/**
* Example of a particle object on the stack.
*/
template <typename StackIteratorInterface>
class ParticleInterface : public corsika::stack::ParticleBase<StackIteratorInterface> {
using corsika::stack::ParticleBase<StackIteratorInterface>::GetStackData;
using corsika::stack::ParticleBase<StackIteratorInterface>::GetIndex;
public:
corsika::particles::Code GetPID() const { return GetStackData().GetPID(GetIndex()); }
corsika::units::si::HEPEnergyType GetEnergy() const {
return GetStackData().GetEnergy(GetIndex());
}
MomentumVector GetMomentum(const corsika::geometry::CoordinateSystem& cs) const {
using namespace corsika::units::si;
const HEPEnergyType mass = corsika::particles::GetMass(GetPID());
const auto P = sqrt((GetEnergy() - mass) * (GetEnergy() + mass));
const auto p = GetStackData().GetDirection(cs);
return p * P;
}
corsika::geometry::Point GetPosition(
const corsika::geometry::CoordinateSystem& cs) const {
return GetStackData().GetPosition(cs, GetIndex());
}
corsika::geometry::Vector<corsika::units::si::speed_d> GetVelocity(
const corsika::geometry::CoordinateSystem& cs) const {
return GetStackData().GetVelocity(cs, GetIndex());
}
corsika::units::si::TimeType GetTime() const {
return GetStackData().GetTime(GetIndex());
}
corsika::geometry::Vector<corsika::units::si::dimensionless_d> GetDirection(
const corsika::geometry::CoordinateSystem& cs) const {
return GetStackData().GetDirection(cs);
}
corsika::units::si::TimeType GetTimeInterval() const {
return GetStackData().GetTimeInterval();
}
};
/**
*
* Memory implementation of the most simple (stupid) particle stack object.
*/
class COASTStackImpl {
const crs::CParticle* fParticle1 = 0;
const crs::CParticle* fParticle2 = 0;
public:
COASTStackImpl(const crs::CParticle* v1, const crs::CParticle* v2) {
fParticle1 = v1;
fParticle2 = v2;
}
void Init() {}
void Clear() {}
// there is one particle only
int GetSize() const { return 1; }
int GetCapacity() const { return 1; }
// you cannot modify the particle:
// there are no Set... function defined
// readout particle data, there is just one particle!
/*
double x;
double y;
double z;
double depth;
double time;
double energy;
double weight;
int particleId;
int hadronicGeneration;
*/
corsika::particles::Code GetPID(const int) const {
return ConvertFromCoast(static_cast<CoastCode>(fParticle1->particleId));
}
corsika::units::si::HEPEnergyType GetEnergy(const int) const {
using namespace corsika::units::si;
return fParticle1->energy * 1_GeV;
}
corsika::geometry::Vector<corsika::units::si::dimensionless_d> GetDirection(
const corsika::geometry::CoordinateSystem& cs) const {
using namespace corsika::units::si;
corsika::geometry::Point p1(
cs, {fParticle1->x * 1_cm, fParticle1->y * 1_cm, fParticle1->z * 1_cm});
corsika::geometry::Point p2(
cs, {fParticle2->x * 1_cm, fParticle2->y * 1_cm, fParticle2->z * 1_cm});
const corsika::geometry::Vector D = p2 - p1;
const auto magD = D.norm();
const corsika::geometry::Vector dir = D / magD;
return dir;
}
corsika::geometry::Vector<corsika::units::si::speed_d> GetVelocity(
const corsika::geometry::CoordinateSystem& cs, const int) const {
using namespace corsika::units::si;
corsika::geometry::Vector<corsika::units::si::dimensionless_d> dir =
GetDirection(cs);
corsika::geometry::Point p1(
cs, {fParticle1->x * 1_cm, fParticle1->y * 1_cm, fParticle1->z * 1_cm});
corsika::geometry::Point p2(
cs, {fParticle2->x * 1_cm, fParticle2->y * 1_cm, fParticle2->z * 1_cm});
const corsika::geometry::Vector D = p2 - p1;
const LengthType magD = D.norm();
const TimeType deltaT = GetTimeInterval();
return dir * magD / deltaT;
}
corsika::geometry::Point GetPosition(const corsika::geometry::CoordinateSystem& cs,
const int) const {
using namespace corsika::units::si;
return corsika::geometry::Point(
cs, {fParticle1->x * 1_cm, fParticle1->y * 1_cm, fParticle1->z * 1_cm});
}
corsika::units::si::TimeType GetTime(const int) const {
using namespace corsika::units::si;
return fParticle1->time * 1_s;
}
corsika::units::si::TimeType GetTimeInterval() const {
using namespace corsika::units::si;
return (fParticle2->time - fParticle1->time) * 1_s;
}
/**
* We do not allow copying!
*/
void Copy(const int, const int) {}
/**
* We do not allow swapping particles, there is just one...
*/
void Swap(const int, const int) {}
// size cannot be increased, do nothing
void IncrementSize() {}
// size cannot be decremented, do nothing
void DecrementSize() {}
}; // end class COASTStackImpl
typedef corsika::stack::Stack<COASTStackImpl, ParticleInterface> COASTStack;
} // namespace corsika::coast
/*
* (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.
*/
#include <interface/CorsikaInterface.h>
#include <corsika/coast/COASTProcess.h>
#include <corsika/coast/COASTStack.h>
#include <corsika/geometry/CoordinateSystem.h>
#include <corsika/geometry/Line.h>
#include <corsika/geometry/Point.h>
#include <corsika/geometry/Trajectory.h>
#include <corsika/geometry/Vector.h>
#include <corsika/units/PhysicalUnits.h>
#include <crs/CInteraction.h>
#include <crs/CParticle.h>
#include <crs/CorsikaTypes.h>
#include <crs/TSubBlock.h>
#include <iostream>
#include <sstream>
using namespace std;
using namespace corsika;
using namespace corsika::units::si;
corsika::coast::COASTProcess gCorsikaProcess;
/*
Data is one CORSIKA data-block constining of 21 SubBlocks.
A SubBlock can be:
- thinned mode: 39 (Particles) * 8 (ENTRIES) * 4 (BYTES)
- not-thinned mode: 39 (Particles) * 7 (ENTRIES) * 4 (BYTES)
*/
extern "C" void wrida_([[maybe_unused]] const CREAL* Data) {
// crs::CParticleFortranPtr p;
// const bool isF = prminfo_(p);
}
extern "C" void inida_([[maybe_unused]] const char* filename,
[[maybe_unused]] const int& thinning,
[[maybe_unused]] const int& /*curved*/,
[[maybe_unused]] const int& /*slant*/,
[[maybe_unused]] const int& /*stackinput*/,
[[maybe_unused]] const int& /*preshower*/,
[[maybe_unused]] int str_length) {
gCorsikaProcess.Init();
}
extern "C" void cloda_() {
// crs::CParticleFortranPtr pptr;
// const bool isF = prminfo_(pptr);
// gCorsikaProcess.Close();
}
void interaction_([[maybe_unused]] const crs::CInteraction& interaction) {
/*
all interactions in the shower are available in this function !
the information availabel in the CInteraction class are:
double x;
double y;
double z;
double etot; // lab energy
double sigma; // cross-section of process
double kela; // elasticity
int projId; // projectile
int targetId; // target
double time;
*/
}
extern "C" void track_([[maybe_unused]] const crs::CParticle& pre,
[[maybe_unused]] const crs::CParticle& post) {
/*
all particles in the shower are available in this function !
The pre and post objecte are the two endpoints for one single track
in the shower, where the information available in CParticle is:
double x;
double y;
double z;
double depth;
double time;
double energy;
double weight;
int particleId;
int hadronicGeneration;
*/
coast::COASTStack stack(&pre, &post);
const auto particle = stack.GetNextParticle();
const geometry::CoordinateSystem& rootCS =
geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem();
geometry::Line const line(particle.GetPosition(rootCS), particle.GetVelocity(rootCS));
const TimeType time = particle.GetTimeInterval();
const geometry::Trajectory<geometry::Line> track(line, time);
gCorsikaProcess.DoContinuous(particle, track, stack);
}
extern "C" void tabularizedatmosphere_([[maybe_unused]] const int& nPoints,
[[maybe_unused]] const double* height,
[[maybe_unused]] const double* refractiveIndex) {
// for special use only but should be defined because it is delcared in CORSIKA.F
}
/*
* (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.
*/
#include <corsika/coast/ParticleConversion.h>
#include <corsika/particles/ParticleProperties.h>
#include <exception>
#include <iostream>
#include <sstream>
using namespace std;
namespace corsika::coast {
/**
Convert particle code, and check if it does exists. Throw exeption, if not!
*/
corsika::particles::Code ConvertFromCoast(CoastCode pCode) {
if (coast2corsika.count(pCode) == 0) {
ostringstream err;
err << "corsika::coast::ConvertFromCoast CoastCode does not exists="
<< static_cast<CoastCodeIntType>(pCode) << endl;
cout << err.str() << endl;
throw std::runtime_error(err.str());
}
return coast2corsika.find(pCode)->second;
}
} // namespace corsika::coast
/*
* (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.
*/
#pragma once
#include <corsika/particles/ParticleProperties.h>
#include <map>
namespace corsika::coast {
/**
Here we define the original CORSIKA particle codes, see corsika manual
*/
enum class CoastCode : int16_t {
Gamma = 1,
Positron = 2,
Electron = 3,
MuonBar = 5,
Muon = 6,
Pi0 = 7,
PiP = 8,
PiM = 9,
Klong = 10,
KP = 11,
KM = 12,
Neutron = 13,
Proton = 14,
ProtonBar = 15,
Kshort = 16,
Eta = 17,
Lambda = 18,
SigmaPlus = 19,
Sigma0 = 20,
SigmaMinus = 21,
Xi0 = 22,
XiMinus = 23,
OmegaMinus = 24,
NeutronBar = 25,
LambdaBar = 26,
SigmaMinusBar = 27,
Sigma0Bar = 28,
SigmaPlusBar = 29,
Xi0Bar = 30,
XiPlusBar = 31,
OmegaPlusBar = 32,
EtaPrime = 48,
Phi = 49,
omega = 50,
Rho0 = 51,
RhoPlus = 52,
RhoMinus = 53,
DeltaPlusPlus = 54,
DeltaPlus = 55,
Delta0 = 56,
DeltaMinus = 57,
DeltaMinusMinusBar = 58,
DeltaMinusBar = 59,
Delta0Bar = 60,
DeltaPlusBar = 61,
KStar0 = 62,
KStarPlus = 63,
KStarMinus = 64,
KStar0Bar = 65,
NeutrinoE = 66,
NeutrinoEBar = 67,
NeutrinoMu = 68,
NeutrinoMuBar = 69,
Code71 = 71,
Code72 = 72,
Code73 = 73,
Code74 = 74,
Code75 = 75,
Code76 = 76,
Code85 = 85,
Code86 = 86,
Code95 = 95,
Code96 = 96,
ProtonNucleus = 101,
Deuterium = 201,
Tritium = 301,
He3 = 302,
Helium = 402,
Lithium = 603,
Beryllium = 904,
Boron = 1005,
Carbon = 1206,
Carbon13 = 1306,
Nitrogen = 1407,
Oxygen = 1608,
Fluor = 1809,
Neon21 = 2110,
Neon = 2210,
Argon = 1838,
Iron = 5628,
Xenon = 12854,
Radon = 13888,
};
using CoastCodeIntType = std::underlying_type<CoastCode>::type;
/**
Here we convert CORSIKA7 to CORSIKA8 codes
*/
const std::map<corsika::coast::CoastCode, corsika::particles::Code> coast2corsika = {
{CoastCode::Gamma, corsika::particles::Code::Gamma},
{CoastCode::Positron, corsika::particles::Code::Positron},
{CoastCode::Electron, corsika::particles::Code::Electron},
//{CoastCode:: ,corsika::particles::Code::Unknown}, // 4
{CoastCode::MuonBar, corsika::particles::Code::MuPlus},
{CoastCode::Muon, corsika::particles::Code::MuMinus},
{CoastCode::Pi0, corsika::particles::Code::Pi0},
{CoastCode::PiP, corsika::particles::Code::PiPlus},
{CoastCode::PiM, corsika::particles::Code::PiMinus},
{CoastCode::Klong, corsika::particles::Code::K0Long}, // 10
{CoastCode::KP, corsika::particles::Code::KPlus},
{CoastCode::KM, corsika::particles::Code::KMinus},
{CoastCode::Neutron, corsika::particles::Code::Neutron},
{CoastCode::Proton, corsika::particles::Code::Proton}, // 14
{CoastCode::ProtonBar, corsika::particles::Code::AntiProton},
{CoastCode::Kshort, corsika::particles::Code::K0Short},
{CoastCode::Eta, corsika::particles::Code::Eta}, // 17
{CoastCode::Lambda, corsika::particles::Code::Lambda0},
{CoastCode::SigmaPlus, corsika::particles::Code::SigmaPlus},
{CoastCode::Sigma0, corsika::particles::Code::Sigma0}, // 20
{CoastCode::SigmaMinus, corsika::particles::Code::SigmaMinus},
{CoastCode::Xi0, corsika::particles::Code::Xi0},
{CoastCode::XiMinus, corsika::particles::Code::XiMinus},
{CoastCode::OmegaMinus, corsika::particles::Code::OmegaMinus},
{CoastCode::NeutronBar, corsika::particles::Code::AntiNeutron}, // 25
{CoastCode::LambdaBar, corsika::particles::Code::Lambda0Bar},
{CoastCode::SigmaMinusBar, corsika::particles::Code::SigmaMinusBar},
{CoastCode::Sigma0Bar, corsika::particles::Code::Sigma0Bar},
{CoastCode::SigmaPlusBar, corsika::particles::Code::SigmaPlusBar},
{CoastCode::Xi0Bar, corsika::particles::Code::Xi0Bar},
{CoastCode::XiPlusBar, corsika::particles::Code::XiPlusBar},
{CoastCode::OmegaPlusBar, corsika::particles::Code::OmegaPlusBar}, // 32
//{CoastCode:: ,corsika::particles::Code::Unknown}, // eta-prime
//{CoastCode:: ,corsika::particles::Code::Unknown}, // PHI
//{CoastCode:: ,corsika::particles::Code::Unknown}, // omega
{CoastCode::Rho0, corsika::particles::Code::Rho0}, // 51
{CoastCode::RhoPlus, corsika::particles::Code::RhoPlus},
{CoastCode::RhoMinus, corsika::particles::Code::RhoMinus},
{CoastCode::DeltaPlusPlus, corsika::particles::Code::DeltaPlusPlus},
{CoastCode::DeltaPlus, corsika::particles::Code::DeltaPlus},
{CoastCode::Delta0, corsika::particles::Code::Delta0}, // 56
//{CoastCode:: ,corsika::particles::Code::Unknown}, // DeltaMinus},
{CoastCode::DeltaMinusMinusBar, corsika::particles::Code::DeltaMinusMinusBar},
{CoastCode::DeltaMinusBar, corsika::particles::Code::DeltaMinusBar},
{CoastCode::Delta0Bar, corsika::particles::Code::Delta0Bar},
//{CoastCode:: ,corsika::particles::Code::Unknown}, // DeltaPlusBar
{CoastCode::KStar0, corsika::particles::Code::KStar0}, // 62
{CoastCode::KStarPlus, corsika::particles::Code::KStarPlus},
{CoastCode::KStarMinus, corsika::particles::Code::KStarMinus},
{CoastCode::KStar0Bar, corsika::particles::Code::KStar0Bar},
{CoastCode::NeutrinoE, corsika::particles::Code::NuE},
{CoastCode::NeutrinoEBar, corsika::particles::Code::NuEBar},
{CoastCode::NeutrinoMu, corsika::particles::Code::NuMu},
{CoastCode::NeutrinoMuBar, corsika::particles::Code::NuMuBar}, // 69
{CoastCode::Code71, corsika::particles::Code::Unknown},
{CoastCode::Code72, corsika::particles::Code::Unknown},
{CoastCode::Code73, corsika::particles::Code::Unknown},
{CoastCode::Code74, corsika::particles::Code::Unknown},
{CoastCode::Code75, corsika::particles::Code::Unknown},
{CoastCode::Code76, corsika::particles::Code::Unknown},
{CoastCode::Code85, corsika::particles::Code::Unknown},
{CoastCode::Code86, corsika::particles::Code::Unknown},
{CoastCode::Code95, corsika::particles::Code::Unknown},
{CoastCode::Code96, corsika::particles::Code::Unknown},
{CoastCode::ProtonNucleus, corsika::particles::Code::Proton}, // 101
{CoastCode::Deuterium, corsika::particles::Code::Deuterium},
{CoastCode::Tritium, corsika::particles::Code::Tritium},
{CoastCode::He3, corsika::particles::Code::Helium3},
{CoastCode::Helium, corsika::particles::Code::Helium}, // 402
//{CoastCode::Lithium, corsika::particles::Code::Lithium},
//{CoastCode::Beryllium, corsika::particles::Code::Beryllium},
//{CoastCode::Boron, corsika::particles::Code::Boron},
//{CoastCode::Carbon, corsika::particles::Code::Carbon},
//{CoastCode::Carbon13, corsika::particles::Code::Carbon13},
//{CoastCode::Nitrogen, corsika::particles::Code::Nitrogen},
//{CoastCode::Fluor, corsika::particles::Code::Fluor},
//{CoastCode::Oxygen, corsika::particles::Code::Oxygen},
//{CoastCode::Neon21, corsika::particles::Code::Neon21},
//{CoastCode::Neon, corsika::particles::Code::Neon},
//{CoastCode::Argon, corsika::particles::Code::Argon},
//{CoastCode::Xenon, corsika::particles::Code::Xenon},
//{CoastCode::Radon, corsika::particles::Code::Radon},
{CoastCode::Iron, corsika::particles::Code::Iron}, // 5628
//{CoastCode::, corsika::particles::Code::},
};
corsika::particles::Code ConvertFromCoast(CoastCode pCode);
} // namespace corsika::coast
# COAST interface {#COAST}
With the COAST interface of CORSIKA 8 you can write a CORSIKA 8
"process" class and link it to CORSIKA 7. This can be very powerful to
benchmark new CORSIKA 8 physics code in the context of "old" CORSIKA 7
simulations.
This is based on corsika7/trunk/coast/CoastOptions/example with an
additional interface to CORSIKA 8. See code in namespace corsika::coast for all details.
We provide a step-by-step example for a "COAST user library" using CORSIKA 8
technology. It explains the steps, how to use the COAST_USER_LIB
option of CORSIKA together with CORSIKA8/COAST
Step 1:
-------
Configure CORSIKA8 with 'cmake -DWITH_COAST=1' and other options you
prefer. You have to define COAST_DIR environment variable to the
location of your existing CORSIKA7 installation. Check that 'ls
$COAST_DIR/include/interface' contains the file
'CorsikaInterface.h'. If this is not the case, this is not a valid or
proper installation of CORSIKA. First compile CORSIKA, e.g. with
ROOTOUT option, or CoReas to get COAST installed!
Step 2:
-------
Compile CORSIKA8, edit COAST/COASTProcess.cc to modify/add your
physics module.
There should be a libCOAST.so as a result! This is what you need.
Step 3:
-------
Create COAST_USER_LIB environment variable to point at your current
directory, where now the 'libCOAST.so' library is located.
Add the path in $COAST_USER_LIB to your LD_LIBRARY_PATH environment
variable.
Step 4:
-------
Go back to your CORSIKA directory and re-start 'coconut'. The option
COAST_USER_LIB will now be visible. Please select it, copile CORSIKA
and start the executable. In the generated console output you will the
statements from your COAST library during Init and Close of the
simulation.
Add any kind of code now working on the CParticle or
CInteraction class to start using the full power of COAST.
Note: the default COASTProcess just prints out tons of ASCII. This is
not very useful, don't run a full MC with this...
Step 5:
-------
enjoy...
# Collaboration agreement
The CORSIKA project very much welcomes all collaboration and
contributions. The aim of the CORSIKA project is to create a
scientific software framework as a fundamental tool for research. The
collaboration agreement and the licensing model are based on the
guidelines layed out by HSF
[[1]](https://hepsoftwarefoundation.org/activities/licensing.html) or
CERN
[[2]](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=2ahUKEwiLqKG00dXdAhUOZFAKHdIwAh4QFjAAegQIARAC&url=https%3A%2F%2Findico.cern.ch%2Fcategory%2F4251%2Fattachments%2F101%2F505%2FOSL-2012-01-Open_Source_Licences_at_CERN-Short_version.pdf&usg=AOvVaw1n4S0PQCSeE6wbdfdhKDqF),
[[3]](http://legal.web.cern.ch/licensing/software), and follow the
examples of other big scientific software projects.
The CORSIKA project consists of the contributions from the scientific
community and individuals in a best effort to deliver the best
possible performance and physics output.
The MCnet guidelines developed by [www.montecarlonet.org](www.montecarlonet.org)
are copied in [MCNET_GUIDELINES](MCNET_GUIDELINES) -- they provide a very good
additional scope that contributors should read and consider.
All possible
liability and licensing question are only handled by the adopted
software license.
## The software license of the CORSIKA project
The license adopted for the CORSIKA project is the explicit copyleft
license GPLv3, as copied in full in the file
[LICENSE](LICENSE). Each source file of the CORSIKA project contains a
short statement of the copyright and this license. Each binary or
source code release of CORSIKA contains the file LICENSE. The
code, documentation and content in the folder [ThirdParty](ThirdParty)
is not integral part of the CORSIKA project and can be based on, or
include, other licenses, which must be compatible with GPLv3. Check the
content of this folder for details and additional license information. It depends on the configuration of
the build system to what extend this code is used to build CORSIKA.
## Contributing
If you want to contribute, you need to read
[the GUIDELINES](CONTRIBUTING.md) and comply with these rules, or help to
improve them.
## The CORSIKA Projects Maintainers
The CORSIKA Project mainters make all decisions for the CORSIKA
Project. They can also change the
[COLLABORATION\_AGREEMENT](COLLABORATION\_AGREEMENT.md), the
[GUIDELINES](CONTRIBUTING.md) or any other structure or document relevant for the CORSIKA Project.
The current CORSIKA Project maintainers are listed in the file [MAINTAINERS](MAINTAINERS.md).
and can be contacted via corsika-project@lists.kit.edu. The chair
person of the CORSIKA Project is Ralf Ulrich (KIT). Maintainers have special
responsibilities for specific parts of the project.
### Planning and performing releases
The CORSIKA maintainers decide on releases of the software, and about the content of it.
# Guidelines for code development, structure, formating etc.
The CORSIKA Project very much welcomes contributions. Here we outlined
The CORSIKA Project very much welcomes contributions. Here we outline
how you can find the right place to contribute, and how to do that.
Connect to https://gitlab.ikp.kit.edu and corsika-devel@lists.kit.edu (self-register at https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in touch with the project.
The CORSIKA Project decides on the [GUIDELINES](CONTRIBUTING.md) and can decide to
Connect to https://gitlab.iap.kit.edu and corsika-devel@lists.kit.edu (self-register at https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in touch with the project.
The CORSIKA Project decides on the [contributing guidelines](CONTRIBUTING.md) and can decide to
change/improve them.
# How to contribute
- We organize all development via `Issues` that may be feature requests,
- We organize all development via gitlab `Issues` that may be feature requests,
ideas, discussions, or bugs fix requests.
- New issues can be created, or existing issues
picked up or contributed to.
......@@ -19,8 +19,8 @@ change/improve them.
created directly via the gitlab web interface.
- Proposed code to close one issue (located in a specific git
branch) is reviewed, discussed, and eventually merged
into the master branch to close the issue.
- all merge request will undergo a code review, and must be approved before merge, in order to ensure high code qualtiy: [Code Approval Procedure](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
into the master branch via a merge-request (MR) to close the issue.
- all merge request will undergo a code review, and must be approved before merge, in order to ensure high code qualtiy: [Code Approval Procedure](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
## Code formatting
......@@ -32,9 +32,9 @@ formatting. We provide a script `do-clang-format.sh`, which can be
very useful. But we urge everybody to integrate `clang-format` already
on the level of your source code editor. See [the official
page](https://clang.llvm.org/docs/ClangFormat.html) for information
about `clang-format` and its editor integration. At least: run
`do-clang-format.sh` prior to any `git add` command. Code with
improper formatting will not be accepted for merging.
about `clang-format` and its editor integrations. At least: run
`do-clang-format.sh` prior to any `git add/commit` command. Code with
improper formatting will not be accepted for merging. It will trigger automatic warnings by the continuous integration (CI) system.
The definition of source code format is written down in the file
[.clang-format](.clang-format) and can be changed, if the CORSIKA
......@@ -43,134 +43,35 @@ e.g. [link1](https://clangformat.com/) or
[link2](https://zed0.co.uk/clang-format-configurator/).
## Naming conventions
While `clang-format` does the structural formatting, we still need to agree on naming conventions:
- Classes and structs start with capital letters ```LikeThis```
- Class member variables start non-captial and have a trailing "_" ```likeThis_```
- Class member functions start with small letters ```LikeThis::doSomething(...)``` or ```LikeThis::do_something(...)```
- Any class setter begins with "set_" ```LikeThis::set_something(...)```
- Any class getter is named accoring to its property: ```LikeThis::something()```
- Logical getters may start with ```is_``` or ```has_```
- enums should be ```enum class```
- Named variables start with small letter ```likeThis```
- types in template definitions start with "T" ```TLikeThis```
- use names that explain and document the code, thus for example
```
TimeType TimeOfIntersection(Line const& line, Plane const& plane) {
auto const line_direction = line.GetDirection();
auto const plane_normal = plane.GetNormal();
return plane_normal.dot(plane.GetCenter()-line.GetPosition()) / plane_normal.dot(line_direction);
}
```
and not
```
TimeType TimeOfIntersection(Line const& l, Plane const& p) {
auto const d = p.GetCenter() - l.GetR0();
auto const v = l.GetV0();
auto const n = p.GetNormal();
auto const c = n.dot(v);
return n.dot(d) / c;
}
```
This actually is suffient to document the code, no further comments should be added in such cases. Only if further clarification is needed.
- We use namespaces to avoid clashes and to structure code
- *Everything* is part of one of those namespaces:
- ```corsika::framework```, ```corsika::physics```, or ```corsika::process```
- All classes and objects are encapsulated into suited sub-namespaces,
thus ```corsika::framework::geometry```, ```corsika::physics::process```, ```corsika::physics::units```, etc.
- Namespace names do not use capital letters.
- Every header file is located in the source tree in ```include/corsika/[namespace]```, which also means that in almost all cases each header file
can only provide definitions for a _single_ namespace. It is one
main purpose of namespaces to structure the location of header
files.
- Each header file uses an include protection ```#pragma once```
immediately below the copyright statement.
- Header files should always be included with `<..>`, thus,
`#include <corsika/geometry/Point.h>` since the build system
will always provide the correct include directives (and files
anyway cannot be found in file-system paths, which generally do
not follow the namespace naming conventions outlined
here).
- Header files are named after the main class (or object) they
define. This also means each header file name starts with a
capital letter.
## Coding rules
- Warnings should be fixed, when they appear on the system(s) currently used by the CI, by altering the code unless the warning originates from third-party code and cannot be fixed. In that case, the warning should be locally silenced with appropriate pragmas or by locally turning off warnings for that translation unit.
- All unit tests must succeed on the specified systems/configurations on gitlab-ci. If tests fail, code is not merged.
- The unit test code coverage should not decrease due to a new merge request.
- We use C++17 features wherever useful and helpful.
- On any major error or malfunction we throw an exception. This is needed and required for complex physics and shower debugging.
- We never catch exceptions for error handling, there might be very few special exceptions from this. We need to discuss such cases.
- Everything that should not change should be ```const```
- Everything that does not need to be visible to the outside of a class/struct should be `private` or `protected`
- We prefer the use of references, wherever useful
- There cannot be any raw pointer in the interface of any class or object
exposed to outside users, there might be (technical) raw pointers for very special cases
inside of classes.
- (member)functions that do something (are not just getters/setters), model actions or transformations, and should therefore be verbs. Classes are nouns.
- When you contribute new code, or extend existing code, at the same time provide unit-tests for all functionality.
- When you contribute new physics algorithms, in addition you also need to provide a validation module (this is still TBD what exactly this means)
- Code must be documented with `doxygen` commands extensively -> MAKE THIS INVESTMENT OF YOUR TIME EARLY, IT REALLY HELPS
- There should not be any useless comments in code, in particular absolutely avoid to commit commented-out debug remnants
- Add sufficient and meaningful comments to the code (only in English)
## CMAKE formatting
- command are lower cases, e.g. ```set (...)```
- variables upper case, e.g. ```set (VAR1 Text)```
Since cmake itself lacks structure almost entirely:
- put a space between command and start of parenthesis, e.g. ```command (...)```
- add two spaces for logical indent
```
if (condition)
do something
endif (condition)
```
- break long lines to start with new keyword in new line (indented)
```
install (
FILES ${CORSIKAstackinterface_HEADERS}
DESTINATION include/${CORSIKAstackinterface_NAMESPACE}
)
```
- add plenty of comments to all cmake code
- use expressive variables and functions
## Coding rules, conventions and guidelines
Please read the [Coding wiki page](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Coding-Conventions-and-Guidelines).
## Release versioning scheme
Releases of CORSIKA are thought to be the baseline for larger scale
testing, and full production. The releases are numbered as x.y.z,
starting with x=8 form the gitlab c++ version. X will only be
incremented for major design or physics changes. The y index is
updated for new official releases that normally contain improved or
enhanced physics performance, and may also contain normal interface
changes to accomodate improvements. The z index can be updated more
Releases of CORSIKA 8 are thought to be the baseline for larger scale
validation, and full production. The releases are numbered as CORSIKA 8 vx.y.z,
starting with x=1. The x index is updated for new releases that normally contain improved or
enhanced physics performance, and also interface
changes to accomodate improvements. The y and z indices can be updated more
frequently for bug fixes or new features. Changes in z will not
contain (major) interface changes, thus, production code will remain
fully compatible within changes of z. Special releases of CORSIKA can
also have a tag name from git, e.g. as in the "milestone1" release.
contain interface changes, thus, production code will remain
fully compatible within changes of z. Special releases of CORSIKA might
also have a release name.
# How to become scientific author of the CORSIKA Project
The CORSIKA Project decides on who becomes scientific author. The
following conditions are clearly sufficient, but not all of them are
following conditions are sufficient, but not all of them are
required all the time:
- responsibility for a particular functionality or software/management part
- have read and follow these [GUIDELINES](CONTRIBUTING.md)
- have read and follow our [contributing guidelines](CONTRIBUTING.md)
- active in the CORSIKA Project, that means responsive to
discussions and problems in corsika-devel@list.kit.edu or on https//gitlab.ikp.kit.edu,
of relevant *Issues*,
or in (phone) meetings
- agreement to the [COLLABORATION_AGREEMENT](COLLABORATION_AGREEMENT.md) is strictly required
- the members of the CORSIKA Project panel agree
discussions and problems in corsika-devel@list.kit.edu or on https//gitlab.iap.kit.edu,
of relevant *Issues*, in (phone) meetings or our Mattermost workspace
- agreement to the [using and collaborating agreement](USING_COLLABORATING.md)
- the members of the CORSIKA Project must agree
Subproject commit 150c0b40b0fe4c44117d064f8184de864d4a958a
add_subdirectory (Doxygen)
add_subdirectory (Examples)