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 936 additions and 0 deletions
/*
* (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.
*/
#pragma once
#include <corsika/media/IRefractiveIndexModel.hpp>
namespace corsika {
/**
* A uniform refractive index.
*
* This class returns the same refractive index
* for all evaluated locations.
*/
template <typename T>
class UniformRefractiveIndex : public T {
double n_; ///< The constant refractive index that we use.
public:
/**
* Construct a UniformRefractiveIndex.
*
* This is initialized with a fixed refractive index
* and returns this refractive index at all locations.
*
* @param n The refractive index to return everywhere.
*/
template <typename... Args>
UniformRefractiveIndex(double const n, Args&&... args);
/**
* Evaluate the refractive index at a given location. Note: since this
* is *uniform* model, it has no position-dependence.
*
* @param point The location to evaluate at (not used internally).
* @returns The refractive index at this point.
*/
double getRefractiveIndex(Point const& point) const override;
/**
* Set the refractive index returned by this instance.
*
* @param n The global refractive index.
*/
void setRefractiveIndex(double const n);
}; // END: class RefractiveIndex
} // namespace corsika
#include <corsika/detail/media/UniformRefractiveIndex.inl>
/*
* (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.
*/
#pragma once
#include <corsika/framework/geometry/Sphere.hpp>
#include <limits>
namespace corsika {
struct Universe : public corsika::Sphere {
Universe(corsika::CoordinateSystemPtr const& pCS);
bool contains(corsika::Point const&) const override;
};
} // namespace corsika
#include <corsika/detail/media/Universe.inl>
/*
* (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.
*/
#pragma once
#include <corsika/framework/geometry/IVolume.hpp>
#include <corsika/media/IEmpty.hpp>
#include <memory>
#include <vector>
namespace corsika {
template <typename TModelProperties = IEmpty>
class VolumeTreeNode {
public:
using IModelProperties = TModelProperties;
using VTN_type = VolumeTreeNode<IModelProperties>;
using VTNUPtr = std::unique_ptr<VTN_type>;
using IMPSharedPtr = std::shared_ptr<IModelProperties>;
using VolUPtr = std::unique_ptr<IVolume>;
VolumeTreeNode(VolUPtr pVolume = nullptr)
: geoVolume_(std::move(pVolume)) {}
//! convenience function equivalent to Volume::isInside
bool contains(Point const& p) const;
VTN_type const* excludes(Point const& p) const;
/** returns a pointer to the sub-VolumeTreeNode which is "responsible" for the given
* \class Point \p p, or nullptr iff \p p is not contained in this volume.
*/
VolumeTreeNode<IModelProperties> const* getContainingNode(Point const& p) const;
VolumeTreeNode<IModelProperties>* getContainingNode(Point const& p);
/**
* Traverses the VolumeTree pre- or post-order and calls the functor \p func for each
* node. \p func takes a reference to VolumeTreeNode as argument. The return value \p
* func is ignored.
*/
template <typename TCallable, bool preorder = true>
void walk(TCallable func) const;
void addChild(VTNUPtr pChild);
/**
* Adds a child to the node containing \p using the same logic as getContainingNode
*/
void addChildToContainingNode(Point const& p, VTNUPtr pChild);
void excludeOverlapWith(VTNUPtr const& pNode);
VTN_type const* getParent() const { return parentNode_; };
auto const& getChildNodes() const { return childNodes_; }
auto const& getExcludedNodes() const { return excludedNodes_; }
auto const& getVolume() const { return *geoVolume_; }
auto const& getModelProperties() const { return *modelProperties_; }
bool hasModelProperties() const { return modelProperties_.get() != nullptr; }
template <typename ModelProperties, typename... Args>
auto setModelProperties(Args&&... args) {
// static_assert(std::is_base_of_v<IModelProperties, ModelProperties>,
// "unusable type provided");
modelProperties_ = std::make_shared<ModelProperties>(std::forward<Args>(args)...);
return modelProperties_;
}
void setModelProperties(IMPSharedPtr ptr) { modelProperties_ = ptr; }
// template <class MediumType, typename... Args>
// static auto createMedium(Args&&... args);
private:
std::vector<VTNUPtr> childNodes_;
std::vector<VTN_type const*> excludedNodes_;
VTN_type const* parentNode_ = nullptr;
VolUPtr geoVolume_;
IMPSharedPtr modelProperties_;
};
} // namespace corsika
#include <corsika/detail/media/VolumeTreeNode.inl>
/*
* (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.
*/
#pragma once
#include <corsika/modules/energy_loss/BetheBlochPDG.hpp>
/*
* (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.
*/
#pragma once
#include <corsika/modules/conex/CONEXhybrid.hpp>
/*
* (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.
*/
#pragma once
#include <corsika/modules/epos/ParticleConversion.hpp>
#include <corsika/modules/epos/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/**
* @file Epos.hpp
*
* Includes all the parts of the EPOS model. Defines the InteractionProcess<TModel>
* classes needed for the ProcessSequence.
*/
namespace corsika::epos {
/**
* epos::Interaction is the process for ProcessSequence.
*
* The epos::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
class Interaction : public InteractionModel, public InteractionProcess<Interaction> {
public:
Interaction(std::set<Code> const& stableList)
: InteractionModel{stableList} {};
};
} // namespace corsika::epos
/*
* (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.
*/
#pragma once
#include <corsika/modules/fluka/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/**
* @file FLUKA.hpp
*
* Includes all the parts of the FLUKA model. Defines the InteractionProcess<TModel>
* classes needed for the ProcessSequence.
*/
namespace corsika::fluka {
/**
* fluka::Interaction is the process for ProcessSequence.
*
* The fluka::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
class Interaction : public fluka::InteractionModel,
public corsika::InteractionProcess<Interaction> {
public:
template <typename TEnvironment>
Interaction(TEnvironment const& env)
: fluka::InteractionModel{env} {}
};
} // namespace corsika::fluka
/*
* (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.
*/
#pragma once
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/random/RNGManager.hpp>
#include <corsika/framework/core/PhysicalConstants.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
namespace corsika {
/**
* A simple model for elastic hadronic interactions based on the formulas
* in Gaisser, Engel, Resconi, Cosmic Rays and Particle Physics (Cambridge Univ. Press,
* 2016), section 4.2 and Donnachie, Landshoff, Phys. Lett. B 296, 227 (1992)
*
* Currently only \f$p\f$ projectiles are supported and cross-sections are assumed to be
* \f$pp\f$-like even for nuclei.
*
* \todo add unit test
*/
class HadronicElasticInteraction
: public InteractionProcess<HadronicElasticInteraction> {
private:
using SquaredHEPEnergyType = decltype(HEPEnergyType() * HEPEnergyType());
using eV2 = decltype(square(electronvolt));
using inveV2 = decltype(1 / square(electronvolt));
inveV2 B(eV2 s) const;
CrossSectionType getCrossSection(SquaredHEPEnergyType s) const;
public:
HadronicElasticInteraction( // x & y values taken from DL for pp collisions
CrossSectionType x = 0.0217 * barn, CrossSectionType y = 0.05608 * barn);
template <typename TParticle>
GrammageType getInteractionLength(TParticle const& p);
template <typename TParticle>
ProcessReturn doInteraction(TParticle&);
private:
CrossSectionType parX_, parY_;
static double constexpr gfEpsilon = 0.0808;
static double constexpr gfEta = 0.4525;
// Froissart-Martin is not violated up for sqrt s < 10^32 eV with these values [DL].
default_prng_type& RNG_ =
RNGManager<>::getInstance().getRandomStream("HadronicElasticModel");
};
} // namespace corsika
#include <corsika/detail/modules/HadronicElasticModel.inl>
/*
* (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.
*/
#pragma once
#include <corsika/media/ShowerAxis.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/core/Step.hpp>
#include <corsika/modules/writers/LongitudinalProfileWriterParquet.hpp>
#include <array>
#include <fstream>
#include <limits>
#include <string>
namespace corsika {
/**
* \class LongitudinalProfile
*
* \todo test missing
*
* is a ContinuousProcess, which is constructed from an environment::ShowerAxis
* object, and a dX in units of g/cm2 (GrammageType).
*
* LongitudinalProfile does then convert each single Track of the
* simulation into a projected grammage range and counts for
* different particle species when they cross dX (default: 10g/cm2)
* boundaries.
*/
template <typename TOutput>
class LongitudinalProfile : public ContinuousProcess<LongitudinalProfile<TOutput>>,
public TOutput {
public:
template <typename... TArgs>
LongitudinalProfile(TArgs&&... args);
template <typename TParticle>
ProcessReturn doContinuous(Step<TParticle> const&, bool);
template <typename TParticle, typename TTrack>
LengthType getMaxStepLength(TParticle const&, TTrack const&) {
return meter * std::numeric_limits<double>::infinity();
}
YAML::Node getConfig() const;
};
} // namespace corsika
#include <corsika/detail/modules/LongitudinalProfile.inl>
/*
* (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.
*/
#pragma once
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/Plane.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/modules/writers/ParticleWriterParquet.hpp>
#include <corsika/modules/writers/WriterOff.hpp>
#include <corsika/framework/core/Step.hpp>
namespace corsika {
/**
* @ingroup Modules
* @{
*
* The ObservationPlane writes PDG codes, kinetic energies, locations and momentum unit
* vectors of particles with respect to the central point of the plane into its output
* file. By default, the particles are considered "absorbed" afterwards. You can also
* set the ObservationPlane as non-absorbing.
*
* The default output format is parquet.
*
* **Note/Limitation:** as discussed in
* https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/issues/397
* you cannot put two ObservationPlanes exactly on top of each
* other. Even if one of them is "permeable". You have to put a
* small gap in between the two plane in such a scenario, or develop
* another more specialized output class.
*/
template <typename TTracking, typename TOutput = ParticleWriterParquet>
class ObservationPlane : public ContinuousProcess<ObservationPlane<TTracking, TOutput>>,
public TOutput {
using TOutput::write;
public:
/**
* Construct a new Observation Plane object.
*
* @tparam TArgs
* @param plane The plane.
* @param x_dir The x-direction/axis.
* @param absorbing Flag to make the plane absorbing.
* @param outputArgs
*/
template <typename... TArgs>
ObservationPlane(Plane const& plane, DirectionVector const& x_dir,
bool const absorbing = true, TArgs&&... outputArgs);
~ObservationPlane() {}
template <typename TParticle>
ProcessReturn doContinuous(Step<TParticle>&, bool const stepLimit);
template <typename TParticle, typename TTrajectory>
LengthType getMaxStepLength(TParticle const&, TTrajectory const& vTrajectory);
Plane getPlane() const { return plane_; }
DirectionVector getXAxis() const { return xAxis_; }
DirectionVector getYAxis() const { return yAxis_; }
YAML::Node getConfig() const;
private:
Plane const plane_;
DirectionVector const xAxis_;
DirectionVector const yAxis_;
bool const deleteOnHit_;
};
//! @}
} // namespace corsika
#include <corsika/detail/modules/ObservationPlane.inl>
/*
* (c) Copyright 2023 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.
*/
#pragma once
#include <corsika/modules/writers/ParticleWriterParquet.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/framework/core/Step.hpp>
namespace corsika {
/**
@ingroup Modules
@{
The ObservationVolume writes PDG codes, kinetic energy, position, and direction
of particles in the observation frame into its output file. The particles
are considered "absorbed" afterwards.
*/
template <typename TTracking, typename TVolume,
typename TOutputWriter = ParticleWriterParquet>
class ObservationVolume
: public ContinuousProcess<ObservationVolume<TTracking, TVolume, TOutputWriter>>,
public TOutputWriter {
public:
ObservationVolume(TVolume vol);
template <typename TParticle>
ProcessReturn doContinuous(Step<TParticle>&, bool const stepLimit);
template <typename TParticle, typename TTrajectory>
LengthType getMaxStepLength(TParticle const&, TTrajectory const& vTrajectory);
void showResults() const;
void reset();
HEPEnergyType getEnergy() const { return energy_; }
YAML::Node getConfig() const;
private:
TVolume vol_;
HEPEnergyType energy_;
unsigned int count_;
};
//! @}
} // namespace corsika
#include <corsika/detail/modules/ObservationVolume.inl>
/*
* (c) Copyright 2018 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.
*/
#pragma once
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/process/SecondariesProcess.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
namespace corsika {
class OnShellCheck : public SecondariesProcess<OnShellCheck> {
public:
OnShellCheck(const double vMassTolerance, const double vEnergyTolerance,
const bool vError);
~OnShellCheck();
template <typename TView>
void doSecondaries(TView&);
private:
// data members
double average_shift_ = 0;
double max_shift_ = 0;
double count_ = 0;
std::shared_ptr<spdlog::logger> logger_ = get_logger("corsika_OnShellCheck");
double mass_tolerance_;
double energy_tolerance_;
bool throw_error_;
};
} // namespace corsika
#include <corsika/detail/modules/OnShellCheck.inl>
/*
* (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.
*/
#pragma once
#include <corsika/modules/proposal/InteractionModel.hpp>
#include <corsika/modules/proposal/ContinuousProcess.hpp>
#include <fmt/format.h>
namespace corsika::proposal {
template <typename THadronicLEModel, typename THadronicHEModel>
class Interaction
: public InteractionModel<THadronicLEModel, THadronicHEModel>,
public InteractionProcess<Interaction<THadronicLEModel, THadronicHEModel>> {
public:
template <typename TEnvironment>
Interaction(TEnvironment const& env, THadronicLEModel& modelLE,
THadronicHEModel& modelHE, HEPEnergyType const& thr)
: InteractionModel<THadronicLEModel, THadronicHEModel>(env, modelLE, modelHE,
thr) {}
};
} // namespace corsika::proposal
//----------------------------------
// SPDLOG PROPOSAL
//----------------------------------
namespace PROPOSAL {
auto format_as(InteractionType code) { return fmt::underlying(code); }
} // namespace PROPOSAL
/*
* (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.
*/
#pragma once
#include <unordered_map>
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/process/SecondariesProcess.hpp>
#include <corsika/framework/process/ContinuousProcess.hpp>
#include <corsika/framework/core/Step.hpp>
#include <corsika/modules/writers/WriterOff.hpp>
namespace corsika {
/**
* ParticleCut process to kill particles.
*
* Goes through the secondaries of an interaction and
* removes particles according to their kinetic energy. Particles with a time delay of
* more than 10ms are removed as well. Invisible particles (neutrinos) can be removed if
* selected. The threshold value is set to 0 by default but in principle can be
* configured for each particle. Special constructors for cuts by the following groups
* are implemented: (electrons,positrons), photons, hadrons and muons.
*/
template <typename TOutput = WriterOff>
class ParticleCut : public SecondariesProcess<ParticleCut<TOutput>>,
public ContinuousProcess<ParticleCut<TOutput>>,
public TOutput {
public:
/**
* particle cut with kinetic energy thresholds for electrons, photons,
* hadrons (including nuclei with energy per nucleon) and muons
* invisible particles (neutrinos) can be cut or not.
*
* @param outputArgs - optional arguments of TOutput writer
*/
template <typename... TArgs>
ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut,
HEPEnergyType const eHadCut, HEPEnergyType const eMuCut,
HEPEnergyType const eTauCut, bool const inv, TArgs&&... args);
/**
* particle cut with kinetic energy thresholds for all particles.
*
* @param outputArgs - optional arguments of TOutput writer
*/
template <typename... TArgs>
ParticleCut(HEPEnergyType const eCut, bool const inv, TArgs&&... OutputArgs);
/**
* Threshold for specific particles redefined. EM and invisible particles can be set
* to be discarded altogether.
*
* @param outputArgs - optional arguments of TOutput writer
*/
template <typename... TArgs>
ParticleCut(std::unordered_map<Code const, HEPEnergyType const> const& eCuts,
bool const inv, TArgs&&... outputArgs);
/**
* Cut particles which are secondaries from discrete processes.
*
* @tparam TStackView
*/
template <typename TStackView>
void doSecondaries(TStackView&);
/**
* Cut particles during continuous processes (energy losses etc).
*
* @tparam TParticle
* @param step
* @param limitFlag
* @return ProcessReturn
*/
template <typename TParticle>
ProcessReturn doContinuous(
Step<TParticle>&,
const bool limitFlag = false); // this is not used for ParticleCut
/**
* Limit on continuous step length imposed by ParticleCut: none.
*
* @tparam TParticle
* @tparam TTrajectory
* @return LengthType
*/
template <typename TParticle, typename TTrajectory>
LengthType getMaxStepLength(TParticle const&, TTrajectory const&) {
return meter * std::numeric_limits<double>::infinity();
}
void printThresholds() const;
HEPEnergyType getElectronKineticECut() const { return cut_electrons_; }
HEPEnergyType getPhotonKineticECut() const { return cut_photons_; }
HEPEnergyType getMuonKineticECut() const { return cut_muons_; }
HEPEnergyType getTauKineticECut() const { return cut_tau_; }
HEPEnergyType getHadronKineticECut() const { return cut_hadrons_; }
//! get configuration of this node, for output
YAML::Node getConfig() const override;
private:
bool checkCutParticle(Code const, HEPEnergyType const, TimeType const) const;
bool isBelowEnergyCut(Code const, HEPEnergyType const) const;
private:
HEPEnergyType cut_electrons_;
HEPEnergyType cut_photons_;
HEPEnergyType cut_hadrons_;
HEPEnergyType cut_muons_;
HEPEnergyType cut_tau_;
bool doCutInv_;
std::unordered_map<Code const, HEPEnergyType const> cuts_;
}; // namespace corsika
} // namespace corsika
#include <corsika/detail/modules/ParticleCut.inl>
/*
* (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.
*/
#pragma once
#include <corsika/modules/pythia8/Decay.hpp>
#include <corsika/modules/pythia8/NeutrinoInteraction.hpp>
#include <corsika/modules/pythia8/InteractionModel.hpp>
namespace corsika::pythia8 {
/**
* pythia8::Interaction is the process for ProcessSequence.
*
* The pythia8::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
class Interaction : public InteractionModel, public InteractionProcess<Interaction> {
public:
Interaction(std::set<Code> const& stableList = {})
: InteractionModel{stableList} {};
};
} // namespace corsika::pythia8
/*
* (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.
*/
#pragma once
#include <corsika/modules/qgsjetII/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/**
* @file QGSJetII.hpp
*
* Includes all the parts of the QGSJetII model. Defines the InteractionProcess<TModel>
* classes needed for the ProcessSequence.
*/
namespace corsika::qgsjetII {
/**
* @brief qgsjetII::Interaction is the process for ProcessSequence.
*
* The qgsjetII::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
class Interaction : public InteractionModel, public InteractionProcess<Interaction> {};
} // namespace corsika::qgsjetII
/*
* (c) Copyright 2023 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.
*/
#pragma once
#include <algorithm>
#include <iterator>
#include <functional>
#include <random>
#include <string_view>
#include <corsika/framework/random/RNGManager.hpp>
namespace corsika {
using rng_function_type = std::function<void(double*, std::size_t)>;
namespace detail {
inline void rng_func(corsika::default_prng_type& rng, double* dest, std::size_t N) {
std::uniform_real_distribution<double> udist(0.0, 1.0);
std::generate(dest, std::next(dest, N), std::bind(udist, std::ref(rng)));
}
} // namespace detail
inline void connect_random_stream(corsika::default_prng_type& rng,
void (*injection_func)(rng_function_type)) {
using namespace std::placeholders;
injection_func(std::bind(detail::rng_func, rng, _1, _2));
}
inline void connect_random_stream(std::string_view stream_name,
void (*injection_func)(rng_function_type)) {
auto& rng = RNGManager<>::getInstance().getRandomStream(std::string{stream_name});
connect_random_stream(rng, injection_func);
}
} // namespace corsika
/*
* (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.
*/
#pragma once
#include <corsika/modules/sibyll/ParticleConversion.hpp>
#include <corsika/modules/sibyll/HadronInteractionModel.hpp>
#include <corsika/modules/sibyll/Decay.hpp>
#include <corsika/modules/sibyll/NuclearInteractionModel.hpp>
#include <corsika/modules/sibyll/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/**
* @file Sibyll.hpp
*
* Includes all the parts of the Sibyll model. Defines the InteractionProcess<TModel>
* classes needed for the ProcessSequence.
*/
namespace corsika::sibyll {
/**
* @brief sibyll::Interaction is the process for ProcessSequence.
*
* The sibyll::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
struct Interaction : public InteractionModel, public InteractionProcess<Interaction> {
Interaction(std::set<Code> const& nuccomp, std::set<Code> const& stablehad)
: InteractionModel{nuccomp, stablehad} {}
};
/**
* @brief sibyll::NuclearInteraction is the process for ProcessSequence.
*
* The sibyll::NuclearInteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
template <class TNucleonModel>
class NuclearInteraction
: public NuclearInteractionModel<TNucleonModel>,
public InteractionProcess<NuclearInteraction<TNucleonModel>> {
public:
NuclearInteraction(TNucleonModel& model, std::set<Code> const& nuccomp)
: NuclearInteractionModel<TNucleonModel>{model, nuccomp} {}
};
} // namespace corsika::sibyll
/*
* (c) Copyright 2022 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.
*/
#pragma once
#include <corsika/modules/sophia/ParticleConversion.hpp>
#include <corsika/modules/sophia/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/*
* (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.
*/
#pragma once
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/process/StackProcess.hpp>
#include <chrono>
namespace corsika {
/**
* StackProcess that will act each @f$n_{step}@f$ steps to perform diagnostics on the
* full stack.
*
* The StackInspector can dump the entrie stack content for debugging, or also just
* determine the total energy remaining on the stack. From the decrease of energy on the
* stack an ETA for the completion of the simulation is determined.
*
* @tparam TStack Is the type of the particle stack.
*/
template <typename TStack>
class StackInspector : public StackProcess<StackInspector<TStack>> {
typedef typename TStack::particle_type Particle;
using StackProcess<StackInspector<TStack>>::getStep;
public:
StackInspector(int const nStep, bool const reportStack, HEPEnergyType const vE0);
~StackInspector();
void doStack(TStack const&);
/**
* To set a new E0, for example when a new shower event is started.
*/
void setE0(HEPEnergyType const E0) { E0_ = E0; }
private:
bool ReportStack_;
int PrintoutCounter_ = 0;
const int MaxNumberOfPrintouts_ = 10;
HEPEnergyType E0_;
const HEPEnergyType dE_threshold_ = 1_eV;
std::chrono::system_clock::time_point StartTime_;
HEPEnergyType energyPostInit_;
std::chrono::system_clock::time_point timePostInit_;
};
} // namespace corsika
#include <corsika/detail/modules/StackInspector.inl>