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 114 additions and 84 deletions
/* /*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -348,7 +347,7 @@ namespace corsika { ...@@ -348,7 +347,7 @@ namespace corsika {
inline void Stack<StackData, MParticleInterface, MSecondaryProducer>::swap( inline void Stack<StackData, MParticleInterface, MSecondaryProducer>::swap(
unsigned int const a, unsigned int const b) { unsigned int const a, unsigned int const b) {
data_.swap(a, b); data_.swap(a, b);
std::swap(deleted_[a], deleted_[b]); std::vector<bool>::swap(deleted_[a], deleted_[b]);
} }
template <typename StackData, template <typename> typename MParticleInterface, template <typename StackData, template <typename> typename MParticleInterface,
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -23,7 +22,7 @@ namespace corsika { ...@@ -23,7 +22,7 @@ namespace corsika {
HEPMassType const massTarget) HEPMassType const massTarget)
: originalCS_{P4projectile.getSpaceLikeComponents().getCoordinateSystem()} : originalCS_{P4projectile.getSpaceLikeComponents().getCoordinateSystem()}
, rotatedCS_{make_rotationToZ(originalCS_, P4projectile.getSpaceLikeComponents())} { , rotatedCS_{make_rotationToZ(originalCS_, P4projectile.getSpaceLikeComponents())} {
auto const pProjectile = P4projectile.getSpaceLikeComponents(); auto const& pProjectile = P4projectile.getSpaceLikeComponents();
auto const pProjNormSquared = pProjectile.getSquaredNorm(); auto const pProjNormSquared = pProjectile.getSquaredNorm();
auto const pProjNorm = sqrt(pProjNormSquared); auto const pProjNorm = sqrt(pProjNormSquared);
...@@ -82,7 +81,7 @@ namespace corsika { ...@@ -82,7 +81,7 @@ namespace corsika {
template <typename FourVector> template <typename FourVector>
inline FourVector COMBoost::toCoM(FourVector const& p4) const { inline FourVector COMBoost::toCoM(FourVector const& p4) const {
auto pComponents = p4.getSpaceLikeComponents().getComponents(rotatedCS_); auto const pComponents = p4.getSpaceLikeComponents().getComponents(rotatedCS_);
Eigen::Vector3d eVecRotated = pComponents.getEigenVector(); Eigen::Vector3d eVecRotated = pComponents.getEigenVector();
Eigen::Vector2d lab; Eigen::Vector2d lab;
...@@ -134,8 +133,10 @@ namespace corsika { ...@@ -134,8 +133,10 @@ namespace corsika {
inverseBoost_ << coshEta, -sinhEta, -sinhEta, coshEta; inverseBoost_ << coshEta, -sinhEta, -sinhEta, coshEta;
} }
inline CoordinateSystemPtr COMBoost::getRotatedCS() const { return rotatedCS_; } inline CoordinateSystemPtr const& COMBoost::getRotatedCS() const { return rotatedCS_; }
inline CoordinateSystemPtr COMBoost::getOriginalCS() const { return originalCS_; } inline CoordinateSystemPtr const& COMBoost::getOriginalCS() const {
return originalCS_;
}
} // namespace corsika } // namespace corsika
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#include <corsika/framework/utility/CorsikaFenv.hpp> #include <corsika/framework/utility/CorsikaFenv.hpp>
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
/** /**
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -254,7 +253,7 @@ namespace corsika { ...@@ -254,7 +253,7 @@ namespace corsika {
if (pre_opt.size()) { if (pre_opt.size()) {
x1 = pre_opt[0]; //*std::max_element(pre_opt.begin(), pre_opt.end()); x1 = pre_opt[0]; //*std::max_element(pre_opt.begin(), pre_opt.end());
#ifdef DEBUG #ifdef _C8_DEBUG_
for (long double test_v : pre_opt) { for (long double test_v : pre_opt) {
CORSIKA_LOG_TRACE("test,andre x={} f(x)={}", test_v, CORSIKA_LOG_TRACE("test,andre x={} f(x)={}", test_v,
cubic_function(test_v, a, b, c, d)); cubic_function(test_v, a, b, c, d));
......
/* /*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
......
/* /*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/core/PhysicalUnits.hpp>
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -41,8 +40,8 @@ namespace corsika { ...@@ -41,8 +40,8 @@ namespace corsika {
long double y = x3[0]; // there is always at least one solution long double y = x3[0]; // there is always at least one solution
// The essence - choosing Y with maximal absolute value. // The essence - choosing Y with maximal absolute value.
if (x3.size() == 3) { if (x3.size() == 3) {
if (fabs(x3[1]) > fabs(y)) y = x3[1]; if (std::abs(x3[1]) > std::abs(y)) y = x3[1];
if (fabs(x3[2]) > fabs(y)) y = x3[2]; if (std::abs(x3[2]) > std::abs(y)) y = x3[2];
} }
long double q1, q2, p1, p2; long double q1, q2, p1, p2;
...@@ -50,13 +49,13 @@ namespace corsika { ...@@ -50,13 +49,13 @@ namespace corsika {
long double Det = y * y - 4 * e; long double Det = y * y - 4 * e;
CORSIKA_LOG_TRACE("Det={}", Det); CORSIKA_LOG_TRACE("Det={}", Det);
if (fabs(Det) < epsilon) // in other words - D==0 if (std::abs(Det) < epsilon) // in other words - D==0
{ {
q1 = q2 = y * 0.5; q1 = q2 = y * 0.5;
// g1+g2 = b && g1+g2 = c-y <=> g^2 - b*g + c-y = 0 (p === g) // g1+g2 = b && g1+g2 = c-y <=> g^2 - b*g + c-y = 0 (p === g)
Det = b * b - 4 * (c - y); Det = b * b - 4 * (c - y);
CORSIKA_LOG_TRACE("Det={}", Det); CORSIKA_LOG_TRACE("Det={}", Det);
if (fabs(Det) < epsilon) { // in other words - D==0 if (std::abs(Det) < epsilon) { // in other words - D==0
p1 = p2 = b * 0.5; p1 = p2 = b * 0.5;
} else { } else {
if (Det < 0) return {}; if (Det < 0) return {};
...@@ -80,7 +79,7 @@ namespace corsika { ...@@ -80,7 +79,7 @@ namespace corsika {
std::vector<double> quad1 = solve_quadratic_real(1, p1, q1, 1e-5); std::vector<double> quad1 = solve_quadratic_real(1, p1, q1, 1e-5);
std::vector<double> quad2 = solve_quadratic_real(1, p2, q2, 1e-5); std::vector<double> quad2 = solve_quadratic_real(1, p2, q2, 1e-5);
if (quad2.size() > 0) { if (quad2.size() > 0) {
for (auto val : quad2) quad1.push_back(val); for (auto const val : quad2) quad1.push_back(val);
} }
return quad1; return quad1;
} }
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -50,7 +49,7 @@ namespace corsika { ...@@ -50,7 +49,7 @@ namespace corsika {
if (uDotA == 0) { if (uDotA == 0) {
return length * rhoStart; return length * rhoStart;
} else { } else {
return rhoStart * (lambda_ / uDotA) * (exp(uDotA * length * invLambda_) - 1); return rhoStart * (lambda_ / uDotA) * expm1(uDotA * length * invLambda_);
} }
} }
...@@ -66,9 +65,9 @@ namespace corsika { ...@@ -66,9 +65,9 @@ namespace corsika {
if (uDotA == 0) { if (uDotA == 0) {
return grammage / rhoStart; return grammage / rhoStart;
} else { } else {
auto const logArg = grammage * invLambda_ * uDotA / rhoStart + 1; auto const logArg = grammage * invLambda_ * uDotA / rhoStart;
if (logArg > 0) { if (logArg > -1) {
return lambda_ / uDotA * log(logArg); return lambda_ / uDotA * log1p(logArg);
} else { } else {
return std::numeric_limits<typename decltype(grammage)::value_type>::infinity() * return std::numeric_limits<typename decltype(grammage)::value_type>::infinity() *
meter; meter;
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
......
/* /*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -20,13 +19,7 @@ namespace corsika { ...@@ -20,13 +19,7 @@ namespace corsika {
TEnvironmentInterface, TExtraEnv>::create(center, constants::EarthRadius::Mean, TEnvironmentInterface, TExtraEnv>::create(center, constants::EarthRadius::Mean,
std::forward<TArgs>(args)...); std::forward<TArgs>(args)...);
// composition values from AIRES manual builder.setNuclearComposition(standardAirComposition);
builder.setNuclearComposition({{
Code::Nitrogen,
Code::Argon,
Code::Oxygen,
},
{0.7847, 0.0047, 1. - 0.7847 - 0.0047}});
// add the standard atmosphere layers // add the standard atmosphere layers
auto const params = atmosphereParameterList[static_cast<uint8_t>(atmId)]; auto const params = atmosphereParameterList[static_cast<uint8_t>(atmId)];
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -49,4 +48,24 @@ namespace corsika { ...@@ -49,4 +48,24 @@ namespace corsika {
std::make_unique<TVolumeType>(std::forward<TVolumeArgs>(args)...)); std::make_unique<TVolumeType>(std::forward<TVolumeArgs>(args)...));
} }
template <typename IEnvironmentModel>
std::set<Code> const get_all_elements_in_universe(
Environment<IEnvironmentModel> const& env) {
auto const& universe = *(env.getUniverse());
auto const allElementsInUniverse = std::invoke([&]() {
std::set<Code> allElementsInUniverse;
auto collectElements = [&](auto& vtn) {
if (vtn.hasModelProperties()) {
auto const& comp =
vtn.getModelProperties().getNuclearComposition().getComponents();
for (auto const c : comp) allElementsInUniverse.insert(c);
}
};
universe.walk(collectElements);
return allElementsInUniverse;
});
return allElementsInUniverse;
}
} // namespace corsika } // namespace corsika
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -24,7 +23,8 @@ namespace corsika { ...@@ -24,7 +23,8 @@ namespace corsika {
, radius_(radius) {} , radius_(radius) {}
template <typename T> template <typename T>
double ExponentialRefractiveIndex<T>::getRefractiveIndex(Point const& point) const { inline double ExponentialRefractiveIndex<T>::getRefractiveIndex(
Point const& point) const {
return n0_ * exp((-lambda_) * (distance(point, center_) - radius_)); return n0_ * exp((-lambda_) * (distance(point, center_) - radius_));
} }
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
...@@ -29,7 +28,7 @@ namespace corsika { ...@@ -29,7 +28,7 @@ namespace corsika {
template <typename T> template <typename T>
inline MassDensityType FlatExponential<T>::getMassDensity(Point const& point) const { inline MassDensityType FlatExponential<T>::getMassDensity(Point const& point) const {
return BaseExponential<FlatExponential<T>>::getMassDensity( return BaseExponential<FlatExponential<T>>::getMassDensity(
(point - BaseExponential<FlatExponential<T>>::getAnchorPoint()).getNorm()); (point - BaseExponential<FlatExponential<T>>::getAnchorPoint()).dot(axis_));
} }
template <typename T> template <typename T>
......
/* /*
* (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#include <corsika/framework/core/Logging.hpp> #include <corsika/framework/core/Logging.hpp>
#include <boost/math/tr1.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
...@@ -174,8 +176,8 @@ namespace corsika { ...@@ -174,8 +176,8 @@ namespace corsika {
p.h = p_h; p.h = p_h;
} }
legendre = pow(-1, p.m) * std::assoc_legendre(p.n, p.m, sin(lat_sph)); legendre = boost::math::tr1::assoc_legendre(p.n, p.m, sin(lat_sph));
next_legendre = pow(-1, p.m) * std::assoc_legendre(p.n + 1, p.m, sin(lat_sph)); next_legendre = boost::math::tr1::assoc_legendre(p.n + 1, p.m, sin(lat_sph));
// Schmidt semi-normalization // Schmidt semi-normalization
if (p.m > 0) { if (p.m > 0) {
...@@ -215,4 +217,4 @@ namespace corsika { ...@@ -215,4 +217,4 @@ namespace corsika {
magneticfield_geo[2] * -1_nT}; magneticfield_geo[2] * -1_nT};
} }
} // namespace corsika } // namespace corsika
\ No newline at end of file
/*
* (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/media/IRefractiveIndexModel.hpp>
namespace corsika {
template <typename T>
template <typename... Args>
inline GladstoneDaleRefractiveIndex<T>::GladstoneDaleRefractiveIndex(
double const referenceRefractiveIndex, Point const point, Args&&... args)
: T(std::forward<Args>(args)...)
, referenceRefractivity_(referenceRefractiveIndex - 1)
, referenceInvDensity_(1 / this->getMassDensity(point)) {}
template <typename T>
inline double GladstoneDaleRefractiveIndex<T>::getRefractiveIndex(
Point const& point) const {
return referenceRefractivity_ * (this->getMassDensity(point) * referenceInvDensity_) +
1.;
}
} // namespace corsika
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
......
/* /*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the 3-clause BSD license.
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of * See file LICENSE for a full version of the license.
* the license.
*/ */
#pragma once #pragma once
......