Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /EICrecon/src/factories/fardetectors/FarDetectorTransportationPostML_factory.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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