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
TargetAtom.cc
1
4//
5// This file is part of MARLEY (Model of Argon Reaction Low Energy Yields)
6//
7// MARLEY is free software: you can redistribute it and/or modify it under the
8// terms of version 3 of the GNU General Public License as published by the
9// Free Software Foundation.
10//
11// For the full text of the license please see COPYING or
12// visit http://opensource.org/licenses/GPL-3.0
13//
14// Please respect the MCnet academic usage guidelines. See GUIDELINES
15// or visit https://www.montecarlonet.org/GUIDELINES for details.
16
17#include "marley/Error.hh"
18#include "marley/TargetAtom.hh"
19#include "marley/marley_utils.hh"
20
24
26 pdg_ = marley_utils::get_nucleus_pid( Z, A );
27 this->check_pdg_validity();
28}
29
31 return marley_utils::get_particle_Z( pdg_ );
32}
33
35 return marley_utils::get_particle_A( pdg_ );
36}
37
38std::string marley::TargetAtom::to_string() const {
39 return marley_utils::get_particle_symbol( pdg_ );
40}
41
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}
Base class for all exceptions thrown by MARLEY functions.
Definition Error.hh:26
int A() const
Returns the mass number of the target atom.
Definition TargetAtom.cc:34
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
std::string to_string() const
Converts the PDG code to a string representation (e.g., "40Ar")
Definition TargetAtom.cc:38
void check_pdg_validity() const
Helper function for the constructors. Checks the atom's PDG code for validity.
Definition TargetAtom.cc:42
TargetAtom(int pdg)
Create a TargetAtom object from an integer PDG code.
Definition TargetAtom.cc:21
int Z() const
Returns the proton number of the target atom.
Definition TargetAtom.cc:30