Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:05

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>
0010     class CollectionCollector_factory : public JOmniFactory<CollectionCollector_factory<T>> {
0011 public:
0012     using AlgoT = eicrecon::CollectionCollector<typename T::collection_type>;
0013 
0014 private:
0015     std::unique_ptr<AlgoT> m_algo;
0016 
0017     typename JOmniFactory<CollectionCollector_factory<T>>::template VariadicPodioInput<T> m_inputs {this};
0018     typename JOmniFactory<CollectionCollector_factory<T>>::template PodioOutput<T> m_output {this};
0019 
0020 public:
0021 
0022     void Configure() {
0023         m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0024         m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0025         m_algo->init();
0026     }
0027 
0028     void ChangeRun(int64_t run_number) {
0029     }
0030 
0031     void Process(int64_t run_number, uint64_t event_number) {
0032         std::vector<gsl::not_null<const typename T::collection_type*>>  in_collections;
0033         for (const auto& in_collection : m_inputs()) {
0034             in_collections.push_back(gsl::not_null<const typename T::collection_type*>{in_collection});
0035         }
0036         typename T::collection_type* merged_collection = m_output().get();
0037         m_algo->process(in_collections, merged_collection);
0038 
0039     };
0040 
0041     };
0042 
0043 } // eicrecon