6#include <spdlog/spdlog.h>
7#include <algorithms/algorithm.h>
16template <
class ToFilterObjectT,
class FilterByObjectT>
18 algorithms::Algorithm<
typename algorithms::Input<
typename ToFilterObjectT::collection_type,
19 typename FilterByObjectT::collection_type>,
20 typename algorithms::Output<
typename ToFilterObjectT::collection_type,
21 typename ToFilterObjectT::collection_type>>;
28template <
typename ToFilterObjectT,
auto ToFilterFunction,
typename FilterByObjectT,
29 auto FilterByFunction>
37 {
"inputCollection",
"inputMatchedCollection"},
38 {
"outputMatchedAssociations",
"outputUnmatchedAssociations"},
39 "Filter by matching to a collection"} {};
48 const auto [toFilterEntries, filterByEntries] = input;
49 auto [is_matched, is_not_matched] = output;
51 is_matched->setSubsetCollection();
52 is_not_matched->setSubsetCollection();
54 for (
const auto& matchedEntry : *toFilterEntries) {
56 auto ref_value = ToFilterFunction(&matchedEntry);
58 bool found_match =
false;
61 for (
const auto& entry : *filterByEntries) {
62 auto other_value = FilterByFunction(&entry);
63 if (other_value == ref_value) {
64 is_matched->push_back(matchedEntry);
71 is_not_matched->push_back(matchedEntry);
Definition FilterMatching.h:31
void process(const typename FilterMatchingAlgorithm< ToFilterObjectT, FilterByObjectT >::Input &input, const typename FilterMatchingAlgorithm< ToFilterObjectT, ToFilterObjectT >::Output &output) const final
Definition FilterMatching.h:44
void init() final
Definition FilterMatching.h:41
FilterMatching(std::string_view name)
Definition FilterMatching.h:34
Definition WithPodConfig.h:22
-client
Definition CalorimeterClusterRecoCoG.cc:37
algorithms::Algorithm< typename algorithms::Input< typename ToFilterObjectT::collection_type, typename FilterByObjectT::collection_type >, typename algorithms::Output< typename ToFilterObjectT::collection_type, typename ToFilterObjectT::collection_type > > FilterMatchingAlgorithm
Definition FilterMatching.h:21