1016{
1018
1025
1030
1032 {
1033
1034 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
1035
1036
1037
1038 auto k2 = std::upper_bound(eTdummyVec.begin(),
1039 eTdummyVec.end(),
1040 k);
1041 auto k1 = k2 - 1;
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055 if (random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
1056 && random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back())
1057 {
1058 auto prob12 =
1059 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1060 eProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1061 random);
1062
1063 auto prob11 = prob12 - 1;
1064
1065 auto prob22 =
1066 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1067 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1068 random);
1069
1070 auto prob21 = prob22 - 1;
1071
1072 valueK1 = *k1;
1073 valueK2 = *k2;
1074 valuePROB21 = *prob21;
1075 valuePROB22 = *prob22;
1076 valuePROB12 = *prob12;
1077 valuePROB11 = *prob11;
1078
1079
1080
1081
1082
1083
1084 nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1085 nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1086 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1087 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097 }
1098
1099
1100 if (random > eProbaShellMap[ionizationLevelIndex][(*k1)].back())
1101 {
1102 auto prob22 =
1103 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1104 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1105 random);
1106
1107 auto prob21 = prob22 - 1;
1108
1109 valueK1 = *k1;
1110 valueK2 = *k2;
1111 valuePROB21 = *prob21;
1112 valuePROB22 = *prob22;
1113
1114
1115
1116 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1117 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1118
1119 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1120 valuePROB22,
1121 random,
1122 nrjTransf21,
1123 nrjTransf22);
1124
1125
1126
1127 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139 return value;
1140 }
1141 }
1142
1144 {
1145
1146 if (k==pTdummyVec.back()) k=k*(1.-1e-12);
1147
1148
1149
1150
1151 auto k2 = std::upper_bound(pTdummyVec.begin(),
1152 pTdummyVec.end(),
1153 k);
1154
1155 auto k1 = k2 - 1;
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170 if (random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back()
1171 && random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
1172 {
1173 auto prob12 =
1174 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1175 pProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1176 random);
1177
1178 auto prob11 = prob12 - 1;
1179
1180 auto prob22 =
1181 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1182 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1183 random);
1184
1185 auto prob21 = prob22 - 1;
1186
1187 valueK1 = *k1;
1188 valueK2 = *k2;
1189 valuePROB21 = *prob21;
1190 valuePROB22 = *prob22;
1191 valuePROB12 = *prob12;
1192 valuePROB11 = *prob11;
1193
1194
1195
1196
1197
1198
1199 nrjTransf11 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1200 nrjTransf12 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1201 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1202 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1203
1204
1205
1206
1207
1208
1209
1210
1211 }
1212
1213
1214
1215 if (random > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
1216 {
1217 auto prob22 =
1218 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1219 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1220 random);
1221
1222 auto prob21 = prob22 - 1;
1223
1224 valueK1 = *k1;
1225 valueK2 = *k2;
1226 valuePROB21 = *prob21;
1227 valuePROB22 = *prob22;
1228
1229
1230
1231 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1232 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1233
1234 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1235 valuePROB22,
1236 random,
1237 nrjTransf21,
1238 nrjTransf22);
1239
1240
1241
1242 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254 return value;
1255 }
1256 }
1257
1258
1259 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
1260 * nrjTransf22;
1261
1262
1263 if (nrjTransfProduct != 0.)
1264 {
1265 nrj = QuadInterpolator(valuePROB11,
1266 valuePROB12,
1267 valuePROB21,
1268 valuePROB22,
1269 nrjTransf11,
1270 nrjTransf12,
1271 nrjTransf21,
1272 nrjTransf22,
1273 valueK1,
1274 valueK2,
1275 k,
1276 random);
1277 }
1278
1279
1280 return nrj;
1281}