File indexing completed on 2024-09-28 07:02:55
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 = algorithms::Algorithm<
0016 typename algorithms::Input<std::vector<const T>>,
0017 typename algorithms::Output<T>
0018 >;
0019
0020 template<class T>
0021 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, const typename CollectionCollector::Output& output) const final{
0034
0035 const auto [in_collections] = input;
0036 auto [out_collection] = output;
0037
0038 out_collection->setSubsetCollection();
0039
0040 for (const auto& collection : in_collections) {
0041 for (const auto& hit : *collection) {
0042 out_collection->push_back(hit);
0043 }
0044 }
0045
0046 this->debug("Collected {} hits from {} input collections", out_collection->size(), in_collections.size());
0047 }
0048
0049 };
0050 }