Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 08:59:57

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024, Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include <spdlog/spdlog.h>
0007 
0008 // Event Model related classes
0009 #include <edm4eic/TrajectoryCollection.h>
0010 #include <algorithms/fardetectors/FarDetectorMLReconstruction.h>
0011 #include <algorithms/fardetectors/FarDetectorMLReconstructionConfig.h>
0012 
0013 #include "extensions/jana/JOmniFactory.h"
0014 #include <extensions/spdlog/SpdlogMixin.h>
0015 #include <spdlog/logger.h>
0016 #include <Evaluator/DD4hepUnits.h>
0017 
0018 namespace eicrecon {
0019 
0020 class FarDetectorMLReconstruction_factory :
0021         public JOmniFactory<FarDetectorMLReconstruction_factory,FarDetectorMLReconstructionConfig> {
0022 
0023 public:
0024     using AlgoT = eicrecon::FarDetectorMLReconstruction;
0025 private:
0026     std::unique_ptr<AlgoT> m_algo;
0027 
0028     PodioInput<edm4eic::TrackParameters>  m_trackparam_input     {this};
0029     PodioInput<edm4hep::MCParticle>       m_beamelectrons_input {this};
0030     PodioOutput<edm4eic::Trajectory>      m_trajectory_output    {this};
0031     PodioOutput<edm4eic::TrackParameters> m_trackparam_output    {this};
0032     PodioOutput<edm4eic::Track>           m_track_output         {this};
0033 
0034 
0035     ParameterRef<std::string> m_modelPath       {this, "modelPath",       config().modelPath       };
0036     ParameterRef<std::string> m_methodName      {this, "methodName",      config().methodName      };
0037 
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 ChangeRun(int64_t run_number) {
0048     }
0049 
0050     void Process(int64_t run_number, uint64_t event_number) {
0051         m_algo->process({m_trackparam_input(),m_beamelectrons_input()}, {m_trajectory_output().get(), m_trackparam_output().get(), m_track_output().get()});
0052     }
0053   };
0054 
0055 } // eicrecon