diff --git a/CMakeLists.txt b/CMakeLists.txt index fba2a28df2e7df36332c526dc23d569acd371e97..4f18d46bf23199b5d4d3bcc34d80735eea190570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,7 +343,7 @@ install (DIRECTORY examples DESTINATION share/corsika) # # tools # -install (DIRECTORY tools DESTINATION share/corsika) +add_subdirectory (tools) diff --git a/COLLABORATION_AGREEMENT.md b/COLLABORATION_AGREEMENT.md index ea9ed3634e0dd71c403ef0025ff6ad86bff94821..9b240a03e91b69d84a368cd569f7db7534e7b528 100644 --- a/COLLABORATION_AGREEMENT.md +++ b/COLLABORATION_AGREEMENT.md @@ -18,9 +18,6 @@ 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 @@ -29,10 +26,18 @@ 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 [externals](externals) +code, documentation and content in the folder [./externals](./externals) 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 +include, other licenses, which must be compatible with GPLv3. + +The folder [./modules](./modules) contains the code of several +external physics models for your convenience. Please consult the +original model authors and honor their policies and licenses. +Of course, we have their consent to +distribute their code together with CORSIKA 8. + +Check the content of these folders carefully 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. @@ -42,22 +47,3 @@ 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. - - diff --git a/README.md b/README.md index a66a44dc6f2a5c87b4ddb357605c77e0130ecea6..1b7175d3d817d0237244d83cc079f8f7a8c823d0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ particle cascades with stochastic and continuous processes. The software makes extensive use of static design patterns and compiler optimization. Thus, the most fundamental configuration decision of the user must be performed at compile time. At run time -only specific model parameters can still be changed. +model parameters can still be changed. CORSIKA 8 is by default released under the GPLv3 license. See [license file](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/LICENSE) @@ -30,58 +30,72 @@ When you plan to contribute to CORSIKA 8 check the guidelines outlined here: guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/CONTRIBUTING.md). Code that fails the review by the CORSIKA author group must be improved before it can be merged in the official code base. After your code has -been accepted and merged you become a contributor of the CORSIKA 8 +been accepted and merged, you become a contributor of the CORSIKA 8 project (code author). IMPORTANT: Before you contribute, you need to read and agree to the [collaboration -agreement](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/COLLABORATION_AGREEMENT.md). The -agreement can be discussed, and eventually improved. +agreement](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/COLLABORATION_AGREEMENT.md). The agreement can be discussed, and eventually improved. We also want to point you to the [MCnet -guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/MCNET_GUIDELINES), -which are very useful also for us. +guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/MCNET_GUIDELINES), which are very useful also for us. ## Get in contact - * Connect to https://gitlab.ikp.kit.edu register yourself and join the "Air Shower Physics" group + * Connect to https://gitlab.ikp.kit.edu register yourself and join the "Air Shower Physics" group. Write to me (ralf.ulrich@kit.edu) only in case there are problems with that. * Connect to corsika-devel@lists.kit.edu (self-register at https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in - touch with the project + touch with the project. + + * Register on the corsika slack channel. +## Installation -CORSIKA 8 is tested regularly at least on gcc7.3.0 and clang-8.0.0. You will -also need: +CORSIKA 8 is tested regularly at least on gcc7.3.0 and clang-8.0.0. -- Python 3 (supported versions are Python >= 3.6) +### Prerequisites + +You will also need: + +- Python 3 (supported versions are Python >= 3.6), with pip +- conan (via pip) - cmake - git +- g++, gfortran, binutils, make + +On a bare Ubuntu 20.04, just add: +``` shell +sudo apt-get install python3 python3-pip cmake g++ gfortran git doxygen graphviz +``` -On a bare Ubuntu 18.04, just add: +On a bare CentOS 7 install python3, pip3 (pip from python3) and cmake3. Any of the devtools 7, 8, 9 should work (at least). +Also initialize devtools, before building CORSIKA 8: ``` shell -sudo apt-get install cmake g++ git +source /opt/rh/devtoolset-9/enable ``` -CORSIKA 8 uses the [conan](https://conan.io/) package manager to manage our -dependencies. If you do not have Conan installed, it can be installed with: +CORSIKA 8 uses the [conan](https://conan.io/) package manager to +manage our dependencies. If you do not have Conan installed, it can be +installed with: ``` shell pip install --user conan ``` +### Compiling + Once Conan is installed, follow these steps to download and install CORSIKA 8: + ``` shell git clone --recursive git@gitlab.ikp.kit.edu:AirShowerPhysics/corsika.git -cd corsika -mkdir ../corsika-build -cd ../corsika-build +mkdir corsika-build +cd corsika-build cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install make -j8 make install ``` -Type `make test` to run the unit test suite. ## Installation (using docker containers) @@ -94,53 +108,81 @@ You only need docker, e.g. on Ubunut: `sudo apt-get install docker` and of cours ## Compiling Follow these steps to download and install CORSIKA 8, master development version -``` +```shell git clone --recursive https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika.git -cd corsika sudo docker run -v $PWD:/corsika -it corsika/devel:clang-8 /bin/bash mkdir build cd build -cmake .. -DCMAKE_INSTALL_PREFIX=../install +cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install make -j8 make install ``` -Type `make test` to run the unit test suite. +## Runing Unit Tests -### Running examples +Note, before you run *any* executbale you must also define the +`CORSIKA_DATA` environment variable to point to the location where you +cloned corsika `modules/data`, thus typically +```shell +export CORSIKA_DATA=$PWD/../corsika/modules/data +``` + +To run the Unit Tests, just type `ctest` in your build area. + + +## Running examples + +To see how a relatively simple hadron cascade develops, +see `examples/cascade_example.cpp` for a starting point. -and if you want to see how the first simple hadron cascade develops, see `Documentation/Examples/cascade_example.cc` for a starting point. +To run the cascade_example, or any other CORSIKA 8 application, you +must first compile it wrt. to the CORSIKA 8 header-only framework. This +can be done best by copying +e.g. `corsika-install/share/corsika/examples/` to your working place +(e.g. `corsika-work`). -Run the cascade_example with: +Next, you need to define the environment variable `corsika_DIR` to point to, either, +your build, or your install area. Thus, e.g. +```shell +export corsika_DIR=<dir where you installed CORSIKA 8 to, or where you buld it"> ``` -cd ../corsika-install -share/examples/cascade_example + +Then compile your example/application with +```shell +cd corsika-work +cmake . +make +bin/cascade_example ``` Visualize output (needs gnuplot installed): -``` -bash share/tools/plot_tracks.sh tracks.dat +```shell +bash $corsika_DIR/share/corsika/tools/plot_tracks.sh tracks.dat firefox tracks.dat.gif ``` +(note, if you use the corsika_DIR to point to the build area: the script `plot_tracks.sh` is +not copied to the build area, it is only part of the source tree at `tools/plot_tracks.sh`) -Or also consider the `vertical_EAS` example in the same directory, which can -be configured with command line options. +Or also consider the `vertical_EAS` example in the same directory, +which can be configured with command line options. +Run `bin/vertical_EAS` to get basic help. ### Generating doxygen documentation -To generate the documentation, you need doxygen and graphviz. If you work with the docker corsika/devel containers this is already included. +To generate the documentation, you need doxygen and graphviz. If you work with +the docker corsika/devel containers this is already included. Otherwise, e.g. on Ubuntu 18.04, do: -``` +```shell sudo apt-get install doxygen graphviz ``` Switch to the corsika build directory and do -``` +```shell make doxygen make install ``` -browse with firefox: -``` -firefox ../corsika-install/share/doc/html/index.html +open with firefox: +```shell +firefox ../corsika-install/share/corsika/doc/html/index.html ``` diff --git a/cmake/FindCORSIKA.cmake b/cmake/FindCORSIKA.cmake deleted file mode 100644 index 5a18d9772d405ba09479ede5c6c8f6b69d6d37ad..0000000000000000000000000000000000000000 --- a/cmake/FindCORSIKA.cmake +++ /dev/null @@ -1,6 +0,0 @@ - -add_library(CORSIKA INTERFACE) - -target_compile_coptions(CORSIKA - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/cmake/FindCORSIKA8.cmake b/cmake/FindCORSIKA8.cmake deleted file mode 100644 index 39f936323ef79cb71ab0843ea41c7c85eca66526..0000000000000000000000000000000000000000 --- a/cmake/FindCORSIKA8.cmake +++ /dev/null @@ -1,9 +0,0 @@ -add_library (CORSIKA8 INTERFACE) - -target_include_directories (CORSIKA8 - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - -target_link_libraries (CORSIKA8 INTERFACE PhysUnits) - -set (CORSIKA8_FOUND TRUE) diff --git a/cmake/FindCorsika8.cmake b/cmake/FindCorsika8.cmake deleted file mode 100644 index 1a8549ce0c9170c05ef3d4bdce60150de486ee97..0000000000000000000000000000000000000000 --- a/cmake/FindCorsika8.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# -# FindCorsika8 -# -# This module tries to find the Corsika8 header files and extrats their version. It -# sets the following variables. -# -# CORSIKA8_FOUND - Set ON if Corsika8 headers are found, otherwise OFF. -# -# CORSIKA8_INCLUDE_DIR - Include directory for hydra header files. (All header -# files will actually be in the Corsika8 subdirectory.) -# CORSIKA8_VERSION - Version of hydra in the form "major.minor.patch". -# - -find_path( CORSIKA8_INCLUDE_DIR - PATHS - ${CMAKE_SOURCE_DIR} - /usr/include - /usr/local/include - ${CORSIKA8_DIR} - NAMES corsika/corsika.h - DOC "Corsika8 headers" - ) - - -if( CORSIKA8_INCLUDE_DIR ) - list( REMOVE_DUPLICATES CORSIKA8_INCLUDE_DIR ) -endif( CORSIKA8_INCLUDE_DIR ) - -# Find hydra version -if (CORSIKA8_INCLUDE_DIR) - file( STRINGS ${CORSIKA_INCLUDE_DIR}/corsika/corsika.h - version - REGEX "#define CORSIKA_VERSION[ \t]+([0-9x]+)" - ) - string( REGEX REPLACE - "#define CORSIKA_VERSION[ \t]+" - "" - version - "${version}" - ) - - string( REGEX MATCH "^[0-9]" major ${version} ) - string( REGEX REPLACE "^${major}00" "" version "${version}" ) - string( REGEX MATCH "^[0-9]" minor ${version} ) - string( REGEX REPLACE "^${minor}0" "" version "${version}" ) - set( CORSIKA_VERSION "${major}.${minor}.${version}") - set( CORSIKA_MAJOR_VERSION "${major}") - set( CORSIKA_MINOR_VERSION "${minor}") -endif() - -# Check for required components -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( Corsika8 - FOUND_VAR CORSIKA8_FOUND - REQUIRED_VARS CORSIKA8_INCLUDE_DIR - VERSION_VAR CORSIKA8_VERSION - ) - -if(CORSIKA8_FOUND) - set(CORSIKA8_INCLUDE_DIRS ${CORSIKA8_INCLUDE_DIR}) -endif() - -mark_as_advanced(CORSIKA8_INCLUDE_DIR) diff --git a/examples/cascade_example.cpp b/examples/cascade_example.cpp index 91bc3f7cc99640a10e067da3360eee6e50911020..eb0938d9fe08e93ac3a3f9d972362d9c58a0ef48 100644 --- a/examples/cascade_example.cpp +++ b/examples/cascade_example.cpp @@ -54,7 +54,6 @@ using namespace std; // int main() { - // logging::set_level(logging::level::info); corsika_logger->set_pattern("[%n:%^%-8l%$] custom pattern: %v"); logging::set_level(logging::level::trace); diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..02b0ff18968a2d183acb2ee96f32a683bc941dd4 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,7 @@ +set (scripts + plot_crossings.sh + plot_tracks.sh + read_hist.py + ) + +install (PROGRAMS ${scripts} DESTINATION share/corsika/tools)