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::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.
 
 TargetAtom (int Z, int A)
 Create a TargetAtom object from a proton number (Z) and mass number (A)
 
int A () const
 Returns the mass number of the target atom.
 
constexpr operator int () const
 Convert the TargetAtom object to an integer PDG code.
 
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.
 

Protected Attributes

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

Detailed Description

An atomic target for a lepton scattering reaction.

Definition at line 26 of file TargetAtom.hh.

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

Definition at line 21 of file TargetAtom.cc.

21 : pdg_( pdg ) {
22 this->check_pdg_validity();
23}
int pdg() const
Returns the nuclear PDG code of the target atom.
Definition TargetAtom.hh:73
int pdg_
PDG code for the nucleus of the target atom.
Definition TargetAtom.hh:85
void check_pdg_validity() const
Helper function for the constructors. Checks the atom's PDG code for validity.
Definition TargetAtom.cc:42

References check_pdg_validity(), pdg(), and pdg_.

◆ 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

Definition at line 25 of file TargetAtom.cc.

25 {
26 pdg_ = marley_utils::get_nucleus_pid( Z, A );
27 this->check_pdg_validity();
28}
int A() const
Returns the mass number of the target atom.
Definition TargetAtom.cc:34
int Z() const
Returns the proton number of the target atom.
Definition TargetAtom.cc:30

References A(), check_pdg_validity(), pdg_, and Z().

Member Function Documentation

◆ A()

int marley::TargetAtom::A ( ) const

Returns the mass number of the target atom.

Definition at line 34 of file TargetAtom.cc.

34 {
35 return marley_utils::get_particle_A( pdg_ );
36}

References pdg_.

Referenced by TargetAtom(), and check_pdg_validity().

◆ 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.

Definition at line 42 of file TargetAtom.cc.

42 {
43 int A = marley_utils::get_particle_A( pdg_ );
44 if ( A <= 0 ) throw marley::Error( "Invalid nuclear PDG code "
45 + std::to_string( pdg_ ) + " encountered upon construction of"
46 + " a marley::TargetAtom object." );
47}

References A(), and pdg_.

Referenced by TargetAtom(), and TargetAtom().

◆ operator int()

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

Convert the TargetAtom object to an integer PDG code.

Definition at line 41 of file TargetAtom.hh.

41{ return pdg_; }

References pdg_.

◆ operator!=()

bool marley::TargetAtom::operator!= ( const marley::TargetAtom & ta) const
inline

Definition at line 50 of file TargetAtom.hh.

51 {
52 return pdg_ != ta.pdg_;
53 }

◆ operator<()

bool marley::TargetAtom::operator< ( const marley::TargetAtom & ta) const
inline

Define the less-than operator so that TargetAtom objects can be used as the keys of a std::map.

Definition at line 57 of file TargetAtom.hh.

58 {
59 return pdg_ < ta.pdg_;
60 }

References pdg_.

◆ operator==()

bool marley::TargetAtom::operator== ( const marley::TargetAtom & ta) const
inline

Two TargetAtom objects are considered equal if their nuclear PDG codes match.

Definition at line 45 of file TargetAtom.hh.

46 {
47 return pdg_ == ta.pdg_;
48 }

References pdg_.

◆ pdg()

int marley::TargetAtom::pdg ( ) const
inline

Returns the nuclear PDG code of the target atom.

Definition at line 73 of file TargetAtom.hh.

73{ return pdg_; }

References pdg_.

Referenced by TargetAtom(), and marley::Generator::create_event().

◆ to_string()

std::string marley::TargetAtom::to_string ( ) const

Converts the PDG code to a string representation (e.g., "40Ar")

Definition at line 38 of file TargetAtom.cc.

38 {
39 return marley_utils::get_particle_symbol( pdg_ );
40}

References pdg_.

◆ Z()

int marley::TargetAtom::Z ( ) const

Returns the proton number of the target atom.

Definition at line 30 of file TargetAtom.cc.

30 {
31 return marley_utils::get_particle_Z( pdg_ );
32}

References pdg_.

Referenced by TargetAtom().

Member Data Documentation

◆ pdg_

int marley::TargetAtom::pdg_
protected

PDG code for the nucleus of the target atom.

Definition at line 85 of file TargetAtom.hh.

Referenced by TargetAtom(), TargetAtom(), A(), check_pdg_validity(), operator int(), operator<(), operator==(), pdg(), to_string(), and Z().


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