Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-09 07:53:30

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Simon Gardner
0003 
0004 #include "extensions/jana/JOmniFactory.h"
0005 #include "algorithms/meta/CollectionCollector.h"
0006 
0007 namespace eicrecon {
0008 
0009 template <class T, bool IsOptional = false>
0010 class CollectionCollector_factory
0011     : public JOmniFactory<CollectionCollector_factory<T, IsOptional>> {
0012 public:
0013   using AlgoT = eicrecon::CollectionCollector<typename T::collection_type>;
0014 
0015 private:
0016   std::unique_ptr<AlgoT> m_algo;
0017 
0018   typename JOmniFactory<CollectionCollector_factory<T, IsOptional>>::template VariadicPodioInput<
0019       T, IsOptional>
0020       m_inputs{this};
0021   typename JOmniFactory<CollectionCollector_factory<T, IsOptional>>::template PodioOutput<T>
0022       m_output{this};
0023 
0024 public:
0025   void Configure() {
0026     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0027     m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0028     m_algo->init();
0029   }
0030 
0031   void ChangeRun(int32_t /* run_number */) {}
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