IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 5ba9a003 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by ralfulrich
Browse files

use SecondaryView instad of SeoncdaryView::GetProjectile() as argument

for DoDecay()
parent b44993dd
No related branches found
No related tags found
1 merge request!254History
...@@ -265,7 +265,7 @@ namespace corsika::cascade { ...@@ -265,7 +265,7 @@ namespace corsika::cascade {
interaction(vParticle, projectile); interaction(vParticle, projectile);
} else { } else {
assert(min_distance == distance_decay); assert(min_distance == distance_decay);
decay(vParticle, projectile); decay(vParticle, secondaries);
// make sure particle actually did decay if it should have done so // make sure particle actually did decay if it should have done so
if (secondaries.getSize() == 1 && if (secondaries.getSize() == 1 &&
projectile.GetPID() == secondaries.GetNextParticle().GetPID()) projectile.GetPID() == secondaries.GetNextParticle().GetPID())
...@@ -314,7 +314,7 @@ namespace corsika::cascade { ...@@ -314,7 +314,7 @@ namespace corsika::cascade {
} }
auto decay(Particle& particle, auto decay(Particle& particle,
decltype(std::declval<TStackView>().GetProjectile()) projectile) { TStackView& view) {
std::cout << "decay" << std::endl; std::cout << "decay" << std::endl;
units::si::InverseTimeType const actual_decay_time = units::si::InverseTimeType const actual_decay_time =
fProcessSequence.GetTotalInverseLifetime(particle); fProcessSequence.GetTotalInverseLifetime(particle);
......
...@@ -22,7 +22,7 @@ using std::vector; ...@@ -22,7 +22,7 @@ using std::vector;
using namespace corsika; using namespace corsika;
using namespace corsika::setup; using namespace corsika::setup;
using Projectile = corsika::setup::StackView::ParticleType; using View = corsika::setup::StackView;
using Particle = corsika::setup::Stack::ParticleType; using Particle = corsika::setup::Stack::ParticleType;
using Track = Trajectory; using Track = Trajectory;
...@@ -184,21 +184,23 @@ namespace corsika::process::pythia { ...@@ -184,21 +184,23 @@ namespace corsika::process::pythia {
} }
template <> template <>
void Decay::DoDecay(Projectile& vP) { void Decay::DoDecay(View& view) {
using geometry::Point; using geometry::Point;
using namespace units; using namespace units;
using namespace units::si; using namespace units::si;
auto const& decayPoint = vP.GetPosition(); auto const projectile = view.GetProjectile();
auto const t0 = vP.GetTime();
auto const& labMomentum = vP.GetMomentum(); auto const& decayPoint = projectile.GetPosition();
auto const t0 = projectile.GetTime();
auto const& labMomentum = projectile.GetMomentum();
geometry::CoordinateSystem const& labCS = labMomentum.GetCoordinateSystem(); geometry::CoordinateSystem const& labCS = labMomentum.GetCoordinateSystem();
// define target kinematics in lab frame // define target kinematics in lab frame
// define boost to and from CoM frame // define boost to and from CoM frame
// CoM frame definition in Pythia projectile: +z // CoM frame definition in Pythia projectile: +z
utl::COMBoost const boost(labMomentum, vP.GetMass()); utl::COMBoost const boost(labMomentum, projectile.GetMass());
auto const& rotatedCS = boost.GetRotatedCS(); auto const& rotatedCS = boost.GetRotatedCS();
fCount++; fCount++;
...@@ -207,7 +209,7 @@ namespace corsika::process::pythia { ...@@ -207,7 +209,7 @@ namespace corsika::process::pythia {
Pythia8::Event& event = fPythia.event; Pythia8::Event& event = fPythia.event;
event.reset(); event.reset();
auto const particleId = vP.GetPID(); auto const particleId = projectile.GetPID();
// set particle unstable // set particle unstable
Decay::SetUnstable(particleId); Decay::SetUnstable(particleId);
...@@ -218,7 +220,7 @@ namespace corsika::process::pythia { ...@@ -218,7 +220,7 @@ namespace corsika::process::pythia {
double constexpr px = 0; double constexpr px = 0;
double constexpr py = 0; double constexpr py = 0;
double constexpr pz = 0; double constexpr pz = 0;
double const en = vP.GetMass() / 1_GeV; double const en = projectile.GetMass() / 1_GeV;
double const m = en; double const m = en;
// add particle to pythia stack // add particle to pythia stack
...@@ -248,7 +250,7 @@ namespace corsika::process::pythia { ...@@ -248,7 +250,7 @@ namespace corsika::process::pythia {
<< fourMomLab.GetSpaceLikeComponents().GetComponents(labCS) / 1_GeV << fourMomLab.GetSpaceLikeComponents().GetComponents(labCS) / 1_GeV
<< " energy=" << fourMomLab.GetTimeLikeComponent() << endl; << " energy=" << fourMomLab.GetTimeLikeComponent() << endl;
vP.AddSecondary( view.AddSecondary(
tuple<particles::Code, units::si::HEPEnergyType, tuple<particles::Code, units::si::HEPEnergyType,
corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{ corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{
pyId, fourMomLab.GetTimeLikeComponent(), pyId, fourMomLab.GetTimeLikeComponent(),
......
...@@ -60,8 +60,8 @@ namespace corsika::process { ...@@ -60,8 +60,8 @@ namespace corsika::process {
In this function PYTHIA is called to execute the decay of the input particle. In this function PYTHIA is called to execute the decay of the input particle.
*/ */
template <typename TProjectile> template <typename TSecondaryView>
void DoDecay(TProjectile&); void DoDecay(TSecondaryView&);
private: private:
void SetUnstable(const corsika::particles::Code); void SetUnstable(const corsika::particles::Code);
......
...@@ -176,10 +176,12 @@ namespace corsika::process::sibyll { ...@@ -176,10 +176,12 @@ namespace corsika::process::sibyll {
} }
template <> template <>
void Decay::DoDecay(SetupProjectile& vP) { void Decay::DoDecay(SetupView& view) {
using geometry::Point; using geometry::Point;
using namespace units::si; using namespace units::si;
auto const projectile = view.GetProjectile();
const particles::Code pCode = vP.GetPID(); const particles::Code pCode = vP.GetPID();
// check if sibyll is configured to handle this decay! // check if sibyll is configured to handle this decay!
if (!IsDecayHandled(pCode)) if (!IsDecayHandled(pCode))
...@@ -190,14 +192,14 @@ namespace corsika::process::sibyll { ...@@ -190,14 +192,14 @@ namespace corsika::process::sibyll {
ss.Clear(); ss.Clear();
// copy particle to sibyll stack // copy particle to sibyll stack
ss.AddParticle(process::sibyll::ConvertToSibyllRaw(pCode), vP.GetEnergy(), ss.AddParticle(process::sibyll::ConvertToSibyllRaw(pCode), projectile.GetEnergy(),
vP.GetMomentum(), projectile.GetMomentum(),
// setting particle mass with Corsika values, may be inconsistent // setting particle mass with Corsika values, may be inconsistent
// with sibyll internal values // with sibyll internal values
particles::GetMass(pCode)); particles::GetMass(pCode));
// remember position // remember position
Point const decayPoint = vP.GetPosition(); Point const decayPoint = projectile.GetPosition();
TimeType const t0 = vP.GetTime(); TimeType const t0 = projectile.GetTime();
// remember if particles is unstable // remember if particles is unstable
// auto const priorIsUnstable = IsUnstable(pCode); // auto const priorIsUnstable = IsUnstable(pCode);
// switch on decay for this particle // switch on decay for this particle
...@@ -220,7 +222,7 @@ namespace corsika::process::sibyll { ...@@ -220,7 +222,7 @@ namespace corsika::process::sibyll {
// FOR NOW: skip particles that have decayed in Sibyll, move to iterator? // FOR NOW: skip particles that have decayed in Sibyll, move to iterator?
if (psib.HasDecayed()) continue; if (psib.HasDecayed()) continue;
// add to corsika stack // add to corsika stack
vP.AddSecondary( view.AddSecondary(
tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector,
geometry::Point, units::si::TimeType>{ geometry::Point, units::si::TimeType>{
process::sibyll::ConvertFromSibyll(psib.GetPID()), psib.GetEnergy(), process::sibyll::ConvertFromSibyll(psib.GetPID()), psib.GetEnergy(),
......
...@@ -52,8 +52,8 @@ namespace corsika::process { ...@@ -52,8 +52,8 @@ namespace corsika::process {
In this function SIBYLL is called to produce to decay the input particle. In this function SIBYLL is called to produce to decay the input particle.
*/ */
template <typename TProjectile> template <typename TSecondaryView>
void DoDecay(TProjectile&); void DoDecay(TSecondaryView&);
template <typename TParticleView> template <typename TParticleView>
EProcessReturn DoSecondaries(TParticleView&); EProcessReturn DoSecondaries(TParticleView&);
......
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