643{
655
656 if(k == pTdummyVec.back())
657 {
658 k = k * (1. - 1e-12);
659 }
660
661
662 auto k2 = std::upper_bound(pTdummyVec.begin(), pTdummyVec.end(), k);
663 auto k1 = k2 - 1;
664
665
666
667
668 if(random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back() &&
669 random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
670 {
671 auto prob12 = std::upper_bound(
672 pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
673 pProbaShellMap[ionizationLevelIndex][(*k1)].end(), random);
674 auto prob11 = prob12 - 1;
675 auto prob22 = std::upper_bound(
676 pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
677 pProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
678
679 auto prob21 = prob22 - 1;
680
681 valueK1 = *k1;
682 valueK2 = *k2;
683 valuePROB21 = *prob21;
684 valuePROB22 = *prob22;
685 valuePROB12 = *prob12;
686 valuePROB11 = *prob11;
687
688 nrjTransf11 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
689 nrjTransf12 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
690 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
691 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
692 }
693
694
695
696
697 if(random > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
698 {
699 auto prob22 = std::upper_bound(
700 pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
701 pProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
702 auto prob21 = prob22 - 1;
703
704 valueK1 = *k1;
705 valueK2 = *k2;
706 valuePROB21 = *prob21;
707 valuePROB22 = *prob22;
708 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
709 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
710
712 Interpolate(valuePROB21, valuePROB22, random, nrjTransf21, nrjTransf22);
713
714 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
715 return value;
716 }
718 nrjTransf11 * nrjTransf12 * nrjTransf21 * nrjTransf22;
719
720 if(nrjTransfProduct != 0.)
721 {
722 nrj = QuadInterpolator(valuePROB11, valuePROB12, valuePROB21, valuePROB22,
723 nrjTransf11, nrjTransf12, nrjTransf21, nrjTransf22,
724 valueK1, valueK2, k, random);
725 }
726 return nrj;
727}