File indexing completed on 2024-11-15 08:59:57
0001
0002
0003
0004 #pragma once
0005
0006 #include <JANA/JEvent.h>
0007 #include <edm4eic/InclusiveKinematicsCollection.h>
0008 #include <memory>
0009 #include <string>
0010 #include <utility>
0011 #include <vector>
0012
0013 #include "algorithms/onnx/InclusiveKinematicsML.h"
0014 #include "extensions/jana/JOmniFactory.h"
0015
0016 namespace eicrecon {
0017
0018 class InclusiveKinematicsML_factory :
0019 public JOmniFactory<InclusiveKinematicsML_factory, InclusiveKinematicsMLConfig> {
0020
0021 public:
0022 using AlgoT = eicrecon::InclusiveKinematicsML;
0023 private:
0024 std::unique_ptr<AlgoT> m_algo;
0025
0026 PodioInput<edm4eic::InclusiveKinematics> m_inclusive_kinematics_electron_input {this};
0027 PodioInput<edm4eic::InclusiveKinematics> m_inclusive_kinematics_da_input {this};
0028 PodioOutput<edm4eic::InclusiveKinematics> m_inclusive_kinematics_output {this};
0029
0030 ParameterRef<std::string> m_modelPath {this, "modelPath", config().modelPath};
0031
0032 public:
0033 void Configure() {
0034 m_algo = std::make_unique<AlgoT>(GetPrefix());
0035 m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0036 m_algo->applyConfig(config());
0037 m_algo->init();
0038 }
0039
0040 void ChangeRun(int64_t run_number) {
0041 }
0042
0043 void Process(int64_t run_number, uint64_t event_number) {
0044 m_algo->process({m_inclusive_kinematics_electron_input(), m_inclusive_kinematics_da_input()}, {m_inclusive_kinematics_output().get()});
0045 }
0046 };
0047
0048 }