27 throw std::invalid_argument(
"Missing input particles collection");
30 throw std::invalid_argument(
"Missing output particles collection");
60 ACTS_DEBUG(
"selection particle number of measurements ["
67 using ParticlesMeasurmentMap =
68 boost::container::flat_multimap<ActsFatras::Barcode, Index>;
74 std::optional<ParticlesMeasurmentMap> particlesMeasMap;
75 if (m_inputMap.isInitialized()) {
79 std::size_t nInvalidCharge = 0;
80 std::size_t nInvalidMeasurementCount = 0;
83 auto within = [](
auto x,
auto min,
auto max) {
84 return (min <=
x) and (
x < max);
92 const bool validNeutral = (
p.charge() == 0) and not
m_cfg.removeNeutral;
93 const bool validCharged = (
p.charge() != 0) and not
m_cfg.removeCharged;
94 const bool validCharge = validNeutral or validCharged;
95 const bool validSecondary = not
m_cfg.removeSecondaries or !
p.isSecondary();
97 nInvalidCharge +=
static_cast<std::size_t
>(not validCharge);
101 bool validMeasurementCount =
true;
102 if (particlesMeasMap) {
103 auto [
b,
e] = particlesMeasMap->equal_range(
p.particleId());
104 validMeasurementCount =
106 m_cfg.measurementsMin,
m_cfg.measurementsMax);
112 nInvalidMeasurementCount +=
113 static_cast<std::size_t
>(not validMeasurementCount);
115 return validCharge and validSecondary and validMeasurementCount and
116 within(
p.transverseMomentum(),
m_cfg.ptMin,
m_cfg.ptMax) and
132 if (isValidParticle(inputParticle)) {
134 outputParticles.insert(outputParticles.end(), inputParticle);
137 outputParticles.shrink_to_fit();
140 << outputParticles.size() <<
" from "
141 << inputParticles.size() <<
" particles");
142 ACTS_DEBUG(
"filtered out because of charge: " << nInvalidCharge);
143 ACTS_DEBUG(
"filtered out because of measurement count: "
144 << nInvalidMeasurementCount);
146 m_outputParticles(ctx,
std::move(outputParticles));