Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GIDI_misc.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26
27#include <g4gidi_version.hh>
28#include <G4GIDI.hh>
29
30/* *********************************************************************************************************//**
31 * Returns the version string for the version of G4GIDI.
32 *
33 * @return A std::string.
34 ***********************************************************************************************************/
35
36std::string G4GIDI_version( ) {
37
38 std::string versionString( G4GIDI_VERSION );
39
40 return versionString;
41}
42
43/* *********************************************************************************************************//**
44 * Returns the major version number for the version of G4GIDI.
45 *
46 * @return An int.
47 ***********************************************************************************************************/
48
50
51 return G4GIDI_MAJOR;
52}
53
54/* *********************************************************************************************************//**
55 * Returns the minor version number for the version of G4GIDI.
56 *
57 * @return An int.
58 ***********************************************************************************************************/
59
61
62 return G4GIDI_MINOR;
63}
64
65/* *********************************************************************************************************//**
66 * Returns the patch level number for the version of G4GIDI.
67 *
68 * @return An int.
69 ***********************************************************************************************************/
70
75
76/* *********************************************************************************************************//**
77 * Returns the git repo hash for the G4GIDI repo for this version..
78 *
79 * @return A std::string.
80 ***********************************************************************************************************/
81
82std::string G4GIDI_GitHash( ) {
83
84 return G4GIDI_GIT;
85}
86
87static std::vector<char const *> G4GIDI_chemicalElementSymbols { // Note, this is zero based. Ergo, "O" is at index 7 not 8.
88 "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne",
89 "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca",
90 "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn",
91 "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr",
92 "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn",
93 "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd",
94 "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb",
95 "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg",
96 "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th",
97 "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm",
98 "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds",
99 "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og" };
100
101/* *********************************************************************************************************//**
102 * Returns the chemical elemental symbol for a specified atomic number *a_Z*.
103 *
104 * @param a_Z [in] The Z of the chemical element.
105 *
106 * @return The symbol as a std::string.
107 ***********************************************************************************************************/
108
109std::string G4GIDI_Misc_Z_toSymbol( int a_Z ) {
110
111 int Zm1 = a_Z - 1;
112
113 if( ( Zm1 < 0 ) || ( Zm1 >= static_cast<int>( G4GIDI_chemicalElementSymbols.size( ) ) ) ) {
114 throw LUPI::Exception( "G4GIDI_Misc_Z_toSymbol: invalid Z = " + std::to_string( a_Z ) + "." );
115 }
116
117 return( std::string( G4GIDI_chemicalElementSymbols[Zm1] ) );
118}
119
120/* *********************************************************************************************************//**
121 * Returns the PoPs for a specified atomic number *a_Z*, mass number *a_A* and meta-stable index *a_M*.
122 *
123 * @param a_Z [in] The Z of the chemical element.
124 * @param a_A [in] The A of the isotope.
125 * @param a_M [in] The meta-stable index of the nuclide.
126 *
127 * @return The symbol as a std::string.
128 ***********************************************************************************************************/
129
130std::string G4GIDI_Misc_Z_A_m_ToName( int a_Z, int a_A, int a_M ) {
131
132 std::string id( G4GIDI_Misc_Z_toSymbol( a_Z ) + std::to_string( a_A ) );
133
134 if( a_M > 0 ) id += "_" + std::to_string( a_M );
135
136 return( id );
137}
int G4GIDI_versionMinor()
int G4GIDI_versionMajor()
std::string G4GIDI_Misc_Z_toSymbol(int a_Z)
int G4GIDI_versionPatchLevel()
std::string G4GIDI_Misc_Z_A_m_ToName(int a_Z, int a_A, int a_M)
std::string G4GIDI_GitHash()
std::string G4GIDI_version()
#define G4GIDI_GIT
#define G4GIDI_MAJOR
#define G4GIDI_PATCHLEVEL
#define G4GIDI_MINOR
#define G4GIDI_VERSION
std::string to_string(G4FermiAtomicMass mass)