Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:17:50

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include "extensions/jana/JOmniFactory.h"
0007 #include "algorithms/meta/CollectionCollector.h"
0008 
0009 namespace eicrecon {
0010 
0011 template <class T, bool IsOptional = false>
0012 class CollectionCollector_factory
0013     : public JOmniFactory<CollectionCollector_factory<T, IsOptional>> {
0014 public:
0015   using AlgoT = eicrecon::CollectionCollector<typename T::collection_type>;
0016 
0017 private:
0018   std::unique_ptr<AlgoT> m_algo;
0019 
0020   typename JOmniFactory<CollectionCollector_factory<T, IsOptional>>::template VariadicPodioInput<
0021       T, IsOptional>
0022       m_inputs{this};
0023   typename JOmniFactory<CollectionCollector_factory<T, IsOptional>>::template PodioOutput<T>
0024       m_output{this};
0025 
0026 public:
0027   void Configure() {
0028     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0029     m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0030     m_algo->init();
0031   }
0032 
0033   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0034     std::vector<gsl::not_null<const typename T::collection_type*>> in_collections;
0035     for (const auto& in_collection : m_inputs()) {
0036       in_collections.push_back(gsl::not_null<const typename T::collection_type*>{in_collection});
0037     }
0038     typename T::collection_type* merged_collection = m_output().get();
0039     m_algo->process(in_collections, merged_collection);
0040   };
0041 };
0042 
0043 } // namespace eicrecon