File indexing completed on 2025-07-03 07:55:53
0001
0002
0003
0004 #include <spdlog/spdlog.h>
0005 #include <algorithms/algorithm.h>
0006 #include <string>
0007 #include <string_view>
0008
0009 #include "services/log/Log_service.h"
0010 #include "algorithms/interfaces/WithPodConfig.h"
0011
0012 namespace eicrecon {
0013
0014 template <class T>
0015 using CollectionCollectorAlgorithm =
0016 algorithms::Algorithm<typename algorithms::Input<std::vector<const T>>,
0017 typename algorithms::Output<T>>;
0018
0019 template <class T> class CollectionCollector : public CollectionCollectorAlgorithm<T> {
0020
0021 public:
0022 CollectionCollector(std::string_view name)
0023 : CollectionCollectorAlgorithm<T>{name,
0024 {"inputCollections"},
0025 {"outputCollection"},
0026 "Merge content of collections into one subset collection"} {
0027 }
0028
0029 void init() final{};
0030
0031 void process(const typename CollectionCollector::Input& input,
0032 const typename CollectionCollector::Output& output) const final {
0033
0034 const auto [in_collections] = input;
0035 auto [out_collection] = output;
0036
0037 out_collection->setSubsetCollection();
0038
0039 for (const auto& collection : in_collections) {
0040 for (const auto& hit : *collection) {
0041 out_collection->push_back(hit);
0042 }
0043 }
0044
0045 this->debug("Collected {} hits from {} input collections", out_collection->size(),
0046 in_collections.size());
0047 }
0048 };
0049 }