Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI_GRIN_continuumGammas.cc
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# Copyright 2019, Lawrence Livermore National Security, LLC.
4# This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
5# gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
6# SPDX-License-Identifier: MIT
7# <<END-copyright>>
8*/
9
10#include "GIDI.hpp"
11#include <HAPI.hpp>
12
13namespace GIDI {
14
15namespace GRIN {
16
17static Form *parseInelasticIncidentEnergySuite( Construction::Settings const &a_construction, Suite *a_parent, HAPI::Node const &a_node,
18 SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, std::string const &a_name,
19 Styles::Suite const *a_styles );
20static Form *parseCaptureLevelProbabilitySuite( Construction::Settings const &a_construction, Suite *a_parent, HAPI::Node const &a_node,
21 SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, std::string const &a_name,
22 Styles::Suite const *a_styles );
23
24/*! \class GRIN_continuumGammas
25 * Base class for the protare sub-classes.
26 */
27
28/* *********************************************************************************************************//**
29 * Base Protare constructor.
30 ***********************************************************************************************************/
31
33 PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, LUPI_maybeUnused ProtareSingle const &a_protare, Styles::Suite const *a_styles ) :
34 GUPI::Ancestry( "" ),
35 m_captureNeutronSeparationEnergy( a_node.child( GIDI_captureNeutronSeparationEnergyChars ), a_setupInfo ),
36 m_maximumCaptureIncidentEnergy( a_node.child( GIDI_maximumIncidentEnergyChars ), a_setupInfo ),
37 m_pops( ),
38 m_inelasticIncidentEnergies( a_construction, GIDI_inelasticIncidentEnergiesChars, GIDI_labelChars, a_node, a_setupInfo, a_pops,
39 a_internalPoPs, parseInelasticIncidentEnergySuite, a_styles ),
40 m_captureLevelProbabilities( a_construction, GIDI_captureLevelProbabilitiesChars, GIDI_labelChars, a_node, a_setupInfo, a_pops,
41 a_internalPoPs, parseCaptureLevelProbabilitySuite, a_styles ),
42 m_captureResidualIntid( -1 ),
43 m_captureResidualIndex( -1 ),
44 m_captureResidualMass( 0.0 ) {
45
46 m_captureNeutronSeparationEnergy.setAncestor( this );
47 m_maximumCaptureIncidentEnergy.setAncestor( this );
48 m_inelasticIncidentEnergies.setAncestor( this );
49 m_captureLevelProbabilities.setAncestor( this );
50
51 m_pops.addDatabase( a_node.child( GIDI_PoPsChars ), true );
52
53 PoPI::Nuclide const &target = a_pops.get<PoPI::Nuclide>( a_setupInfo.m_protare->target( ).pid( ) );
54 std::string captureResidualId = target.isotope( )->chemicalElement( )->symbol( ) + std::to_string( target.A( ) + 1 );
55 PoPI::Nuclide const &captureResidual = a_pops.get<PoPI::Nuclide>( captureResidualId );
56 m_captureResidualId = std::move( captureResidualId );
57 m_captureResidualIntid = captureResidual.intid( );
58 m_captureResidualIndex = static_cast<int>( captureResidual.index( ) );
59 m_captureResidualMass = captureResidual.massValue( "MeV/c**2" );
60}
61
62/* *********************************************************************************************************//**
63 ***********************************************************************************************************/
64
67
68/* *********************************************************************************************************//**
69 * Returns a pointer to the member whose moniker is *a_item*.
70 *
71 * @param a_item [in] The moniker of the member to return.
72 * @return Returns the pointer to the member of nullptr if it does not exists.
73 ***********************************************************************************************************/
74
76
77 if( a_item == GIDI_captureNeutronSeparationEnergyChars ) return( &m_captureNeutronSeparationEnergy );
78 if( a_item == GIDI_maximumIncidentEnergyChars ) return( &m_maximumCaptureIncidentEnergy );
79 if( a_item == GIDI_inelasticIncidentEnergiesChars ) return( &m_inelasticIncidentEnergies );
80 if( a_item == GIDI_captureLevelProbabilitiesChars ) return( &m_captureLevelProbabilities );
81// The following does not work as PoPI::Database does not yet inherent from GUPI::Ancestry. This needs to be fixed.
82// if( a_item == PoPI_PoPsChars ) return( &m_pops );
83
84 return( nullptr );
85}
86
87/* *********************************************************************************************************//**
88 * Returns a pointer to the member whose moniker is *a_item*.
89 *
90 * @param a_item [in] The moniker of the member to return.
91 * @return Returns the pointer to the member of nullptr if it does not exists.
92 ***********************************************************************************************************/
93
94GUPI::Ancestry const *GRIN_continuumGammas::findInAncestry3( std::string const &a_item ) const {
95
96 if( a_item == GIDI_captureNeutronSeparationEnergyChars ) return( &m_captureNeutronSeparationEnergy );
97 if( a_item == GIDI_maximumIncidentEnergyChars ) return( &m_maximumCaptureIncidentEnergy );
98 if( a_item == GIDI_inelasticIncidentEnergiesChars ) return( &m_inelasticIncidentEnergies );
99 if( a_item == GIDI_captureLevelProbabilitiesChars ) return( &m_captureLevelProbabilities );
100// The following does not work as PoPI::Database does not yet inherent from GUPI::Ancestry. This needs to be fixed.
101// if( a_item == PoPI_PoPsChars ) return( &m_pops );
102
103 return( nullptr );
104}
105
106/* *********************************************************************************************************//**
107 * Function that parses a <**inelasticIncidentEnergy**> node. Called from a Suite::parse instance.
108 *
109 * @param a_construction [in] Used to pass user options for parsing.
110 * @param a_parent [in] The parent GIDI::Suite that the returned Form will be added to.
111 * @param a_node [in] The **HAPI::Node** to be parsed.
112 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
113 * @param a_pops [in] A PoPs Database instance used to get particle indices and possibly other particle information.
114 * @param a_internalPoPs [in] The *internal* PoPI::Database instance used to get particle indices and possibly other particle information.
115 * This is the <**PoPs**> node under the <**reactionSuite**> node.
116 * @param a_name [in] The moniker for the node to be parsed.
117 * @param a_styles [in] A pointer to the <**styles**> node.
118 *
119 * @return The parsed and constructed GIDI::Form or nullptr if the node is not supported.
120 ***********************************************************************************************************/
121
122static Form *parseInelasticIncidentEnergySuite( Construction::Settings const &a_construction, LUPI_maybeUnused Suite *a_parent, HAPI::Node const &a_node, SetupInfo &a_setupInfo,
123 LUPI_maybeUnused PoPI::Database const &a_pops, LUPI_maybeUnused PoPI::Database const &a_internalPoPs, std::string const &a_name, LUPI_maybeUnused Styles::Suite const *a_styles ) {
124
125 Form *form = nullptr;
126
127 if( a_name == GIDI_inelasticIncidentEnergyChars ) {
128 form = new InelasticIncidentEnergy( a_construction, a_node, a_setupInfo ); }
129 else {
130 std::cout << "parseInelasticIncidentEnergySuite: Ignoring unsupported Form '" << a_name << "'." << std::endl;
131 }
132
133 return( form );
134}
135
136/* *********************************************************************************************************//**
137 * Function that parses a <**captureLevelProbability**> node. Called from a Suite::parse instance.
138 *
139 * @param a_construction [in] Used to pass user options for parsing.
140 * @param a_parent [in] The parent GIDI::Suite that the returned Form will be added to.
141 * @param a_node [in] The **HAPI::Node** to be parsed.
142 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
143 * @param a_pops [in] A PoPs Database instance used to get particle indices and possibly other particle information.
144 * @param a_internalPoPs [in] The *internal* PoPI::Database instance used to get particle indices and possibly other particle information.
145 * This is the <**PoPs**> node under the <**reactionSuite**> node.
146 * @param a_name [in] The moniker for the node to be parsed.
147 * @param a_styles [in] A pointer to the <**styles**> node.
148 *
149 * @return The parsed and constructed GIDI::Form or nullptr if the node is not supported.
150 ***********************************************************************************************************/
151
152static Form *parseCaptureLevelProbabilitySuite( Construction::Settings const &a_construction, LUPI_maybeUnused Suite *a_parent, HAPI::Node const &a_node, SetupInfo &a_setupInfo,
153 LUPI_maybeUnused PoPI::Database const &a_pops, LUPI_maybeUnused PoPI::Database const &a_internalPoPs, std::string const &a_name, LUPI_maybeUnused Styles::Suite const *a_styles ) {
154
155 Form *form = nullptr;
156
157 if( a_name == GIDI_captureLevelProbabilityChars ) {
158 form = new CaptureLevelProbability( a_construction, a_node, a_setupInfo ); }
159 else {
160 std::cout << "parseCaptureLevelProbabilitySuite: Ignoring unsupported Form '" << a_name << "'." << std::endl;
161 }
162
163 return( form );
164}
165/* *********************************************************************************************************//**
166 * Function that parses a <**inelasticIncidentEnergy**> node. Called from a Suite::parse instance.
167 *
168 * @param a_construction [in] Used to pass user options for parsing.
169 * @param a_node [in] The **HAPI::Node** to be parsed.
170 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
171 ***********************************************************************************************************/
172
174 Form( a_node, a_setupInfo, FormType::GRIN_inelasticIncidentEnergy ),
175 m_energy( a_node.attribute_as_double( GIDI_energyChars ) ),
176 m_unit( a_node.attribute_as_string( GIDI_unitChars ) ),
177 m_table( a_construction, a_node.child( GIDI_tableChars ), a_setupInfo ) {
178
179}
180
181/* *********************************************************************************************************//**
182 ***********************************************************************************************************/
183
187
188/* *********************************************************************************************************//**
189 * Function that parses a <**captureLevelProbability**> node. Called from a Suite::parse instance.
190 *
191 * @param a_construction [in] Used to pass user options for parsing.
192 * @param a_node [in] The **HAPI::Node** to be parsed.
193 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
194 ***********************************************************************************************************/
195
197 Form( a_node, a_setupInfo, FormType::GRIN_captureLevelProbability ),
198 m_probabilty( a_node.attribute_as_double( GIDI_probabilityChars ) ),
199 m_spin( a_node.attribute_as_double( PoPI_spinChars ) ),
200 m_spinUnit( a_node.attribute_as_string( GIDI_spinUnitChars ) ),
201 m_parity( a_node.attribute_as_int( PoPI_parityChars ) ),
202 m_capturePrimaryToContinua( a_node.attribute_as_string( GIDI_capturePrimaryToContinuaChars ) ),
203 m_table( a_construction, a_node.child( GIDI_tableChars ), a_setupInfo ) {
204
205}
206
207/* *********************************************************************************************************//**
208 ***********************************************************************************************************/
209
213
214} // End namespace GRIN.
215
216} // End namespace GIDI.
#define GIDI_capturePrimaryToContinuaChars
Definition GIDI.hpp:483
#define GIDI_tableChars
Definition GIDI.hpp:190
#define GIDI_inelasticIncidentEnergiesChars
Definition GIDI.hpp:477
#define GIDI_maximumIncidentEnergyChars
Definition GIDI.hpp:476
#define GIDI_captureLevelProbabilitiesChars
Definition GIDI.hpp:479
#define GIDI_captureNeutronSeparationEnergyChars
Definition GIDI.hpp:475
#define GIDI_inelasticIncidentEnergyChars
Definition GIDI.hpp:478
#define GIDI_unitChars
Definition GIDI.hpp:439
#define GIDI_PoPsChars
Definition GIDI.hpp:178
#define GIDI_labelChars
Definition GIDI.hpp:438
#define GIDI_spinUnitChars
Definition GIDI.hpp:482
#define GIDI_captureLevelProbabilityChars
Definition GIDI.hpp:480
#define GIDI_energyChars
Definition GIDI.hpp:346
#define GIDI_probabilityChars
Definition GIDI.hpp:481
#define LUPI_maybeUnused
#define PoPI_parityChars
Definition PoPI.hpp:75
#define PoPI_spinChars
Definition PoPI.hpp:74
Form(FormType a_type)
Definition GIDI_form.cc:25
CaptureLevelProbability(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo)
std::string captureResidualId() const
Definition GIDI.hpp:3855
GRIN_continuumGammas(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, ProtareSingle const &a_protare, Styles::Suite const *a_styles)
GUPI::Ancestry * findInAncestry3(std::string const &a_item)
InelasticIncidentEnergy(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo)
std::string const & pid() const
Definition GIDI.hpp:762
ParticleInfo const & target() const
Definition GIDI.hpp:4543
ProtareSingle * m_protare
Definition GIDI.hpp:597
Ancestry(std::string const &a_moniker, std::string const &a_attribute="")
Node child(const char *name) const
Definition HAPI_Node.cc:72
int intid() const
Definition PoPI.hpp:655
T const & get(std::string const &a_id) const
Definition GIDI.hpp:32
FormType
Definition GIDI.hpp:118
@ GRIN_inelasticIncidentEnergy
Definition GIDI.hpp:144
@ GRIN_captureLevelProbability
Definition GIDI.hpp:144
Definition GUPI.hpp:20
std::string to_string(G4FermiAtomicMass mass)