20 const auto &log = logger<LogArea::HyperSurfaceCrossing>();
21 log.debug(
"Process: Hypersurface Crossing. ");
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) {
100 bool hypersurface_is_crossed = crosses_hypersurface(
101 pdata_before_propagation, pdata_after_propagation, prop_time_);
103 if (hypersurface_is_crossed) {
105 FourVector crossing_position = coordinates_on_hypersurface(
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;
void generate_final_state() override
Generate the final state of the hypersurface crossing particles.
#define SMASH_UNUSED(x)
Mark as unused, silencing compiler warnings.
The ThreeVector class represents a physical three-vector with the components .
const FourVector & position() const
Get the particle's position in Minkowski space.
void check_conservation(const uint32_t id_process) const override
Check various conservation laws.
double tau() const
calculate the proper time from the given four vector
ThreeVector velocity() const
Get the velocity 3-vector.
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
ThreeVector velocity() const
Get the velocity (3-vector divided by zero component).
ParticleList incoming_particles_
List with data of incoming particles.
A container for storing conserved values.
bool crosses_hypersurface(ParticleData &pdata_before_propagation, ParticleData &pdata_after_propagation, const double tau) const
Determine whether particle crosses hypersurface within next timestep during propagation.
void set_4position(const FourVector &pos)
Set the particle's 4-position directly.
FourVector coordinates_on_hypersurface(ParticleData &pdata_before_propagation, ParticleData &pdata_after_propagation, const double tau) const
Find the coordinates where particle crosses hypersurface.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
ActionList find_actions_in_cell(const ParticleList &plist, double dt, const double, const std::vector< FourVector > &beam_momentum) const override
Find the next hypersurface crossings for each particle that occur within the timestepless propagation...
ParticleData contains the dynamic information of a certain particle.