10 #ifndef SRC_INCLUDE_ACTION_H_ 11 #define SRC_INCLUDE_ACTION_H_ 43 Action(
const ParticleList &in_part,
double time)
74 Action(
const ParticleList &in_part,
const ParticleList &out_part,
139 template <
typename Branch>
141 ProcessBranchList<Branch> &subprocesses,
142 double &total_weight) {
143 if (p->weight() > 0) {
144 total_weight += p->weight();
145 subprocesses.emplace_back(std::move(p));
156 template <
typename Branch>
158 ProcessBranchList<Branch> &subprocesses,
159 double &total_weight) {
160 subprocesses.reserve(subprocesses.size() + pv.size());
161 for (
auto &proc : pv) {
162 if (proc->weight() > 0) {
163 total_weight += proc->weight();
164 subprocesses.emplace_back(std::move(proc));
298 using std::invalid_argument::invalid_argument;
325 for (
const auto &
p : incoming_particles_) {
340 template <
typename Branch>
342 double total_weight) {
343 const auto &log = logger<LogArea::Action>();
345 double weight_sum = 0.;
348 for (
const auto &proc : subprocesses) {
349 weight_sum += proc->weight();
350 if (random_weight <= weight_sum) {
357 "Problem in choose_channel: ", subprocesses.size(),
" ",
358 weight_sum,
" ", total_weight,
" ",
360 random_weight,
"\n");
375 double kinetic_energy_cm)
const;
387 double kinetic_energy_cm);
448 inline std::vector<ActionPtr> &
operator+=(std::vector<ActionPtr> &lhs,
449 std::vector<ActionPtr> &&rhs) {
450 if (lhs.size() == 0) {
451 lhs = std::move(rhs);
453 lhs.insert(lhs.end(), std::make_move_iterator(rhs.begin()),
454 std::make_move_iterator(rhs.end()));
463 inline std::ostream &
operator<<(std::ostream &out,
const ActionPtr &action) {
464 return out << *action;
471 std::ostream &
operator<<(std::ostream &out,
const ActionList &actions);
475 #endif // SRC_INCLUDE_ACTION_H_ friend std::ostream & operator<<(std::ostream &out, const Action &action)
Dispatches formatting to the virtual Action::format_debug_output function.
const ParticleType & type_of_pout(const ParticleData &p_out) const
Get the type of a given particle.
virtual void format_debug_output(std::ostream &out) const =0
Writes information about this action to the out stream.
virtual void generate_final_state()=0
Generate the final state for this action.
double sqrt_s() const
Determine the total energy in the center-of-mass frame [GeV].
ProcessType
Process Types are used to identify the type of the process.
ProcessType process_type_
type of process
Action(const ParticleList &in_part, const ParticleList &out_part, double absolute_execution_time, ProcessType type)
Construct an action object with the incoming particles, absolute time, and the already known outgoing...
Action(const ParticleList &in_part, double time)
Construct an action object with incoming particles and relative time.
double abs() const
calculate the lorentz invariant absolute value
double time_of_execution() const
Get the time at which the action is supposed to be performed.
virtual double get_partial_weight() const =0
Return the specific weight for the chosen outgoing channel, which is mainly used for the partial weig...
Action(const ParticleData &in_part, const ParticleData &out_part, double time, ProcessType type)
Construct an action object with the incoming particles, relative time, and the already known outgoing...
bool operator<(const Action &rhs) const
Determine whether one action takes place before another in time.
bool is_pauli_blocked(const Particles &particles, const PauliBlocker &p_bl) const
Check if the action is Pauli-blocked.
void update_incoming(const Particles &particles)
Update the incoming particles that are stored in this action to the state they have in the global par...
virtual ProcessType get_type() const
Get the process type.
virtual void sample_angles(std::pair< double, double > masses, double kinetic_energy_cm)
Sample final-state momenta in general X->2 processes (here: using an isotropical angular distribution...
FourVector total_momentum() const
Sum of 4-momenta of incoming particles.
FourVector total_momentum_of_outgoing_particles() const
Calculate the total kinetic momentum of the outgoing particles.
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
#define source_location
Hackery that is required to output the location in the source code where the log statement occurs...
virtual void sample_3body_phasespace()
Sample the full 3-body phase-space (masses, momenta, angles) in the center-of-mass frame for the fina...
Particle type contains the static properties of a particle species.
ParticleList incoming_particles_
List with data of incoming particles.
std::pair< FourVector, FourVector > get_potential_at_interaction_point() const
Get the skyrme and asymmetry potential at the interaction point.
void add_process(ProcessBranchPtr< Branch > &p, ProcessBranchList< Branch > &subprocesses, double &total_weight)
Add a new subprocess.
A class that stores parameters needed for Pauli blocking, tabulates necessary integrals and computes ...
const ParticleType & type() const
Get the type of the particle.
void add_processes(ProcessBranchList< Branch > pv, ProcessBranchList< Branch > &subprocesses, double &total_weight)
Add several new subprocesses at once.
Action is the base class for a generic process that takes a number of incoming particles and transfor...
virtual double get_total_weight() const =0
Return the total weight value, which is mainly used for the weight output entry.
virtual std::pair< double, double > sample_masses(double kinetic_energy_cm) const
Sample final-state masses in general X->2 processes (thus also fixing the absolute c...
bool is_valid(const Particles &particles) const
Check whether the action still applies.
FourVector get_interaction_point() const
Get the interaction point.
void check_conservation(const uint32_t id_process) const
Check various conservation laws.
std::vector< ActionPtr > & operator+=(std::vector< ActionPtr > &lhs, std::vector< ActionPtr > &&rhs)
Append vector of action pointers.
void sample_2body_phasespace()
Sample the full 2-body phase-space (masses, momenta, angles) in the center-of-mass frame for the fina...
const Branch * choose_channel(const ProcessBranchList< Branch > &subprocesses, double total_weight)
Decide for a particular final-state channel via Monte-Carlo and return it as a ProcessBranch.
const ParticleList & incoming_particles() const
Get the list of particles that go into the action.
A pointer-like interface to global references to ParticleType objects.
The Particles class abstracts the storage and manipulation of particles.
const ParticleType & type_of_pout(const ParticleTypePtr &p_out) const
Get the particle type for given pointer to a particle type.
const ParticleList & outgoing_particles() const
Get the list of particles that resulted from the action.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
ParticleData contains the dynamic information of a certain particle.
virtual ~Action()
Virtual Destructor.
const double time_of_execution_
Time at which the action is supposed to be performed (absolute time in the lab frame in fm/c)...
virtual void perform(Particles *particles, uint32_t id_process)
Actually perform the action, e.g.