IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 785332c9 authored by Ralf Ulrich's avatar Ralf Ulrich
Browse files

Merge branch '467-repair-epos-interface' into 'master'

run EPOS in CoM

Closes #443 and #467

See merge request !407
parents 0c7fbcaf 5c08ca4b
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <cmath>
namespace corsika::epos { namespace corsika::epos {
...@@ -112,7 +113,7 @@ namespace corsika::epos { ...@@ -112,7 +113,7 @@ namespace corsika::epos {
::epos::nucl6_.infragm = ::epos::nucl6_.infragm =
2; // 0: keep free nucleons in fragmentation,1: one fragment, 2: fragmentation 2; // 0: keep free nucleons in fragmentation,1: one fragment, 2: fragmentation
::epos::othe2_.iframe = 12; // lab frame, target at rest ::epos::othe2_.iframe = 11; // cms frame
// set paths to tables in corsika data // set paths to tables in corsika data
::epos::datadir BASE(data_path_); ::epos::datadir BASE(data_path_);
...@@ -136,8 +137,8 @@ namespace corsika::epos { ...@@ -136,8 +137,8 @@ namespace corsika::epos {
::epos::nfname_.nfncs = CS.length; ::epos::nfname_.nfncs = CS.length;
// initialiazes maximum energy and mass // initialiazes maximum energy and mass
initializeEventLab(Code::Lead, Lead::nucleus_A, Lead::nucleus_Z, Code::Lead, initializeEventCoM(Code::Lead, Lead::nucleus_A, Lead::nucleus_Z, Code::Lead,
Lead::nucleus_A, Lead::nucleus_Z, 1_TeV); Lead::nucleus_A, Lead::nucleus_Z, 1_PeV);
} }
inline void InteractionModel::initializeEventCoM(Code const idBeam, int const iBeamA, inline void InteractionModel::initializeEventCoM(Code const idBeam, int const iBeamA,
...@@ -163,30 +164,6 @@ namespace corsika::epos { ...@@ -163,30 +164,6 @@ namespace corsika::epos {
::epos::ainit_(); ::epos::ainit_();
} }
inline void InteractionModel::initializeEventLab(Code const idBeam, int const iBeamA,
int const iBeamZ, Code const idTarget,
int const iTargetA, int const iTargetZ,
HEPEnergyType const Plab) const {
CORSIKA_LOGGER_TRACE(logger_,
"initialize event in lab. frame!"
" Plab per nuc={} GeV",
Plab / 1_GeV);
::epos::lept1_.engy = -1.;
::epos::enrgy_.ecms = -1.;
::epos::enrgy_.elab = -1.;
::epos::enrgy_.ekin = -1.;
::epos::hadr1_.pnll = -1.;
// hadron-nucleon momentum
::epos::hadr1_.pnll = float(Plab / 1_GeV); // -> lab frame
CORSIKA_LOGGER_TRACE(logger_, "inside EPOS: Ecm={}, Elab={}, Pnll={}",
::epos::enrgy_.ecms, ::epos::enrgy_.elab, ::epos::hadr1_.pnll);
configureParticles(idBeam, iBeamA, iBeamZ, idTarget, iTargetA, iTargetZ);
::epos::ainit_();
}
inline void InteractionModel::configureParticles(Code const idBeam, int const iBeamA, inline void InteractionModel::configureParticles(Code const idBeam, int const iBeamA,
int const iBeamZ, Code const idTarget, int const iBeamZ, Code const idTarget,
int const iTargetA, int const iTargetA,
...@@ -392,7 +369,7 @@ namespace corsika::epos { ...@@ -392,7 +369,7 @@ namespace corsika::epos {
// define projectile // define projectile
// define projectile, in lab frame // define projectile, in lab frame
auto const sqrtS2 = (projectileP4 + targetP4).getNormSqr(); auto const sqrtS2 = (projectileP4 + targetP4).getNormSqr();
auto const sqrtS = sqrt(sqrtS2); HEPEnergyType const sqrtS = sqrt(sqrtS2);
if (!isValid(projectileId, targetId, sqrtS)) { if (!isValid(projectileId, targetId, sqrtS)) {
throw std::runtime_error("invalid projectile/target/energy combination."); throw std::runtime_error("invalid projectile/target/energy combination.");
} }
...@@ -411,11 +388,14 @@ namespace corsika::epos { ...@@ -411,11 +388,14 @@ namespace corsika::epos {
sqrt((Elab - get_mass(projectileId)) * (Elab + get_mass(projectileId))); sqrt((Elab - get_mass(projectileId)) * (Elab + get_mass(projectileId)));
MomentumVector pLab(csPrime, {0_eV, 0_eV, pLabMag}); MomentumVector pLab(csPrime, {0_eV, 0_eV, pLabMag});
// internal EPOS lab system CORSIKA_LOGGER_DEBUG(logger_,
COMBoost const boostInternal({Elab, pLab}, get_mass(targetId)); "doInteraction: interaction, projectile id={}, E={}, p3={} ",
projectileId, projectileP4.getTimeLikeComponent(),
CORSIKA_LOGGER_DEBUG(logger_, "doInteraction: {} interaction, Elab={} ", projectileId, projectileP4.getSpaceLikeComponents());
Elab); CORSIKA_LOGGER_DEBUG(
logger_, "doInteraction: interaction, target id={}, E={}, p3={} ", targetId,
targetP4.getTimeLikeComponent(), targetP4.getSpaceLikeComponents());
CORSIKA_LOGGER_DEBUG(logger_, "doInteraction: Elab={}, sqrtS={} ", Elab, sqrtS);
int beamA = 1; int beamA = 1;
int beamZ = 1; int beamZ = 1;
...@@ -425,8 +405,6 @@ namespace corsika::epos { ...@@ -425,8 +405,6 @@ namespace corsika::epos {
CORSIKA_LOGGER_DEBUG(logger_, "A={}, Z={} ", beamA, beamZ); CORSIKA_LOGGER_DEBUG(logger_, "A={}, Z={} ", beamA, beamZ);
} }
HEPMomentumType const projectileMomentumLabPerNucleon = pLabMag / beamA;
// // from corsika7 interface // // from corsika7 interface
// // NEXLNK-part // // NEXLNK-part
int targetA = 1; int targetA = 1;
...@@ -435,8 +413,7 @@ namespace corsika::epos { ...@@ -435,8 +413,7 @@ namespace corsika::epos {
targetA = get_nucleus_A(targetId); targetA = get_nucleus_A(targetId);
targetZ = get_nucleus_Z(targetId); targetZ = get_nucleus_Z(targetId);
} }
initializeEventLab(projectileId, beamA, beamZ, targetId, targetA, targetZ, initializeEventCoM(projectileId, beamA, beamZ, targetId, targetA, targetZ, sqrtS);
projectileMomentumLabPerNucleon);
// create event // create event
int iarg = 1; int iarg = 1;
...@@ -450,8 +427,8 @@ namespace corsika::epos { ...@@ -450,8 +427,8 @@ namespace corsika::epos {
// NSTORE-part // NSTORE-part
MomentumVector Plab_final(originalCS, {0.0_GeV, 0.0_GeV, 0.0_GeV}); MomentumVector P_final(originalCS, {0.0_GeV, 0.0_GeV, 0.0_GeV});
HEPEnergyType Elab_final = 0_GeV; HEPEnergyType E_final = 0_GeV;
// position and time of interaction, not used in QgsjetII // position and time of interaction, not used in QgsjetII
auto const& projectile = view.getProjectile(); auto const& projectile = view.getProjectile();
...@@ -460,15 +437,13 @@ namespace corsika::epos { ...@@ -460,15 +437,13 @@ namespace corsika::epos {
// secondaries // secondaries
EposStack es; EposStack es;
CORSIKA_LOGGER_DEBUG(logger_, "number of particles: {}", es.getSize()); CORSIKA_LOGGER_DEBUG(logger_, "number of entries on Epos stack: {}", es.getSize());
for (auto& psec : es) { for (auto& psec : es) {
if (!psec.isFinal()) continue; if (!psec.isFinal()) continue;
auto momentum = psec.getMomentum(csPrime); auto momentum = psec.getMomentum(csPrime);
// this is not "CoM" here, but rather the system defined by projectile+target, // transform particle output to frame defined by input 4-momenta
// which in Cascade-mode is already lab auto const P4output = boost.fromCoM(FourVector{psec.getEnergy(), momentum});
auto const P4com = boostInternal.toCoM(FourVector{psec.getEnergy(), momentum});
auto const P4output = boost.fromCoM(P4com);
auto p3output = P4output.getSpaceLikeComponents(); auto p3output = P4output.getSpaceLikeComponents();
p3output.rebase(originalCS); // transform back into standard lab frame p3output.rebase(originalCS); // transform back into standard lab frame
...@@ -480,14 +455,15 @@ namespace corsika::epos { ...@@ -480,14 +455,15 @@ namespace corsika::epos {
pid, p3output.getComponents() / 1_GeV); pid, p3output.getComponents() / 1_GeV);
auto pnew = view.addSecondary(std::make_tuple(pid, p3output, pOrig, tOrig)); auto pnew = view.addSecondary(std::make_tuple(pid, p3output, pOrig, tOrig));
Plab_final += pnew.getMomentum(); P_final += pnew.getMomentum();
Elab_final += pnew.getEnergy(); E_final += pnew.getEnergy();
} }
CORSIKA_LOGGER_DEBUG( CORSIKA_LOGGER_DEBUG(
logger_, logger_,
"conservation (all GeV): Ecm_final= n/a" /* << Ecm_final / 1_GeV*/ "conservation (all GeV): Ecm_final= n/a" /* << Ecm_final / 1_GeV*/
", Elab_final={}" ", E_final={} GeV"
", Plab_final={}", ", P_final={} GeV"
Elab_final / 1_GeV, (Plab_final / 1_GeV).getComponents()); ", no. of particles={}",
E_final / 1_GeV, (P_final / 1_GeV).getComponents(), view.getSize());
} }
} // namespace corsika::epos } // namespace corsika::epos
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