410 G4bool findThermalElement =
false;
413 for (
G4int i = 0; i <
n ; i++ )
417 if ( aNucleus.GetZ_asInt() == (
G4int)(theElement->
GetZ() + 0.5 ) )
420 if ( getTS_ID( NULL , theElement ) != -1 )
422 ielement = getTS_ID( NULL , theElement );
423 findThermalElement =
true;
426 else if ( getTS_ID( theMaterial , theElement ) != -1 )
428 ielement = getTS_ID( theMaterial , theElement );
429 findThermalElement =
true;
435 if ( findThermalElement ==
true )
447 if ( random <= inelastic/total )
452 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator it;
453 std::vector<G4double> v_temp;
455 for ( it = inelasticFSs->find( ielement )->second->begin() ; it != inelasticFSs->find( ielement )->second->end() ; it++ )
457 v_temp.push_back( it->first );
461 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
465 std::vector< E_P_E_isoAng* >* vNEP_EPM_TL = 0;
466 std::vector< E_P_E_isoAng* >* vNEP_EPM_TH = 0;
468 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
470 vNEP_EPM_TL = inelasticFSs->find( ielement )->second->find ( tempLH.first/
kelvin )->second;
471 vNEP_EPM_TH = inelasticFSs->find( ielement )->second->find ( tempLH.second/
kelvin )->second;
473 else if ( tempLH.first == 0.0 )
475 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator itm;
476 itm = inelasticFSs->find( ielement )->second->begin();
477 vNEP_EPM_TL = itm->second;
479 vNEP_EPM_TH = itm->second;
480 tempLH.first = tempLH.second;
481 tempLH.second = itm->first;
483 else if ( tempLH.second == 0.0 )
485 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator itm;
486 itm = inelasticFSs->find( ielement )->second->end();
488 vNEP_EPM_TH = itm->second;
490 vNEP_EPM_TL = itm->second;
491 tempLH.second = tempLH.first;
492 tempLH.first = itm->first;
497 std::pair< G4double , E_isoAng > TL = create_sE_and_EPM_from_pE_and_vE_P_E_isoAng ( rand_for_sE , aTrack.
GetKineticEnergy() , vNEP_EPM_TL );
498 std::pair< G4double , E_isoAng > TH = create_sE_and_EPM_from_pE_and_vE_P_E_isoAng ( rand_for_sE , aTrack.
GetKineticEnergy() , vNEP_EPM_TH );
501 sE = get_linear_interpolated ( aTemp , std::pair < G4double , G4double > ( tempLH.first , TL.first ) , std::pair < G4double , G4double > ( tempLH.second , TH.first ) );
505 if ( TL.second.n == TH.second.n )
508 anE_isoAng.
n = TL.second.n;
509 for (
G4int i=0 ; i < anE_isoAng.
n ; i++ )
512 angle = get_linear_interpolated ( aTemp , std::pair< G4double , G4double > ( tempLH.first , TL.second.isoAngle[ i ] ) , std::pair< G4double , G4double > ( tempLH.second , TH.second.isoAngle[ i ] ) );
513 anE_isoAng.
isoAngle.push_back( angle );
515 mu = getMu( &anE_isoAng );
519 throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Do not yet supported");
528 else if ( random <= ( inelastic + theXSection->
GetCoherentCrossSection( dp , theElement , theMaterial ) ) / total )
535 std::map < G4double , std::vector< std::pair< G4double , G4double >* >* >::iterator it;
536 std::vector<G4double> v_temp;
538 for ( it = coherentFSs->find( ielement )->second->begin() ; it != coherentFSs->find( ielement )->second->end() ; it++ )
540 v_temp.push_back( it->first );
544 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
549 std::vector< std::pair< G4double , G4double >* >* pvE_p_TL = NULL;
550 std::vector< std::pair< G4double , G4double >* >* pvE_p_TH = NULL;
552 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
554 pvE_p_TL = coherentFSs->find( ielement )->second->find ( tempLH.first/
kelvin )->second;
555 pvE_p_TH = coherentFSs->find( ielement )->second->find ( tempLH.first/
kelvin )->second;
557 else if ( tempLH.first == 0.0 )
559 pvE_p_TL = coherentFSs->find( ielement )->second->find ( v_temp[ 0 ] )->second;
560 pvE_p_TH = coherentFSs->find( ielement )->second->find ( v_temp[ 1 ] )->second;
561 tempLH.first = tempLH.second;
562 tempLH.second = v_temp[ 1 ];
564 else if ( tempLH.second == 0.0 )
566 pvE_p_TH = coherentFSs->find( ielement )->second->find ( v_temp.back() )->
second;
567 std::vector< G4double >::iterator itv;
571 pvE_p_TL = coherentFSs->find( ielement )->second->find ( *itv )->second;
572 tempLH.second = tempLH.first;
578 throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Unexpected temperature values in data");
581 std::vector< G4double > vE_T;
582 std::vector< G4double > vp_T;
584 G4int n1 = pvE_p_TL->size();
587 for (
G4int i=1 ; i < n1 ; i++ )
589 if ( (*pvE_p_TL)[i]->
first != (*pvE_p_TH)[i]->
first )
throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data!");
590 vE_T.push_back ( (*pvE_p_TL)[i]->
first );
591 vp_T.push_back ( get_linear_interpolated ( aTemp , std::pair< G4double , G4double > ( tempLH.first , (*pvE_p_TL)[i]->second ) , std::pair< G4double , G4double > ( tempLH.second , (*pvE_p_TL)[i]->second ) ) );
595 for (
G4int i = 1 ; i <
n ; i++ )
597 if ( E/
eV < vE_T[ i ] )
607 for (
G4int i = 1 ; i < j ; i++ )
609 G4double Pi = vp_T[ i ] / vp_T[ j ];
610 if ( rand_for_mu < Pi )
622 if ( mu < -1.0 ) mu = -1.0;
634 std::map < G4double , std::vector < E_isoAng* >* >::iterator it;
635 std::vector<G4double> v_temp;
637 for ( it = incoherentFSs->find( ielement )->second->begin() ; it != incoherentFSs->find( ielement )->second->end() ; it++ )
639 v_temp.push_back( it->first );
643 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
652 if ( tempLH.first != 0.0 && tempLH.second != 0.0 ) {
654 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( tempLH.first/
kelvin )->second );
655 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( tempLH.second/
kelvin )->second );
656 }
else if ( tempLH.first == 0.0 ) {
658 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp[ 0 ] )->second );
659 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp[ 1 ] )->second );
660 tempLH.first = tempLH.second;
661 tempLH.second = v_temp[ 1 ];
662 }
else if ( tempLH.second == 0.0 ) {
664 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp.back() )->
second );
665 std::vector< G4double >::iterator itv;
669 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( *itv )->second );
670 tempLH.second = tempLH.first;
678 if ( anEPM_TL_E.
n == anEPM_TH_E.n )
680 anEPM_T_E.
n = anEPM_TL_E.
n;
681 for (
G4int i=0 ; i < anEPM_TL_E.
n ; i++ )
684 angle = get_linear_interpolated ( aTemp , std::pair< G4double , G4double > ( tempLH.first , anEPM_TL_E.
isoAngle[ i ] ) , std::pair< G4double , G4double > ( tempLH.second , anEPM_TH_E.isoAngle[ i ] ) );
685 anEPM_T_E.
isoAngle.push_back( angle );
687 mu = getMu ( &anEPM_T_E );
691 throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Do not yet supported");
std::vector< G4double > isoAngle
static G4double angle[DIM]
static constexpr double second
const G4Element * GetElement(G4int iel) const
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static constexpr double eV
static constexpr double kelvin
const G4LorentzVector & Get4Momentum() const
void SetEnergyChange(G4double anEnergy)
G4double total(Particle const *const p1, Particle const *const p2)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
G4HadFinalState theParticleChange
G4double GetTemperature() const
const G4Material * GetMaterial() const
size_t GetNumberOfElements() const
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void SetMomentumChange(const G4ThreeVector &aV)