MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
marley::TargetAtom Class Reference

An atomic target for a lepton scattering reaction. More...

#include <TargetAtom.hh>

Public Member Functions

 TargetAtom (int pdg)
 Create a TargetAtom object from an integer PDG code. More...
 
 TargetAtom (int Z, int A)
 Create a TargetAtom object from a proton number (Z) and mass number (A) More...
 
int A () const
 Returns the mass number of the target atom.
 
 operator int () const
 Convert the TargetAtom object to an integer PDG code. More...
 
bool operator!= (const marley::TargetAtom &ta) const
 
bool operator< (const marley::TargetAtom &ta) const
 Define the less-than operator so that TargetAtom objects can be used as the keys of a std::map.
 
bool operator== (const marley::TargetAtom &ta) const
 Two TargetAtom objects are considered equal if their nuclear PDG codes match.
 
int pdg () const
 Returns the nuclear PDG code of the target atom.
 
std::string to_string () const
 Converts the PDG code to a string representation (e.g., "40Ar")
 
int Z () const
 Returns the proton number of the target atom.
 

Protected Member Functions

void check_pdg_validity () const
 Helper function for the constructors. Checks the atom's PDG code for validity. More...
 

Protected Attributes

int pdg_
 PDG code for the nucleus of the target atom.
 

Detailed Description

An atomic target for a lepton scattering reaction.

Constructor & Destructor Documentation

◆ TargetAtom() [1/2]

marley::TargetAtom::TargetAtom ( int  pdg)
explicit

Create a TargetAtom object from an integer PDG code.

Parameters
pdgParticle Data Group code for the atomic species

◆ TargetAtom() [2/2]

marley::TargetAtom::TargetAtom ( int  Z,
int  A 
)
explicit

Create a TargetAtom object from a proton number (Z) and mass number (A)

Parameters
ZThe proton number of the target atom
AThe mass number of the target atom

Member Function Documentation

◆ check_pdg_validity()

void marley::TargetAtom::check_pdg_validity ( ) const
protected

Helper function for the constructors. Checks the atom's PDG code for validity.

If the pdg_ member variable does not correspond to an atom (or a free neutron) when this function is called, then a marley::Error will be thrown.

◆ operator int()

marley::TargetAtom::operator int ( ) const
inlineexplicit

Convert the TargetAtom object to an integer PDG code.

Todo:
Make this "constexpr" eventually. There is a bug in GCC before version 7.2 that doesn't respect the C++14 standard. Clang 3.6 correctly recognizes use of "constexpr" for this function as valid. See https://stackoverflow.com/a/36489493 for more details. For now, we'll drop "constexpr" to preserve compatibility with old versions of GCC.

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