7 std::size_t localDestroyNum, std::size_t oldDaughterLocal,
8 const Kokkos::View<ippl::Vector<double, 3>*>& parentR,
9 const Kokkos::View<ippl::Vector<double, 3>*>& parentP,
10 const Kokkos::View<double*>& parentDt,
11 const Kokkos::View<ippl::Vector<float, 3>*>& ) {
12 using pc_size_type = ippl::detail::size_type;
20 using PolView_t = Kokkos::View<ippl::Vector<float, 3>*>;
22 if (daughterHasSpin) {
52 const double pFixed = (M * M - md * md) / (2.0 * M);
53 const double eDaughter = Kokkos::sqrt(pFixed * pFixed + md * md);
56 "PionDecay::createDaughters",
static_cast<pc_size_type
>(localDestroyNum),
57 KOKKOS_LAMBDA(
const pc_size_type j) {
58 auto gen = pool.get_state();
61 const double cosTheta = 2.0 * gen.drand(0.0, 1.0) - 1.0;
62 const double sinTheta = Kokkos::sqrt(1.0 - cosTheta * cosTheta);
63 const double phi = 2.0 *
Physics::pi * gen.drand(0.0, 1.0);
64 const double pxRF = pFixed * sinTheta * Kokkos::cos(phi);
65 const double pyRF = pFixed * sinTheta * Kokkos::sin(phi);
66 const double pzRF = pFixed * cosTheta;
73 const auto& parentMom = parentP(j);
74 const double bg2 = parentMom[0] * parentMom[0] + parentMom[1] * parentMom[1]
75 + parentMom[2] * parentMom[2];
76 const double gamma = Kokkos::sqrt(1.0 + bg2);
77 const double betaX = parentMom[0] / gamma;
78 const double betaY = parentMom[1] / gamma;
79 const double betaZ = parentMom[2] / gamma;
80 const double beta2 = bg2 / (gamma * gamma);
82 double pxLab, pyLab, pzLab;
84 const double betaDotP = betaX * pxRF + betaY * pyRF + betaZ * pzRF;
85 const double factor = (gamma - 1.0) * betaDotP / beta2 + gamma * eDaughter;
86 pxLab = pxRF + factor * betaX;
87 pyLab = pyRF + factor * betaY;
88 pzLab = pzRF + factor * betaZ;
97 const pc_size_type idx =
static_cast<pc_size_type
>(oldDaughterLocal) + j;
99 dP(idx)[0] = pxLab / daughterMass;
100 dP(idx)[1] = pyLab / daughterMass;
101 dP(idx)[2] = pzLab / daughterMass;
102 dDt(idx) = parentDt(j);
108 if (daughterHasSpin) {
109 const double inv = helicitySign / pFixed;
110 dPol(idx)[0] =
static_cast<float>(pxRF * inv);
111 dPol(idx)[1] =
static_cast<float>(pyRF * inv);
112 dPol(idx)[2] =
static_cast<float>(pzRF * inv);
115 pool.free_state(gen);
void createDaughterParticles(std::size_t localDestroyNum, std::size_t oldDaughterLocal, const Kokkos::View< ippl::Vector< double, 3 > * > &parentR, const Kokkos::View< ippl::Vector< double, 3 > * > &parentP, const Kokkos::View< double * > &parentDt, const Kokkos::View< ippl::Vector< float, 3 > * > &parentPol) override
Create daughter particles from collected parent data.