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