39 m_MCGIDI_protare( a_MCGIDI_protare ),
40 m_target( a_GIDI_protare.target( ).ID( ) ),
41 m_fileName( a_GIDI_protare.fileName( ) ),
42 m_evaluation( a_GIDI_protare.evaluation( ) ),
47 m_domainHash( a_domainHash ),
48 m_elasticAngular( nullptr ) {
51 PoPI::Base const *targetAsBase2 = targetAsBase;
52 if( targetAsBase->
isAlias( ) ) {
53 targetAsBase2 = &a_pops.get<PoPI::Base const>( a_pops.final( m_target ) );
59 PoPI::Particle const *targetAsParticle = static_cast<PoPI::Particle const *>( targetAsBase2 );
60 m_targetMass = targetAsParticle->massValue(
"amu" );
63 for( std::size_t reactionIndex = 0; reactionIndex < a_MCGIDI_protare->numberOfReactions( ); ++reactionIndex ) {
66 if( reaction->ENDF_MT( ) == 2 ) {
67 m_elasticIndices.push_back(
static_cast<int>( reactionIndex ) ); }
68 else if( reaction->ENDF_MT( ) == 18 ) {
69 m_fissionIndices.push_back(
static_cast<int>( reactionIndex ) ); }
70 else if( reaction->ENDF_MT( ) == 102 ) {
71 m_captureIndices.push_back(
static_cast<int>( reactionIndex ) ); }
73 m_othersIndices.push_back(
static_cast<int>( reactionIndex ) );
77 if( m_elasticIndices.size( ) > 0 ) {
78 MCGIDI::Reaction const *elastic = a_MCGIDI_protare->reaction( m_elasticIndices[0] );
79 MCGIDI::Product const *firstProduct = elastic->product( 0 );
80 MCGIDI::Distributions::AngularTwoBody const *angularTwoBody = static_cast<MCGIDI::Distributions::AngularTwoBody const *>( firstProduct->distribution( ) );
81 m_elasticAngular = angularTwoBody->angular( );
90 delete m_MCGIDI_protare;
98 return(
static_cast<int>( m_MCGIDI_protare->numberOfReactions( ) ) );
105 return(
static_cast<int>( m_MCGIDI_protare->numberOfOrphanProducts( ) ) );
113 return(
channelID( m_MCGIDI_protare->reaction( channelIndex )->label( ).c_str( ) ) );
121 std::vector<channelID> *channelIDs =
new std::vector<channelID>( 0 );
123 for( std::size_t reactionIndex = 0; reactionIndex < m_MCGIDI_protare->numberOfReactions( ); ++reactionIndex ) {
124 MCGIDI::Reaction const *reaction = m_MCGIDI_protare->reaction( reactionIndex );
125 channelIDs->push_back( reaction->label( ).c_str( ) );
128 return( channelIDs );
136 std::vector<channelID> *channelIDs =
new std::vector<channelID>( 0 );
138 for( std::size_t reactionIndex = 0; reactionIndex < m_MCGIDI_protare->numberOfOrphanProducts( ); ++reactionIndex ) {
139 MCGIDI::Reaction const *reaction = m_MCGIDI_protare->orphanProduct( reactionIndex );
140 channelIDs->push_back( reaction->label( ).c_str( ) );
143 return( channelIDs );
151 std::size_t hashIndex = m_domainHash.index( a_energy );
153 return( m_MCGIDI_protare->crossSection( m_URR_protareInfos, hashIndex, a_temperature, a_energy ) );
193 std::size_t hashIndex = m_domainHash.index( a_energy );
194 double crossSection = 0.0;
196 for(
auto indexIter = a_indices.begin( ); indexIter != a_indices.end( ); ++indexIter ) {
197 crossSection += m_MCGIDI_protare->reactionCrossSection( *indexIter, m_URR_protareInfos, hashIndex, a_temperature, a_energy );
200 return( crossSection );
208 std::vector<int> indices( a_nIndices );
209 for(
int index = 0; index < a_nIndices; ++index ) indices[index] = a_indices[index];
218 double (*a_rng)(
void * ),
void *a_rngState )
const {
221 int nIndices =
static_cast<int>( a_indices.size( ) );
223 double crossSectionSum = 0.0;
225 crossSectionSample *= a_rng( a_rngState );
226 for( ; index < nIndices; ++index ) {
228 if( crossSectionSum >= crossSectionSample )
break;
230 if( index == nIndices ) --index;
232 return( a_indices[index] );
238 double (*a_rng)(
void * ),
void *a_rngState )
const {
240 std::vector<int> indices( a_nIndices );
241 for(
int index = 0; index < a_nIndices; ++index ) indices[index] = a_indices[index];
251 return( m_elasticAngular->sample( a_energy, a_rng( a_rngState ), [&]() ->
double {
return a_rng( a_rngState ); } ) );
259 return(
getFinalState( m_captureIndices, a_energy, a_temperature, a_rng, a_rngState ) );
267 return(
getFinalState( m_fissionIndices, a_energy, a_temperature, a_rng, a_rngState ) );
275 return(
getFinalState( m_othersIndices, a_energy, a_temperature, a_rng, a_rngState ) );
282 double (*a_rng)(
void * ),
void *a_rngState )
const {
286 if( a_indices.size( ) == 0 )
return( NULL );
287 if( a_indices.size( ) == 1 ) {
288 reactionIndex = a_indices[0]; }
297 MCGIDI::Reaction const *reaction = m_MCGIDI_protare->reaction( reactionIndex );
298 reaction->sampleProducts( m_MCGIDI_protare, input, [&]() ->
double {
return a_rng( a_rngState ); },
301 std::vector<G4GIDI_Product> *products =
new std::vector<G4GIDI_Product>( productHandler.
size( ) );
303 for( std::size_t index = 0; index < productHandler.
size( ); ++index ) {
317 productOut.
A = parseIntidInfo.
AAA( );
318 productOut.
Z = parseIntidInfo.
ZZZ( );
335 double (*a_rng)(
void * ),
void *a_rngState )
const {
337 std::vector<int> indices( a_nIndices );
338 for(
int index = 0; index < a_nIndices; ++index ) indices[index] = a_indices[index];
340 return(
getFinalState( indices, a_energy, a_temperature, a_rng, a_rngState ) );
double sumChannelCrossSectionAtE(std::vector< int > const &a_indices, double a_energy, double a_temperature) const
G4GIDI_target(PoPI::Database const &a_pops, MCGIDI::DomainHash const &a_domainHash, GIDI::Protare const &a_GIDI_protare, MCGIDI::Protare *a_MCGIDI_protare)
channelID getChannelsID(int channelIndex) const
double getElasticFinalState(double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
int getNumberOfProductionChannels() const
double getFissionCrossSectionAtE(double a_energy, double a_temperature) const
double getTotalCrossSectionAtE(double a_energy, double a_temperature) const
std::vector< G4GIDI_Product > * getFinalState(std::vector< int > const &a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
double getElasticCrossSectionAtE(double a_energy, double a_temperature) const
std::vector< G4GIDI_Product > * getCaptureFinalState(double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
std::vector< G4GIDI_Product > * getOthersFinalState(double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
double getOthersCrossSectionAtE(double a_energy, double a_temperature) const
int sampleChannelCrossSectionAtE(std::vector< int > const &a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
int getNumberOfChannels() const
std::vector< G4GIDI_Product > * getFissionFinalState(double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
std::vector< channelID > * getProductionChannelIDs() const
std::vector< channelID > * getChannelIDs() const
double getCaptureCrossSectionAtE(double a_energy, double a_temperature) const
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE Reaction const * reaction(std::size_t a_index) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE void push_back(Product &a_product)
LUPI_HOST_DEVICE std::size_t size()
virtual bool isParticle() const
T const & get(std::string const &a_id) const
int particleA(Base const &a_particle, bool a_isNeutronProtonANucleon=false)
int particleMetaStableIndex(Base const &a_particle)
int particleZ(Base const &a_particle, bool a_isNeutronProtonANucleon=false)