IAP GITLAB

Skip to content
Snippets Groups Projects
Commit a7ac24f5 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

first try

parent e1a332f3
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ endif (PYTHIA8_FOUND)
add_subdirectory (HadronicElasticModel)
add_subdirectory (UrQMD)
add_subdirectory (SwitchProcess)
add_subdirectory (VerySimpleModel)
# continuous physics
add_subdirectory (EnergyLoss)
......@@ -34,3 +35,4 @@ add_dependencies(CORSIKAprocesses ProcessTrackingLine)
add_dependencies(CORSIKAprocesses ProcessEnergyLoss)
add_dependencies(CORSIKAprocesses ProcessUrQMD)
add_dependencies(CORSIKAprocesses ProcessParticleCut)
add_dependencies(CORSIKAprocesses ProcessVerySimpleModel)
set (
MODEL_SOURCES
VerySimpleModel.cc
)
set (
MODEL_HEADERS
VerySimpleModel.h
)
set (
MODEL_NAMESPACE
corsika/process/very_simple_model
)
add_library (ProcessVerySimpleModel STATIC ${MODEL_SOURCES})
CORSIKA_COPY_HEADERS_TO_NAMESPACE (ProcessVerySimpleModel ${MODEL_NAMESPACE} ${MODEL_HEADERS})
set_target_properties (
ProcessVerySimpleModel
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
# PUBLIC_HEADER "${MODEL_HEADERS}"
)
# target dependencies on other libraries (also the header onlys)
target_link_libraries (
ProcessVerySimpleModel
CORSIKAunits
CORSIKAgeometry
CORSIKAsetup
)
target_include_directories (
ProcessVerySimpleModel
INTERFACE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/include>
)
install (
TARGETS ProcessVerySimpleModel
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
# PUBLIC_HEADER DESTINATION include/${MODEL_NAMESPACE}
)
# --------------------
# code unit testing
#~ CORSIKA_ADD_TEST (testProcessVerySimpleModel)
#~ target_link_libraries (
#~ testProcessVerySimpleModel
#~ ProcessVerySimpleModel
#~ CORSIKAsetup
#~ CORSIKAgeometry
#~ CORSIKAunits
#~ CORSIKAtesting
#~ )
/*
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <corsika/process/very_simple_model/VerySimpleModel.h>
#include <corsika/setup/SetupStack.h>
#include <corsika/setup/SetupTrajectory.h>
#include <tuple>
using namespace corsika;
using namespace corsika::units::si;
using namespace corsika::process::very_simple_model;
using SetupParticle = corsika::setup::Stack::StackIterator;
using SetupProjectile = corsika::setup::StackView::StackIterator;
void VerySimpleModel::Init() {}
VerySimpleModel::VerySimpleModel() {}
template <>
process::EProcessReturn VerySimpleModel::DoInteraction(SetupProjectile& vP) {
const auto projectileID = vP.GetPID();
auto const posOrig = vP.GetPosition();
auto const tOrig = vP.GetTime();
auto const eProjectileLab = vP.GetEnergy();
auto const pProjectileLab = vP.GetMomentum();
const auto* currentNode = vP.GetNode();
const auto& mediumComposition =
currentNode->GetModelProperties().GetNuclearComposition();
// get cross sections for target materials
auto const& compVec = mediumComposition.GetComponents();
std::vector<units::si::CrossSectionType> cross_section_of_components(compVec.size());
for (size_t i = 0; i < compVec.size(); ++i) {
cross_section_of_components[i] = GetCrossSection(projectileID, compVec[i]);
}
const auto corsikaTargetId =
mediumComposition.SampleTarget(cross_section_of_components, fRNG);
// add secondaries to corsika stack
auto const sec1Code = particles::Code::MuPlus;
auto const sec1E = eProjectileLab;
auto const sec1P = pProjectileLab;
auto secondary1 = vP.AddSecondary(
std::tuple<particles::Code, units::si::HEPEnergyType, stack::MomentumVector,
geometry::Point, units::si::TimeType>(sec1Code, sec1E, sec1P, posOrig,
tOrig));
auto const sec2Code = particles::Code::MuMinus;
auto const sec2E = eProjectileLab;
auto const sec2P = pProjectileLab;
auto secondary2 = vP.AddSecondary(
std::tuple<particles::Code, units::si::HEPEnergyType, stack::MomentumVector,
geometry::Point, units::si::TimeType>(sec2Code, sec2E, sec2E, posOrig,
tOrig));
return process::EProcessReturn::eOk;
}
template <>
corsika::units::si::CrossSectionType GetCrossSection(SetupParticle const& vProjectile,
particles::Code vTargetCode) {
if (vProjectile.GetPID() == particles::MuPlus) {
return 20_mb;
} else if (vProjectile.GetPID() == particles::MuMinus) {
return 10_mb;
} else {
return 0_mb;
}
}
template <>
corsika::units::si::GrammageType GetInteractionLength(Projectile const& vP) {
auto const* currentNode = vP.GetNode();
const auto& mediumComposition =
currentNode->GetModelProperties().GetNuclearComposition();
si::CrossSectionType weightedProdCrossSection = mediumComposition.WeightedSum(
[=](particles::Code targetID) -> si::CrossSectionType {
return this->GetCrossSection(corsikaBeamId, targetID);
});
GrammageType const int_length = mediumComposition.GetAverageMassNumber() *
units::constants::u / weightedProdCrossSection;
return int_length;
}
/*
* (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 GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _Physics_VerySimpleModel_h_
#define _Physics_VerySimpleModel_h_
#include <corsika/particles/ParticleProperties.h>
#include <corsika/process/InteractionProcess.h>
#include <corsika/units/PhysicalUnits.h>
#include <corsika/random/RNGManager.h>
namespace corsika::process::very_simple_model {
class VerySimpleModel : public corsika::process::InteractionProcess<VerySimpleModel> {
corsika::random::RNG& fRNG =
corsika::random::RNGManager::GetInstance().GetRandomStream("VerySimpleModel");
public:
VerySimpleModel();
void Init();
template <typename TParticle>
corsika::units::si::CrossSectionType GetCrossSection(TParticle const&,
particles::Code);
template <typename TParticle>
corsika::units::si::GrammageType GetInteractionLength(TParticle const&);
template <typename TProjectile>
corsika::process::EProcessReturn DoInteraction(TProjectile&);
};
} // namespace corsika::process::very_simple_model
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment