Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:18:51

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024, Dmitry Kalinkin
0003 
0004 #pragma once
0005 
0006 #include "algorithms/onnx/CalorimeterParticleIDPostML.h"
0007 #include "services/algorithms_init/AlgorithmsInit_service.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009 
0010 
0011 namespace eicrecon {
0012 
0013 class CalorimeterParticleIDPostML_factory : public JOmniFactory<CalorimeterParticleIDPostML_factory, NoConfig> {
0014 
0015 public:
0016   using AlgoT = eicrecon::CalorimeterParticleIDPostML;
0017 private:
0018   std::unique_ptr<AlgoT> m_algo;
0019 
0020   PodioInput<edm4eic::Cluster> m_cluster_input {this};
0021   PodioInput<edm4eic::MCRecoClusterParticleAssociation> m_cluster_assoc_input {this};
0022   PodioInput<edm4eic::Tensor> m_prediction_tensor_input {this};
0023 
0024   PodioOutput<edm4eic::Cluster> m_cluster_output {this};
0025   PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_cluster_assoc_output {this};
0026   PodioOutput<edm4hep::ParticleID> m_particle_id_output {this};
0027 
0028 public:
0029   void Configure() {
0030         m_algo = std::make_unique<AlgoT>(GetPrefix());
0031         m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0032         m_algo->applyConfig(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         m_algo->process({m_cluster_input(), m_cluster_assoc_input(), m_prediction_tensor_input()},
0041                                         {m_cluster_output().get(), m_cluster_assoc_output().get(), m_particle_id_output().get()});
0042   }
0043 };
0044 
0045 } // eicrecon