1068{
1070
1077
1082
1084 {
1085
1086 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
1087
1088
1089
1090 auto k2 = std::upper_bound(eTdummyVec.begin(),
1091 eTdummyVec.end(),
1092 k);
1093 auto k1 = k2 - 1;
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107 if (random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
1108 && random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back())
1109 {
1110 auto prob12 =
1111 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1112 eProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1113 random);
1114
1115 auto prob11 = prob12 - 1;
1116
1117 auto prob22 =
1118 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1119 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1120 random);
1121
1122 auto prob21 = prob22 - 1;
1123
1124 valueK1 = *k1;
1125 valueK2 = *k2;
1126 valuePROB21 = *prob21;
1127 valuePROB22 = *prob22;
1128 valuePROB12 = *prob12;
1129 valuePROB11 = *prob11;
1130
1131
1132
1133
1134
1135
1136 nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1137 nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1138 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1139 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149 }
1150
1151
1152 if (random > eProbaShellMap[ionizationLevelIndex][(*k1)].back())
1153 {
1154 auto prob22 =
1155 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1156 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1157 random);
1158
1159 auto prob21 = prob22 - 1;
1160
1161 valueK1 = *k1;
1162 valueK2 = *k2;
1163 valuePROB21 = *prob21;
1164 valuePROB22 = *prob22;
1165
1166
1167
1168 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1169 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1170
1171 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1172 valuePROB22,
1173 random,
1174 nrjTransf21,
1175 nrjTransf22);
1176
1177
1178
1179 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191 return value;
1192 }
1193 }
1194
1196 {
1197
1198 if (k==pTdummyVec.back()) k=k*(1.-1e-12);
1199
1200
1201
1202
1203 auto k2 = std::upper_bound(pTdummyVec.begin(),
1204 pTdummyVec.end(),
1205 k);
1206
1207 auto k1 = k2 - 1;
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222 if (random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back()
1223 && random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
1224 {
1225 auto prob12 =
1226 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1227 pProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1228 random);
1229
1230 auto prob11 = prob12 - 1;
1231
1232 auto prob22 =
1233 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1234 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1235 random);
1236
1237 auto prob21 = prob22 - 1;
1238
1239 valueK1 = *k1;
1240 valueK2 = *k2;
1241 valuePROB21 = *prob21;
1242 valuePROB22 = *prob22;
1243 valuePROB12 = *prob12;
1244 valuePROB11 = *prob11;
1245
1246
1247
1248
1249
1250
1251 nrjTransf11 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1252 nrjTransf12 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1253 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1254 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1255
1256
1257
1258
1259
1260
1261
1262
1263 }
1264
1265
1266
1267 if (random > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
1268 {
1269 auto prob22 =
1270 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1271 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1272 random);
1273
1274 auto prob21 = prob22 - 1;
1275
1276 valueK1 = *k1;
1277 valueK2 = *k2;
1278 valuePROB21 = *prob21;
1279 valuePROB22 = *prob22;
1280
1281
1282
1283 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1284 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1285
1286 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1287 valuePROB22,
1288 random,
1289 nrjTransf21,
1290 nrjTransf22);
1291
1292
1293
1294 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306 return value;
1307 }
1308 }
1309
1310
1311 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
1312 * nrjTransf22;
1313
1314
1315 if (nrjTransfProduct != 0.)
1316 {
1317 nrj = QuadInterpolator(valuePROB11,
1318 valuePROB12,
1319 valuePROB21,
1320 valuePROB22,
1321 nrjTransf11,
1322 nrjTransf12,
1323 nrjTransf21,
1324 nrjTransf22,
1325 valueK1,
1326 valueK2,
1327 k,
1328 random);
1329 }
1330
1331
1332 return nrj;
1333}