327 G4bool findThermalElement =
false;
330 for (
G4int i = 0; i <
n ; i++ )
334 if ( aNucleus.GetZ_asInt() == (
G4int)(theElement->
GetZ() + 0.5 ) )
337 if ( getTS_ID( NULL , theElement ) != -1 )
339 ielement = getTS_ID( NULL , theElement );
340 findThermalElement =
true;
343 else if ( getTS_ID( theMaterial , theElement ) != -1 )
345 ielement = getTS_ID( theMaterial , theElement );
346 findThermalElement =
true;
352 if ( findThermalElement ==
true )
364 if ( random <= inelastic/total )
369 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator it;
370 std::vector<G4double> v_temp;
372 for ( it = inelasticFSs.find( ielement )->second->begin() ; it != inelasticFSs.find( ielement )->second->end() ; it++ )
374 v_temp.push_back( it->first );
378 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
382 std::vector< E_P_E_isoAng* >* vNEP_EPM_TL = 0;
383 std::vector< E_P_E_isoAng* >* vNEP_EPM_TH = 0;
385 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
387 vNEP_EPM_TL = inelasticFSs.find( ielement )->second->find ( tempLH.first/
kelvin )->second;
388 vNEP_EPM_TH = inelasticFSs.find( ielement )->second->find ( tempLH.second/
kelvin )->second;
390 else if ( tempLH.first == 0.0 )
392 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator itm;
393 itm = inelasticFSs.find( ielement )->second->begin();
394 vNEP_EPM_TL = itm->second;
396 vNEP_EPM_TH = itm->second;
397 tempLH.first = tempLH.second;
398 tempLH.second = itm->first;
400 else if ( tempLH.second == 0.0 )
402 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator itm;
403 itm = inelasticFSs.find( ielement )->second->end();
405 vNEP_EPM_TH = itm->second;
407 vNEP_EPM_TL = itm->second;
408 tempLH.second = tempLH.first;
409 tempLH.first = itm->first;
414 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 );
415 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 );
418 sE = get_linear_interpolated ( aTemp , std::pair < G4double , G4double > ( tempLH.first , TL.first ) , std::pair < G4double , G4double > ( tempLH.second , TH.first ) );
422 if ( TL.second.n == TH.second.n )
425 anE_isoAng.
n = TL.second.n;
426 for (
G4int i=0 ; i < anE_isoAng.
n ; i++ )
429 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 ] ) );
430 anE_isoAng.
isoAngle.push_back( angle );
432 mu = getMu( &anE_isoAng );
436 G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Do not yet supported");
445 else if ( random <= ( inelastic + theXSection->
GetCoherentCrossSection( dp , theElement , theMaterial ) ) / total )
452 std::map < G4double , std::vector< std::pair< G4double , G4double >* >* >::iterator it;
453 std::vector<G4double> v_temp;
455 for ( it = coherentFSs.find( ielement )->second->begin() ; it != coherentFSs.find( ielement )->second->end() ; it++ )
457 v_temp.push_back( it->first );
461 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
466 std::vector< std::pair< G4double , G4double >* >* pvE_p_TL = NULL;
467 std::vector< std::pair< G4double , G4double >* >* pvE_p_TH = NULL;
469 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
471 pvE_p_TL = coherentFSs.find( ielement )->second->find ( tempLH.first/
kelvin )->second;
472 pvE_p_TH = coherentFSs.find( ielement )->second->find ( tempLH.first/
kelvin )->second;
474 else if ( tempLH.first == 0.0 )
476 pvE_p_TL = coherentFSs.find( ielement )->second->find ( v_temp[ 0 ] )->second;
477 pvE_p_TH = coherentFSs.find( ielement )->second->find ( v_temp[ 1 ] )->second;
478 tempLH.first = tempLH.second;
479 tempLH.second = v_temp[ 1 ];
481 else if ( tempLH.second == 0.0 )
483 pvE_p_TL = coherentFSs.find( ielement )->second->find ( v_temp.back() )->
second;
484 std::vector< G4double >::iterator itv;
488 pvE_p_TL = coherentFSs.find( ielement )->second->find ( *itv )->second;
489 tempLH.second = tempLH.first;
495 G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Unexpected temperature values in data");
498 std::vector< G4double > vE_T;
499 std::vector< G4double > vp_T;
501 G4int n1 = pvE_p_TL->size();
504 for (
G4int i=1 ; i < n1 ; i++ )
506 if ( (*pvE_p_TL)[i]->first != (*pvE_p_TH)[i]->first )
G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data!");
507 vE_T.push_back ( (*pvE_p_TL)[i]->first );
508 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 ) ) );
512 for (
G4int i = 1 ; i <
n ; i++ )
514 if ( E/
eV < vE_T[ i ] )
524 for (
G4int i = 1 ; i < j ; i++ )
526 G4double Pi = vp_T[ i ] / vp_T[ j ];
527 if ( rand_for_mu < Pi )
539 if ( mu < -1.0 ) mu = -1.0;
551 std::map < G4double , std::vector < E_isoAng* >* >::iterator it;
552 std::vector<G4double> v_temp;
554 for ( it = incoherentFSs.find( ielement )->second->begin() ; it != incoherentFSs.find( ielement )->second->end() ; it++ )
556 v_temp.push_back( it->first );
560 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
569 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
571 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs.find( ielement )->second->find ( tempLH.first/
kelvin )->second );
572 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs.find( ielement )->second->find ( tempLH.second/
kelvin )->second );
574 else if ( tempLH.first == 0.0 )
576 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs.find( ielement )->second->find ( v_temp[ 0 ] )->second );
577 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs.find( ielement )->second->find ( v_temp[ 1 ] )->second );
578 tempLH.first = tempLH.second;
579 tempLH.second = v_temp[ 1 ];
581 else if ( tempLH.second == 0.0 )
583 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs.find( ielement )->second->find ( v_temp.back() )->
second );
584 std::vector< G4double >::iterator itv;
588 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs.find( ielement )->second->find ( *itv )->second );
589 tempLH.second = tempLH.first;
597 if ( anEPM_TL_E.
n == anEPM_TH_E.n )
599 anEPM_T_E.
n = anEPM_TL_E.
n;
600 for (
G4int i=0 ; i < anEPM_TL_E.
n ; i++ )
603 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 ] ) );
604 anEPM_T_E.
isoAngle.push_back( angle );
606 mu = getMu ( &anEPM_T_E );
610 G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Do not yet supported");
std::vector< G4double > isoAngle
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
static G4MaterialTable * GetMaterialTable()
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
const G4Element * GetElement(G4int iel) const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
void BuildPhysicsTable(const G4ParticleDefinition &)
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void SetEnergyChange(G4double anEnergy)
G4double total(Particle const *const p1, Particle const *const p2)
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4HadFinalState theParticleChange
G4double GetTemperature() const
const G4Material * GetMaterial() const
size_t GetNumberOfElements() const
void SetMomentumChange(const G4ThreeVector &aV)