21 #include <boost/program_options.hpp>
24 using boost::program_options::bool_switch;
28 auto opt = desc.add_options();
29 opt(
"select-rho-mm", value<Interval>()->value_name(
"MIN:MAX"),
30 "Select particle transverse distance to the origin in mm");
31 opt(
"select-absz-mm", value<Interval>()->value_name(
"MIN:MAX"),
32 "Select particle absolute longitudinal distance to the origin in mm");
33 opt(
"select-time-ns", value<Interval>()->value_name(
"MIN:MAX"),
34 "Select particle time in ns");
35 opt(
"select-phi-degree", value<Interval>()->value_name(
"MIN:MAX"),
36 "Select particle direction angle in the transverse plane in degree");
37 opt(
"select-eta", value<Interval>()->value_name(
"MIN:MAX"),
38 "Select particle pseudo-rapidity");
39 opt(
"select-abseta", value<Interval>()->value_name(
"MIN:MAX"),
40 "Select particle absolute pseudo-rapidity");
41 opt(
"select-pt-gev", value<Interval>()->value_name(
"MIN:MAX"),
42 "Select particle transverse momentum in GeV");
43 opt(
"remove-charged", bool_switch(),
"Remove charged particles");
44 opt(
"remove-neutral", bool_switch(),
"Remove neutral particles");
49 using namespace Acts::UnitLiterals;
52 auto extractInterval = [&](
const char*
name,
auto unit,
auto& lower,
54 if (vars[
name].empty()) {
58 lower = interval.
lower.value_or(lower) * unit;
59 upper = interval.upper.value_or(upper) * unit;
63 extractInterval(
"select-rho-mm", 1_mm, cfg.rhoMin, cfg.rhoMax);
64 extractInterval(
"select-absz-mm", 1_mm, cfg.absZMin, cfg.absZMax);
65 extractInterval(
"select-time-ns", 1_ns, cfg.timeMin, cfg.timeMax);
66 extractInterval(
"select-phi-degree", 1_degree, cfg.phiMin, cfg.phiMax);
67 extractInterval(
"select-eta", 1.0, cfg.etaMin, cfg.etaMax);
68 extractInterval(
"select-abseta", 1.0, cfg.absEtaMin, cfg.absEtaMax);
69 extractInterval(
"select-pt-gev", 1_GeV, cfg.ptMin, cfg.ptMax);
70 cfg.removeCharged = vars[
"remove-charged"].as<
bool>();
71 cfg.removeNeutral = vars[
"remove-neutral"].as<
bool>();
79 throw std::invalid_argument(
"Missing input particles collection");
82 throw std::invalid_argument(
"Missing output particles collection");
105 auto within = [](
double x,
double min,
double max) {
106 return (min <= x) and (x <
max);
113 const bool validNeutral = (
p.charge() == 0) and not m_cfg.removeNeutral;
114 const bool validCharged = (
p.charge() != 0) and not m_cfg.removeCharged;
115 const bool validCharge = validNeutral or validCharged;
116 return validCharge and
117 within(
p.transverseMomentum(), m_cfg.ptMin, m_cfg.ptMax) and
118 within(
std::abs(
eta), m_cfg.absEtaMin, m_cfg.absEtaMax) and
119 within(
eta, m_cfg.etaMin, m_cfg.etaMax) and
120 within(phi, m_cfg.phiMin, m_cfg.phiMax) and
123 within(rho, m_cfg.rhoMin, m_cfg.rhoMax) and
124 within(
p.time(), m_cfg.timeMin, m_cfg.timeMax);
128 const auto& inputParticles =
131 outputParticles.reserve(inputParticles.size());
134 for (
const auto& inputParticle : inputParticles) {
135 if (isValidParticle(inputParticle)) {
137 outputParticles.insert(outputParticles.end(), inputParticle);
140 outputParticles.shrink_to_fit();
143 << outputParticles.size() <<
" from "
144 << inputParticles.size() <<
" particles");
146 ctx.
eventStore.
add(m_cfg.outputParticles, std::move(outputParticles));