Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-14 08:51:55

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include "algorithms/meta/SubDivideCollection.h"
0007 #include "services/algorithms_init/AlgorithmsInit_service.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009 
0010 namespace eicrecon {
0011 
0012 template <class T>
0013 class SubDivideCollection_factory
0014     : public JOmniFactory<SubDivideCollection_factory<T>, SubDivideCollectionConfig<T>> {
0015 
0016 public:
0017   using AlgoT    = eicrecon::SubDivideCollection<T>;
0018   using FactoryT = JOmniFactory<SubDivideCollection_factory<T>, SubDivideCollectionConfig<T>>;
0019 
0020 private:
0021   std::unique_ptr<AlgoT> m_algo;
0022 
0023   typename FactoryT::template PodioInput<T> m_input{this};
0024   typename FactoryT::template VariadicPodioOutput<T> m_split_output{this};
0025 
0026   typename FactoryT::template Service<AlgorithmsInit_service> m_algorithmsInit{this};
0027 
0028 public:
0029   void Configure() {
0030     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0031     m_algo->level(static_cast<algorithms::LogLevel>(this->logger()->level()));
0032     m_algo->applyConfig(this->config());
0033     m_algo->init();
0034   }
0035 
0036   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0037 
0038     std::vector<gsl::not_null<typename T::collection_type*>> split_collections;
0039     for (const auto& split : m_split_output()) {
0040       split_collections.push_back(gsl::not_null<typename T::collection_type*>(split.get()));
0041     }
0042     m_algo->process(m_input(), split_collections);
0043   };
0044 }; // SplitGeometry_factory
0045 } // namespace eicrecon