Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-07 07:50:23

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024, Dmitry Kalinkin
0003 
0004 #pragma once
0005 
0006 #include <edm4eic/EDM4eicVersion.h>
0007 #include "algorithms/onnx/CalorimeterParticleIDPostML.h"
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 #include "extensions/jana/JOmniFactory.h"
0010 
0011 namespace eicrecon {
0012 
0013 class CalorimeterParticleIDPostML_factory
0014     : public JOmniFactory<CalorimeterParticleIDPostML_factory, NoConfig> {
0015 
0016 public:
0017   using AlgoT = eicrecon::CalorimeterParticleIDPostML;
0018 
0019 private:
0020   std::unique_ptr<AlgoT> m_algo;
0021 
0022   PodioInput<edm4eic::Cluster> m_cluster_input{this};
0023   PodioInput<edm4eic::MCRecoClusterParticleAssociation> m_cluster_assoc_input{this};
0024   PodioInput<edm4eic::Tensor> m_prediction_tensor_input{this};
0025 
0026   PodioOutput<edm4eic::Cluster> m_cluster_output{this};
0027 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0028   PodioOutput<edm4eic::MCRecoClusterParticleLink> m_cluster_links_output{this};
0029 #endif
0030   PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_cluster_assoc_output{this};
0031   PodioOutput<edm4hep::ParticleID> m_particle_id_output{this};
0032 
0033 public:
0034   void Configure() {
0035     m_algo = std::make_unique<AlgoT>(GetPrefix());
0036     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0037     m_algo->applyConfig(config());
0038     m_algo->init();
0039   }
0040 
0041   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0042     m_algo->process({m_cluster_input(), m_cluster_assoc_input(), m_prediction_tensor_input()},
0043                     {m_cluster_output().get(),
0044 #if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
0045                      m_cluster_links_output().get(),
0046 #endif
0047                      m_cluster_assoc_output().get(), m_particle_id_output().get()});
0048   }
0049 };
0050 
0051 } // namespace eicrecon