MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
marley::Reaction Class Referenceabstract

Abstract base class that represents a 2 → 2 scattering reaction. More...

#include <Reaction.hh>

Inheritance diagram for marley::Reaction:
marley::ElectronReaction marley::NuclearReaction marley::ContinuumNuclearReaction marley::DiscreteNuclearReaction

Public Types

enum  DataFormat { DiscreteStrengths = 0 , MultipoleResponses = 1 }
 Enumerated type describing the file format for reaction data. More...
 
enum  ProcessType {
  Unknown = -1 , NeutrinoCC_Discrete = 0 , AntiNeutrinoCC_Discrete = 1 , NC_Discrete = 2 ,
  NuElectronElastic = 3 , NeutrinoCC_Continuum = 4 , AntiNeutrinoCC_Continuum = 5 , NC_Continuum = 6 ,
  StandaloneDecay = 7
}
 Enumerated type describing the kind of scattering process represented by a Reaction. More...
 

Public Member Functions

 Reaction (const std::string &source_file)
 Construct a Reaction with the resolved path of the data file.
 
virtual marley::TargetAtom atomic_target () const =0
 Returns the target atom involved in this reaction.
 
virtual std::shared_ptr< HepMC3::GenEventcreate_event (int pdg_a, double KEa, marley::Generator &gen) const =0
 Create an event object for this reaction.
 
const std::string & get_description () const
 Get a string that contains the formula for this reaction.
 
int pdg_a () const
 Get the projectile PDG code.
 
int pdg_b () const
 Get the target PDG code.
 
ProcessType process_type () const
 Get the process type for this reaction.
 
const std::string & source_file () const
 Get the resolved path of the reaction data file used to construct this Reaction.
 
virtual double threshold_kinetic_energy () const =0
 Get the minimum lab-frame kinetic energy (MeV) of the projectile that allows this reaction to proceed via a transition to the residue's ground state.
 
virtual double total_xs (int pdg_a, double KEa) const =0
 Compute the reaction's total cross section (MeV -2)
 

Static Public Member Functions

static int get_ejectile_pdg (int pdg_a, ProcessType proc_type)
 
static void get_residue_pdg_and_charge (ProcessType proc_type, int pdg_b, int &pdg_d, int &q_d)
 
static std::vector< std::unique_ptr< Reaction > > load_from_file (const std::string &filename, StructureDatabase &db, CoulombCorrector::CoulombMode coulomb_mode, const JSON &ff_config)
 
static std::string proc_type_to_string (const ProcessType &pt)
 

Protected Member Functions

virtual std::shared_ptr< HepMC3::GenEventmake_event_object (double KEa, const std::shared_ptr< HepMC3::GenParticle > &ejectile, const std::shared_ptr< HepMC3::GenParticle > &residue) const
 Helper function that makes an event object.
 
virtual std::shared_ptr< HepMC3::GenEventmake_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.
 
void two_two_scatter (double KEa, double &s, double &Ec_cm, double &pc_cm, double &Ed_cm) const
 Helper function that handles CM frame kinematics for the reaction.
 

Static Protected Member Functions

static const std::vector< int > & get_projectiles (ProcessType proc_type)
 

Protected Attributes

std::string description_
 String that contains a formula describing the reaction.
 
double ma_
 Projectile mass (MeV)
 
double mb_
 Target mass (MeV)
 
double mc_
 Ejectile mass (MeV)
 
double md_
 Residue mass (MeV)
 
int pdg_a_
 PDG code for the projectile.
 
int pdg_b_
 PDG code for the target.
 
int pdg_c_
 PDG code for the ejectile.
 
int pdg_d_
 PDG code for the residue.
 
ProcessType process_type_
 Type of scattering process (CC, NC) represented by this reaction.
 
const std::string source_file_
 Resolved path of the reaction data file.
 

Detailed Description

Abstract base class that represents a 2 → 2 scattering reaction.

This class models a reaction of the form a + b → c + d. The projectile (particle a) is taken to have lab-frame kinetic energy KEa and to be traveling toward the target along the positive z direction. The target (particle b) is taken to be at rest in the lab frame.

Todo
Add check that projectile kinetic energy KEa >= 0. for all relevant member functions of Reaction and NuclearReaction

Definition at line 46 of file Reaction.hh.

Member Enumeration Documentation

◆ DataFormat

Enumerated type describing the file format for reaction data.

Enumerator
DiscreteStrengths 

Fermi and Gamow-Teller matrix elements are tabulated for discrete nuclear levels

MultipoleResponses 

Continuum nuclear responses are given for one or more multipoles.

Definition at line 71 of file Reaction.hh.

71 {
77 };
@ MultipoleResponses
Continuum nuclear responses are given for one or more multipoles.
Definition Reaction.hh:76

◆ ProcessType

Enumerated type describing the kind of scattering process represented by a Reaction.

Enumerator
Unknown 

Dummy value used for error handling.

NeutrinoCC_Discrete 

Nuclear matrix elements contain \( t_{-} \) for a transition to a discrete nuclear level.

AntiNeutrinoCC_Discrete 

Nuclear matrix elements contain \( t_{+} \) for a transition to a discrete nuclear level.

NC_Discrete 

Nuclear matrix elements contain \( t_{3} \) for a transition to a discrete nuclear level.

NuElectronElastic 

Neutrino-electron elastic scattering.

NeutrinoCC_Continuum 

Nuclear matrix elements contain \( t_{-} \) for a transition to a continuum of nuclear levels.

AntiNeutrinoCC_Continuum 

Nuclear matrix elements contain \( t_{+} \) for a transition to a continuum of nuclear levels.

NC_Continuum 

Nuclear matrix elements contain \( t_{3} \) for a transition to a continuum of nuclear levels.

StandaloneDecay 

Standalone nuclear de-excitation with no simulated primary reaction (used by "marley decay")

Definition at line 58 of file Reaction.hh.

58 {
59 Unknown = -1,
62 NC_Discrete = 2,
66 NC_Continuum = 6,
67 StandaloneDecay = 7,
68 };
@ NC_Continuum
Nuclear matrix elements contain for a transition to a continuum of nuclear levels.
Definition Reaction.hh:66
@ NC_Discrete
Nuclear matrix elements contain for a transition to a discrete nuclear level.
Definition Reaction.hh:62
@ Unknown
Dummy value used for error handling.
Definition Reaction.hh:59
@ StandaloneDecay
Standalone nuclear de-excitation with no simulated primary reaction (used by "marley decay")
Definition Reaction.hh:67
@ AntiNeutrinoCC_Discrete
Nuclear matrix elements contain for a transition to a discrete nuclear level.
Definition Reaction.hh:61
@ NuElectronElastic
Neutrino-electron elastic scattering.
Definition Reaction.hh:63
@ NeutrinoCC_Discrete
Nuclear matrix elements contain for a transition to a discrete nuclear level.
Definition Reaction.hh:60
@ AntiNeutrinoCC_Continuum
Nuclear matrix elements contain for a transition to a continuum of nuclear levels.
Definition Reaction.hh:65
@ NeutrinoCC_Continuum
Nuclear matrix elements contain for a transition to a continuum of nuclear levels.
Definition Reaction.hh:64

Constructor & Destructor Documentation

◆ Reaction()

marley::Reaction::Reaction ( const std::string & source_file)

Construct a Reaction with the resolved path of the data file.

Parameters
source_fileResolved path of the reaction data file

Definition at line 362 of file Reaction.cc.

const std::string & source_file() const
Get the resolved path of the reaction data file used to construct this Reaction.
Definition Reaction.hh:104
const std::string source_file_
Resolved path of the reaction data file.
Definition Reaction.hh:210

References source_file(), and source_file_.

Referenced by marley::NuclearReaction::NuclearReaction().

Member Function Documentation

◆ atomic_target()

virtual marley::TargetAtom marley::Reaction::atomic_target ( ) const
pure virtual

Returns the target atom involved in this reaction.

For nuclear reactions, this is identical to the pdg_b_ member variable. For electron reactions, it is distinct (since particle b is the initial struck electron).

Implemented in marley::ElectronReaction, and marley::NuclearReaction.

References pdg_a(), and pdg_b().

Referenced by marley::Generator::create_event().

◆ create_event()

virtual std::shared_ptr< HepMC3::GenEvent > marley::Reaction::create_event ( int pdg_a,
double KEa,
marley::Generator & gen ) const
pure virtual

Create an event object for this reaction.

Parameters
pdg_aPDG code for the incident projectile
KEaLab-frame kinetic energy of the projectile
genReference to the Generator to use for random sampling
Note
Functions that override create_event() should throw an Error if pdg_a != pdg_a_.

Implemented in marley::ContinuumNuclearReaction, marley::DiscreteNuclearReaction, and marley::ElectronReaction.

References pdg_a().

Referenced by marley::Generator::create_event().

◆ get_description()

const std::string & marley::Reaction::get_description ( ) const
inline

Get a string that contains the formula for this reaction.

Definition at line 97 of file Reaction.hh.

97{ return description_; }
std::string description_
String that contains a formula describing the reaction.
Definition Reaction.hh:157

References description_.

◆ get_ejectile_pdg()

int marley::Reaction::get_ejectile_pdg ( int pdg_a,
ProcessType proc_type )
static

Function that returns the ejectile PDG code given the projectile PDG code and the ProcessType

Definition at line 329 of file Reaction.cc.

329 {
330 int pdg_c = 0;
331
332 // First, check that the projectile PDG code is valid for the
333 // given process type
334 const auto& vec = proc_type_to_nu_pdg.at( proc_type );
335 if ( std::find(vec.cbegin(), vec.cend(), pdg_a) != vec.end() ) {
336 if ( proc_type == ProcType::NeutrinoCC_Discrete ||
337 proc_type == ProcType::NeutrinoCC_Continuum ) pdg_c = pdg_a - 1;
338 else if ( proc_type == ProcType::AntiNeutrinoCC_Discrete ||
339 proc_type == ProcType::AntiNeutrinoCC_Continuum ) pdg_c = pdg_a + 1;
340 else if ( proc_type == ProcType::NC_Discrete ||
341 proc_type == ProcType::NC_Continuum ) pdg_c = pdg_a;
342
343 else if ( proc_type == ProcType::NuElectronElastic ) pdg_c = pdg_a;
344 else throw marley::Error("Unrecognized ProcessType encountered in"
345 " marley::Reaction::get_ejectile_pdg()");
346 }
347 else throw marley::Error("A projectile with PDG code "
348 + std::to_string(pdg_a) + " cannot participate in reactions of type "
349 + proc_type_to_string_map.at(proc_type));
350
351 return pdg_c;
352}
int pdg_a() const
Get the projectile PDG code.
Definition Reaction.hh:109

References pdg_a().

Referenced by marley::TabulatedXSec::compute_integral(), and load_from_file().

◆ get_projectiles()

const std::vector< int > & marley::Reaction::get_projectiles ( ProcessType proc_type)
staticprotected

Returns a vector of PDG codes for projectiles that participate in a particular ProcessType

Definition at line 358 of file Reaction.cc.

358 {
359 return proc_type_to_nu_pdg.at( pt );
360}

Referenced by load_from_file().

◆ get_residue_pdg_and_charge()

void marley::Reaction::get_residue_pdg_and_charge ( ProcessType proc_type,
int pdg_b,
int & pdg_d,
int & q_d )
static

Determines the PDG code and net charge of the residue given the target PDG code and the process type

Definition at line 573 of file Reaction.cc.

575{
576 // First, figure out the PDG code for the final nucleus and its ionization
577 // state (net atomic charge after the 2->2 scatter)
578 int Zi = marley_utils::get_particle_Z( pdg_b );
579 int A = marley_utils::get_particle_A( pdg_b );
580
581 // NC scattering leaves the target nucleus the same
584 {
585 pdg_d = pdg_b;
586 q_d = 0;
587 }
588 // Neutrino CC scattering raises Z by one
591 {
592 // Check that the neutron number of the target is positive
593 int Ni = A - Zi;
594 if ( Ni <= 0 ) throw marley::Error("A NeutrinoCC process requires"
595 " a target nucleus with N > 0");
596 int Zf = Zi + 1;
597 pdg_d = marley_utils::get_nucleus_pid(Zf, A);
598 // Recoil ion has charge +1
599 q_d = 1;
600 }
601 // Antineutrino CC scattering lowers Z by one
604 {
605 // Check that the neutron number of the target is positive
606 if ( Zi <= 0 ) throw marley::Error("An AntiNeutrinoCC process requires"
607 " a target nucleus with Z > 0");
608 int Zf = Zi - 1;
609 pdg_d = marley_utils::get_nucleus_pid(Zf, A);
610 // Recoil ion has charge -1
611 q_d = -1;
612 }
613 else throw marley::Error( "Unrecognized ProcessType encountered in"
614 " marley::Reaction::get_residue_pdg_and_charge()" );
615}
int pdg_b() const
Get the target PDG code.
Definition Reaction.hh:112

References AntiNeutrinoCC_Continuum, AntiNeutrinoCC_Discrete, NC_Continuum, NC_Discrete, NeutrinoCC_Continuum, NeutrinoCC_Discrete, and pdg_b().

Referenced by load_from_file().

◆ load_from_file()

std::vector< std::unique_ptr< marley::Reaction > > marley::Reaction::load_from_file ( const std::string & filename,
marley::StructureDatabase & db,
CoulombCorrector::CoulombMode coulomb_mode,
const JSON & ff_config )
static

Factory method called by JSONConfig to build Reaction objects given a file with matrix element data

Todo
Add error handling for parsing problems
Todo
This can be done more cleanly via iss = std::istringstream( line ); However, GCC 4 does not include the move constructor for string streams. This was fixed for GCC 5. Change this line after MARLEY drops support for GCC < 5. See https://stackoverflow.com/a/27152585 and https://stackoverflow.com/q/7623650 for more details.
Todo
Consider implementing a sorting procedure rather than strictly enforcing that energies must be given in ascending order.

Definition at line 366 of file Reaction.cc.

369{
370 // Create an empty vector to start
371 std::vector< std::unique_ptr<marley::Reaction> > loaded_reactions;
372
373 std::regex rx_comment("#.*"); // Matches comment lines
374
375 // Open the reaction data file for parsing
376 std::ifstream file_in( filename );
377
378 // If the file doesn't exist or some other error
379 // occurred, complain and give up.
380 if ( !file_in.good() ) {
381 throw marley::Error("Could not read from the file " + filename);
382 }
383
384 // String to store the current line of the reaction data file during parsing
385 std::string line;
386
388 line = marley_utils::get_next_line( file_in, rx_comment, false );
389
390 // Read in the ProcessType code and the target PDG code
391 std::istringstream iss( line );
392 int integer_proc_type;
393 iss >> integer_proc_type;
394
395 auto proc_type = static_cast<ProcType>( integer_proc_type );
396
397 // For neutrino-electron elastic scattering, we won't have a table of
398 // matrix elements. Instead, a table of atomic target PDG codes appears.
399 // Make Reaction objects for each atomic target for each of the possible
400 // projectiles (every neutrino species) and return the result.
401 if ( proc_type == ProcessType::NuElectronElastic ) {
402
403 do {
404 // Loop over target atoms
405 int target_pdg;
406 while ( iss >> target_pdg ) {
407 // Loop over neutrino species
408 for ( const int& pdg_a : get_projectiles(proc_type) ) {
409 loaded_reactions.emplace_back(
410 std::make_unique<marley::ElectronReaction>(pdg_a, target_pdg,
411 filename) );
412 }
413 }
414
415 line = marley_utils::get_next_line( file_in, rx_comment, false );
422 iss.str( line );
423 iss.clear();
424 } while ( !line.empty() );
425
426 return loaded_reactions;
427 }
428
429 // For nuclear reaction modes, there is a single target nucleus PDG code
430 // per file.
431 int pdg_b;
432 iss >> pdg_b;
433
434 // Multiple formats are allowed for the nuclear reaction modes. Get the
435 // format code from the current line in order to decide what to do next.
436 int integer_data_format;
437 iss >> integer_data_format;
438 auto df = static_cast< DataFormat >( integer_data_format );
439
440 if ( df == DiscreteStrengths ) {
441
442 // Read in all of the level energy (MeV), squared matrix element (B(F) or
443 // B(GT) strength), and matrix element type identifier (0 represents B(F),
444 // 1 represents B(GT)) triplets. Create a vector of MatrixElement objects
445 // based on this information. Use a shared pointer so that the vector can
446 // be re-used by multiple Reaction objects, one for each neutrino species
447 // for which the matrix elements are relevant. This avoids unnecessary
448 // duplication of storage for the matrix elements.
449 auto matrix_elements = std::make_shared<std::vector<
450 marley::MatrixElement> >();
451
452 // Set the old energy entry to the lowest representable double
453 // value. This guarantees that we always read in the first energy
454 // value given in the reaction data file
455 double old_energy = std::numeric_limits<double>::lowest();
456 while (line = marley_utils::get_next_line(file_in, rx_comment, false),
457 file_in.good())
458 {
459 iss.str(line);
460 iss.clear();
461
464
465 // The order of the entries is important because later uses of the vector
466 // of matrix elements assume that they are sorted in order of ascending
467 // final level energy.
468 double energy, strength;
469 int integer_me_type;
470 iss >> energy >> strength >> integer_me_type;
471 if ( old_energy >= energy ) throw marley::Error( "Invalid reaction"
472 " dataset. Level energies must be unique and must be given in"
473 " ascending order." );
474
475 // Read optional uncertainty columns:
476 // 4 columns: symmetric uncertainty (err_low = err_high = err)
477 // 5 columns: asymmetric uncertainties (err_low, err_high)
478 // 3 columns (legacy): no uncertainty (both default to zero)
479 double err_low = 0., err_high = 0.;
480 if ( iss >> err_low ) {
481 err_high = err_low; // default to symmetric
482 iss >> err_high; // try for asymmetric (fails silently)
483 }
484
485 // @todo Right now, 0 corresponds to a Fermi transition, and 1
486 // corresponds to a Gamow-Teller transition. As you add new matrix
487 // element types, consider changing the convention and its
488 // implementation. All of the level pointers owned by the matrix elements
489 // will initially be set to nullptr. This may be changed later if
490 // discrete level data can be found for the residual nucleus.
491 matrix_elements->emplace_back( energy, strength,
492 static_cast<ME_Type>(integer_me_type), err_low, err_high,
493 nullptr );
494 old_energy = energy;
495 }
496
497 // We now have all the information that we need. Build Reaction objects for
498 // all neutrino species that can participate in the process described by
499 // the matrix elements in the table. Use the ProcessType code to figure
500 // this out
501 int pdg_d, q_d;
502 get_residue_pdg_and_charge( proc_type, pdg_b, pdg_d, q_d );
503
504 // Now that we know the PDG code for the final nucleus, look up discrete
505 // level data for it. Set the level pointers for matrix elements
506 // representing transitions to discrete nuclear levels
507 set_level_ptrs( *matrix_elements, pdg_b, pdg_d, db );
508
509 // Now loop over the projectile PDG codes that can participate in the
510 // scattering process of interest. For each one, decide what the ejectile
511 // PDG code should be, then produce a corresponding Reaction object
512 for ( const int& pdg_a : get_projectiles(proc_type) ) {
513 int pdg_c = get_ejectile_pdg( pdg_a, proc_type );
514
515 loaded_reactions.emplace_back(
516 std::make_unique< marley::DiscreteNuclearReaction >( proc_type,
517 pdg_a, pdg_b, pdg_c, pdg_d, q_d, matrix_elements, coulomb_mode,
518 ff_config, filename )
519 );
520 }
521 }
522 else if ( df == MultipoleResponses ) {
523
524 // An energy shift is provided following the data format code if we
525 // are working with multipole responses. This accounts for the energy
526 // difference between the ground state of the initial nucleus and the
527 // isobaric analog state in the daughter nucleus.
528 double delta_ias;
529 iss >> delta_ias;
530
531 // Create a shared pointer to a TabulatedXSec object that will manage
532 // the tables of nuclear responses. These can be re-used for multiple
533 // neutrino flavors by separate Reaction objects.
534 auto txsec = std::make_shared< marley::TabulatedXSec >(
535 pdg_b, proc_type, coulomb_mode, delta_ias );
536
537 // Each line contains a file name corresponding to a distinct table
538 // of nuclear responses. Add each one to the map managed by the
539 // TabulatedXSec object.
540 std::string table_file_name;
541 while ( table_file_name = marley_utils::get_next_line(file_in,
542 rx_comment, false), file_in.good() )
543 {
544 txsec->add_table( table_file_name );
545 }
546
547 // Get the PDG code and (net) charge of the final nucleus
548 int pdg_d, q_d;
549 get_residue_pdg_and_charge( proc_type, pdg_b, pdg_d, q_d );
550
551 // Now loop over the projectile PDG codes that can participate in the
552 // scattering process of interest. For each one, decide what the ejectile
553 // PDG code should be, then produce a corresponding Reaction object
554 for ( const int& pdg_a : get_projectiles(proc_type) ) {
555 int pdg_c = get_ejectile_pdg(pdg_a, proc_type);
556
557 // TODO: remove hard-coding here
558 txsec->optimize( pdg_a, 100. );
559
560 loaded_reactions.emplace_back(
561 std::make_unique< marley::ContinuumNuclearReaction >( proc_type, pdg_a,
562 pdg_b, pdg_c, pdg_d, q_d, txsec, filename )
563 );
564 }
565
566 }
567 else throw marley::Error( "Unrecognized reaction data format"
568 " encountered in marley::Reaction::load_from_file()" );
569
570 return loaded_reactions;
571}
static int get_ejectile_pdg(int pdg_a, ProcessType proc_type)
Definition Reaction.cc:329
DataFormat
Enumerated type describing the file format for reaction data.
Definition Reaction.hh:71
static const std::vector< int > & get_projectiles(ProcessType proc_type)
Definition Reaction.cc:358
static void get_residue_pdg_and_charge(ProcessType proc_type, int pdg_b, int &pdg_d, int &q_d)
Definition Reaction.cc:573

References DiscreteStrengths, get_ejectile_pdg(), get_projectiles(), get_residue_pdg_and_charge(), MultipoleResponses, NuElectronElastic, pdg_a(), and pdg_b().

◆ make_event_object() [1/2]

std::shared_ptr< HepMC3::GenEvent > marley::Reaction::make_event_object ( double KEa,
const std::shared_ptr< HepMC3::GenParticle > & ejectile,
const std::shared_ptr< HepMC3::GenParticle > & residue ) const
protectedvirtual

Helper function that makes an event object.

This function expects pre-made HepMC3::GenParticle objects as input that have four-momenta expressed in the lab frame.

Parameters
KEaLab-frame kinetic energy (MeV) of the projectile
ejectileGenParticle object for the ejectile
residueGenParticle object for the residue

Definition at line 283 of file Reaction.cc.

286{
287 // NuHepMC E.R.4
288 auto event = std::make_shared< HepMC3::GenEvent >( HepMC3::Units::MEV,
289 HepMC3::Units::CM );
290
291 // NuHepMC E.R.3
292 int signal_process_id = marley_hepmc3::get_nuhepmc_proc_id( process_type_ );
293 event->add_attribute( "signal_process_id",
294 std::make_shared< HepMC3::IntAttribute >( signal_process_id )
295 );
296
297 // Create the primary vertex
298 // NuHepMC E.R.6
299 auto prim_vtx = std::make_shared< HepMC3::GenVertex >();
300 prim_vtx->set_status( marley_hepmc3::NUHEPMC_PRIMARY_VERTEX );
301
302 event->add_vertex( prim_vtx );
303
304 // Get the lab-frame total energy of the projectile
305 double Ea = KEa + ma_;
306
307 // Determine the magnitude of the lab-frame 3-momentum of the projectile
308 double pa = real_sqrt( KEa * (KEa + 2.*ma_) );
309
310 // Create particle objects representing the projectile and target in the lab
311 // frame
312 // @todo Allow for projectile directions other than along the z-axis
313 auto projectile = marley_hepmc3::make_particle( pdg_a_, 0., 0., pa, Ea,
314 marley_hepmc3::NUHEPMC_PROJECTILE_STATUS, ma_ );
315
316 auto target = marley_hepmc3::make_particle( pdg_b_,
317 marley_hepmc3::NUHEPMC_TARGET_STATUS, mb_ );
318
319 // Attach the particles to the primary vertex
320 prim_vtx->add_particle_in( projectile );
321 prim_vtx->add_particle_in( target );
322
323 prim_vtx->add_particle_out( ejectile );
324 prim_vtx->add_particle_out( residue );
325
326 return event;
327}
int pdg_a_
PDG code for the projectile.
Definition Reaction.hh:142
ProcessType process_type_
Type of scattering process (CC, NC) represented by this reaction.
Definition Reaction.hh:161
int pdg_b_
PDG code for the target.
Definition Reaction.hh:143
double ma_
Projectile mass (MeV)
Definition Reaction.hh:147
double mb_
Target mass (MeV)
Definition Reaction.hh:148

References ma_, mb_, pdg_a_, pdg_b_, and process_type_.

◆ make_event_object() [2/2]

std::shared_ptr< HepMC3::GenEvent > marley::Reaction::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
protectedvirtual

Helper function that makes an event object.

This function should be called by marley::Reaction::create_event() after CM frame scattering angles have been sampled for the ejectile. The two outgoing particles are treated as generic final-state particles. Subclasses that need to attach particle-specific metadata to the residue (e.g., nuclear excitation information) should wrap this function (or the overload below) and add the desired attributes afterwards.

Parameters
KEaLab-frame kinetic energy (MeV) of the projectile
pc_cmEjectile 3-momentum magnitude (MeV) in the CM frame
cos_theta_c_cmCosine of ejectile's CM frame polar angle
phi_c_cmEjectile's CM frame azimuthal angle (radians)
Ec_cmEjectile total energy (MeV) in the CM frame
Ed_cmResidue total energy (MeV) in the CM frame
residue_statusNuHepMC status code to assign to the residue particle (the final-state particle that recoils against the ejectile)

Definition at line 247 of file Reaction.cc.

250{
251 // Determine the Cartesian components of the ejectile's CM frame momentum
252 double sin_theta_c_cm = real_sqrt( 1. - std::pow(cos_theta_c_cm, 2) );
253
254 double pc_cm_x = sin_theta_c_cm * std::cos( phi_c_cm ) * pc_cm;
255 double pc_cm_y = sin_theta_c_cm * std::sin( phi_c_cm ) * pc_cm;
256 double pc_cm_z = cos_theta_c_cm * pc_cm;
257
258 // Create particle objects representing the ejectile and residue in the CM
259 // frame.
260 auto ejectile = marley_hepmc3::make_particle( pdg_c_, pc_cm_x, pc_cm_y,
261 pc_cm_z, Ec_cm, marley_hepmc3::NUHEPMC_FINAL_STATE_STATUS, mc_ );
262
263 auto residue = marley_hepmc3::make_particle( pdg_d_, -pc_cm_x, -pc_cm_y,
264 -pc_cm_z, Ed_cm, residue_status, md_ );
265
266 // Get the lab-frame total energy of the projectile
267 double Ea = KEa + ma_;
268
269 // Determine the magnitude of the lab-frame 3-momentum of the projectile
270 double pa = real_sqrt( KEa * (KEa + 2.*ma_) );
271
272 // Boost the ejectile and residue into the lab frame.
273 double beta_z = pa / (Ea + mb_);
274 marley_kinematics::lorentz_boost( 0., 0., -beta_z, *ejectile );
275 marley_kinematics::lorentz_boost( 0., 0., -beta_z, *residue );
276
277 // Now that we have the outgoing particles defined in the lab frame, delegate
278 // the remaining tasks for creation of the event to this overloaded version
279 // of the function
280 return this->make_event_object( KEa, ejectile, residue );
281}
double md_
Residue mass (MeV)
Definition Reaction.hh:154
double mc_
Ejectile mass (MeV)
Definition Reaction.hh:149
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.
Definition Reaction.cc:247
int pdg_c_
PDG code for the ejectile.
Definition Reaction.hh:144
int pdg_d_
PDG code for the residue.
Definition Reaction.hh:145

References ma_, make_event_object(), mb_, mc_, md_, pdg_c_, and pdg_d_.

Referenced by marley::ElectronReaction::create_event(), make_event_object(), marley::NuclearReaction::make_nuclear_event_object(), and marley::NuclearReaction::make_nuclear_event_object().

◆ pdg_a()

◆ pdg_b()

int marley::Reaction::pdg_b ( ) const
inline

◆ proc_type_to_string()

std::string marley::Reaction::proc_type_to_string ( const ProcessType & pt)
static

Definition at line 354 of file Reaction.cc.

354 {
355 return proc_type_to_string_map.at( pt );
356}

◆ process_type()

ProcessType marley::Reaction::process_type ( ) const
inline

Get the process type for this reaction.

Definition at line 100 of file Reaction.hh.

100{ return process_type_; }

References process_type_.

◆ source_file()

const std::string & marley::Reaction::source_file ( ) const
inline

Get the resolved path of the reaction data file used to construct this Reaction.

Definition at line 104 of file Reaction.hh.

104{ return source_file_; }

References source_file_.

Referenced by marley::DiscreteNuclearReaction::DiscreteNuclearReaction(), marley::NuclearReaction::NuclearReaction(), and Reaction().

◆ threshold_kinetic_energy()

virtual double marley::Reaction::threshold_kinetic_energy ( ) const
pure virtual

Get the minimum lab-frame kinetic energy (MeV) of the projectile that allows this reaction to proceed via a transition to the residue's ground state.

Implemented in marley::ElectronReaction, and marley::NuclearReaction.

◆ total_xs()

virtual double marley::Reaction::total_xs ( int pdg_a,
double KEa ) const
pure virtual

Compute the reaction's total cross section (MeV -2)

Parameters
pdg_aProjectile's PDG code
KEaLab-frame kinetic energy of the incident projectile
Returns
Reaction total cross section (MeV -2)
Note
Functions that override total_xs() should always return zero if pdg_a != pdg_a_.

Implemented in marley::ContinuumNuclearReaction, marley::DiscreteNuclearReaction, and marley::ElectronReaction.

References pdg_a().

Referenced by marley::Generator::create_event().

◆ two_two_scatter()

void marley::Reaction::two_two_scatter ( double KEa,
double & s,
double & Ec_cm,
double & pc_cm,
double & Ed_cm ) const
protected

Helper function that handles CM frame kinematics for the reaction.

Parameters
KEaLab-frame kinetic energy (MeV) of the projectile
[out]sMandelstam s (MeV2)
[out]Ec_cmEjectile total energy (MeV) in the CM frame
[out]pc_cmEjectile 3-momentum magnitude (MeV) in the CM frame
[out]Ed_cmResidue total energy (MeV) in the CM frame

Definition at line 226 of file Reaction.cc.

228{
229 // Get the lab-frame total energy of the projectile
230 double Ea = KEa + ma_;
231
232 // Compute Mandelstam s (the square of the total CM frame energy)
233 s = ma_*ma_ + mb_*mb_ + 2.*mb_*Ea;
234 double sqrt_s = std::sqrt(s);
235
236 // Determine the CM frame energy and momentum of the ejectile
237 Ec_cm = (s + mc_*mc_ - md_*md_) / (2 * sqrt_s);
238 pc_cm = real_sqrt(std::pow(Ec_cm, 2) - mc_*mc_);
239
240 // Determine the residue's CM frame energy. Roundoff errors may cause Ed_cm to
241 // dip below md, which is unphysical. Prevent this from occurring by allowing
242 // md to be the minimum value of Ed_cm. Also note that, in the CM frame, the
243 // residue and ejectile have equal and opposite momenta.
244 Ed_cm = std::max(sqrt_s - Ec_cm, md_);
245}

References ma_, mb_, mc_, and md_.

Referenced by marley::DiscreteNuclearReaction::create_event(), and marley::ElectronReaction::create_event().

Member Data Documentation

◆ description_

◆ ma_

◆ mb_

◆ mc_

◆ md_

◆ pdg_a_

◆ pdg_b_

◆ pdg_c_

int marley::Reaction::pdg_c_
protected

◆ pdg_d_

◆ process_type_

ProcessType marley::Reaction::process_type_
protected

Type of scattering process (CC, NC) represented by this reaction.

Definition at line 161 of file Reaction.hh.

Referenced by marley::NuclearReaction::NuclearReaction(), marley::DiscreteNuclearReaction::diff_xs(), make_event_object(), and process_type().

◆ source_file_

const std::string marley::Reaction::source_file_
protected

Resolved path of the reaction data file.

Definition at line 210 of file Reaction.hh.

Referenced by Reaction(), and source_file().


The documentation for this class was generated from the following files: