File indexing completed on 2025-01-18 09:55:44
0001
0002
0003
0004
0005
0006 #pragma once
0007
0008 #include <JANA/JEvent.h>
0009 #include <edm4eic/CherenkovParticleIDCollection.h>
0010 #include <memory>
0011 #include <string>
0012 #include <utility>
0013 #include <vector>
0014
0015
0016 #include "algorithms/pid/MergeParticleID.h"
0017 #include "algorithms/pid/MergeParticleIDConfig.h"
0018 #include "extensions/jana/JOmniFactory.h"
0019
0020 namespace eicrecon {
0021
0022 class MergeCherenkovParticleID_factory :
0023 public JOmniFactory<MergeCherenkovParticleID_factory, MergeParticleIDConfig> {
0024
0025 private:
0026
0027
0028 using AlgoT = eicrecon::MergeParticleID;
0029 std::unique_ptr<AlgoT> m_algo;
0030
0031
0032 VariadicPodioInput<edm4eic::CherenkovParticleID> m_particleID_input {this};
0033
0034
0035 PodioOutput<edm4eic::CherenkovParticleID> m_particleID_output {this};
0036
0037
0038 ParameterRef<int> m_mergeMode {this, "mergeMode", config().mergeMode};
0039
0040 public:
0041 void Configure() {
0042 m_algo = std::make_unique<AlgoT>(GetPrefix());
0043 m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0044 m_algo->applyConfig(config());
0045 m_algo->init(logger());
0046 }
0047
0048 void ChangeRun(int64_t run_number) { }
0049
0050 void Process(int64_t run_number, uint64_t event_number) {
0051 auto in1 = m_particleID_input();
0052 std::vector<gsl::not_null<const edm4eic::CherenkovParticleIDCollection*>> in2;
0053 std::copy(in1.cbegin(), in1.cend(), std::back_inserter(in2));
0054 m_algo->process({in2}, {m_particleID_output().get()});
0055 }
0056
0057 };
0058 }