Version: SMASH-3.1
wallcrossingaction.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2017-2019,2022
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
11 
12 namespace smash {
13 
15  const ParticleList& plist, double t_max, const double,
16  const std::vector<FourVector>&) const {
17  std::vector<ActionPtr> actions;
18  for (const ParticleData& p : plist) {
19  const ThreeVector& r = p.position().threevec();
20  const ThreeVector& v = p.velocity();
21  double time_until_crossing = t_max;
22  int i_cross = -1;
23  for (int i = 0; i < 3; i++) {
24  double t = t_max + 1.;
25  if (v[i] > really_small) {
26  t = (l_[i] - r[i]) / v[i];
27  } else if (v[i] < -really_small) {
28  t = -r[i] / v[i];
29  }
30  if (t < time_until_crossing) {
31  time_until_crossing = t;
32  i_cross = i;
33  }
34  }
35  // No crossing
36  if (i_cross == -1) {
37  continue;
38  }
39  FourVector crossing_point(p.position().x0() + time_until_crossing,
40  r + v * time_until_crossing);
41  crossing_point[i_cross + 1] = ((v[i_cross] > 0.0) ? 0.0 : l_[i_cross]);
42 
43  ParticleData outgoing_particle(p);
44  outgoing_particle.set_4position(crossing_point);
45  ActionPtr action = std::make_unique<WallcrossingAction>(
46  p, outgoing_particle, time_until_crossing);
47  actions.emplace_back(std::move(action));
48  }
49  return actions;
50 }
51 
52 } // namespace smash
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
Definition: fourvector.h:33
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:58
void set_4position(const FourVector &pos)
Set the particle's 4-position directly.
Definition: particledata.h:209
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:31
ActionList find_actions_in_cell(const ParticleList &plist, double t_max, const double, const std::vector< FourVector > &) const override
Find the next wall crossings for every particle before time t_max.
const std::array< double, 3 > l_
Periods in x,y,z directions in fm.
constexpr int p
Proton.
Definition: action.h:24
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:37