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