1082 std::vector<const Trk::TrackStateOnSurface*> newTSOSvector;
1083 int maxsize = 2 * matvec.size();
1085 newTSOSvector.reserve(
maxsize);
1094 double sigmaDeltaPhi2_tot = 0.;
1095 double sigmaDeltaTheta2_tot = 0.;
1096 double deltaE_tot = 0.;
1097 double sigmaDeltaE_tot = 0.;
1098 double sigmaPlusDeltaE_tot = 0.;
1099 double sigmaMinusDeltaE_tot = 0.;
1100 double deltaE_ioni_tot = 0.;
1101 double sigmaDeltaE_ioni_tot = 0.;
1102 double deltaE_rad_tot = 0.;
1103 double sigmaDeltaE_rad_tot = 0.;
1110 double deltaEFirst = 0.;
1113 double deltaTheta = 0.;
1122 std::bitset<Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes>
1128 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>
1133 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes>
1134 typePatternDeposit(0);
1139 for (
const auto*
m : matvec) {
1140 if (!
m->trackParameters()) {
1144 if (
m->materialEffectsOnTrack()) {
1145 double X0 =
m->materialEffectsOnTrack()->thicknessInX0();
1148 m->materialEffectsOnTrack());
1174 <<
m->dumpType() <<
" TSOS surface "
1175 <<
m->trackParameters()->associatedSurface()
1176 <<
" position x " <<
m->trackParameters()->position().x()
1177 <<
" y " <<
m->trackParameters()->position().y() <<
" z "
1178 <<
m->trackParameters()->position().z() <<
" direction x "
1179 <<
m->trackParameters()->momentum().unit().x() <<
" y "
1180 <<
m->trackParameters()->momentum().unit().y() <<
" z "
1181 <<
m->trackParameters()->momentum().unit().z() <<
" p "
1182 <<
m->trackParameters()->momentum().mag() <<
" X0 " <<
X0
1183 <<
" deltaE " << energyLoss->
deltaE()
1185 <<
" depth " <<
depth);
1187 X0_tot += scaleX0 *
X0;
1189 sigmaDeltaTheta2_tot +=
1191 sigmaDeltaPhi2_tot +=
1197 deltaE_tot += scaleEloss * energyLoss->
deltaE();
1198 sigmaDeltaE_tot += scaleEloss * energyLoss->
sigmaDeltaE();
1201 deltaE_ioni_tot += scaleEloss * energyLoss->
meanIoni();
1202 sigmaDeltaE_ioni_tot += scaleEloss * energyLoss->
sigmaIoni();
1203 deltaE_rad_tot += scaleEloss * energyLoss->
meanRad();
1204 sigmaDeltaE_rad_tot += scaleEloss * energyLoss->
sigmaRad();
1216 <<
pos.z() <<
" perp " <<
pos.perp());
1223 << pos0.x() <<
" y " << pos0.y() <<
" z " << pos0.z()
1224 <<
" perp " << pos0.perp());
1226 << posNew.x() <<
" y " << posNew.y() <<
" z " << posNew.z()
1227 <<
" perp " << posNew.perp() <<
" distance "
1228 << (pos0 - posNew).mag() <<
" depth " <<
depth);
1232 deltaEFirst = energyLoss->
deltaE();
1238 wpos +=
w * pos0 / 2.;
1239 wpos +=
w * posNew / 2.;
1242 wdist2 +=
w * (pos0 - posFirst).
mag2() / 2.;
1243 wdist2 +=
w * (posNew - posFirst).
mag2() / 2.;
1245 if (!aggregate && !reposition) {
1246 auto scatNew = ScatteringAngles(
deltaPhi, deltaTheta,
1247 std::sqrt(sigmaDeltaPhi2_tot),
1248 std::sqrt(sigmaDeltaTheta2_tot));
1249 auto energyLossNew = std::make_unique<Trk::EnergyLoss>(
1250 deltaE_tot, sigmaDeltaE_tot, sigmaPlusDeltaE_tot,
1251 sigmaMinusDeltaE_tot, deltaE_ioni_tot, sigmaDeltaE_ioni_tot,
1252 deltaE_rad_tot, sigmaDeltaE_rad_tot,
depth);
1253 Eloss_tot += energyLossNew->deltaE();
1255 auto meotLast = std::make_unique<Trk::MaterialEffectsOnTrack>(
1256 X0_tot, scatNew, std::move(energyLossNew), surf, meotPattern);
1257 auto pars =
m->trackParameters()->uniqueClone();
1261 nullptr, std::move(
pars), std::move(meotLast), typePattern);
1262 newTSOSvector.push_back(newTSOS);
1265 sigmaDeltaTheta2_tot = 0.;
1266 sigmaDeltaPhi2_tot = 0.;
1268 sigmaDeltaE_tot = 0;
1269 sigmaPlusDeltaE_tot = 0.;
1270 sigmaMinusDeltaE_tot = 0.;
1271 deltaE_ioni_tot = 0.;
1272 sigmaDeltaE_ioni_tot = 0.;
1273 deltaE_rad_tot = 0.;
1274 sigmaDeltaE_rad_tot = 0.;
1276 }
else if (!aggregate && reposition) {
1277 if (std::abs(
depth) < 10.) {
1278 auto scatNew = ScatteringAngles(
deltaPhi, deltaTheta,
1279 std::sqrt(sigmaDeltaPhi2_tot),
1280 std::sqrt(sigmaDeltaTheta2_tot));
1281 auto energyLossNew = std::make_unique<Trk::EnergyLoss>(
1282 deltaE_tot, sigmaDeltaE_tot, sigmaPlusDeltaE_tot,
1283 sigmaMinusDeltaE_tot, deltaE_ioni_tot, sigmaDeltaE_ioni_tot,
1284 deltaE_rad_tot, sigmaDeltaE_rad_tot,
depth);
1286 Eloss_tot += energyLossNew->deltaE();
1287 auto meotLast = std::make_unique<Trk::MaterialEffectsOnTrack>(
1288 X0_tot, scatNew, std::move(energyLossNew), surf, meotPattern);
1289 std::unique_ptr<Trk::TrackParameters>
pars =
1290 m->trackParameters()->uniqueClone();
1294 std::move(meotLast), typePattern);
1295 newTSOSvector.push_back(newTSOS);
1297 sigmaDeltaTheta2_tot = 0.;
1298 sigmaDeltaPhi2_tot = 0.;
1300 sigmaDeltaE_tot = 0;
1301 sigmaPlusDeltaE_tot = 0.;
1302 sigmaMinusDeltaE_tot = 0.;
1303 deltaE_ioni_tot = 0.;
1304 sigmaDeltaE_ioni_tot = 0.;
1305 deltaE_rad_tot = 0.;
1306 sigmaDeltaE_rad_tot = 0.;
1314 auto energyLoss0 = std::make_unique<Trk::EnergyLoss>(0., 0., 0., 0.);
1315 auto scatFirst = ScatteringAngles(
deltaPhi, deltaTheta,
1316 sqrt(sigmaDeltaPhi2_tot / 2.),
1317 sqrt(sigmaDeltaTheta2_tot / 2.));
1321 auto scatNew = ScatteringAngles(
deltaPhi, deltaTheta,
1322 sqrt(sigmaDeltaPhi2_tot / 2.),
1323 sqrt(sigmaDeltaTheta2_tot / 2.));
1324 auto energyLossNew = std::make_unique<Trk::EnergyLoss>(
1325 deltaE_tot, sigmaDeltaE_tot, sigmaPlusDeltaE_tot,
1326 sigmaMinusDeltaE_tot, deltaE_ioni_tot, sigmaDeltaE_ioni_tot,
1327 deltaE_rad_tot, sigmaDeltaE_rad_tot, 0.);
1341 Eloss_tot += energyLossNew->deltaE();
1343 auto meotFirst = std::make_unique<Trk::MaterialEffectsOnTrack>(
1344 X0_tot / 2., scatFirst, std::move(energyLoss0), *surfFirst,
1346 auto meotLast = std::make_unique<Trk::MaterialEffectsOnTrack>(
1347 X0_tot / 2., scatNew, std::move(energyLossNew), *surfLast,
1351 double qOverP0 =
m->trackParameters()->charge() /
1352 (
m->trackParameters()->momentum().mag() -
1353 std::fabs(energyLoss->
deltaE()));
1357 std::unique_ptr<Trk::TrackParameters> parsFirst =
1359 0., 0.,
dir.phi(),
dir.theta(), qOverP0);
1361 double qOverPNew =
m->trackParameters()->charge() /
1362 m->trackParameters()->momentum().mag();
1363 std::unique_ptr<Trk::TrackParameters> parsLast =
1365 0., 0.,
dir.phi(),
dir.theta(), qOverPNew);
1370 std::move(meotFirst), typePattern);
1373 std::move(meotLast), typePattern);
1375 newTSOSvector.push_back(newTSOSFirst);
1376 newTSOSvector.push_back(newTSOS);
1379 sigmaDeltaTheta2_tot = 0.;
1380 sigmaDeltaPhi2_tot = 0.;
1382 sigmaDeltaE_tot = 0;
1383 sigmaPlusDeltaE_tot = 0.;
1384 sigmaMinusDeltaE_tot = 0.;
1385 deltaE_ioni_tot = 0.;
1386 sigmaDeltaE_ioni_tot = 0.;
1387 deltaE_rad_tot = 0.;
1388 sigmaDeltaE_rad_tot = 0.;
1395 if (aggregate && reposition) {
1401 bool threePlanes =
false;
1402 if (X0_tot > 50 && std::fabs(
pos.z()) < 6700 &&
pos.perp() < 4200)
1405 auto energyLoss0 = std::make_unique<Trk::EnergyLoss>(0., 0., 0., 0.);
1407 ScatteringAngles(
deltaPhi, deltaTheta, sqrt(sigmaDeltaPhi2_tot / 2.),
1408 sqrt(sigmaDeltaTheta2_tot / 2.));
1411 ScatteringAngles(
deltaPhi, deltaTheta, sqrt(sigmaDeltaPhi2_tot / 2.),
1412 sqrt(sigmaDeltaTheta2_tot / 2.));
1414 deltaE_tot, sigmaDeltaE_tot, sigmaPlusDeltaE_tot,
1415 sigmaMinusDeltaE_tot, deltaE_ioni_tot, sigmaDeltaE_ioni_tot,
1416 deltaE_rad_tot, sigmaDeltaE_rad_tot, 0.);
1420 auto energyLossNew =
1423 caloEnergyError, pCaloEntry,
1424 momentumError, elossFlag)
1426 sigmaPlusDeltaE_tot, sigmaMinusDeltaE_tot,
1427 deltaE_ioni_tot, sigmaDeltaE_ioni_tot,
1428 deltaE_rad_tot, sigmaDeltaE_rad_tot, 0.));
1440 double halflength2 =
1441 wdist2 / w_tot - (
pos - posFirst).
mag() * (
pos - posFirst).
mag();
1442 double halflength = 0.;
1443 if (halflength2 > 0) halflength = sqrt(halflength2);
1448 ATH_MSG_DEBUG(
" WITH aggregation and WITH reposition center planes x "
1449 <<
pos.x() <<
" y " <<
pos.y() <<
" z " <<
pos.z()
1450 <<
" halflength " << halflength <<
" w_tot " << w_tot
1451 <<
" X0_tot " << X0_tot);
1461 std::fabs(deltaEFirst));
1465 std::unique_ptr<Trk::TrackParameters> parsFirst =
1467 0., 0.,
dir.phi(),
dir.theta(), qOverP0);
1468 std::unique_ptr<Trk::TrackParameters> parsLast =
1470 0., 0.,
dir.phi(),
dir.theta(), qOverPNew);
1472 Eloss_tot += energyLossNew.deltaE();
1479 auto meotFirst = std::make_unique<Trk::MaterialEffectsOnTrack>(
1480 X0_tot / 2., scatFirst, std::move(energyLoss0), *surfFirst,
1485 auto meotLast = std::make_unique<Trk::MaterialEffectsOnTrack>(
1486 X0_tot / 2., scatNew,
1487 std::make_unique<Trk::EnergyLoss>(std::move(energyLossNew)),
1488 *surfLast, meotPattern);
1492 std::move(meotFirst), typePattern);
1493 auto whichType = (elossFlag != 0) ? typePatternDeposit : typePattern;
1495 nullptr, std::move(parsLast),
1496 std::move(meotLast), whichType);
1498 newTSOSvector.push_back(newTSOSFirst);
1499 newTSOSvector.push_back(newTSOS);
1504 auto scatZero = ScatteringAngles(0., 0., 0., 0.);
1507 std::unique_ptr<Trk::TrackParameters>
pars =
1509 0., 0.,
dir.phi(),
dir.theta(), qOverPNew);
1512 auto meotFirst = std::make_unique<Trk::MaterialEffectsOnTrack>(
1513 X0_tot / 2., scatFirst,
1514 std::make_unique<Trk::EnergyLoss>(0., 0., 0., 0.), *surfFirst,
1518 auto meot = std::make_unique<Trk::MaterialEffectsOnTrack>(
1520 std::make_unique<Trk::EnergyLoss>(std::move(energyLossNew)), *surf,
1524 auto meotLast = std::make_unique<Trk::MaterialEffectsOnTrack>(
1525 X0_tot / 2., scatNew,
1526 std::make_unique<Trk::EnergyLoss>(0., 0., 0., 0.), *surfLast,
1530 std::move(meotFirst), typePattern);
1532 nullptr, std::move(
pars), std::move(meot), typePatternDeposit);
1535 std::move(meotLast), typePattern);
1536 newTSOSvector.push_back(newTSOSFirst);
1537 newTSOSvector.push_back(newTSOS);
1538 newTSOSvector.push_back(newTSOSLast);
1543 return newTSOSvector;