From ab5a6fa0d00cb1316dd7c98dd0d01ec6e9059434 Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de> Date: Mon, 15 Jun 2020 12:14:48 +0200 Subject: [PATCH] start --- Processes/CONEXSourceCut/CMakeLists.txt | 67 ++++++++++++++++++++++ Processes/CONEXSourceCut/CONEX.h | 10 ++++ Processes/CONEXSourceCut/CONEXSourceCut.cc | 46 +++++++++++++++ Processes/CONEXSourceCut/CONEXSourceCut.h | 36 ++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 Processes/CONEXSourceCut/CMakeLists.txt create mode 100644 Processes/CONEXSourceCut/CONEX.h create mode 100644 Processes/CONEXSourceCut/CONEXSourceCut.cc create mode 100644 Processes/CONEXSourceCut/CONEXSourceCut.h diff --git a/Processes/CONEXSourceCut/CMakeLists.txt b/Processes/CONEXSourceCut/CMakeLists.txt new file mode 100644 index 000000000..f0afca985 --- /dev/null +++ b/Processes/CONEXSourceCut/CMakeLists.txt @@ -0,0 +1,67 @@ +set ( + MODEL_SOURCES + CONEXSourceCut.cc +) + +set ( + MODEL_HEADERS + CONEXSourceCut.h + ) + +set ( + MODEL_NAMESPACE + corsika/process/conex_source_cut + ) + +add_library (ProcessCONEXSourceCut STATIC ${MODEL_SOURCES}) +CORSIKA_COPY_HEADERS_TO_NAMESPACE (ProcessCONEXSourceCut ${MODEL_NAMESPACE} ${MODEL_HEADERS}) + +set_target_properties ( + ProcessCONEXSourceCut + PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION 1 +# PUBLIC_HEADER "${MODEL_HEADERS}" + ) + +# target dependencies on other libraries (also the header onlys) +target_link_libraries ( + ProcessCONEXSourceCut + CORSIKAunits + CORSIKAparticles + CORSIKAprocesssequence + CORSIKAsetup + ) + +target_include_directories ( + ProcessCONEXSourceCut + INTERFACE + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include> + $<INSTALL_INTERFACE:include/include> + ) + +install ( + TARGETS ProcessCONEXSourceCut + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +# PUBLIC_HEADER DESTINATION include/${MODEL_NAMESPACE} + ) + +# -------------------- +# code unit testing +# CORSIKA_ADD_TEST(testCONEXSourceCut SOURCES +# testCONEXSourceCut.cc +# ${MODEL_HEADERS} +# ) +# +# target_link_libraries ( +# testCONEXSourceCut +# ProcessCONEXSourceCut +# CORSIKAunits +# CORSIKAstackinterface +# CORSIKAprocesssequence +# CORSIKAsetup +# CORSIKAgeometry +# CORSIKAenvironment +# CORSIKAtesting +# ) diff --git a/Processes/CONEXSourceCut/CONEX.h b/Processes/CONEXSourceCut/CONEX.h new file mode 100644 index 000000000..b152b2298 --- /dev/null +++ b/Processes/CONEXSourceCut/CONEX.h @@ -0,0 +1,10 @@ +#pragma once +#include <array> + +extern "C" { +int InitialParticle_(int const&); + +struct cxoptl_ { + std::array<double, 16> dptl; +}; +} diff --git a/Processes/CONEXSourceCut/CONEXSourceCut.cc b/Processes/CONEXSourceCut/CONEXSourceCut.cc new file mode 100644 index 000000000..d82ecb7ea --- /dev/null +++ b/Processes/CONEXSourceCut/CONEXSourceCut.cc @@ -0,0 +1,46 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + +#include <corsika/process/conex_source_cut/CONEXSourceCut.h> +#include <algorithm> +#include <iomanip> + +using namespace std; + +using namespace corsika::process::conex_source_cut; +using namespace corsika::units::si; +using namespace corsika::particles; +using namespace corsika::setup; + +corsika::process::EProcessReturn CONEXSourceCut::DoSecondaries( + corsika::setup::StackView& vS) { + auto p = vS.begin(); + while (p != vS.end()) { + Code const pid = p.GetPID(); + HEPEnergyType const energy = p.GetEnergy(); + + if (std::find(em_codes_.cbegin(), em_codes_.cend(), pid) != em_codes_.cend()) { + std::cout << "CONEXSourceCut: removing " << pid << " " << std::scientific << energy + << std::endl; + + p.Delete(); + } + + else { + ++p; + } + } + + return corsika::process::EProcessReturn::eOk; +} + +void CONEXSourceCut::Init() {} + +CONEXSourceCut::CONEXSourceCut() {} diff --git a/Processes/CONEXSourceCut/CONEXSourceCut.h b/Processes/CONEXSourceCut/CONEXSourceCut.h new file mode 100644 index 000000000..037451bb3 --- /dev/null +++ b/Processes/CONEXSourceCut/CONEXSourceCut.h @@ -0,0 +1,36 @@ +/* + * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + +#ifndef _corsika_process_particle_cut_CONEXSourceCut_h_ +#define _corsika_process_particle_cut_CONEXSourceCut_h_ + +#include <corsika/particles/ParticleProperties.h> +#include <corsika/process/SecondariesProcess.h> +#include <corsika/setup/SetupStack.h> +#include <corsika/units/PhysicalUnits.h> + +namespace corsika::process { + namespace conex_source_cut { + class CONEXSourceCut : public process::SecondariesProcess<CONEXSourceCut> { + + public: + CONEXSourceCut(); + corsika::process::EProcessReturn DoSecondaries(corsika::setup::StackView&); + + void Init(); + + private: + static std::array<particles::Code, 3> constexpr em_codes_{ + particles::Code::Gamma, particles::Code::Electron, particles::Code::Positron}; + }; + } // namespace conex_source_cut +} // namespace corsika::process + +#endif -- GitLab