59,incoherentFSs(nullptr)
79void G4ParticleHPThermalScattering::clearCurrentFSData()
81 if ( incoherentFSs !=
nullptr )
83 for (
auto it=incoherentFSs->cbegin(); it!=incoherentFSs->cend(); ++it)
85 for (
auto itt=it->second->cbegin(); itt!= it->second->cend(); ++itt)
87 for (
auto ittt=itt->second->cbegin(); ittt!=itt->second->cend(); ++ittt)
97 if ( coherentFSs !=
nullptr )
99 for (
auto it=coherentFSs->cbegin(); it!=coherentFSs->cend(); ++it)
101 for (
auto itt=it->second->cbegin(); itt!=it->second->cend(); ++itt)
103 for (
auto ittt=itt->second->cbegin(); ittt!=itt->second->cend(); ++ittt)
113 if ( inelasticFSs !=
nullptr )
115 for (
auto it=inelasticFSs->cbegin(); it!=inelasticFSs->cend(); ++it)
117 for (
auto itt=it->second->cbegin(); itt!=it->second->cend(); ++itt)
119 for (
auto ittt=itt->second->cbegin(); ittt!=itt->second->cend(); ++ittt)
121 for (
auto it4=(*ittt)->vE_isoAngle.cbegin(); it4!=(*ittt)->vE_isoAngle.cend(); ++it4)
133 incoherentFSs =
nullptr;
134 coherentFSs =
nullptr;
135 inelasticFSs =
nullptr;
146std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >*
147G4ParticleHPThermalScattering::readACoherentFSDATA(
G4String name )
149 auto aCoherentFSDATA =
new std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >;
151 std::istringstream theChannel(std::ios::in);
154 std::vector< G4double > vBraggE;
157 while ( theChannel >> dummy )
162 std::vector < std::pair< G4double , G4double >* >*
163 anBragE_P =
new std::vector < std::pair< G4double , G4double >* >;
167 for (
G4int i = 0 ; i < n ; ++i )
171 if ( aCoherentFSDATA->size() == 0 )
174 vBraggE.push_back( Ei );
181 anBragE_P->push_back (
new std::pair < G4double , G4double > ( Ei , Pi ) );
183 aCoherentFSDATA->insert ( std::pair <
G4double , std::vector < std::pair< G4double , G4double >* >* > ( temp , anBragE_P ) );
185 return aCoherentFSDATA;
189std::map < G4double , std::vector < E_P_E_isoAng* >* >*
190G4ParticleHPThermalScattering::readAnInelasticFSDATA (
G4String name )
192 auto anT_E_P_E_isoAng =
new std::map < G4double , std::vector < E_P_E_isoAng* >* >;
194 std::istringstream theChannel(std::ios::in);
198 while ( theChannel >> dummy )
203 std::vector < E_P_E_isoAng* >* vE_P_E_isoAng =
new std::vector < E_P_E_isoAng* >;
206 for (
G4int i = 0 ; i <
n ; ++i )
208 vE_P_E_isoAng->push_back ( readAnE_P_E_isoAng ( &theChannel ) );
210 anT_E_P_E_isoAng->insert ( std::pair <
G4double , std::vector < E_P_E_isoAng* >* > ( temp , vE_P_E_isoAng ) );
213 return anT_E_P_E_isoAng;
218G4ParticleHPThermalScattering::readAnE_P_E_isoAng( std::istream* file )
233 for (
G4int i = 0 ; i < aData->
n ; ++i )
240 anE_isoAng->
n = nl - 2;
241 anE_isoAng->
isoAngle.resize( anE_isoAng->
n );
243 aData->
prob.push_back( prob );
245 for (
G4int j = 0 ; j < anE_isoAng->
n ; ++j )
256 for (
G4int i = 0 ; i < aData->
n - 1 ; ++i )
281std::map < G4double , std::vector < E_isoAng* >* >*
282G4ParticleHPThermalScattering::readAnIncoherentFSDATA (
G4String name )
284 auto T_E =
new std::map < G4double , std::vector < E_isoAng* >* >;
287 std::istringstream theChannel(std::ios::in);
291 while ( theChannel >> dummy )
296 std::vector < E_isoAng* >* vE_isoAng =
new std::vector < E_isoAng* >;
299 for (
G4int i = 0 ; i <
n ; i++ )
300 vE_isoAng->push_back ( readAnE_isoAng( &theChannel ) );
301 T_E->insert ( std::pair <
G4double , std::vector < E_isoAng* >* > ( temp , vE_isoAng ) );
309E_isoAng* G4ParticleHPThermalScattering::readAnE_isoAng( std::istream* file )
328 for (
G4int i = 0 ; i < aData->
n ; i++ )
344 G4bool findThermalElement =
false;
347 for (
G4int i = 0; i < n ; ++i )
354 if ( getTS_ID(
nullptr , theElement ) != -1 )
356 ielement = getTS_ID(
nullptr , theElement );
357 findThermalElement =
true;
360 else if ( getTS_ID( theMaterial , theElement ) != -1 )
362 ielement = getTS_ID( theMaterial , theElement );
363 findThermalElement =
true;
369 if ( findThermalElement ==
true )
379 if ( random <= inelastic/total )
383 std::vector<G4double> v_temp;
385 for (
auto it = inelasticFSs->find( ielement )->second->cbegin();
386 it != inelasticFSs->find( ielement )->second->cend() ; ++it )
388 v_temp.push_back( it->first );
391 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
395 std::vector< E_P_E_isoAng* >* vNEP_EPM_TL =
nullptr;
396 std::vector< E_P_E_isoAng* >* vNEP_EPM_TH =
nullptr;
398 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
400 vNEP_EPM_TL = inelasticFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second;
401 vNEP_EPM_TH = inelasticFSs->find( ielement )->second->find ( tempLH.second/kelvin )->second;
403 else if ( tempLH.first == 0.0 )
405 auto itm = inelasticFSs->find( ielement )->second->cbegin();
406 vNEP_EPM_TL = itm->second;
408 vNEP_EPM_TH = itm->second;
409 tempLH.first = tempLH.second;
410 tempLH.second = itm->first;
412 else if ( tempLH.second == 0.0 )
414 auto itm = inelasticFSs->find( ielement )->second->cend();
416 vNEP_EPM_TH = itm->second;
418 vNEP_EPM_TL = itm->second;
419 tempLH.second = tempLH.first;
420 tempLH.first = itm->first;
427 std::pair< G4double , G4double > secondaryParam;
429 if ( rand_temp < (aTemp-tempLH.first)/(tempLH.second - tempLH.first) )
430 secondaryParam = sample_inelastic_E_mu( aTrack.
GetKineticEnergy() , vNEP_EPM_TH );
432 secondaryParam = sample_inelastic_E_mu( aTrack.
GetKineticEnergy() , vNEP_EPM_TL );
434 sE = secondaryParam.first;
435 mu = secondaryParam.second;
440 G4double sint= std::sqrt ( 1 - mu*mu );
443 else if ( random <= ( inelastic + theXSection->
GetCoherentCrossSection( dp , theElement , theMaterial ) ) / total )
450 std::vector<G4double> v_temp;
452 for (
auto it = coherentFSs->find(ielement)->second->cbegin();
453 it != coherentFSs->find(ielement)->second->cend(); ++it)
455 v_temp.push_back( it->first );
459 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
464 std::vector< std::pair< G4double , G4double >* >* pvE_p_TL =
nullptr;
465 std::vector< std::pair< G4double , G4double >* >* pvE_p_TH =
nullptr;
467 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
469 pvE_p_TL = coherentFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second;
470 pvE_p_TH = coherentFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second;
472 else if ( tempLH.first == 0.0 )
474 pvE_p_TL = coherentFSs->find( ielement )->second->find ( v_temp[ 0 ] )->second;
475 pvE_p_TH = coherentFSs->find( ielement )->second->find ( v_temp[ 1 ] )->second;
476 tempLH.first = tempLH.second;
477 tempLH.second = v_temp[ 1 ];
479 else if ( tempLH.second == 0.0 )
481 pvE_p_TH = coherentFSs->find( ielement )->second->find ( v_temp.back() )->second;
482 auto itv = v_temp.cend();
485 pvE_p_TL = coherentFSs->find( ielement )->second->find ( *itv )->second;
486 tempLH.second = tempLH.first;
492 throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Unexpected temperature values in data");
495 std::vector< G4double > vE_T;
496 std::vector< G4double > vp_T;
501 std::vector< std::pair< G4double , G4double >* >* pvE_p_T_sampled;
503 if ( rand_temp < (aTemp-tempLH.first)/(tempLH.second - tempLH.first) )
504 pvE_p_T_sampled = pvE_p_TH;
506 pvE_p_T_sampled = pvE_p_TL;
509 for (
G4int i=0 ; i < n1 ; ++i )
511 vE_T.push_back ( (*pvE_p_T_sampled)[i]->first );
512 vp_T.push_back ( (*pvE_p_T_sampled)[i]->second );
516 for (
G4int i = 1 ; i < n1 ; ++i )
518 if ( E/eV < vE_T[ i ] )
528 for (
G4int i = 0 ; i <= j ; ++i )
530 G4double Pi = vp_T[ i ] / vp_T[ j ];
531 if ( rand_for_mu < Pi )
542 if ( mu < -1.0 ) mu = -1.0;
546 G4double sint= std::sqrt ( 1 - mu*mu );
554 std::vector<G4double> v_temp;
556 for (
auto it = incoherentFSs->find(ielement)->second->cbegin();
557 it != incoherentFSs->find(ielement)->second->cend(); ++it)
559 v_temp.push_back( it->first );
563 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
572 if ( tempLH.first != 0.0 && tempLH.second != 0.0 ) {
574 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second );
575 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( tempLH.second/kelvin )->second );
576 }
else if ( tempLH.first == 0.0 ) {
578 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp[ 0 ] )->second );
579 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp[ 1 ] )->second );
580 tempLH.first = tempLH.second;
581 tempLH.second = v_temp[ 1 ];
582 }
else if ( tempLH.second == 0.0 ) {
584 anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp.back() )->second );
585 auto itv = v_temp.cend();
588 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( *itv )->second );
589 tempLH.second = tempLH.first;
599 if ( rand_temp < (aTemp-tempLH.first)/(tempLH.second - tempLH.first) )
600 anEPM_T_E_sampled = anEPM_TH_E;
602 anEPM_T_E_sampled = anEPM_TL_E;
604 mu = getMu ( &anEPM_T_E_sampled );
609 G4double sint= std::sqrt ( 1 - mu*mu );
632std::pair< G4double , G4int> G4ParticleHPThermalScattering::
641 rndm1 < anE_P_E_isoAng->secondary_energy_cdf[i+1] )
649 G4double alpha = (sE_pdf_i1 - sE_pdf_i) / (sE_pdf_i1 + sE_pdf_i);
652 if ( std::fabs(alpha) < 1E-8 )
658 G4double beta = 2 * sE_pdf_i / (sE_pdf_i1 + sE_pdf_i);
663 if ( delta < 0 && std::fabs(delta) < 1.E-8 ) delta = 0;
665 lambda = -beta + std::sqrt(delta);
668 if ( lambda > 1 )
lambda = 1;
669 else if ( lambda < 0 )
lambda = 0;
672 sE_value = sE_value_i +
lambda * (sE_value_i1 - sE_value_i);
678 return std::pair< G4double , G4int >( sE_value , i );
685std::pair< G4double , G4double > G4ParticleHPThermalScattering::
686sample_inelastic_E_mu(
G4double pE , std::vector< E_P_E_isoAng* >* vNEP_EPM )
689 std::map< G4double , G4int > map_energy;
691 std::vector< G4double > v_energy;
694 for (
auto itv = vNEP_EPM->cbegin(); itv != vNEP_EPM->cend(); ++itv)
696 v_energy.push_back( (*itv)->energy );
697 map_energy.insert( std::pair< G4double , G4int >( (*itv)->energy , i ) );
701 std::pair< G4double , G4double > energyLH = find_LH( pE , &v_energy );
703 std::vector< E_P_E_isoAng* > pE_P_E_isoAng_limit(2,
nullptr);
705 if ( energyLH.first != 0.0 && energyLH.second != 0.0 )
707 pE_P_E_isoAng_limit[0] = (*vNEP_EPM)[ map_energy.find ( energyLH.first )->second ];
708 pE_P_E_isoAng_limit[1] = (*vNEP_EPM)[ map_energy.find ( energyLH.second )->second ];
710 else if ( energyLH.first == 0.0 )
712 pE_P_E_isoAng_limit[0] = (*vNEP_EPM)[ 0 ];
713 pE_P_E_isoAng_limit[1] = (*vNEP_EPM)[ 1 ];
715 if ( energyLH.second == 0.0 )
717 pE_P_E_isoAng_limit[1] = (*vNEP_EPM).back();
718 auto itv = vNEP_EPM->cend();
721 pE_P_E_isoAng_limit[0] = *itv;
725 G4double factor = (energyLH.second - pE) / (energyLH.second - energyLH.first);
727 if ( (energyLH.second - pE) <= 0. && std::fabs(pE/energyLH.second - 1) < 1E-11 ) factor = 0.;
728 if ( (energyLH.first - pE) >= 0. && std::fabs(energyLH.first / pE - 1) < 1E-11 ) factor = 1.;
734 std::pair< G4double , G4int > sE_lower = sample_inelastic_E( rndm1, rndm2, pE_P_E_isoAng_limit[0] );
735 std::pair< G4double , G4int > sE_upper = sample_inelastic_E( rndm1, rndm2, pE_P_E_isoAng_limit[1] );
736 G4double sE = factor * sE_lower.first + (1 - factor) * sE_upper.first;
742 G4double mu_lower = getMu( rndm1, rndm2, pE_P_E_isoAng_limit[0]->vE_isoAngle[sE_lower.second] );
743 G4double mu_upper = getMu( rndm1, rndm2, pE_P_E_isoAng_limit[1]->vE_isoAngle[sE_upper.second] );
744 G4double mu = factor * mu_lower + (1 - factor) * mu_upper;
746 return std::pair< G4double , G4double >( sE , mu );
761 G4double mu_l = (*anEPM).isoAngle[ in-1 ];
762 G4double mu_h = (*anEPM).isoAngle[ in ];
763 result = ( mu_h - mu_l ) * ( rndm1*((*anEPM).n) - in ) + mu_l;
772 G4double mu_h = (*anEPM).isoAngle[ 0 ];
773 result = ( mu_h - mu_l ) * rndm2 + mu_l;
777 G4double mu_l = (*anEPM).isoAngle[ (*anEPM).n - 1 ];
779 result = ( mu_h - mu_l ) * rndm2 + mu_l;
801 G4double mu_l = (*anEPM).isoAngle[ in-1 ];
802 G4double mu_h = (*anEPM).isoAngle[ in ];
803 result = ( mu_h - mu_l ) * ( random * ( (*anEPM).n ) - in ) + mu_l;
814 G4double mu_h = (*anEPM).isoAngle[ 0 ];
815 result = ( mu_h - mu_l ) * xx + mu_l;
819 G4double mu_l = (*anEPM).isoAngle[ (*anEPM).n - 1 ];
821 result = ( mu_h - mu_l ) * xx + mu_l;
828std::pair < G4double , G4double > G4ParticleHPThermalScattering::find_LH (
G4double x , std::vector< G4double >* aVector )
834 if ( aVector->size() == 1 ) {
835 LL = aVector->front();
836 H = aVector->front();
841 for (
auto it = aVector->cbegin() ; it != aVector->cend() ; ++it ) {
844 if ( it != aVector->cbegin() ) {
856 if ( H == 0.0 ) LL = aVector->back();
859 return std::pair < G4double , G4double > ( LL , H );
863G4double G4ParticleHPThermalScattering::get_linear_interpolated (
G4double x , std::pair< G4double , G4double > Low , std::pair< G4double , G4double > High )
866 if ( High.first - Low.first != 0 ) {
867 y = ( High.second - Low.second ) / ( High.first - Low.first ) * ( x - Low.first ) + Low.second;
869 if ( High.second == Low.second ) {
872 G4cout <<
"G4ParticleHPThermalScattering liner interpolation err!!" <<
G4endl;
881G4ParticleHPThermalScattering::create_E_isoAng_from_energy(
G4double energy,
882 std::vector<E_isoAng*>* vEPM)
886 std::vector<G4double> v_e;
888 for (
auto iv = vEPM->cbegin(); iv != vEPM->cend(); ++iv)
889 v_e.push_back( (*iv)->energy );
891 std::pair<G4double, G4double> energyLH = find_LH(energy, &v_e);
897 if (energyLH.first != 0.0 && energyLH.second != 0.0) {
898 for (
auto iv = vEPM->cbegin(); iv != vEPM->cend(); ++iv) {
899 if (energyLH.first == (*iv)->energy) {
907 }
else if (energyLH.first == 0.0) {
908 panEPM_T_EL = (*vEPM)[0];
909 panEPM_T_EH = (*vEPM)[1];
911 }
else if (energyLH.second == 0.0) {
912 panEPM_T_EH = (*vEPM).back();
913 auto iv = vEPM->cend();
919 if (panEPM_T_EL != 0 && panEPM_T_EH != 0) {
922 if ( !(check_E_isoAng(panEPM_T_EL) ) ) panEPM_T_EL = panEPM_T_EH;
923 if ( !(check_E_isoAng(panEPM_T_EH) ) ) panEPM_T_EH = panEPM_T_EL;
925 if (panEPM_T_EL->
n == panEPM_T_EH->
n) {
927 anEPM_T_E.
n = panEPM_T_EL->
n;
929 for (
G4int i=0; i < panEPM_T_EL->
n; ++i) {
931 angle = get_linear_interpolated(energy, std::pair<G4double,G4double>(energyLH.first, panEPM_T_EL->
isoAngle[i] ),
932 std::pair<G4double,G4double>(energyLH.second, panEPM_T_EH->
isoAngle[i] ) );
933 anEPM_T_E.
isoAngle.push_back(angle);
937 G4Exception(
"G4ParticleHPThermalScattering::create_E_isoAng_from_energy",
939 "G4ParticleHPThermalScattering does not support yet EL->n != EH->n.");
943 G4Exception(
"G4ParticleHPThermalScattering::create_E_isoAng_from_energy",
945 "Pointer panEPM_T_EL or panEPM_T_EH is zero");
952G4double G4ParticleHPThermalScattering::
977 for (
G4int i = 0 ; i <
n-1 ; ++i )
982 sum_p += ( ( anE_P_E_isoAng->
prob[i] ) * dE );
984 if ( random <= sum_p/total )
986 secondary_energy = get_linear_interpolated ( random , std::pair < G4double , G4double > ( sum_p_L/total , E_L ) , std::pair < G4double , G4double > ( sum_p/total , E_H ) );
987 secondary_energy = secondary_energy*eV;
993 return secondary_energy;
997std::pair< G4double , E_isoAng > G4ParticleHPThermalScattering::
998create_sE_and_EPM_from_pE_and_vE_P_E_isoAng (
G4double rand_for_sE ,
G4double pE , std::vector < E_P_E_isoAng* >* vNEP_EPM )
1000 std::map< G4double , G4int > map_energy;
1002 std::vector< G4double > v_energy;
1005 for (
auto itv = vNEP_EPM->cbegin(); itv != vNEP_EPM->cend(); ++itv)
1007 v_energy.push_back( (*itv)->energy );
1008 map_energy.insert( std::pair < G4double , G4int > ( (*itv)->energy , i ) );
1012 std::pair < G4double , G4double > energyLH = find_LH ( pE , &v_energy );
1017 if ( energyLH.first != 0.0 && energyLH.second != 0.0 )
1019 pE_P_E_isoAng_EL = (*vNEP_EPM)[ map_energy.find ( energyLH.first )->second ];
1020 pE_P_E_isoAng_EH = (*vNEP_EPM)[ map_energy.find ( energyLH.second )->second ];
1022 else if ( energyLH.first == 0.0 )
1024 pE_P_E_isoAng_EL = (*vNEP_EPM)[ 0 ];
1025 pE_P_E_isoAng_EH = (*vNEP_EPM)[ 1 ];
1027 if ( energyLH.second == 0.0 )
1029 pE_P_E_isoAng_EH = (*vNEP_EPM).back();
1030 auto itv = vNEP_EPM->cend();
1033 pE_P_E_isoAng_EL = *itv;
1040 sE_L = get_secondary_energy_from_E_P_E_isoAng ( rand_for_sE , pE_P_E_isoAng_EL );
1041 sE_H = get_secondary_energy_from_E_P_E_isoAng ( rand_for_sE , pE_P_E_isoAng_EH );
1043 sE = get_linear_interpolated ( pE , std::pair < G4double , G4double > ( energyLH.first , sE_L ) , std::pair < G4double , G4double > ( energyLH.second , sE_H ) );
1046 E_isoAng E_isoAng_L = create_E_isoAng_from_energy ( sE , &(pE_P_E_isoAng_EL->
vE_isoAngle) );
1047 E_isoAng E_isoAng_H = create_E_isoAng_from_energy ( sE , &(pE_P_E_isoAng_EH->
vE_isoAngle) );
1053 if ( E_isoAng_L.
n == E_isoAng_H.
n )
1055 anE_isoAng.
n = E_isoAng_L.
n;
1056 for (
G4int j=0 ; j < anE_isoAng.
n ; ++j )
1059 angle = get_linear_interpolated ( sE , std::pair< G4double , G4double > ( sE_L , E_isoAng_L.
isoAngle[ j ] ) , std::pair< G4double , G4double > ( sE_H , E_isoAng_H.
isoAngle[ j ] ) );
1060 anE_isoAng.
isoAngle.push_back( angle );
1068 return std::pair< G4double , E_isoAng >( sE , anE_isoAng);
1072void G4ParticleHPThermalScattering::buildPhysicsTable()
1083 std::map < G4String , G4int > co_dic;
1089 for ( std::size_t i = 0 ; i < numberOfMaterials ; ++i )
1091 G4Material* material = (*theMaterialTable)[i];
1093 for (
G4int j = 0 ; j < numberOfElements ; ++j )
1098 G4int ts_ID_of_this_geometry;
1100 if ( co_dic.find ( ts_ndl_name ) != co_dic.cend() )
1102 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
1106 ts_ID_of_this_geometry = (
G4int)co_dic.size();
1107 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
1114 dic.insert( std::pair < std::pair < G4Material* , const G4Element* > ,
G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
1123 for ( std::size_t i = 0 ; i < numberOfElements ; ++i )
1125 const G4Element* element = (*theElementTable)[i];
1130 G4int ts_ID_of_this_geometry;
1132 if ( co_dic.find ( ts_ndl_name ) != co_dic.cend() )
1134 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
1138 ts_ID_of_this_geometry = (
G4int)co_dic.size();
1139 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
1141 dic.insert( std::pair < std::pair < const G4Material* , const G4Element* > ,
G4int > ( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)
nullptr , element ) , ts_ID_of_this_geometry ) );
1147 G4cout <<
"Neutron HP Thermal Scattering: Following material-element pairs or elements are registered." <<
G4endl;
1148 for ( std::map < std::pair < const G4Material* , const G4Element* > ,
G4int >::iterator it = dic.begin() ; it != dic.end() ; it++ )
1150 if ( it->first.first !=
nullptr )
1152 G4cout <<
"Material " << it->first.first->GetName() <<
" - Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
1156 G4cout <<
"Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
1170 clearCurrentFSData();
1172 if ( coherentFSs ==
nullptr ) coherentFSs =
new std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >;
1173 if ( incoherentFSs ==
nullptr ) incoherentFSs =
new std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >;
1174 if ( inelasticFSs ==
nullptr ) inelasticFSs =
new std::map < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* >;
1178 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
1181 for (
auto it = co_dic.cbegin() ; it != co_dic.cend() ; ++it)
1184 G4int ts_ID = it->second;
1187 G4String fsName =
"/ThermalScattering/Coherent/FS/";
1188 G4String fileName = dirName + fsName + tsndlName;
1189 coherentFSs->insert ( std::pair <
G4int , std::map <
G4double , std::vector < std::pair< G4double , G4double >* >* >* > ( ts_ID , readACoherentFSDATA( fileName ) ) );
1192 fsName =
"/ThermalScattering/Incoherent/FS/";
1193 fileName = dirName + fsName + tsndlName;
1194 incoherentFSs->insert ( std::pair <
G4int , std::map <
G4double , std::vector < E_isoAng* >* >* > ( ts_ID , readAnIncoherentFSDATA( fileName ) ) );
1197 fsName =
"/ThermalScattering/Inelastic/FS/";
1198 fileName = dirName + fsName + tsndlName;
1199 inelasticFSs->insert ( std::pair <
G4int , std::map <
G4double , std::vector < E_P_E_isoAng* >* >* > ( ts_ID , readAnInelasticFSDATA( fileName ) ) );
1214 if ( dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) != dic.end() )
1215 result = dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) )->second;
1223 return std::pair<G4double, G4double>(10.0*perCent, 350.0*CLHEP::GeV);
1231 buildPhysicsTable();
1235G4bool G4ParticleHPThermalScattering::check_E_isoAng(
E_isoAng* anE_IsoAng )
1241 for (
G4int i = 0 ; i < n ; ++i ) {
1244 if ( sum != 0.0 ) result =
true;
1252 outFile <<
"High Precision model based on thermal scattering data in\n"
1253 <<
"evaluated nuclear data libraries for neutrons below 5eV\n"
1254 <<
"on specific materials\n";
std::vector< G4Element * > G4ElementTable
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cout
static G4ElementTable * GetElementTable()
static size_t GetNumberOfElements()
const G4String & GetName() const
void SetEnergyChange(G4double anEnergy)
void SetMomentumChange(const G4ThreeVector &aV)
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
G4HadFinalState theParticleChange
void SetMinEnergy(G4double anEnergy)
void SetMaxEnergy(const G4double anEnergy)
static size_t GetNumberOfMaterials()
G4double GetTemperature() const
const G4Element * GetElement(G4int iel) const
size_t GetNumberOfElements() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
static G4Neutron * Neutron()
void BuildPhysicsTable(const G4ParticleDefinition &)
void RegisterThermalScatteringCoherentFinalStates(std::map< G4int, std::map< G4double, std::vector< std::pair< G4double, G4double > * > * > * > *val)
void RegisterThermalScatteringIncoherentFinalStates(std::map< G4int, std::map< G4double, std::vector< E_isoAng * > * > * > *val)
void RegisterThermalScatteringInelasticFinalStates(std::map< G4int, std::map< G4double, std::vector< E_P_E_isoAng * > * > * > *val)
std::map< G4int, std::map< G4double, std::vector< std::pair< G4double, G4double > * > * > * > * GetThermalScatteringCoherentFinalStates()
static G4ParticleHPManager * GetInstance()
std::map< G4int, std::map< G4double, std::vector< E_isoAng * > * > * > * GetThermalScatteringIncoherentFinalStates()
void GetDataStream(G4String, std::istringstream &iss)
std::map< G4int, std::map< G4double, std::vector< E_P_E_isoAng * > * > * > * GetThermalScatteringInelasticFinalStates()
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void BuildPhysicsTable(const G4ParticleDefinition &)
void AddUserThermalScatteringFile(G4String, G4String)
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void AddThermalElement(G4String, G4String)
G4bool IsThisThermalElement(G4String)
G4String GetTS_NDL_Name(G4String nameG4Element)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
void AddUserThermalScatteringFile(G4String, G4String)
G4ParticleHPThermalScattering()
virtual void ModelDescription(std::ostream &outFile) const
virtual const std::pair< G4double, G4double > GetFatalEnergyCheckLevels() const
~G4ParticleHPThermalScattering()
void BuildPhysicsTable(const G4ParticleDefinition &)
G4double total(Particle const *const p1, Particle const *const p2)
G4double energy(const ThreeVector &p, const G4double m)
std::vector< G4double > prob
std::vector< E_isoAng * > vE_isoAngle
std::vector< G4double > secondary_energy_pdf
G4int secondary_energy_cdf_size
std::vector< G4double > secondary_energy_cdf
std::vector< G4double > secondary_energy_value
std::vector< G4double > isoAngle