File indexing completed on 2025-09-18 08:17:45
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> class CollectionCollector : public CollectionCollectorAlgorithm<T> {
0022
0023 public:
0024 CollectionCollector(std::string_view name)
0025 : CollectionCollectorAlgorithm<T>{name,
0026 {"inputCollections"},
0027 {"outputCollection"},
0028 "Merge content of collections into one subset collection"} {
0029 }
0030
0031 void init() final {};
0032
0033 void process(const typename CollectionCollector::Input& input,
0034 const typename CollectionCollector::Output& output) const final {
0035
0036 const auto [in_collections] = input;
0037 auto [out_collection] = output;
0038
0039 out_collection->setSubsetCollection();
0040
0041 for (const auto& collection : in_collections) {
0042 for (const auto& hit : *collection) {
0043 out_collection->push_back(hit);
0044 }
0045 }
0046
0047 this->debug("Collected {} hits from {} input collections", out_collection->size(),
0048 in_collections.size());
0049 }
0050 };
0051 }