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