393{
394
395
396
397
398
399
400
401
402
403
404
408
409
410 G4bool findThermalElement =
false;
413 for (
G4int i = 0; i <
n ; i++ )
414 {
416
417 if ( aNucleus.GetZ_asInt() == (
G4int)(theElement->
GetZ() + 0.5 ) )
418 {
419
420 if ( getTS_ID( NULL , theElement ) != -1 )
421 {
422 ielement = getTS_ID( NULL , theElement );
423 findThermalElement = true;
424 break;
425 }
426 else if ( getTS_ID( theMaterial , theElement ) != -1 )
427 {
428 ielement = getTS_ID( theMaterial , theElement );
429 findThermalElement = true;
430 break;
431 }
432 }
433 }
434
435 if ( findThermalElement == true )
436 {
437
438
439
444
445
447 if ( random <= inelastic/total )
448 {
449
450
451
452 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator it;
453 std::vector<G4double> v_temp;
454 v_temp.clear();
455 for ( it = inelasticFSs->find( ielement )->second->begin() ; it != inelasticFSs->find( ielement )->second->end() ; it++ )
456 {
457 v_temp.push_back( it->first );
458 }
459
460
461 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
462
463
464
465 std::vector< E_P_E_isoAng* >* vNEP_EPM_TL = 0;
466 std::vector< E_P_E_isoAng* >* vNEP_EPM_TH = 0;
467
468 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
469 {
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;
472 }
473 else if ( tempLH.first == 0.0 )
474 {
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;
478 itm++;
479 vNEP_EPM_TH = itm->second;
480 tempLH.first = tempLH.second;
481 tempLH.second = itm->first;
482 }
483 else if ( tempLH.second == 0.0 )
484 {
485 std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator itm;
486 itm = inelasticFSs->find( ielement )->second->end();
487 itm--;
488 vNEP_EPM_TH = itm->second;
489 itm--;
490 vNEP_EPM_TL = itm->second;
491 tempLH.second = tempLH.first;
492 tempLH.first = itm->first;
493 }
494
496
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 );
499
501 sE = get_linear_interpolated ( aTemp , std::pair < G4double , G4double > ( tempLH.first , TL.first ) , std::pair < G4double , G4double > ( tempLH.second , TH.first ) );
502
505 if ( TL.second.n == TH.second.n )
506 {
508 anE_isoAng.
n = TL.second.n;
509 for (
G4int i=0 ; i < anE_isoAng.
n ; i++ )
510 {
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 );
514 }
515 mu = getMu( &anE_isoAng );
516
517 } else {
518
519 throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Do not yet supported");
520 }
521
522
525
526 }
527
528 else if ( random <= ( inelastic + theXSection->
GetCoherentCrossSection( dp , theElement , theMaterial ) ) / total )
529 {
530
531
533
534
535 std::map < G4double , std::vector< std::pair< G4double , G4double >* >* >::iterator it;
536 std::vector<G4double> v_temp;
537 v_temp.clear();
538 for ( it = coherentFSs->find( ielement )->second->begin() ; it != coherentFSs->find( ielement )->second->end() ; it++ )
539 {
540 v_temp.push_back( it->first );
541 }
542
543
544 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
545
546
547
548
549 std::vector< std::pair< G4double , G4double >* >* pvE_p_TL = NULL;
550 std::vector< std::pair< G4double , G4double >* >* pvE_p_TH = NULL;
551
552 if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
553 {
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;
556 }
557 else if ( tempLH.first == 0.0 )
558 {
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 ];
563 }
564 else if ( tempLH.second == 0.0 )
565 {
566 pvE_p_TH = coherentFSs->find( ielement )->second->find ( v_temp.back() )->second;
567 std::vector< G4double >::iterator itv;
568 itv = v_temp.end();
569 itv--;
570 itv--;
571 pvE_p_TL = coherentFSs->find( ielement )->second->find ( *itv )->second;
572 tempLH.second = tempLH.first;
573 tempLH.first = *itv;
574 }
575 else
576 {
577
578 throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Unexpected temperature values in data");
579 }
580
581 std::vector< G4double > vE_T;
582 std::vector< G4double > vp_T;
583
584 G4int n1 = pvE_p_TL->size();
585
586
587
588 for (
G4int i=0 ; i < n1 ; i++ )
589 {
590 if ( (*pvE_p_TL)[i]->first != (*pvE_p_TH)[i]->first )
throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data!");
591 vE_T.push_back ( (*pvE_p_TL)[i]->first );
592 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 ) ) );
593 }
594
596 for (
G4int i = 1 ; i < n1 ; i++ )
597 {
598 if ( E/eV < vE_T[ i ] )
599 {
600 j = i-1;
601 break;
602 }
603 }
604
606
608 for (
G4int i = 0 ; i <= j ; i++ )
609 {
610 G4double Pi = vp_T[ i ] / vp_T[ j ];
611 if ( rand_for_mu < Pi )
612 {
613 k = i;
614 break;
615 }
616 }
617
619
621
622 if ( mu < -1.0 ) mu = -1.0;
623
624
627
628 }
629 else
630 {
631
632
633
634 std::map < G4double , std::vector < E_isoAng* >* >::iterator it;
635 std::vector<G4double> v_temp;
636 v_temp.clear();
637 for ( it = incoherentFSs->find( ielement )->second->begin() ; it != incoherentFSs->find( ielement )->second->end() ; it++ )
638 {
639 v_temp.push_back( it->first );
640 }
641
642
643 std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
644
645
646
647
648
651
652 if ( tempLH.first != 0.0 && tempLH.second != 0.0 ) {
653
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 ) {
657
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 ) {
663
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;
666 itv = v_temp.end();
667 itv--;
668 itv--;
669 anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.
GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( *itv )->second );
670 tempLH.second = tempLH.first;
671 tempLH.first = *itv;
672 }
673
674
677
678 if ( anEPM_TL_E.
n == anEPM_TH_E.
n )
679 {
680 anEPM_T_E.
n = anEPM_TL_E.
n;
681 for (
G4int i=0 ; i < anEPM_TL_E.
n ; i++ )
682 {
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 );
686 }
687 mu = getMu ( &anEPM_T_E );
688
689 } else {
690
691 throw G4HadronicException(__FILE__, __LINE__,
"A problem is found in Thermal Scattering Data! Do not yet supported");
692 }
693
694
697
698 }
699 delete dp;
700
702
703 }
704 else
705 {
706
707
709 }
710
711}
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
G4double GetTemperature() const
const G4Element * GetElement(G4int iel) const
size_t GetNumberOfElements() const
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
G4double total(Particle const *const p1, Particle const *const p2)
std::vector< G4double > isoAngle