IAP GITLAB

Commit 61cd7c65 authored by Ralf Ulrich's avatar Ralf Ulrich

final small fixed and style

parent 1f7a2c17
Pipeline #3530 passed with stages
in 14 minutes and 8 seconds
......@@ -35,9 +35,11 @@ namespace corsika {
GrammageType const grammageStart = shower_axis_.getProjectedX(vTrack.getPosition(0));
GrammageType const grammageEnd = shower_axis_.getProjectedX(vTrack.getPosition(1));
CORSIKA_LOG_INFO(
"pos1={} m, pos2={}, X1={} g/cm2, X2={} g/cm2", vTrack.getPosition(0).getCoordinates() / 1_m,
vTrack.getPosition(1).getCoordinates() / 1_m, grammageStart / 1_g * square(1_cm), grammageEnd / 1_g * square(1_cm));
CORSIKA_LOG_INFO("pos1={} m, pos2={}, X1={} g/cm2, X2={} g/cm2",
vTrack.getPosition(0).getCoordinates() / 1_m,
vTrack.getPosition(1).getCoordinates() / 1_m,
grammageStart / 1_g * square(1_cm),
grammageEnd / 1_g * square(1_cm));
// Note: particle may go also "upward", thus, grammageEnd<grammageStart
const int binStart = std::ceil(grammageStart / dX_);
......
......@@ -125,13 +125,14 @@ namespace corsika::proposal {
// hyper parameter which must be adjusted.
//
auto const energy = vP.getEnergy();
auto const energy_lim =
std::max(energy * 0.9, // either 10% relative loss max., or
get_energy_threshold(
code) // energy thresholds globally defined for individual particles
* 0.99 // need to go 1% below global e-cut to assure removal in ParticleCut. The
// 1% does not matter since at cut-time the entire energy is removed.
);
auto const energy_lim = std::max(
energy * 0.9, // either 10% relative loss max., or
get_energy_threshold(
code) // energy thresholds globally defined for individual particles
*
0.99 // need to go 1% below global e-cut to assure removal in ParticleCut. The
// 1% does not matter since at cut-time the entire energy is removed.
);
// solving the track integral for giving energy lim
auto c = getCalculator(vP, calc);
......
......@@ -176,7 +176,7 @@ namespace corsika {
CORSIKA_LOG_TRACE("Solution (real) for current Volume: {} ", dist);
if (numericallyInside) {
// there must be an entry (negative) and exit (positive) solution
if (dist < 0.0001_m) { // security margin to assure transfer to next
if (dist < -0.0001_m) { // security margin to assure transfer to next
// logical volume
if (first_entry == 0) {
d_enter = dist;
......@@ -200,7 +200,7 @@ namespace corsika {
// both physical solutions (entry, exit) must be positive, and as small as
// possible
if (dist < 0.0001_m) { // need small numerical margin, to assure transport
if (dist < -0.0001_m) { // need small numerical margin, to assure transport
// into next logical volume
continue;
}
......
......@@ -73,12 +73,14 @@ namespace corsika {
//! true iff the particle is a hard-coded nucleus or Code::Nucleus
bool constexpr is_nucleus(Code const);
bool constexpr is_hadron(Code const); //!< true iff particle is hadron
bool constexpr is_em(Code const); //!< true iff particle is electron, positron or gamma
bool constexpr is_muon(Code const); //!< true iff particle is mu+ or mu-
bool constexpr is_neutrino(Code const); //!< true iff particle is (anti-) neutrino
int constexpr get_nucleus_A(Code const); //!< returns A for hard-coded nucleus, otherwise 0
int constexpr get_nucleus_Z(Code const); //!< returns Z for hard-coded nucleus, otherwise 0
bool constexpr is_hadron(Code const); //!< true iff particle is hadron
bool constexpr is_em(Code const); //!< true iff particle is electron, positron or gamma
bool constexpr is_muon(Code const); //!< true iff particle is mu+ or mu-
bool constexpr is_neutrino(Code const); //!< true iff particle is (anti-) neutrino
int constexpr get_nucleus_A(
Code const); //!< returns A for hard-coded nucleus, otherwise 0
int constexpr get_nucleus_Z(
Code const); //!< returns Z for hard-coded nucleus, otherwise 0
//! returns mass of (A,Z) nucleus, disregarding binding energy
HEPMassType get_nucleus_mass(unsigned int const, unsigned int const);
......
......@@ -38,7 +38,7 @@ namespace corsika::setup {
The default tracking algorithm.
*/
//typedef corsika::tracking_leapfrog_curved::Tracking Tracking;
// typedef corsika::tracking_leapfrog_curved::Tracking Tracking;
// typedef corsika::tracking_leapfrog_straight::Tracking Tracking;
typedef corsika::tracking_line::Tracking Tracking;
......@@ -47,6 +47,6 @@ namespace corsika::setup {
*/
/// definition of Trajectory base class, to be used in tracking and cascades
typedef StraightTrajectory Trajectory;
//typedef corsika::LeapFrogTrajectory Trajectory;
// typedef corsika::LeapFrogTrajectory Trajectory;
} // namespace corsika::setup
......@@ -131,7 +131,7 @@ int main(int argc, char** argv) {
builder.addExponentialLayer(1144.9069_g / (1_cm * 1_cm), 878153.55_cm, 10_km);
builder.addExponentialLayer(1305.5948_g / (1_cm * 1_cm), 636143.04_cm, 40_km);
builder.addExponentialLayer(540.1778_g / (1_cm * 1_cm), 772170.16_cm, 100_km);
builder.addLinearLayer(1e9_cm, 112.8_km+constants::EarthRadius::Mean);
builder.addLinearLayer(1e9_cm, 112.8_km + constants::EarthRadius::Mean);
builder.assemble(env);
CORSIKA_LOG_DEBUG(
......@@ -157,7 +157,7 @@ int main(int argc, char** argv) {
Code beamCode;
HEPEnergyType mass;
unsigned short Z = 0;
if (A>0) {
if (A > 0) {
beamCode = Code::Nucleus;
Z = std::stoi(std::string(argv[2]));
mass = get_nucleus_mass(A, Z);
......@@ -200,14 +200,14 @@ int main(int argc, char** argv) {
stack.addParticle(std::make_tuple(beamCode, E0, plab, injectionPos, 0_ns, A, Z));
} else {
if (A==1) {
if (A == 1) {
if (Z == 1) {
stack.addParticle(std::make_tuple(Code::Proton, E0, plab, injectionPos, 0_ns));
stack.addParticle(std::make_tuple(Code::Proton, E0, plab, injectionPos, 0_ns));
} else if (Z == 0) {
stack.addParticle(std::make_tuple(Code::Neutron, E0, plab, injectionPos, 0_ns));
stack.addParticle(std::make_tuple(Code::Neutron, E0, plab, injectionPos, 0_ns));
} else {
std::cerr << "illegal parameters" << std::endl;
return EXIT_FAILURE;
std::cerr << "illegal parameters" << std::endl;
return EXIT_FAILURE;
}
} else {
stack.addParticle(std::make_tuple(beamCode, E0, plab, injectionPos, 0_ns));
......
......@@ -23,7 +23,7 @@
using namespace corsika;
TEST_CASE("ParticleCut", "[processes]") {
TEST_CASE("ParticleCut", "processes") {
logging::set_level(logging::level::info);
corsika_logger->set_pattern("[%n:%^%-8l%$] %v");
......@@ -222,7 +222,10 @@ TEST_CASE("ParticleCut", "[processes]") {
for (auto proType : particleList) {
auto particle = stack.addParticle(std::make_tuple(
proType, Eabove, MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}), point0, 0_ns));
cut.doContinuous(particle, track);
if (cut.doContinuous(particle, track) == ProcessReturn::ParticleAbsorbed) {
particle.erase();
}
}
CHECK(stack.getEntries() == 9);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment