23 ParticleList empty_list;
33 const uint32_t id_process)
const {
36 if (before == after) {
39 throw std::runtime_error(
40 "Conservation laws conserved in the hypersurface "
41 "crossing action. Particle was not properly removed in process: " +
42 std::to_string(id_process));
46 throw std::runtime_error(
47 "Particle was not removed successfully in "
48 "hypersurface crossing action.");
53 const ParticleList &plist,
double dt,
const double,
54 const std::vector<FourVector> &beam_momentum)
const {
55 std::vector<ActionPtr> actions;
60 double t0 =
p.position().x0();
61 double t_end = t0 + dt;
80 const bool no_prior_interactions =
81 (static_cast<uint64_t>(
p.id()) <
82 static_cast<uint64_t>(beam_momentum.size())) &&
83 (
p.get_history().collisions_per_particle == 0);
85 if (no_prior_interactions) {
101 pdata_before_propagation, pdata_after_propagation,
prop_time_);
103 if (hypersurface_is_crossed) {
106 pdata_before_propagation, pdata_after_propagation,
prop_time_);
108 double time_until_crossing = crossing_position[0] - t0;
112 ActionPtr action = make_unique<HypersurfacecrossingAction>(
113 p, outgoing_particle, time_until_crossing);
114 actions.emplace_back(std::move(action));
122 ParticleData &pdata_after_propagation,
const double tau)
const {
123 bool hypersurface_is_crossed =
false;
124 const bool t_greater_z_before_prop =
125 (fabs(pdata_before_propagation.
position().
x0()) >
126 fabs(pdata_before_propagation.
position().
x3())
129 const bool t_greater_z_after_prop =
130 (fabs(pdata_after_propagation.
position().
x0()) >
135 if (t_greater_z_before_prop && t_greater_z_after_prop) {
137 const double tau_before = pdata_before_propagation.
position().
tau();
138 const double tau_after = pdata_after_propagation.
position().
tau();
140 if (tau_before <= tau && tau <= tau_after) {
141 hypersurface_is_crossed =
true;
143 }
else if (!t_greater_z_before_prop && t_greater_z_after_prop) {
145 const double tau_after = pdata_after_propagation.
position().
tau();
146 if (tau_after >= tau) {
147 hypersurface_is_crossed =
true;
151 return hypersurface_is_crossed;
156 ParticleData &pdata_after_propagation,
const double tau)
const {
158 const double t1 = pdata_before_propagation.
position().
x0();
159 const double z1 = pdata_before_propagation.
position().
x3();
162 const double t2 = pdata_after_propagation.
position().
x0();
163 const double z2 = pdata_after_propagation.
position().
x3();
167 const double m = (z2 - z1) / (t2 - t1);
168 const double n = z1 - m * t1;
172 const double sol1 =
n * m / (1 - m * m) +
173 std::sqrt((1 - m * m) * tau * tau +
n *
n) / (1 - m * m);
174 const double sol2 =
n * m / (1 - m * m) -
175 std::sqrt((1 - m * m) * tau * tau +
n *
n) / (1 - m * m);
178 assert((sol1 >= t1 && sol1 <= t2));
179 assert(!(sol2 >= t1 && sol2 <= t2));
185 crossing_position.
set_x0(sol1);
187 return crossing_position;