19#include "HepMC3/Attribute.h"
20#include "HepMC3/GenEvent.h"
21#include "HepMC3/GenParticle.h"
22#include "marley/hepmc3_utils.hh"
23#include "marley/marley_utils.hh"
24#include "marley/Error.hh"
25#include "marley/Generator.hh"
26#include "marley/Level.hh"
27#include "marley/Logger.hh"
28#include "marley/MatrixElement.hh"
29#include "marley/NucleusDecayer.hh"
30#include "marley/Parity.hh"
31#include "marley/Reaction.hh"
36 int pdg_c,
int pdg_d,
int q_d,
const std::string&
source_file )
67 if (
pdg_d_ > 1000000000 ) {
93 double E_CM = std::sqrt( std::pow(
ma_ +
mb_, 2) + 2*
mb_*KEa );
112 double Qw = Ni - ( 1. - 4.*marley_utils::sin2thetaw )*
Zi_;
127 std::shared_ptr< HepMC3::GenEvent >& event )
const
130 auto target = marley_hepmc3::get_target( *event );
131 marley_hepmc3::set_particle_charge( *target, 0 );
134 auto residue = marley_hepmc3::get_residue( *event );
135 marley_hepmc3::set_particle_charge( *residue,
q_d_ );
139 const std::shared_ptr< HepMC3::GenParticle >& residue,
144 std::make_shared< HepMC3::DoubleAttribute >(E_level) );
146 std::make_shared< HepMC3::IntAttribute >(twoJ) );
148 std::make_shared< HepMC3::IntAttribute >(
static_cast<int>( P )) );
151std::shared_ptr< HepMC3::GenEvent >
153 double KEa,
double pc_cm,
double cos_theta_c_cm,
double phi_c_cm,
154 double Ec_cm,
double Ed_cm,
double E_level,
int twoJ,
161 cos_theta_c_cm, phi_c_cm, Ec_cm, Ed_cm,
162 marley_hepmc3::NUHEPMC_UNDECAYED_RESIDUE_STATUS );
169 auto residue = marley_hepmc3::get_residue( *event );
175std::shared_ptr< HepMC3::GenEvent >
177 double KEa,
const std::shared_ptr< HepMC3::GenParticle >& ejectile,
178 const std::shared_ptr< HepMC3::GenParticle >& residue,
bool add_attribute(const std::string &name, std::shared_ptr< Attribute > att)
Add an attribute to this particle.
Singleton lookup table for particle and atomic masses.
static const MassTable & Instance()
Get a const reference to the singleton instance of the MassTable.
double get_atomic_mass(int pdg_code, bool theory_ok=true) const
Get the mass of an atom.
double get_particle_mass(int pdg_code) const
Get the mass of a particle.
int Ai_
Target mass number.
double weak_nuclear_charge() const
void set_nuclear_residue_attributes(const std::shared_ptr< HepMC3::GenParticle > &residue, double E_level, int twoJ, const marley::Parity &P) const
Helper function that adds the nuclear level attributes ( , , and parity) needed to keep track of the ...
double threshold_kinetic_energy() const override
Get the minimum lab-frame kinetic energy (MeV) of the projectile that allows this reaction to proceed...
virtual std::shared_ptr< HepMC3::GenEvent > make_nuclear_event_object(double KEa, double pc_cm, double cos_theta_c_cm, double phi_c_cm, double Ec_cm, double Ed_cm, double E_level, int twoJ, const marley::Parity &P) const
Helper function that makes a complete event object for a nuclear reaction.
virtual void set_description()
Creates the description string based on the PDG code values for the initial and final particles.
double max_level_energy(double KEa) const
Get the maximum possible excitation energy (MeV) of the final-state residue that is kinematically all...
int q_d_
Net charge of the residue (in units of the proton charge) following this reaction.
NuclearReaction(ProcessType pt, int pdg_a, int pdg_b, int pdg_c, int pdg_d, int q_d, const std::string &source_file)
int Zi_
Target atomic number.
int Af_
Residue mass number.
double KEa_threshold_
Lab-frame kinetic energy of the projectile at threshold for this reaction (i.e., the residue is produ...
int Zf_
Residue atomic number.
double md_gs_
Ground state mass (MeV) of the residue.
void set_charge_attributes(std::shared_ptr< HepMC3::GenEvent > &event) const
Helper function that sets the charges of the target and residue in an otherwise complete event record...
Type-safe representation of a parity value (either +1 or -1)
Reaction(const std::string &source_file)
Construct a Reaction with the resolved path of the data file.
int pdg_a_
PDG code for the projectile.
ProcessType process_type_
Type of scattering process (CC, NC) represented by this reaction.
double mc_
Ejectile mass (MeV)
ProcessType
Enumerated type describing the kind of scattering process represented by a Reaction.
const std::string & source_file() const
Get the resolved path of the reaction data file used to construct this Reaction.
std::string description_
String that contains a formula describing the reaction.
virtual std::shared_ptr< HepMC3::GenEvent > make_event_object(double KEa, double pc_cm, double cos_theta_c_cm, double phi_c_cm, double Ec_cm, double Ed_cm, int residue_status) const
Helper function that makes an event object.
int pdg_c_
PDG code for the ejectile.
int pdg_d_
PDG code for the residue.
int pdg_a() const
Get the projectile PDG code.
int pdg_b_
PDG code for the target.
double ma_
Projectile mass (MeV)
int pdg_b() const
Get the target PDG code.
double mb_
Target mass (MeV)