IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 1927ca9c authored by ralfulrich's avatar ralfulrich
Browse files

a bit more cleanup

parent 813a49b9
No related branches found
No related tags found
No related merge requests found
...@@ -226,12 +226,12 @@ int main() { ...@@ -226,12 +226,12 @@ int main() {
// setup particle stack, and add primary particle // setup particle stack, and add primary particle
setup::Stack stack; setup::Stack stack;
stack.Clear(); stack.Clear();
const EnergyType E0 = 1_TeV; const hep::EnergyType E0 = 1_TeV;
{ {
auto particle = stack.NewParticle(); auto particle = stack.NewParticle();
particle.SetPID(Code::Proton); particle.SetPID(Code::Proton);
hep::MomentumType P0 = sqrt(E0 * E0 - 0.93827_GeV * 0.93827_GeV); hep::MomentumType P0 = sqrt(E0 * E0 - 0.93827_GeV * 0.93827_GeV);
auto plab = stack::super_stupid::MomentumVector(rootCS, 0. * 1_GeV, 0. * 1_GeV, -P0); auto plab = stack::super_stupid::MomentumVector(rootCS, 0_GeV, 0_GeV, -P0);
particle.SetEnergy(E0); particle.SetEnergy(E0);
particle.SetMomentum(plab); particle.SetMomentum(plab);
particle.SetTime(0_ns); particle.SetTime(0_ns);
......
...@@ -104,7 +104,6 @@ namespace corsika::process::sibyll { ...@@ -104,7 +104,6 @@ namespace corsika::process::sibyll {
<< "nucleon mass " << nucleon_mass << std::endl; << "nucleon mass " << nucleon_mass << std::endl;
// calculate interaction length in medium // calculate interaction length in medium
GrammageType int_length = kTarget * nucleon_mass / sig; GrammageType int_length = kTarget * nucleon_mass / sig;
// pick random step lenth
std::cout << "Interaction: " std::cout << "Interaction: "
<< "interaction length (g/cm2): " << int_length << std::endl; << "interaction length (g/cm2): " << int_length << std::endl;
...@@ -112,17 +111,6 @@ namespace corsika::process::sibyll { ...@@ -112,17 +111,6 @@ namespace corsika::process::sibyll {
} }
return std::numeric_limits<double>::infinity() * 1_g / (1_cm * 1_cm); return std::numeric_limits<double>::infinity() * 1_g / (1_cm * 1_cm);
/*
what are the units of the output? slant depth or 3space length?
*/
//
// int a = 0;
// const double next_step = -int_length * log(s_rndm_(a));
// std::cout << "Interaction: "
// << "next step (g/cm2): " << next_step << std::endl;
// return next_step;
} }
template <typename Particle, typename Stack> template <typename Particle, typename Stack>
...@@ -158,12 +146,11 @@ namespace corsika::process::sibyll { ...@@ -158,12 +146,11 @@ namespace corsika::process::sibyll {
GetNucleusA(); // env.GetTargetParticle().GetPID(); GetNucleusA(); // env.GetTargetParticle().GetPID();
// FOR NOW: target is always at rest // FOR NOW: target is always at rest
const EnergyType Etarget = 0. * 1_GeV + corsika::particles::Proton::GetMass(); const EnergyType Etarget = 0_GeV + corsika::particles::Proton::GetMass();
const auto pTarget = MomentumVector(rootCS, 0_GeV, 0_GeV, 0_GeV); const auto pTarget = MomentumVector(rootCS, 0_GeV, 0_GeV, 0_GeV);
cout << "target momentum (GeV/c): " cout << "target momentum (GeV/c): " << pTarget.GetComponents() / 1_GeV << endl;
<< pTarget.GetComponents() / 1_GeV * constants::c << endl; cout << "beam momentum (GeV/c): " << p.GetMomentum().GetComponents() / 1_GeV
cout << "beam momentum (GeV/c): " << endl;
<< p.GetMomentum().GetComponents() / 1_GeV * constants::c << endl;
cout << "position of interaction: " << pOrig.GetCoordinates() << endl; cout << "position of interaction: " << pOrig.GetCoordinates() << endl;
cout << "time: " << tOrig << endl; cout << "time: " << tOrig << endl;
...@@ -181,8 +168,7 @@ namespace corsika::process::sibyll { ...@@ -181,8 +168,7 @@ namespace corsika::process::sibyll {
// total momentum // total momentum
MomentumVector Ptot = p.GetMomentum(); MomentumVector Ptot = p.GetMomentum();
// invariant mass, i.e. cm. energy // invariant mass, i.e. cm. energy
EnergyType Ecm = EnergyType Ecm = sqrt(Etot * Etot - Ptot.squaredNorm());
sqrt(Etot * Etot - Ptot.squaredNorm()); // sqrt( 2. * E * 0.93827_GeV );
/* /*
get transformation between Stack-frame and SibStack-frame get transformation between Stack-frame and SibStack-frame
for EAS Stack-frame is lab. frame, could be different for CRMC-mode for EAS Stack-frame is lab. frame, could be different for CRMC-mode
...@@ -228,7 +214,8 @@ namespace corsika::process::sibyll { ...@@ -228,7 +214,8 @@ namespace corsika::process::sibyll {
// SibStack does not know about momentum yet so we need counter to access // SibStack does not know about momentum yet so we need counter to access
// momentum array in Sibyll // momentum array in Sibyll
int i = -1; int i = -1;
MomentumVector Ptot_final(rootCS, {0.0_GeV, 0.0_GeV, 0.0_GeV}); MomentumVector Plab_final(rootCS, {0.0_GeV, 0.0_GeV, 0.0_GeV});
EnergyType E_final = 0_GeV, Ecm_final = 0_GeV;
for (auto& psib : ss) { for (auto& psib : ss) {
++i; ++i;
// skip particles that have decayed in Sibyll // skip particles that have decayed in Sibyll
...@@ -263,10 +250,14 @@ namespace corsika::process::sibyll { ...@@ -263,10 +250,14 @@ namespace corsika::process::sibyll {
pnew.SetMomentum(MomentumVector(rootCS, p_lab_c)); pnew.SetMomentum(MomentumVector(rootCS, p_lab_c));
pnew.SetPosition(pOrig); pnew.SetPosition(pOrig);
pnew.SetTime(tOrig); pnew.SetTime(tOrig);
Ptot_final += pnew.GetMomentum(); Plab_final += pnew.GetMomentum();
E_final += en_lab;
Ecm_final += psib.GetEnergy();
} }
// cout << "tot. momentum final (GeV/c): " << Ptot_final.GetComponents() / 1_GeV std::cout << "conservation (all GeV): E_final=" << E_final / 1_GeV
// * constants::c << endl; << ", Ecm_final=" << Ecm_final / 1_GeV
<< ", Plab_final=" << (Plab_final / 1_GeV).GetComponents()
<< std::endl;
} }
} }
return process::EProcessReturn::eOk; return process::EProcessReturn::eOk;
......
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