From e94dab23af8d803793045699257002458575aaee Mon Sep 17 00:00:00 2001 From: Felix Riehn <felix@matilda> Date: Fri, 22 Apr 2022 18:38:24 +0100 Subject: [PATCH] proposal logger, set appropriate levels --- .../modules/proposal/HadronicPhotonModel.inl | 22 ++++++++++--------- .../modules/proposal/InteractionModel.inl | 3 ++- .../modules/proposal/HadronicPhotonModel.hpp | 1 + corsika/modules/proposal/InteractionModel.hpp | 2 ++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/corsika/detail/modules/proposal/HadronicPhotonModel.inl b/corsika/detail/modules/proposal/HadronicPhotonModel.inl index c6e30a4d3..eeba6a1be 100644 --- a/corsika/detail/modules/proposal/HadronicPhotonModel.inl +++ b/corsika/detail/modules/proposal/HadronicPhotonModel.inl @@ -25,14 +25,15 @@ namespace corsika::proposal { HEPEnergyType const sqrtS = calculate_com_energy(_heenthresholdNN, Rho0::mass, Proton::mass); if (!heHadronicInteraction_.isValid(Code::Rho0, Code::Proton, sqrtS)) { - CORSIKA_LOG_ERROR( + CORSIKA_LOGGER_CRITICAL( + logger_, "Invalid energy threshold for hadron interaction model. theshold_lab= {} GeV, " "theshold_com={} GeV", _heenthresholdNN / 1_GeV, sqrtS / 1_GeV); throw std::runtime_error("Configuration error!"); } - CORSIKA_LOG_INFO( - "Threshold for HE hadronic interactions in proposal set to Elab={} GeV", + CORSIKA_LOGGER_DEBUG( + logger_, "Threshold for HE hadronic interactions in proposal set to Elab={} GeV", _heenthresholdNN / 1_GeV); }; @@ -42,8 +43,8 @@ namespace corsika::proposal { TStackView& view, CoordinateSystemPtr const& labCS, FourMomentum const& photonP4, Code const& targetId) { if (photonP4.getTimeLikeComponent() > heHadronicModelThresholdLabNN_) { - CORSIKA_LOG_INFO( - "HE photo-hadronic interaction! calling hadronic interaction model.."); + CORSIKA_LOGGER_TRACE( + logger_, "HE photo-hadronic interaction! calling hadronic interaction model.."); // copy from sibyll::NuclearInteractionModel // temporarily add to stack, will be removed after interaction in DoInteraction @@ -63,8 +64,9 @@ namespace corsika::proposal { TStackView photon_secondaries(hadronicPhoton); // call inner hadronic event generator - CORSIKA_LOG_INFO("{} + {} interaction. Ekinlab = {} GeV", hadPhotonCode, targetId, - photonP4.getTimeLikeComponent() / 1_GeV); + CORSIKA_LOGGER_TRACE(logger_, "{} + {} interaction. Ekinlab = {} GeV", + hadPhotonCode, targetId, + photonP4.getTimeLikeComponent() / 1_GeV); heHadronicInteraction_.doInteraction(photon_secondaries, hadPhotonCode, targetId, photonP4, targetP4); for (const auto& pSec : photon_secondaries) { @@ -74,10 +76,10 @@ namespace corsika::proposal { calculate_kinetic_energy(p3lab.getNorm(), get_mass(pid)); view.addSecondary(std::make_tuple(pid, secEkin, p3lab.normalized())); } - CORSIKA_LOG_INFO("number of particles produced: {}", view.getEntries()); } else { - CORSIKA_LOG_INFO( - "LE photo-hadronic interaction! production of secondaries not implemented.."); + CORSIKA_LOGGER_TRACE( + logger_, + "LE photo-hadronic interaction! Production of secondaries not implemented.."); } return ProcessReturn::Ok; } diff --git a/corsika/detail/modules/proposal/InteractionModel.inl b/corsika/detail/modules/proposal/InteractionModel.inl index 867b03858..4790e1e54 100644 --- a/corsika/detail/modules/proposal/InteractionModel.inl +++ b/corsika/detail/modules/proposal/InteractionModel.inl @@ -124,7 +124,8 @@ namespace corsika::proposal { auto const A = int(target.GetAtomicNum()); auto const Z = int(target.GetNucCharge()); Code const targetId = get_nucleus_code(A, Z); - CORSIKA_LOG_INFO( + CORSIKA_LOGGER_DEBUG( + logger_, "photo-hadronic interaction of projectile={} with target={}! Energy={} GeV", projectileId, targetId, E / 1_GeV); this->doHadronicPhotonInteraction(view, labCS, photonP4, targetId); diff --git a/corsika/modules/proposal/HadronicPhotonModel.hpp b/corsika/modules/proposal/HadronicPhotonModel.hpp index b8e8a4156..f021ab508 100644 --- a/corsika/modules/proposal/HadronicPhotonModel.hpp +++ b/corsika/modules/proposal/HadronicPhotonModel.hpp @@ -35,6 +35,7 @@ namespace corsika::proposal { FourMomentum const&, Code const&); private: + inline static auto logger_{get_logger("corsika_proposal_HadronicPhotonModel")}; THadronicModel& heHadronicInteraction_; //! threshold for high energy hadronic interaction model. Lab. energy per nucleon HEPEnergyType heHadronicModelThresholdLabNN_; diff --git a/corsika/modules/proposal/InteractionModel.hpp b/corsika/modules/proposal/InteractionModel.hpp index 6e41f9752..78a9445dc 100644 --- a/corsika/modules/proposal/InteractionModel.hpp +++ b/corsika/modules/proposal/InteractionModel.hpp @@ -49,6 +49,8 @@ namespace corsika::proposal { //! void buildCalculator(Code, NuclearComposition const&) final; + inline static auto logger_{get_logger("corsika_proposal_InteractionModel")}; + public: //! //! Produces the stoachastic loss calculator for leptons based on nuclear -- GitLab