23 throw std::invalid_argument(
"Missing input track parameters collection");
26 throw std::invalid_argument(
"Missing output track parameters collection");
29 throw std::invalid_argument(
"Missing output track indices collection");
36 auto within = [](
double x,
double min,
double max) {
37 return (min <= x) and (x <
max);
39 auto isValidTrack = [&](
const auto& trk) {
40 const auto theta = trk.template get<Acts::eBoundTheta>();
41 const auto eta = -std::log(std::tan(
theta / 2));
43 const bool validNeutral = (trk.charge() == 0) and not m_cfg.removeNeutral;
44 const bool validCharged = (trk.charge() != 0) and not m_cfg.removeCharged;
45 const bool validCharge = validNeutral or validCharged;
46 return validCharge and
47 within(trk.transverseMomentum(), m_cfg.ptMin, m_cfg.ptMax) and
49 within(eta, m_cfg.etaMin, m_cfg.etaMax) and
50 within(trk.template get<Acts::eBoundPhi>(), m_cfg.phiMin,
52 within(trk.template get<Acts::eBoundLoc0>(), m_cfg.loc0Min,
54 within(trk.template get<Acts::eBoundLoc1>(), m_cfg.loc1Min,
56 within(trk.template get<Acts::eBoundTime>(), m_cfg.timeMin,
61 const auto& inputTrackParameters =
64 std::vector<uint32_t> outputTrackIndices;
65 outputTrackParameters.reserve(inputTrackParameters.size());
66 outputTrackIndices.reserve(inputTrackParameters.size());
69 for (
uint32_t i = 0; i < inputTrackParameters.size(); ++i) {
70 const auto& trk = inputTrackParameters[i];
71 if (isValidTrack(trk)) {
72 outputTrackParameters.push_back(trk);
73 outputTrackIndices.push_back(i);
76 outputTrackParameters.shrink_to_fit();
77 outputTrackIndices.shrink_to_fit();
80 << outputTrackParameters.size() <<
" from "
81 << inputTrackParameters.size() <<
" tracks");
84 std::move(outputTrackParameters));
85 ctx.
eventStore.
add(m_cfg.outputTrackIndices, std::move(outputTrackIndices));