Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-07 08:04:16

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2026 ePIC Collaboration
0003 
0004 #pragma once
0005 
0006 #include "algorithms/reco/ClustersToParticles.h"
0007 #include "algorithms/reco/ClustersToParticlesConfig.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009 #include "services/algorithms_init/AlgorithmsInit_service.h"
0010 
0011 namespace eicrecon {
0012 
0013 class ClustersToParticles_factory
0014     : public JOmniFactory<ClustersToParticles_factory, ClustersToParticlesConfig> {
0015 public:
0016   using AlgoT = eicrecon::ClustersToParticles;
0017 
0018 private:
0019   // algorithm
0020   std::unique_ptr<AlgoT> m_algo;
0021 
0022   // input collections
0023   PodioInput<edm4eic::Cluster> m_clusters_in{this};
0024   PodioInput<edm4eic::MCRecoClusterParticleAssociation> m_cluster_assocs_in{this};
0025 
0026   // output collections
0027   PodioOutput<edm4eic::ReconstructedParticle> m_parts_out{this};
0028 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0029   PodioOutput<edm4eic::MCRecoParticleLink> m_part_links_out{this};
0030 #endif
0031   PodioOutput<edm4eic::MCRecoParticleAssociation> m_part_assocs_out{this};
0032 
0033   // parameters
0034   ParameterRef<int> m_pdgCode{this, "pdgCode", config().pdgCode};
0035 
0036   // services
0037   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0038 
0039 public:
0040   void Configure() {
0041     m_algo = std::make_unique<AlgoT>(GetPrefix());
0042     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0043     m_algo->applyConfig(config());
0044     m_algo->init();
0045   }
0046 
0047   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0048     m_algo->process({m_clusters_in(), m_cluster_assocs_in()}, {m_parts_out().get(),
0049 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0050                                                                m_part_links_out().get(),
0051 #endif
0052                                                                m_part_assocs_out().get()});
0053   }
0054 };
0055 
0056 } // namespace eicrecon