File indexing completed on 2025-02-22 10:33:27
0001
0002
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 : public JOmniFactory<SubDivideCollection_factory<T>, SubDivideCollectionConfig<T>> {
0014
0015 public:
0016 using AlgoT = eicrecon::SubDivideCollection<T>;
0017 using FactoryT = JOmniFactory<SubDivideCollection_factory<T>, SubDivideCollectionConfig<T>>;
0018
0019 private:
0020
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 ChangeRun(int64_t run_number) {
0037 }
0038
0039 void Process(int64_t run_number, uint64_t event_number) {
0040
0041 std::vector<gsl::not_null<typename T::collection_type*>> split_collections;
0042 for (const auto& split : m_split_output()) {
0043 split_collections.push_back(gsl::not_null<typename T::collection_type*>(split.get()));
0044 }
0045 m_algo->process(m_input(),split_collections);
0046
0047 };
0048 };
0049 }