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