Version: SMASH-2.0
wallcrossingaction.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2017-2019
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 = make_unique<WallcrossingAction>(p, outgoing_particle,
46  time_until_crossing);
47  actions.emplace_back(std::move(action));
48  }
49  return actions;
50 }
51 
52 } // namespace smash
smash
Definition: action.h:24
smash::ParticleData
Definition: particledata.h:52
smash::really_small
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:37
wallcrossingaction.h
smash::ThreeVector
Definition: threevector.h:31
smash::WallCrossActionsFinder::l_
const std::array< double, 3 > l_
Periods in x,y,z directions in fm.
Definition: wallcrossingaction.h:91
smash::ParticleData::set_4position
void set_4position(const FourVector &pos)
Set the particle's 4-position directly.
Definition: particledata.h:203
smash::FourVector
Definition: fourvector.h:33
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
smash::WallCrossActionsFinder::find_actions_in_cell
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.
Definition: wallcrossingaction.cc:14