Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:17:55

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 - 2025, Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include "algorithms/fardetectors/FarDetectorTransportationPostML.h"
0007 #include "services/algorithms_init/AlgorithmsInit_service.h"
0008 #include "extensions/jana/JOmniFactory.h"
0009 
0010 namespace eicrecon {
0011 
0012 class FarDetectorTransportationPostML_factory
0013     : public JOmniFactory<FarDetectorTransportationPostML_factory,
0014                           FarDetectorTransportationPostMLConfig> {
0015 
0016 public:
0017   using AlgoT = eicrecon::FarDetectorTransportationPostML;
0018 
0019 private:
0020   std::unique_ptr<AlgoT> m_algo;
0021 
0022   PodioInput<edm4eic::Tensor> m_prediction_tensor_input{this};
0023   PodioInput<edm4eic::MCRecoTrackParticleAssociation> m_association_input{this};
0024   PodioInput<edm4hep::MCParticle> m_beamelectrons_input{this};
0025 
0026   PodioOutput<edm4eic::ReconstructedParticle> m_particle_output{this};
0027   PodioOutput<edm4eic::MCRecoParticleAssociation> m_association_output{this};
0028 
0029   ParameterRef<float> m_beamE{this, "beamE", config().beamE};
0030   ParameterRef<bool> m_requireBeamElectron{this, "requireBeamElectron",
0031                                            config().requireBeamElectron};
0032   ParameterRef<int> m_pdg_value{
0033       this, "pdgValue", config().pdg_value,
0034       "PDG value for the particle type to identify (default is electron)"};
0035 
0036   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0037 
0038 public:
0039   void Configure() {
0040     m_algo = std::make_unique<AlgoT>(GetPrefix());
0041     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0042     m_algo->applyConfig(config());
0043     m_algo->init();
0044   }
0045 
0046   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0047     m_algo->process({m_prediction_tensor_input(), m_association_input(), m_beamelectrons_input()},
0048                     {m_particle_output().get(), m_association_output().get()});
0049   }
0050 };
0051 
0052 } // namespace eicrecon